[v2] Add a runnable example for routing requests to tenant-specific APIs

オープン 初心者向け
#3,243 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
68/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript
領域
documentation

調査の方向性

HTTP ガイドの https://ts.sdk.modelcontextprotocol.io/v2/serving/http#pass-authentication-through のセクションと examples/scoped-tools の例を読み、既存の認証 API と例の慣例を確認してください。2 つのモックバックエンドと、検証済みのテナント ID を承認済み URL に対応付けるサーバー側の map を備えた、実行可能な例を追加してください。並行リクエストと、テナントがない場合や不明な場合も扱ってください。例が実行でき、これらのケースがテストされていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

v2
What happened?

I'm building a single MCP endpoint that serves multiple tenants, each with its own backend API. The HTTP guide shows how createMcpHandler receives verified authInfo, and examples/scoped-tools shows per-tool authorization. I couldn't find a runnable example that takes the next step and uses that verified identity to select the tenant's backend.

I tried this locally on v2.4.0 with two fictional tenants. Concurrent requests resolved to different configured backend URLs, and a request without tenant context was rejected. This passed in both the legacy and 2026-07-28 protocol modes using fixture identities.

What did you expect?

Would you be open to a small runnable example using the existing SDK APIs? I can contribute an example with two mock backends, a server-side map from verified tenant IDs to approved URLs, and tests for concurrent requests and missing or unknown tenants. Would this fit alongside scoped-tools or in the HTTP guide?

Code to reproduce
https://ts.sdk.modelcontextprotocol.io/v2/serving/http#pass-authentication-through
SDK version

@modelcontextprotocol/[email protected], @modelcontextprotocol/[email protected]

Area

Documentation

主要言語
TypeScript
スター
13.8k
フォーク
2.5k
平均マージ
6日 23時間
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

modelcontextprotocol/typescript-sdk のほかの issue

modelcontextprotocol/typescript-sdk の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。