Skip to content

sdk: Expose disabled MCP servers across languages - #2260

Open
connor4312 wants to merge 3 commits into
github:mainfrom
connor4312:issue-2056-disabled-mcp-servers
Open

sdk: Expose disabled MCP servers across languages#2260
connor4312 wants to merge 3 commits into
github:mainfrom
connor4312:issue-2056-disabled-mcp-servers

Conversation

@connor4312

Copy link
Copy Markdown
Contributor

Why

SDK consumers can supply MCP servers and plugin directories per session, but cannot currently prevent a discovered server from starting before the first turn. The global disabledMcpServers setting avoids startup but persists user state and has the wrong scope.

This addresses https://github.com/github/copilot-mcp-core/issues/2056.

Companion runtime contract PR: https://github.com/github/copilot-agent-runtime/pull/14727

What

Expose session-scoped disabled MCP server names on create and resume across all six SDKs:

  • Node: disabledMcpServers
  • Python: disabled_mcp_servers
  • Go: DisabledMCPServers
  • .NET: DisabledMcpServers
  • Java: setDisabledMcpServers(...)
  • Rust: with_disabled_mcp_servers(...)

The exact names are forwarded as disabledMcpServers without writing global settings. Omission preserves existing behavior; Python and Go also preserve an explicitly empty list.

The Node E2E coverage uses real plugin-provided stdio servers and the built-in github-mcp-server to prove:

  • a separate post-create non-MCP RPC does not start MCP;
  • the first user message starts enabled plugin servers but never spawns disabled ones;
  • a disabled built-in GitHub MCP makes no /mcp request;
  • an enabled control reaches connected;
  • cold resume applies the session-scoped disabled set before startup.

Testing

  • Node build, typecheck, format check, lint, and unit tests
  • Node disabled-MCP E2E against the locally built runtime: 3/3 passed
  • Go tests
  • Rust formatting and 204 library tests
  • Cross-language serialization/copy tests added for Python, Java, and .NET; those toolchains were unavailable locally
  • Persistent local proof covered first-message startup, no-global-mutation, direct list, and cold resume

Release note

The option is backward-compatible and targets the existing legacy session.create / session.resume wire field. After the runtime contract PR is released, SDK codegen can be refreshed to expose the same field through generated sessions.open options.

Allow callers to disable exact MCP server names per session on create and resume without mutating global settings. Cover all SDK wire mappings and verify plugin and built-in GitHub MCP servers stay stopped on the first message.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 4, 2026 21:37

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.

Pull request overview

Adds session-scoped disabled MCP server configuration across all six SDKs without modifying global settings.

Changes:

  • Exposes and forwards disabled server names during create and resume.
  • Adds serialization, cloning, and E2E coverage.
  • Documents cross-language configuration names and behavior.
Show a summary per file
File Description
test/harness/test-mcp-server.mjs Adds configurable server names and startup markers.
test/harness/replayingCapiProxy.ts Adds a hermetic /mcp transport mock.
rust/src/wire.rs Adds create and resume wire fields.
rust/src/types.rs Adds Rust configuration APIs and tests.
python/test_client.py Tests Python forwarding and omission semantics.
python/copilot/client.py Adds Python create and resume options.
nodejs/test/e2e/disabled_mcp_servers.e2e.test.ts Tests create, built-in, and cold-resume behavior.
nodejs/test/client.test.ts Tests Node.js request forwarding.
nodejs/src/types.ts Defines the Node.js public option.
nodejs/src/client.ts Forwards the Node.js option.
java/src/test/java/com/github/copilot/SessionRequestBuilderTest.java Tests Java request serialization.
java/src/test/java/com/github/copilot/ConfigCloneTest.java Tests Java configuration cloning.
java/src/main/java/com/github/copilot/SessionRequestBuilder.java Copies configuration into requests.
java/src/main/java/com/github/copilot/rpc/SessionConfig.java Adds Java create-session configuration.
java/src/main/java/com/github/copilot/rpc/ResumeSessionRequest.java Adds the Java resume wire field.
java/src/main/java/com/github/copilot/rpc/ResumeSessionConfig.java Adds Java resume configuration.
java/src/main/java/com/github/copilot/rpc/CreateSessionRequest.java Adds the Java create wire field.
go/types.go Adds Go public and wire fields.
go/client.go Preserves nil versus empty Go lists.
go/client_test.go Tests Go serialization semantics.
dotnet/test/Unit/SerializationTests.cs Tests .NET wire serialization.
dotnet/test/Unit/CloneTests.cs Tests .NET collection cloning.
dotnet/src/Types.cs Adds the .NET public property.
dotnet/src/Client.cs Forwards the .NET property.
docs/features/mcp.md Documents session-scoped disabling.

Review details

  • Files reviewed: 25/25 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread test/harness/test-mcp-server.mjs
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 4, 2026 22:15
@connor4312
connor4312 marked this pull request as ready for review August 4, 2026 22:16
@connor4312
connor4312 requested a review from a team as a code owner August 4, 2026 22:16

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.

Review details

Suppressed comments (1)

nodejs/test/e2e/disabled_mcp_servers.e2e.test.ts:439

  • This cold-resume test uses the global 30-second Vitest timeout, even though both polling helpers below allow up to 60 seconds and the test starts two runtimes. On slower CI hosts, Vitest can abort a valid run before those waits complete. Give this test the same explicit extended timeout as the two preceding MCP tests.
        "applies disabled plugin MCP servers on cold stdio resume",
        async () => {
  • Files reviewed: 25/25 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Format the disabled MCP server accessors and Javadocs exactly as required by the Java CI Spotless check.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 4, 2026 22:52

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.

Review details

  • Files reviewed: 25/25 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

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