Repository navigation
feat(mcp): support static bearer credentials in auth.yaml - #2583
Conversation
Final design and reviewFocused current plan for PR #2583, replacing the revision chronology. Approved contracts and deferrals remain; historical local records are preserved. Full review found no blockers or important findings, with two optional advisories listed below. No code changed during this review. Source: MCP static bearer credentials in auth.yamlSlug: 2577-mcp-auth-file Outcome and exampleOperators can keep MCP API keys in server-owned # settings.yaml
mcp:
mode: global
servers:
- name: github
url: https://mcp.example.com/github
auth:
mode: static_bearer
static_bearer:
token_ref: github# auth.yaml
mcp:
github:
token: "<TOKEN>"Contract
Ownership and scope
Environment enumeration uses injected All four local roots share source/loader/warning ownership. Remote CLI mechanisms use Completion and verificationCompleted work: parser/mutation support; shared source and root/lifecycle integration; isolated offline regression tests; minimal owning docs and generated references covering selection, rotation/restart, server custody and global-only deployment limits. Local gates passed on the exact tree committed as Coverage includes precedence/invalid-present no-fallback/custom paths; file snapshots/failures/strict warnings; parser/provider mutation preservation; profile selection/warning isolation; actual destination headers/containment/reconnect/fresh startup; OAuth-only no-read with positive controls; four real local factories; remote no-read/no-upload; test-owned state and poisoned ambient inputs. No live provider calls required. An initial run hit an untouched broker-listener test failure; ten focused repetitions, package recheck and complete aggregate rerun passed. Precise transient cause unproven. CI observed for the delivered head is passing; conditional live jobs are skipped. Local receipts and CI are separate evidence. Full review and remaining advisoriesFresh whole-PR review against the base above: 49 files, +2,896/−261 lines, three commits. Spec, Standards, independent Test adequacy, Security, Architecture, Library reuse and Duplication completed. No blockers, important findings, or material churn residue. Two optional advisories remain; neither changes the contract and no code fixes were applied:
An initial duplicate-provider parsing concern was retracted after an offline proof confirmed rejection before map decoding. Historical review chronology and intermediate designs are omitted from this focused plan; local records are preserved. API compatibility and authorityHost-local credential/configuration changes: conforming remote clients need no changes. No wire-major/feature identifier, public engine API change or stored-session migration. Provider identities/formats and OAuth formats stay unchanged; shipped Commit/push and PR description/comment updates were explicitly authorized. Keep this plan ignored; update the existing plan comment in place. No merge, rebase, replacement PR, deployment or unrelated cleanup is authorized. No unresolved product decisions. |
Resolve explicit token_ref profiles from the selected operator auth-file snapshot, preserving environment sources and legacy overrides. Wire all server roots, retain provider credential editing, and cover transport delivery, containment, custom paths, and remote-client isolation. Co-authored-by: Mecatl <noreply@mecatl.dev>
9adf8de to
7d9ab27
Compare
…ntial source Prefer derived MCP environment credentials over auth.yaml while preserving immutable startup snapshots. Deprecate exact token_env selectors with effective-profile warnings, remove flag-owned credential caches, and cover all composition roots and direct lifecycle paths. Co-authored-by: Mecatl <noreply@mecatl.dev>
…ming Use ResolveEnv.Environ for static credential enumeration, remove separate environment plumbing, and relax tests that guaranteed in-process environment mutation isolation. Preserve file snapshots and credential precedence. Keep CLI server entries distinct from deprecated token_env selectors and simplify the static bearer examples. Co-authored-by: Mecatl <noreply@mecatl.dev>
Track the shared secret-management direction in #2585 without implying that the current startup resolver provides general secret storage. Co-authored-by: Mecatl <noreply@mecatl.dev>
Summary
Store static MCP bearer tokens in the server's
auth.yaml, referenced from non-secret settings withtoken_ref: github.MECATL_MCP_TOKEN_GITHUBbeforemcp.github.token; only an absent environment variable permits file fallback. Empty/invalid values fail closed.token_envwith a deprecation warning. CLI--mcp-serverremains a separate, non-deprecated path. OAuth behavior is unchanged.mecatuifree of credential reads/uploads. Update docs and generated examples.Closes #2577. Search migration (#2578) and broader settings ownership (#774) remain separate.
API compatibility
No wire/engine API or stored-session change; existing clients need no changes. Provider/OAuth formats remain unchanged. Older auth-file parsers may reject the new
mcpnamespace: upgrade the server before adopting it; remove that namespace before rollback. Restart the owning server/Pod after credential rotation.Verification and review
For head
038688e48: local full test/race suites, lint, docs/site build and offline demo passed. Offline coverage includes precedence, invalid-env no-fallback, file snapshots, actual header delivery/secret containment, all four roots, OAuth isolation and remote-client isolation. An initial unrelated broker-listener test failure passed focused/package/full-suite rechecks. Current CI checks pass; conditional live jobs are skipped.A fresh whole-PR panel covered Spec, Standards, Test adequacy, Security, Architecture, Reuse and Duplication. No blockers or important findings. Two optional advisories remain: consolidate CLI anonymous/no-fallback test assertions, and inline a one-use warning helper. No code was changed by the review.
Final design, contracts and review notes.