Server answers transport errors with legacy code -32000 on the 2026-07-28 path

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

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
express, node.js, typescript
領域
api, backend

調査の方向性

server、express、node パッケージ全体で -32e3 / -32000 を grep する。名前付きのエントリポイントは server の modernOnlyStrictRejection と jsonRpcErrorResponse(405)、および express と node の host/origin 403 ミドルウェアである。handshake 時代の streamable transport は、その 400/403/406/409/413/415 コードを維持する必要があるため、別途読むこと。handshake リビジョンに紐づかないレスポンスのみを -32600 に変更し(または body を削除し)、影響を受ける transport テストを更新し、issue 内の 2 つの curl コマンドで確認する。

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

説明

v2

Summary

The server packages answer several transport-level failures with JSON-RPC code -32000, including on the 2026-07-28 path. That revision marks -32000 to -32019 as legacy and says new implementations should not use it.

Spec

MCP 2026-07-28, Overview › Error Codes:

-32000 to -32019 — legacy. Codes in this sub-range were allocated by implementations before this policy was introduced. New codes MUST NOT be allocated in this sub-range, and new implementations SHOULD NOT use codes from this sub-range at all. Apart from -32002 (see below), receivers MUST NOT assume any specific meaning for these codes.

and, for codes with no defined meaning:

New error codes for purposes not defined by this specification SHOULD be allocated outside the JSON-RPC reserved range (-32768 to -32000); the remainder of the integer space is available for application-defined errors.

The body is optional in both cases below: Streamable HTTP › Security & Endpoint says the 403 body "MAY comprise a JSON-RPC error response that has no id", and Backward Compatibility asks only for 405 Method Not Allowed on GET or DELETE.

Where

Seen in @modelcontextprotocol/server 2.4.0, @modelcontextprotocol/express 2.0.2 and @modelcontextprotocol/node 2.1.2 (dist/):

  • server: modernOnlyStrictRejection → new ProtocolError(-32e3, "Method not allowed.") for a non-POST request on a modern-only endpoint, and jsonRpcErrorResponse(405, -32e3, "Method not allowed.") on the dual-era handler.
  • express and node: the host and origin validation middleware answer 403 with code: -32e3.
  • server: the handshake-era streamable transport uses -32e3 for 400 / 403 / 406 / 409 / 413 / 415 responses. That is legacy behaviour and probably has to stay for those revisions.

Reproduce

Serve any server with createMcpHandler behind createMcpExpressApp({ host: '127.0.0.1' }), then:

curl -i -X GET http://127.0.0.1:3000/mcp
# HTTP/1.1 405 Method Not Allowed
# {"jsonrpc":"2.0","error":{"code":-32000,"message":"Method not allowed."},"id":null}

curl -i -X POST http://127.0.0.1:3000/mcp -H 'Origin: https://evil.example' \
  -H 'Content-Type: application/json' -H 'MCP-Protocol-Version: 2026-07-28' -H 'Mcp-Method: server/discover' \
  -d '{"jsonrpc":"2.0","id":1,"method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}}}}'
# HTTP/1.1 403 Forbidden
# {"jsonrpc":"2.0","error":{"code":-32000,"message":"Invalid Origin: evil.example"},"id":null}

Suggestion

For responses not tied to a handshake revision (the modern-only rejections and the host / origin middleware), use a standard code such as -32600 (Invalid Request), or send no JSON-RPC body. Keep -32000 where a handshake-era client may depend on it.

This is a SHOULD NOT, and nothing breaks today, so it is low priority. Filing it so the modern path does not carry the legacy code forward.

主要言語
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 を短くまとめたダイジェスト。