Skip to content

docs: add token_exchange auth type, per-client TLS/sync/timeout fields, tool list persistence, and reconnect per-call clarifications to MCP docs and OpenAPI spec - #5977

Merged
Pratham-Mishra04 merged 1 commit into
devfrom
08-08-docs_fix_remaining_reconnect-400_wording_and_tool-persistence_gaps_across_mcp_docs
Aug 8, 2026
Merged

docs: add token_exchange auth type, per-client TLS/sync/timeout fields, tool list persistence, and reconnect per-call clarifications to MCP docs and OpenAPI spec#5977
Pratham-Mishra04 merged 1 commit into
devfrom
08-08-docs_fix_remaining_reconnect-400_wording_and_tool-persistence_gaps_across_mcp_docs

Conversation

@Pratham-Mishra04

Copy link
Copy Markdown
Collaborator

Summary

This PR updates the MCP documentation to reflect new client configuration fields, the token_exchange auth type (enterprise only), clarified reconnect behavior for per-call clients, and tool list persistence across restarts.

Changes

  • Added token_exchange as a valid auth_type in the config.json schema reference, including its required token_exchange block fields, enterprise-only restriction, and the new POST /api/mcp/client/{id}/verify-exchange verification endpoint.
  • Documented new client_configs fields: is_ping_available, tool_sync_interval, tool_execution_timeout, allow_on_all_virtual_keys, and tls_config.
  • Clarified that the reconnect endpoint returns 400 not only for per-user auth clients but for any per-call client (including shared clients with needs_session_stickiness false/omitted), since none hold a shared upstream connection to re-establish. Updated this in connecting-to-servers.mdx, gateway.mdx, the OpenAPI YAML, and the generated openapi.json.
  • Updated the post-verification state label from connected to healthy and added token_exchange to the set of auth types that boot into pending_verification.
  • Added a note across gateway.mdx, per-user-headers.mdx, and per-user-oauth.mdx clarifying that every discovered tool list is persisted to the database, so a restart does not revert the tool list to what was found at original bootstrap verification. Persistence is skipped when the result is byte-identical to what is already stored.
  • Updated schema enforcement language to include token_exchange block rejection on non-token_exchange auth types.
  • Added a reference to the new Connections, States & Lifecycles page alongside the existing MCP Auth link.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

Review the rendered documentation pages for:

  • docs/deployment-guides/config-json/schema-reference.mdx — confirm new fields and token_exchange auth type appear correctly, including the enterprise warning block.
  • docs/mcp/connecting-to-servers.mdx — confirm the reconnect 400 note accurately describes per-call clients.
  • docs/mcp/gateway.mdx, docs/mcp/auth/per-user-headers.mdx, docs/mcp/auth/per-user-oauth.mdx — confirm the tool list persistence note is present.
  • docs/openapi/paths/management/mcp.yaml and docs/openapi/openapi.json — confirm the reconnect endpoint description matches the prose documentation.

Breaking changes

  • Yes
  • No

Related issues

Security considerations

The token_exchange auth type is explicitly documented as enterprise-only and is rejected at boot on OSS deployments with an error logged. The tls_config.insecure_skip_verify field is documented as development-only. The token_exchange block fields (client_id, client_secret) support env.VAR_NAME and vault.path references, consistent with existing secret handling patterns.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This was referenced Aug 8, 2026

Pratham-Mishra04 commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Documentation
    • Expanded configuration guidance for token exchange, client settings, timeouts, virtual keys, TLS, and validation rules.
    • Documented enterprise token-exchange client states, verification endpoints, and the healthy verification status.
    • Clarified that dynamically discovered tools persist across restarts.
    • Updated reconnect guidance and API descriptions to explain eligibility, unavailable client types, and recoverable states.

Walkthrough

The documentation now covers token-exchange MCP configuration and lifecycle behavior, persistence of changed tool-sync results, and reconnect restrictions across MCP guides and OpenAPI descriptions.

Changes

MCP documentation behavior

Layer / File(s) Summary
Token-exchange configuration and lifecycle
docs/deployment-guides/config-json/schema-reference.mdx
Documents token_exchange settings, validation rules, enterprise-only behavior, verification, and the healthy lifecycle state.
Tool-sync persistence
docs/mcp/gateway.mdx, docs/mcp/auth/per-user-headers.mdx, docs/mcp/auth/per-user-oauth.mdx
Documents persistence of changed discovered tool lists and skipping of unchanged database writes.
Reconnect availability and API contract
docs/mcp/connecting-to-servers.mdx, docs/openapi/...
Clarifies reconnect restrictions for per-call, per-user, and pending-verification clients. Documents error and unstable as recoverable states.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: akshaydeo, bearts, impoiler

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the documentation, authentication, persistence, and reconnect changes in the pull request.
Description check ✅ Passed The description covers the required sections, explains the changes, identifies affected areas, and provides documentation validation steps.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 08-08-docs_fix_remaining_reconnect-400_wording_and_tool-persistence_gaps_across_mcp_docs

Comment @coderabbitai help to get the list of available commands.

@coderabbitai
coderabbitai Bot requested a review from BearTS August 8, 2026 10:31
@coderabbitai
coderabbitai Bot requested a review from impoiler August 8, 2026 10:31

Pratham-Mishra04 commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

Merge activity

  • Aug 8, 10:33 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Aug 8, 11:58 AM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 8, 11:59 AM UTC: @Pratham-Mishra04 merged this pull request with Graphite.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/deployment-guides/config-json/schema-reference.mdx`:
- Line 293: The schema table entry for needs_session_stickiness must explicitly
include token_exchange, per_user_oauth, and per_user_headers in the
always-per-call rule, and change “Cannot be false” to “This field cannot be
false” while preserving the existing HTTP and SSE/stdio behavior.
- Line 298: Update the tls_config schema-reference description to state that it
applies only to HTTP/SSE connections, insecure_skip_verify takes precedence over
ca_cert_pem when enabled, and insecure_skip_verify is discouraged in production;
replace the ambiguous “and/or” wording so it does not imply custom CA
verification remains effective when verification is disabled.
- Around line 295-296: Update the documentation entries for tool_sync_interval
and tool_execution_timeout to match transports/config.schema.json: document the
supported duration-string formats and units, retain integer compatibility for
tool_execution_timeout, and document legacy nanosecond compatibility for
tool_sync_interval. Ensure the described fallback and disabling behavior remains
accurate.
- Line 311: Clarify the documentation paragraph describing auth_type
"token_exchange" so it states that the API/Web UI declaration path is available
only on enterprise deployments and cannot enable this authentication type on
OSS. Remove the contradictory reference to using that path in a non-enterprise
config.json environment while preserving the existing OSS rejection behavior.
- Line 306: Update the token_exchange entry in the schema reference table to
remove the unsupported authorization_server_url field, keeping only audience,
client_id, optional client_secret, and optional scopes so the documentation
matches transports/config.schema.json and provider behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d9850591-deca-4fcc-bdb7-0348d4f81d90

📥 Commits

Reviewing files that changed from the base of the PR and between 3db595c and ae5a1d1.

📒 Files selected for processing (7)
  • docs/deployment-guides/config-json/schema-reference.mdx
  • docs/mcp/auth/per-user-headers.mdx
  • docs/mcp/auth/per-user-oauth.mdx
  • docs/mcp/connecting-to-servers.mdx
  • docs/mcp/gateway.mdx
  • docs/openapi/openapi.json
  • docs/openapi/paths/management/mcp.yaml

| `tools_to_auto_execute` | array | Subset of `tools_to_execute` that runs without user confirmation |
| `headers` | object | Static admin headers (used by `headers` and as additions on `per_user_headers`) |
| `is_code_mode_client` | boolean | Wrap tools as Python code-mode helpers instead of raw tool calls |
| `needs_session_stickiness` | boolean | HTTP-only, and only meaningful for `oauth`/`headers`/`none` (per-user auth types are always per-call). `true` holds one persistent upstream connection reused for every tool call; `false`/omitted (default) dials fresh per tool call. Cannot be `false` for `connection_type` `"sse"`/`"stdio"` — both are always sticky. See [Session Stickiness](/mcp/connecting-to-servers#session-stickiness-http-only). |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the per-call rule explicit for token_exchange.

token_exchange exchanges each caller's identity token at tool-use time. Name it with per_user_oauth and per_user_headers in the always-per-call rule. Also change “Cannot be false...” to “This field cannot be false...” so the restriction has an explicit subject.

As per path instructions, this page must document HTTP session stickiness and per-call behavior. The supplied transports/bifrost-http/handlers/mcp.go context, Lines [629]-[774], shows caller tokens are exchanged on each tool use.

🧰 Tools
🪛 LanguageTool

[style] ~293-~293: To form a complete sentence, be sure to include a subject.
Context: ...ed (default) dials fresh per tool call. Cannot be false for connection_type `"sse"...

(MISSING_IT_THERE)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/deployment-guides/config-json/schema-reference.mdx` at line 293, The
schema table entry for needs_session_stickiness must explicitly include
token_exchange, per_user_oauth, and per_user_headers in the always-per-call
rule, and change “Cannot be false” to “This field cannot be false” while
preserving the existing HTTP and SSE/stdio behavior.

Sources: Path instructions, Linters/SAST tools

Comment on lines +295 to +296
| `tool_sync_interval` | integer | Per-client tool-list sync interval in minutes. `0`/omitted falls back to the global `client.mcp_tool_sync_interval`; negative disables periodic sync for this client. |
| `tool_execution_timeout` | integer | Per-client tool execution timeout in seconds. `0`/omitted falls back to the global `client.mcp_tool_execution_timeout`. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Match the documented duration formats to the schema.

Lines [295]-[296] declare integer-only minute/second fields. The supplied schema guidance requires duration strings where supported. It also requires integer compatibility for tool_execution_timeout and legacy nanoseconds for tool_sync_interval. Update the documented types and units before users copy these values into config.json.

As per coding guidelines, documentation configuration examples must match transports/config.schema.json. As per path instructions, documentation must match the schema's duration and compatibility behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/deployment-guides/config-json/schema-reference.mdx` around lines 295 -
296, Update the documentation entries for tool_sync_interval and
tool_execution_timeout to match transports/config.schema.json: document the
supported duration-string formats and units, retain integer compatibility for
tool_execution_timeout, and document legacy nanosecond compatibility for
tool_sync_interval. Ensure the described fallback and disabling behavior remains
accurate.

Sources: Coding guidelines, Path instructions

| `tool_sync_interval` | integer | Per-client tool-list sync interval in minutes. `0`/omitted falls back to the global `client.mcp_tool_sync_interval`; negative disables periodic sync for this client. |
| `tool_execution_timeout` | integer | Per-client tool execution timeout in seconds. `0`/omitted falls back to the global `client.mcp_tool_execution_timeout`. |
| `allow_on_all_virtual_keys` | boolean | When `true`, every virtual key can use this client without an explicit allowlist entry. |
| `tls_config` | object | `{ "insecure_skip_verify": bool, "ca_cert_pem": string }` — skip TLS verification (development only) and/or trust a custom CA certificate for this client's connection. `ca_cert_pem` supports `env.VAR_NAME`. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Document TLS scope and precedence.

tls_config applies only to HTTP/SSE. If insecure_skip_verify is true, it takes precedence over ca_cert_pem. Add both rules and state that insecure_skip_verify is discouraged in production. The current “and/or” wording can imply that the custom CA still protects a connection when verification is disabled.

As per path instructions, TLS scope, precedence, and production guidance must be documented.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/deployment-guides/config-json/schema-reference.mdx` at line 298, Update
the tls_config schema-reference description to state that it applies only to
HTTP/SSE connections, insecure_skip_verify takes precedence over ca_cert_pem
when enabled, and insecure_skip_verify is discouraged in production; replace the
ambiguous “and/or” wording so it does not imply custom CA verification remains
effective when verification is disabled.

Source: Path instructions

|-------|-----------|-------------|
| `oauth_config` | `oauth`, `per_user_oauth` | Optional inline OAuth provider block. The whole block can be omitted, and any inner field (`client_id`, `client_secret`, `authorize_url`, `token_url`, `registration_url`, `scopes`) can be omitted individually — RFC 8414 metadata discovery + RFC 7591 dynamic client registration fill the gaps off `connection_string` at admin-click time. `client_id` / `client_secret` support `env.VAR_NAME` and `vault.path` references (resolved at runtime, reference stored); the other fields take literal values (encrypted at rest, redacted in API responses). |
| `per_user_header_keys` | `per_user_headers` | Required, non-empty. Array of header names each end-user must supply. |
| `token_exchange` | `token_exchange` | Required. `{ "audience": string, "client_id": SecretVar, "client_secret": SecretVar (optional, public clients), "scopes": string[] (optional), "authorization_server_url": string (optional) }`. `client_id`/`client_secret` support `env.VAR_NAME`/`vault.path` references. Include `"offline_access"` in `scopes` where the identity provider supports it to keep the retained admin discovery credential self-renewing instead of expiring into `needs_reauth`. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Remove the unsupported authorization_server_url field.

transports/config.schema.json, Lines [4846]-[4874], defines token_exchange with audience, client_id, optional client_secret, and optional scopes. It sets additionalProperties to false. A user who follows this table will fail schema validation.

As per coding guidelines, documentation configuration examples must match transports/config.schema.json. As per path instructions, documentation must remain in parity with the schema and provider behavior.

Suggested correction
-... `"scopes": string[] (optional), "authorization_server_url": string (optional) }`.
+... `"scopes": string[] (optional) }`.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| `token_exchange` | `token_exchange` | Required. `{ "audience": string, "client_id": SecretVar, "client_secret": SecretVar (optional, public clients), "scopes": string[] (optional), "authorization_server_url": string (optional) }`. `client_id`/`client_secret` support `env.VAR_NAME`/`vault.path` references. Include `"offline_access"` in `scopes` where the identity provider supports it to keep the retained admin discovery credential self-renewing instead of expiring into `needs_reauth`. |
| `token_exchange` | `token_exchange` | Required. `{ "audience": string, "client_id": SecretVar, "client_secret": SecretVar (optional, public clients), "scopes": string[] (optional) }`. `client_id`/`client_secret` support `env.VAR_NAME`/`vault.path` references. Include `"offline_access"` in `scopes` where the identity provider supports it to keep the retained admin discovery credential self-renewing instead of expiring into `needs_reauth`. |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/deployment-guides/config-json/schema-reference.mdx` at line 306, Update
the token_exchange entry in the schema reference table to remove the unsupported
authorization_server_url field, keeping only audience, client_id, optional
client_secret, and optional scopes so the documentation matches
transports/config.schema.json and provider behavior.

Sources: Coding guidelines, Path instructions

The schema enforces these pairings: `oauth_config` is rejected on non-OAuth auth types, `per_user_header_keys` is rejected on any auth type other than `per_user_headers`, and `token_exchange` is rejected on any auth type other than `token_exchange` — a misplaced block fails `$schema` validation instead of being silently ignored.

<Warning>
**Enterprise only:** `auth_type: "token_exchange"` in `config.json` is rejected on OSS — the client is skipped entirely at boot with an error logged naming it. Declare `token_exchange` clients via the API/Web UI on an enterprise deployment instead if you need them in a non-enterprise `config.json` environment during a migration.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Clarify the OSS migration condition.

The warning says OSS rejects token_exchange, then says to use API/Web UI on an enterprise deployment “if you need them in a non-enterprise config.json environment.” This is contradictory. State that the API/Web UI path applies only to enterprise deployments and cannot enable this auth type on OSS.

As per path instructions, documentation must match provider behavior. The PR objective defines token_exchange as enterprise-only.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/deployment-guides/config-json/schema-reference.mdx` at line 311, Clarify
the documentation paragraph describing auth_type "token_exchange" so it states
that the API/Web UI declaration path is available only on enterprise deployments
and cannot enable this authentication type on OSS. Remove the contradictory
reference to using that path in a non-enterprise config.json environment while
preserving the existing OSS rejection behavior.

Source: Path instructions

@Pratham-Mishra04
Pratham-Mishra04 changed the base branch from 08-08-docs_openapi_fix_stale_mcp_connection-state_enum_document_premature-completion_409_on_complete-oauth to graphite-base/5977 August 8, 2026 11:54
@Pratham-Mishra04
Pratham-Mishra04 changed the base branch from graphite-base/5977 to dev August 8, 2026 11:57
@Pratham-Mishra04
Pratham-Mishra04 requested a review from a team as a code owner August 8, 2026 11:57
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 08-08-docs_fix_remaining_reconnect-400_wording_and_tool-persistence_gaps_across_mcp_docs branch from ae5a1d1 to ab01d0e Compare August 8, 2026 11:57
@Pratham-Mishra04
Pratham-Mishra04 merged commit c077583 into dev Aug 8, 2026
14 of 15 checks passed
@Pratham-Mishra04
Pratham-Mishra04 deleted the 08-08-docs_fix_remaining_reconnect-400_wording_and_tool-persistence_gaps_across_mcp_docs branch August 8, 2026 11:59
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.

2 participants