Skip to content

docs: add multi-server tool routing example#2103

Open
lil-goat wants to merge 5 commits into
modelcontextprotocol:mainfrom
lil-goat:fix/issue-740-can-we-have-a-chatbot-example-that-conne
Open

docs: add multi-server tool routing example#2103
lil-goat wants to merge 5 commits into
modelcontextprotocol:mainfrom
lil-goat:fix/issue-740-can-we-have-a-chatbot-example-that-conne

Conversation

@lil-goat
Copy link
Copy Markdown

@lil-goat lil-goat commented May 16, 2026

Fixes #740

Summary

  • Adds a Streamable HTTP multi-server tool routing example under examples/client.
  • Accepts multiple server URLs, creates one Client + StreamableHTTPClientTransport per URL, and calls listTools() for each server.
  • Keeps a { serverName, client, tools } registry plus a tool-name routing map so selected tool calls are sent back to the owning MCP client.
  • Fails fast on duplicate tool names across servers to avoid ambiguous routing.

Validation

  • pnpm --filter @modelcontextprotocol/examples-client typecheck
  • pnpm --filter @modelcontextprotocol/examples-client exec eslint src/multiServerToolRouting.ts
  • pnpm exec prettier --check examples/client/src/multiServerToolRouting.ts examples/client/README.md

@lil-goat lil-goat requested a review from a team as a code owner May 16, 2026 01:22
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 16, 2026

⚠️ No Changeset found

Latest commit: 9bc3a7e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 16, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@2103

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/codemod@2103

@modelcontextprotocol/server

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@2103

@modelcontextprotocol/express

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@2103

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/fastify@2103

@modelcontextprotocol/hono

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@2103

@modelcontextprotocol/node

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@2103

commit: 9bc3a7e

@BossChaos

This comment was marked as abuse.

@lil-goat lil-goat changed the title docs: add multi-server chatbot quickstart example docs: add multi-server tool routing example May 26, 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.

Can we have a chatbot example that connected to multiple remote servers

2 participants