Skip to content

Expose Copilot Connector session support - #2436

Open
mattdholloway wants to merge 24 commits into
mainfrom
mattdholloway-managed-mcp-sdk
Open

mattdholloway wants to merge 24 commits into
mainfrom
mattdholloway-managed-mcp-sdk

Conversation

@mattdholloway

@mattdholloway mattdholloway commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

This replaces the caller-managed Connector/MCP bridge with the runtime-owned experimental Connector session API across Node.js, Python, Go, .NET, Java, and Rust.

  • The runtime owns Connector catalog validation, GitHub authorization, bounded connection polling, MCP projection, and authoritative same-session reconciliation.
  • The SDK host owns opaque account selection, browser/consent UI, destructive-action confirmation, and presentation.
  • Connector methods accept only an opaque account selection ID. Connector DTOs never accept or return credentials or provider tokens.
  • Managed-MCP implementation details and Connector credential callbacks are not exposed as public SDK APIs.
  • Existing mcpServers behavior is unchanged and remains the API for MCP servers configured directly by the application.
  • Generated clients share one exact, fail-closed schema overlay until the pinned schema contains the Connector contract.
  • No dependencies, lockfiles, runtime pins, project files, or workflows are changed.

Exposed functions

Function Purpose Result
getCapabilities() Detect API availability and read hard continuation bounds without a Connector service request API version, availability, account-selection support, and polling ceilings
getStatus() Read authoritative session state without a Connector service request Pinned account ID, cached catalog, pending continuations, and live Connector-owned MCP status
list({ accountId }) Read the cached catalog, fetching it when the session has no catalog Validated Connector catalog
refresh({ accountId }) Refresh and validate the catalog Validated Connector catalog
connect({ accountId, connectorName }) Start an idempotent connection flow without opening a browser connected, consent_required, or pending
reconnect({ accountId, connectorName }) Restart the same connection flow for an existing Connector connected, consent_required, or pending
continueConnection({ continuationId, maxAttempts, pollIntervalMs, deadlineMs }) Continue consent/connection polling within caller-supplied and runtime-enforced bounds Typed connection result
disconnect({ accountId, connectorName }) Disconnect a Connector and remove its session-owned MCP projection Disconnect result plus authoritative session status
reconcile({ accountId, refreshCatalog? }) Reconcile the authoritative catalog into the current session Authoritative session status

SDK surface

SDK Namespace
Node.js session.rpc.connectors
Python session.rpc.connectors
Go session.RPC.Connectors
.NET session.Rpc.Connectors
Java session.getRpc().connectors
Rust session.rpc().connectors()

Each SDK includes wire-shape coverage for all nine methods and typed result/enum serialization. Shared documentation now distinguishes direct mcpServers configuration from runtime-managed Connectors and demonstrates the capability → account selection → list → reconcile → connect → consent → bounded continuation flow.

Validation

  • Shared and Java code generation are reproducible with no diff and match the compatible runtime Connector schema exactly.
  • Node.js: formatting, lint, typecheck, and Connector/codegen tests pass.
  • Python: Ruff checks and Connector tests pass.
  • Go: Connector and generated RPC packages pass with the race detector.
  • .NET: all three Connector RPC tests and the all-target build pass.
  • Java: Spotless, Checkstyle, focused Connector serialization/RPC tests, and the full JDK 25 verification suite pass.
  • Rust: nightly formatting, Clippy with warnings denied, all-feature tests, doctests, and documentation with warnings denied pass.
  • Real authenticated E2E passes through both standalone stdio and in-process transports: capability detection, catalog retrieval, reconciliation, three live Connector MCP servers, authoritative connected status, and live tools/list results (22, 1, and 3 tools).

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

This comment has been minimized.

Preserve managed MCP startup dispatch, hook response receipts, and vendored runtime metadata while incorporating the latest SDK lifecycle and generated contracts.

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

Copilot-Session: 4a5fe505-7f39-4e3c-aeb7-78ec28c9767f
@github-actions

This comment has been minimized.

@mattdholloway
mattdholloway marked this pull request as ready for review September 14, 2026 15:04
@mattdholloway
mattdholloway requested a review from a team as a code owner September 14, 2026 15:04
Copilot AI balanced review requested due to automatic review settings September 14, 2026 15:04
@github-actions

This comment has been minimized.

@github-actions github-actions 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.

Generated by SDK Consistency Review Agent for #2436 · copilot · sonnet50 · 70.2 AIC · ⌖ 14.3 AIC · ⊞ 8.3K

Comment thread java/sdk/src/main/java/com/github/copilot/rpc/SessionConfig.java Outdated

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

The overlay accepts partial schemas, Go leaves handler panics unrecovered, and several public APIs introduce compatibility or experimental-gating breaks.

Get a fresh assessment by requesting another Copilot review.

Review tier: Balanced
Findings: 2 High severity · 3 Medium severity

Open findings (5)
What changed in this PR

Adds managed MCP server configuration, dynamic credential-header refresh, and managed provenance across all SDKs.

Changes:

  • Adds a temporary fail-closed schema overlay and regenerated bindings.
  • Exposes create/resume configuration and refresh handlers in six SDKs.
  • Adds tests and managed MCP host guidance.
File Description
scripts/​codegen/​utils.ts Applies the schema overlay during shared codegen.
scripts/​codegen/​rust.ts Applies the overlay during Rust generation.
scripts/​codegen/​managedMcpSchemaOverlay.ts Implements overlay validation and mutation.
scripts/​codegen/​managed-mcp-schema-overlay.json Defines legacy and target contract nodes.
rust/​tests/​session_test.rs Tests refresh dispatch, cleanup, and hooks.
rust/​tests/​e2e/​rpc_tasks_and_handlers.rs Adapts RPC fixture construction for TTL.
rust/​src/​wire.rs Adds managed servers to create/resume payloads.
rust/​src/​types.rs Adds public managed MCP configuration APIs.
rust/​src/​session.rs Registers and dispatches refresh handlers.
rust/​src/​resolve.rs Corrects conditional runtime validation compilation.
rust/​src/​hooks.rs Adds request identity and response callbacks.
rust/​src/​handler.rs Defines Rust refresh request/result handlers.
rust/​src/​generated/​session_events.rs Adds managed provenance display metadata.
rust/​src/​generated/​api_types.rs Adds generated managed MCP RPC types.
rust/​cli-version-in-process.txt Records bundled runtime artifact hashes.
rust/​.gitignore Tracks the runtime-version snapshot.
python/​test_client.py Tests Python forwarding and refresh responses.
python/​copilot/​session.py Implements Python refresh dispatch.
python/​copilot/​generated/​session_events.py Adds generated managed event metadata.
python/​copilot/​client.py Adds create/resume managed MCP options.
python/​copilot/​__init__.py Exports the new Python APIs.
nodejs/​test/​shared-codegen.test.ts Tests overlay behavior.
nodejs/​test/​client.test.ts Tests Node.js forwarding and responses.
nodejs/​src/​types.ts Defines Node.js managed MCP APIs.
nodejs/​src/​session.ts Implements Node.js refresh dispatch.
nodejs/​src/​index.ts Exports managed MCP types.
nodejs/​src/​generated/​session-events.ts Adds managed event provenance.
nodejs/​src/​generated/​rpc.ts Adds generated managed RPC contracts.
nodejs/​src/​client.ts Forwards options and registers event interest.
java/​sdk/​src/​test/​java/​com/​github/​copilot/​SessionRequestBuilderTest.java Tests Java request serialization.
java/​sdk/​src/​test/​java/​com/​github/​copilot/​McpHeadersRefreshHandlerTest.java Tests Java refresh handler outcomes.
java/​sdk/​src/​test/​java/​com/​github/​copilot/​McpAuthInterestRegistrationTest.java Tests Java event-interest registration.
java/​sdk/​src/​test/​java/​com/​github/​copilot/​generated/​rpc/​GeneratedRpcRecordsCoverageTest.java Adapts generated record construction.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​SessionRequestBuilder.java Maps Java managed MCP configuration.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​SessionConfig.java Adds create-session managed MCP APIs.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​ResumeSessionRequest.java Adds managed servers to resume requests.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​ResumeSessionConfig.java Adds resume managed MCP APIs.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​McpHeadersRefreshResult.java Defines Java refresh results.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​McpHeadersRefreshRequest.java Defines Java refresh requests.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​McpHeadersRefreshInvocation.java Defines Java invocation context.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​McpHeadersRefreshHandler.java Defines the Java handler interface.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​CreateSessionRequest.java Adds managed servers to create requests.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​CopilotSession.java Dispatches Java refresh callbacks.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​CopilotClient.java Registers Java MCP event interests.
java/​sdk/​src/​generated/​java/​com/​github/​copilot/​generated/​rpc/​SessionOpenOptions.java Adds generated managed session options.
java/​sdk/​src/​generated/​java/​com/​github/​copilot/​generated/​rpc/​McpServerSource.java Adds managed RPC provenance.
java/​sdk/​src/​generated/​java/​com/​github/​copilot/​generated/​rpc/​McpServer.java Adds managed display names.
java/​sdk/​src/​generated/​java/​com/​github/​copilot/​generated/​rpc/​ManagedMcpServerConfig.java Defines generated managed server configuration.
java/​sdk/​src/​generated/​java/​com/​github/​copilot/​generated/​McpServerSource.java Adds managed event provenance.
java/​sdk/​src/​generated/​java/​com/​github/​copilot/​generated/​McpServersLoadedServer.java Adds event display metadata.
java/​scripts/​codegen/​java.ts Applies the overlay in Java codegen.
go/​zsession_events.go Re-exports managed provenance.
go/​types.go Defines Go managed MCP APIs.
go/​session.go Dispatches Go refresh handlers.
go/​session_test.go Tests Go refresh outcomes.
go/​rpc/​zsession_events.go Adds generated event metadata.
go/​rpc/​zrpc.go Adds generated managed RPC types.
go/​rpc/​zrpc_encoding.go Encodes the new RPC variants.
go/​client.go Forwards options and registers interests.
go/​client_test.go Tests Go create/resume behavior.
dotnet/​test/​Unit/​SerializationTests.cs Tests .NET request serialization.
dotnet/​test/​Unit/​ClientSessionLifetimeTests.cs Tests .NET refresh dispatch.
dotnet/​src/​Types.cs Defines .NET managed MCP APIs.
dotnet/​src/​Session.cs Implements .NET refresh handling.
dotnet/​src/​Generated/​SessionEvents.cs Adds generated managed event metadata.
dotnet/​src/​Generated/​Rpc.cs Adds generated refresh RPC variants.
dotnet/​src/​Client.cs Forwards .NET managed configuration.
docs/​features/​mcp.md Documents managed MCP host responsibilities.
Files not reviewed (3)
  • go/rpc/zrpc_encoding.go: Generated file
  • go/rpc/zsession_events.go: Generated file
  • go/zsession_events.go: Generated file

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread go/session.go Outdated
Comment thread rust/src/hooks.rs Outdated
Comment thread java/sdk/src/main/java/com/github/copilot/rpc/ResumeSessionConfig.java Outdated
Comment thread java/sdk/src/main/java/com/github/copilot/rpc/SessionConfig.java Outdated
Comment thread scripts/codegen/managedMcpSchemaOverlay.ts Outdated
…-mcp-sdk

# Conflicts:
#	dotnet/src/Generated/SessionEvents.cs
#	java/sdk/src/test/java/com/github/copilot/generated/rpc/GeneratedRpcRecordsCoverageTest.java
#	nodejs/src/generated/session-events.ts
#	python/copilot/generated/rpc.py
#	rust/src/generated/session_events.rs

Co-authored-by: mattdholloway <918573+mattdholloway@users.noreply.github.com>
@github-actions

This comment has been minimized.

@mattdholloway mattdholloway changed the title Add managed MCP support across SDKs Add Copilot Connectors support across SDKs Sep 16, 2026
@mattdholloway mattdholloway changed the title Add Copilot Connectors support across SDKs Add Copilot Connectors support Sep 16, 2026
mattdholloway and others added 3 commits September 16, 2026 11:31
Keep runtime managed-MCP details behind Connector-facing configuration, validate authorization against the real runtime, and remove the obsolete schema overlay.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep the pull request focused on Connector session configuration and authorization.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mattdholloway mattdholloway changed the title Add Copilot Connectors support Expose Copilot Connector session support across SDKs Sep 16, 2026
@github-actions

This comment has been minimized.

@mattdholloway mattdholloway added post-to-slack Post PR to reviewers Slack channel deep-review Requested detailed code review labels Sep 16, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mattdholloway mattdholloway changed the title Expose Copilot Connector session support across SDKs Expose experimental Copilot Connector APIs across SDKs Sep 18, 2026
@mattdholloway mattdholloway changed the title Expose experimental Copilot Connector APIs across SDKs Expose Copilot Connector session support Sep 18, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

Copilot AI 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.

Copilot review overview

🔵 Needs a closer look

The cross-language generated contract still has validation, Java opt-in, and Python coverage concerns requiring human review.

Review effort: Balanced
Findings: 4 Medium severity

Open (4)
Resolved since last review (5)
Files not reviewed (1)
  • go/rpc/zrpc_encoding.go: Generated file

Comment thread java/scripts/codegen/java.ts
Comment thread python/test_connectors.py Outdated
Comment thread python/test_connectors.py Outdated
Comment thread scripts/codegen/connector-session-api-overlay.json Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

The schema overlay still has TypeScript correctness and custom-path application defects.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (4)
Files not reviewed (1)
  • go/rpc/zrpc_encoding.go: Generated file
Previously missed (1)

In code that hasn't changed since last review

Medium severity Apply the overlay to custom API schema paths

scripts/​codegen/​connectorSessionApiOverlay.ts:60

API generators accept an explicit schema path, but this basename guard applies the overlay only when that path is literally named api.schema.json. For example, passing /tmp/connector-api.json through getApiSchemaPath(cliArg) silently generates clients without the Connector contract. Identify API versus session-event schemas at the call sites instead of inferring the schema kind from the filename.

Comment thread scripts/codegen/connectorSessionApiOverlay.ts Outdated
mattdholloway and others added 2 commits September 18, 2026 19:35
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

SDK Consistency Review — PR #2436 (Connector session API)

Reviewed the authoritative PR delta (140 changed files across all 6 language SDKs) via get_files/get_diff.

Finding: Consistent, well-executed cross-SDK feature addition.

This PR adds the experimental Copilot Connector session API uniformly across all six SDKs, with matching:

  • Method surface (9 methods each): getCapabilities/get_capabilities/GetCapabilities, getStatus/get_status/GetStatus, list/List, refresh/Refresh, connect/Connect, reconnect/Reconnect, continueConnection/continue_connection/ContinueConnection, disconnect/Disconnect, reconcile/Reconcile — each following the correct language idiom (camelCase for Node/Python via snake_case/Java, PascalCase for Go/.NET, snake_case for Rust).
  • Namespace access pattern, matching the documented table in docs/features/mcp.md:
    • Node.js: session.rpc.connectors
    • Python: session.rpc.connectors
    • Go: session.RPC.Connectors
    • .NET: session.Rpc.Connectors
    • Java: session.getRpc().connectors
    • Rust: session.rpc().connectors()
  • Experimental gating consistent with each SDK's existing experimental-API conventions (Java's @AllowCopilotExperimental annotation + compiler-enforced opt-in with new CopilotExperimentalProcessorTest coverage, .NET's [Experimental(Diagnostics.Experimental)], Rust's doc-comment experimental warnings, Go's // Experimental: comments).
  • Discriminated connect/continuation result types (connected / consent_required / pending) implemented equivalently in each language's union/enum idiom (Go tagged unions with Kind(), TS discriminated unions, Java sealed-style DTOs, Rust enums, Python dataclasses).
  • Security-relevant behavior parity: every SDK's docs/tests confirm the API accepts only opaque account IDs and continuation IDs — no credentials or provider tokens cross the wire — and that consent-URL handling/browser UX remains host-owned in all six implementations.
  • Test coverage added per SDK: dotnet/test/Unit/RpcConnectorsTests.cs, go/connectors_rpc_test.go, java/sdk/src/test/java/.../RpcWrappersTest.java + CopilotExperimentalProcessorTest.java, nodejs/test/connectors.test.ts, python/test_connectors.py, rust/tests/api_types_test.rs / session_test.rs.
  • README updates are present and mutually consistent for all 6 languages, plus the shared docs/features/mcp.md overview with a per-SDK access table.

No inconsistencies, one-off single-language features, or naming/behavior mismatches were found. This is a good example of a coordinated, feature-parity-preserving cross-SDK change (codegen-driven from scripts/codegen/connector-session-api-overlay.json / connectorSessionApiOverlay.ts, with per-language generator updates in scripts/codegen/rust.ts, java/scripts/codegen/java.ts, and scripts/codegen/utils.ts).

No action needed from a consistency standpoint.

Generated by SDK Consistency Review Agent for #2436 · copilot · sonnet50 · 48.9 AIC · ⌖ 11.7 AIC · ⊞ 7.8K ·

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

Labels

deep-review Requested detailed code review dependencies Pull requests that update a dependency file post-to-slack Post PR to reviewers Slack channel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants