Skip to content

feat: multi-transport support for concurrent stdio/SSE/HTTP Stream#164

Merged
QuantGeekDev merged 2 commits intomainfrom
feat/multi-transport
Apr 2, 2026
Merged

feat: multi-transport support for concurrent stdio/SSE/HTTP Stream#164
QuantGeekDev merged 2 commits intomainfrom
feat/multi-transport

Conversation

@QuantGeekDev
Copy link
Copy Markdown
Owner

Summary

Closes #124

  • Adds transports array config to MCPServerConfig for running multiple transports concurrently from a single server instance
  • Introduces TransportBinding model: each transport gets its own SDK Server instance, all sharing the same tool/prompt/resource registrations
  • Validates config at construction: mutual exclusion of transport/transports, at most one stdio, no port conflicts
  • Per-invocation tool.injectServer(targetServer) in the CallTool handler routes progress/sampling through the correct transport
  • sendLog() broadcasts to all connected transports
  • Full backward compatibility: existing transport: { type: 'stdio' } config works identically

Example usage

const server = new MCPServer({
  transports: [
    { type: "stdio" },
    { type: "sse", options: { port: 3001 } },
    { type: "http-stream", options: { port: 8080 }, auth: { provider: oauthProvider } },
  ],
});
await server.start();

Test plan

  • 99 new tests across 4 test files (config validation, lifecycle parity, injectServer parity, e2e compat)
  • All 781 existing tests pass unchanged (zero regressions)
  • TypeScript compiles cleanly
  • Manual test: start server with stdio + HTTP Stream, connect via both

🤖 Generated with Claude Code

#124)

Enable running multiple transports simultaneously from a single MCPServer
instance. Each transport gets its own SDK Server instance with shared
tool/prompt/resource registrations via the TransportBinding model.

- Add `transports` array config alongside existing singular `transport`
- Validate: mutual exclusion, stdio singleton, port conflict detection
- Per-invocation server injection routes progress/sampling correctly
- Broadcast sendLog() to all connected transports
- 99 new tests covering config validation, lifecycle parity, and e2e

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Incorporate createSDKServerForSession() and SSE per-session server
factory from main into the multi-transport bindings loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@QuantGeekDev QuantGeekDev merged commit d6353a6 into main Apr 2, 2026
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.

Multiple transports in one server?

1 participant