Skip to content

Session token validation, multi-instance support, and project metadata - #3

Open
biterik wants to merge 1 commit into
mainfrom
feat/token-validation-multi-instance
Open

Session token validation, multi-instance support, and project metadata#3
biterik wants to merge 1 commit into
mainfrom
feat/token-validation-multi-instance

Conversation

@biterik

@biterik biterik commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

Integrates work that was built on the original scaffold onto the current main. Three themes:

1. Token validation + actionable help (the original ask)

  • The personal access token is validated against the server on first use in a session (inside OpenbisClient.connect(), which caches — so it runs once and adds no per-call overhead).
  • An expired/invalid token (or a failed username/password login) raises OpenbisAuthError whose message contains step-by-step instructions for creating a new token in the openBIS web UI and where to store it (.env, MCP client env block, or *_TOKEN_FILE).
  • New check_authentication tool surfaces this proactively — checks all configured instances, or a named one.

2. Multiple openBIS instances

  • Configure additional servers with an OPENBIS_<NAME>_* prefix (supports _TOKEN, _TOKEN_FILE, _USERNAME, _PASSWORD, _VERIFY_CERTIFICATES).
  • A ConnectionManager owns one lazy client per instance; every openBIS tool gains an optional instance argument, plus a new list_instances tool.
  • Fully backward compatible: the bare OPENBIS_* vars define a default instance, so existing single-server setups need no changes.

3. Project metadata (completes the licensing the repo already started)

The MPL-2.0 LICENSE file already exists, but pyproject.toml still had the old author / no license field and the README said "currently unlicensed". This PR makes it consistent:

  • license = { file = "LICENSE" } + MPL classifier in pyproject.toml; SPDX/author headers on all source files.
  • Authors updated to Erik Bitzek (e.bitzek@mpi-susmat.de) and Niklas Siemer.
  • New CITATION.cff (includes DFG funding acknowledgement); README Authors / Citation / License / Funding sections.
  • README + .env.example document the new tools, the instance argument, and multi-instance configuration.

Testing

  • pytest: 32 passed, 1 failed — the one failure (test_s3_get_file_metadata) is pre-existing and environmental (xxhash from the optional [s3] extra is not installed); it is unrelated to this diff (our only change to s3_support.py is the license header).
  • Added tests for token validation, PAT-help text, instance discovery (incl. token-file), default resolution, unknown/ambiguous-instance errors, instance routing, and check_authentication.

Notes for review

  • instance is appended as a trailing optional parameter on each tool, so existing tool calls are unaffected.
  • The LICENSE file on main is untouched.

🤖 Generated with Claude Code

…adata

Token validation
- Validate the personal access token on first use in a session; on an
  expired/invalid token (or failed password login), raise OpenbisAuthError
  carrying step-by-step instructions for creating a new token and where to
  store it. New check_authentication tool surfaces this proactively (checks
  all instances, or a named one).

Multiple instances
- Support several openBIS servers via OPENBIS_<NAME>_* env vars (incl.
  _TOKEN_FILE) with a ConnectionManager; every openBIS tool gains an optional
  `instance` argument, plus a new list_instances tool. The bare OPENBIS_* form
  still defines a "default" instance, so existing setups are unchanged.

Project metadata
- Fill in the licensing the LICENSE file already declared: license = MPL-2.0
  in pyproject, MPL classifier, SPDX/author headers on all source files, and a
  README License section (replacing the stale "currently unlicensed" note).
- Update authors (Erik Bitzek <e.bitzek@mpi-susmat.de>, Niklas Siemer).
- Add CITATION.cff (incl. DFG funding) and README Authors/Citation/Funding
  sections; document the new tools, `instance` arg, and multi-instance config
  in README and .env.example.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant