Server fails to decode ChatGPT's `initialize` (`experimental` typed `[String: String]`, `extensions` unmodeled); error is returned inside an HTTP 200
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- swift
- Ambito
- api, backend-api-design
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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:
- Run any MCP server built on swift-sdk 0.12.1 with
StatelessHTTPServerTransport(a single tool is enough). - POST the following
initializerequest (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"] }
}
}
}
}
- Observe an HTTP 200 whose body is a JSON-RPC internal error; the server's initialize handler never runs.
- 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
experimentalas[String: Value]?(or another arbitrary-JSON container) to match the schema, and addextensions: [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-32603actively hides this class of bug. - Workaround we run in production: strip
params.capabilities.experimentalandparams.capabilities.extensionsfrominitializebodies 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.
- Lingua principale
- Swift
- Stelle
- 1.5k
- Fork
- 246
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di modelcontextprotocol/swift-sdk
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Tutte le issue di modelcontextprotocol/swift-sdk
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
openwatersio/slackwater-ios#535 ·
I maintainer di solito rispondono entro 1 giorno
-
area:dictation bug P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
uttrflow/uttrflow-swift#2721 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[@capacitor/app] iOS: 'Expression implicitly coerced from String? to Any' warning in getAppLanguageApertatriage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
ionic-team/capacitor-plugins#2604 ·
-
auth type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
googleapis/google-cloud-swift#1260 ·
I maintainer di solito rispondono entro 1 giorno