Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Server fails to decode ChatGPT's `initialize` (`experimental` typed `[String: String]`, `extensions` unmodeled); error is returned inside an HTTP 200

オープン
#262 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
swift

調査の方向性

Start in Sources/MCP/Client/Client.swift at Client.Capabilities and compare its decoding with the initialize JSON shown in the issue and the 2025-11-25 schema. Verify that nested experimental entries and extensions decode without preventing the initialize handler from running, then confirm the resulting request no longer returns the JSON-RPC error inside HTTP 200.

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

説明

bug

Describe the bug
Client.Capabilities types experimental as [String: String]? (Sources/MCP/Client/Client.swift, line 128 in 0.12.1) and has no extensions property. The MCP schema defines experimental as a map of arbitrary objects ({ [key: string]: object }), and extensions is a spec-defined ClientCapabilities field as of protocol 2025-11-25 (https://modelcontextprotocol.io/extensions/overview).

ChatGPT's MCP client (openai-mcp, protocol 2025-11-25) sends both fields. The SDK's request decoder throws while decoding initialize — before any server handler runs — and StatelessHTTPServerTransport returns the JSON-RPC error inside an HTTP 200 response, making the failed handshake indistinguishable from success at the HTTP layer.

Practical impact: every Swift-SDK server fails ChatGPT Developer-Mode connector setup. ChatGPT shows the connector as "Connected" (OAuth succeeds) but imports zero actions and displays a generic error banner. Because nothing 4xx/5xx appears anywhere, this took us a two-day investigation across OAuth, transports, and tool schemas before we inspected the JSON-RPC body of a "200 OK" initialize.

To Reproduce
Steps to reproduce the behavior:

  1. Run any MCP server built on swift-sdk 0.12.1 with StatelessHTTPServerTransport (a single tool is enough).
  2. POST the following initialize request (captured verbatim from ChatGPT Developer Mode, July 2026) to the server's MCP endpoint:
{
  "jsonrpc": "2.0",
  "method": "initialize",
  "id": 1,
  "params": {
    "protocolVersion": "2025-11-25",
    "clientInfo": { "name": "openai-mcp", "version": "1.0.0" },
    "capabilities": {
      "experimental": {
        "openai/visibility": { "enabled": true }
      },
      "extensions": {
        "io.modelcontextprotocol/ui": { "mimeTypes": ["text/html;profile=mcp-app"] }
      }
    }
  }
}
  1. Observe an HTTP 200 whose body is a JSON-RPC internal error; the server's initialize handler never runs.
  2. Real-world trigger: add the server as a ChatGPT Developer-Mode custom connector — OAuth completes, then setup fails with no actions imported.

Expected behavior
The initialize request decodes and succeeds. experimental["openai/visibility"] is a nested object, which is valid per the schema, and extensions is a spec-defined field. More defensively: unknown or unexpectedly-shaped entries inside capabilities should arguably never fail the entire initialize — capability objects evolve faster than typed models, and a server that ignores capabilities it does not consume is spec-safe.

Logs
Response to the request above (HTTP status 200):

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32603,
    "message": "Internal error: The operation could not be completed. The data isn’t in the correct format."
  }
}

Server-side request logging shows only a successful-looking POST; no 4xx/5xx is emitted anywhere in the exchange.

Additional context

  • Suggested fix: type experimental as [String: Value]? (or another arbitrary-JSON container) to match the schema, and add extensions: [String: Value]? per the 2025-11-25 spec. Also worth considering: surfacing request-decode failures distinctly from handler errors, so servers can log them — the 200-wrapped -32603 actively hides this class of bug.
  • Workaround we run in production: strip params.capabilities.experimental and params.capabilities.extensions from initialize bodies before handing the request to the SDK transport (safe when the server doesn't consume them). This fully restores ChatGPT connector functionality.
  • Happy to open a PR for the capability typing if maintainers agree with the direction.
主要言語
Swift
スター
1.5k
フォーク
246
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

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

modelcontextprotocol/swift-sdk のほかの issue

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

似ている issue

Swift の issue をもっと見る

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

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