Skip to content

Add managed MCP support across SDKs - #2436

Draft
mattdholloway wants to merge 8 commits into
mainfrom
mattdholloway-managed-mcp-sdk
Draft

Add managed MCP support across SDKs#2436
mattdholloway wants to merge 8 commits into
mainfrom
mattdholloway-managed-mcp-sdk

Conversation

@mattdholloway

@mattdholloway mattdholloway commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add the additive managedMcpServers session create/resume contract across Node.js, Python, Go, .NET, Rust, and Java.
  • Regenerate supported RPC and session-event bindings for managed provenance, display metadata, optional ttlMs, and the explicit broker-error result.
  • Add high-level dynamic-header refresh handlers in every SDK while preserving raw RPC access.
  • Dispatch headers, no-result, broker failures, cancellation, and handler panics/failures through the runtime response contract.
  • Document managed origin versus HTTP transport and the host responsibilities for trusted catalogs, memory-only credentials, expiry/revocation, and cold resume.

Compatibility

This is additive. Existing mcpServers, MCP OAuth handlers and storage, local stdio, SSE, arbitrary HTTP servers, static headers, and low-level RPC APIs remain unchanged. Managed catalog entries use a separate field so the runtime establishes source: "managed" provenance without changing transport semantics.

The branch is merged with the current main base and preserves upstream ask-user variants, auto routing tiers, client info, runtime artifact resolution, and generated contract changes introduced since the PR was opened.

Validation

  • Node.js: Prettier, ESLint, typecheck, focused managed-MCP tests, and schema-overlay guard tests pass.
  • Python: Ruff formatting/lint, ty, and focused managed-MCP tests pass.
  • Go: gofmt, golangci-lint, and focused managed-MCP tests pass.
  • .NET: restore, formatting verification, build, and focused managed-MCP tests pass.
  • Rust: nightly rustfmt, Clippy, managed-MCP serialization/dispatch tests, and the failed-interest cleanup regression test pass with runtime download disabled for the local compile-only validation.
  • Java: Spotless, Checkstyle, compilation, and focused managed-MCP tests pass with the JDK 25 enforcer skipped because this machine has JDK 17.
  • The repository's normal shared and Java codegen commands reproduce the generated outputs against @github/copilot@1.0.83-1 plus the managed-MCP overlay.

Dependency and rollout

Depends on github/copilot-agent-runtime#17210 (09c398fc881b43a52e1223fe381c61279f0f709c). The currently pinned @github/copilot@1.0.83-1 package still does not contain this contract.

Until a CLI package containing the runtime change is published, codegen applies a repository-local, fail-closed schema overlay containing the exact pre-contract and target nodes from agent-runtime#17210. It accepts only the known pinned legacy shape or the final target shape, rejects missing or unknown upstream definitions, and is exercised by the normal codegen commands. Remove the overlay after the pinned package publishes the same schema.

Catalog implementation, token-broker implementation, and CLI rollout are intentionally out of scope.

Closes github/copilot-mcp-core#2140

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattdholloway
mattdholloway force-pushed the mattdholloway-managed-mcp-sdk branch from fa950ff to bf1592a Compare August 28, 2026 10:01
mattdholloway and others added 2 commits September 1, 2026 18:22
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1aa90135-4c64-4faa-8006-b5605338176a
Auto-committed by java-codegen-check workflow.
@github-actions github-actions Bot added the dependencies Pull requests that update a dependency file label Sep 1, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1aa90135-4c64-4faa-8006-b5605338176a
Comment thread python/copilot/session.py Fixed
mattdholloway and others added 2 commits September 2, 2026 15:10
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1aa90135-4c64-4faa-8006-b5605338176a
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

Start session dispatch before local session.create completes so managed MCP startup header requests cannot deadlock creation. Ship the in-process CLI integrity snapshot for vendored consumers and keep no-bundle builds warning-free.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1aa90135-4c64-4faa-8006-b5605338176a
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review — PR #2436

Reviewed the authoritative diff (get_files + get_diff) for the new Managed MCP servers feature (host-injected non-secret MCP server catalog) and its companion headers refresh callback (dynamic credential injection for managed servers).

Result: ✅ Consistent across all six SDKs.

The feature is implemented in parallel across Node.js/TypeScript, Python, Go, .NET, Java, and Rust:

SDK Managed servers config Header refresh callback
Node.js managedMcpServers onMcpHeadersRefresh
Python managed_mcp_servers on_mcp_headers_refresh
Go ManagedMCPServers OnMCPHeadersRefresh
.NET ManagedMcpServers OnMcpHeadersRefresh
Java setManagedMcpServers(...) setOnMcpHeadersRefreshRequest(...)
Rust with_managed_mcp_servers(...) with_mcp_headers_handler(...)

Observations:

  • Naming follows each language's idiomatic convention (camelCase/PascalCase/snake_case/fluent-builder), while remaining semantically parallel (config field + host-supplied handler pair).
  • The new wire type ManagedMcpServerConfig and RPC method mcp.headers.handlePendingHeadersRefreshRequest (session.mcp.headers.handlePendingHeadersRefreshRequest) are present and wired into session lifecycle (createSession/resumeSession, event-interest registration for mcp.headers_refresh_required) consistently in every SDK's generated + hand-written code.
  • Error/None/Headers result variants (McpHeadersHandlePendingHeadersRefreshRequest{Error,None,Headers}) are mirrored in Rust, Go, .NET, and Java generated types; Node/Python use equivalent discriminated unions/dicts.
  • Docs (docs/features/mcp.md) already include a cross-SDK naming table and clear host-responsibility guidance (trusted catalog injection, memory-only credentials, TTL clamping, cold-resume re-supply requirement) — good practice for cross-language features.
  • Test coverage (client_test.go, session_test.go, ClientSessionLifetimeTests.cs, Java McpHeadersRefreshHandlerTest/McpAuthInterestRegistrationTest, nodejs/test/client.test.ts, python/test_client.py, rust/tests/session_test.rs) accompanies the change in every touched language.

No inconsistencies or gaps found — this PR maintains full feature parity across all supported SDKs. Nice work keeping the multi-language surface aligned.

Generated by SDK Consistency Review Agent for #2436 · sonnet50 42.9 AIC · ⌖ 6.52 AIC · ⊞ 8.8K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants