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>
CopilotAI balanced review requested due to automatic review settings August 4, 2026 21:37

CopilotAI 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
FileDescription
test/harness/test-mcp-server.mjsAdds configurable server names and startup markers.
test/harness/replayingCapiProxy.tsAdds a hermetic /mcp transport mock.
rust/src/wire.rsAdds create and resume wire fields.
rust/src/types.rsAdds Rust configuration APIs and tests.
python/test_client.pyTests Python forwarding and omission semantics.
python/copilot/client.pyAdds Python create and resume options.
nodejs/test/e2e/disabled_mcp_servers.e2e.test.tsTests create, built-in, and cold-resume behavior.
nodejs/test/client.test.tsTests Node.js request forwarding.
nodejs/src/types.tsDefines the Node.js public option.
nodejs/src/client.tsForwards the Node.js option.
java/src/test/java/com/github/copilot/SessionRequestBuilderTest.javaTests Java request serialization.
java/src/test/java/com/github/copilot/ConfigCloneTest.javaTests Java configuration cloning.
java/src/main/java/com/github/copilot/SessionRequestBuilder.javaCopies configuration into requests.
java/src/main/java/com/github/copilot/rpc/SessionConfig.javaAdds Java create-session configuration.
java/src/main/java/com/github/copilot/rpc/ResumeSessionRequest.javaAdds the Java resume wire field.
java/src/main/java/com/github/copilot/rpc/ResumeSessionConfig.javaAdds Java resume configuration.
java/src/main/java/com/github/copilot/rpc/CreateSessionRequest.javaAdds the Java create wire field.
go/types.goAdds Go public and wire fields.
go/client.goPreserves nil versus empty Go lists.
go/client_test.goTests Go serialization semantics.
dotnet/test/Unit/SerializationTests.csTests .NET wire serialization.
dotnet/test/Unit/CloneTests.csTests .NET collection cloning.
dotnet/src/Types.csAdds the .NET public property.
dotnet/src/Client.csForwards the .NET property.
docs/features/mcp.mdDocuments session-scoped disabling.

Review details

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

Comment threadtest/harness/test-mcp-server.mjs
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
CopilotAI 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 ownerAugust 4, 2026 22:16

CopilotAI 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>
CopilotAI review requested due to automatic review settings August 4, 2026 22:52

CopilotAI 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 freeto 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

@connor4312