MCP: initialize fails with -32603 when a client sends object-valued experimental capabilities (breaks Codex CLI integration)

Aperta
#2,780 5 commenti 1 reazione 1 assegnatario Vedi su GitHub

@NghiaTranUIT ci sta già lavorando.

Dal 30/9/2026.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
swift
Ambito
api, backend

Direzione di ricerca

Start at the bundled /Applications/Proxyman.app/Contents/MacOS/mcp-server entry point and trace decoding of the MCP initialize request, especially ClientCapabilities.experimental. Reproduce the object-valued capability case with the provided stdio script; done means initialize succeeds for arbitrary experimental values and Codex can list and call tools.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

✅ Done bug

Summary

Proxyman's bundled mcp-server rejects the MCP initialize handshake with
-32603 Internal error: The data couldn't be read because it isn't in the correct format.
whenever the client advertises an experimental client capability whose value is not a string.

The MCP specification defines ClientCapabilities.experimental as a map of capability
names to arbitrary objects. OpenAI's Codex CLI always advertises
experimental: {"codex/auth-change": {}}, so Proxyman's MCP server cannot be used
from Codex at all
— the server fails before any tool becomes available.

Claude Code is unaffected because it does not send an experimental field.

Environment

Proxyman 26.0.1 (build 260001), direct download (non-Setapp)
macOS 26.6.2 (25G83), Apple Silicon (arm64)
Server binary /Applications/Proxyman.app/Contents/MacOS/mcp-server
Client Codex CLI 0.158.0
Protocol version 2025-06-18

Reproduction

Minimal script — drives mcp-server over stdio and varies only the value type inside
capabilities.experimental:

#!/usr/bin/env python3
import json, subprocess, threading, time

SERVER = ['/Applications/Proxyman.app/Contents/MacOS/mcp-server']

def probe(label, caps):
    p = subprocess.Popen(SERVER, stdin=subprocess.PIPE,
                         stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
    out = []
    threading.Thread(target=lambda: [out.append(l) for l in p.stdout], daemon=True).start()
    req = {"jsonrpc": "2.0", "id": 1, "method": "initialize",
           "params": {"protocolVersion": "2025-06-18", "capabilities": caps,
                      "clientInfo": {"name": "probe", "version": "1"}}}
    p.stdin.write((json.dumps(req) + "\n").encode()); p.stdin.flush()
    time.sleep(2)
    try: p.terminate(); p.wait(timeout=2)
    except Exception: p.kill()
    verdict = "no response"
    if out:
        d = json.loads(out[0].decode('utf-8', 'replace'))
        verdict = "FAIL: " + d['error']['message'] if 'error' in d else "OK"
    print(f"{label:46s} -> {verdict}")

probe('capabilities: {}',                        {})
probe('experimental: {}',                        {"experimental": {}})
probe('experimental: {"foo": "bar"}   (string)', {"experimental": {"foo": "bar"}})
probe('experimental: {"foo": {}}      (object)', {"experimental": {"foo": {}}})
probe('experimental: {"foo": 123}     (number)', {"experimental": {"foo": 123}})
probe('experimental: {"foo": null}    (null)',   {"experimental": {"foo": None}})
probe('experimental: {"codex/auth-change": {}}', {"experimental": {"codex/auth-change": {}}})
Observed output
capabilities: {}                               -> OK
experimental: {}                               -> OK
experimental: {"foo": "bar"}   (string)        -> OK
experimental: {"foo": {}}      (object)        -> FAIL: Internal error: The data couldn't be read because it isn't in the correct format.
experimental: {"foo": 123}     (number)        -> FAIL: Internal error: The data couldn't be read because it isn't in the correct format.
experimental: {"foo": null}    (null)          -> FAIL: Internal error: The data couldn't be read because it isn't in the correct format.
experimental: {"codex/auth-change": {}}        -> FAIL: Internal error: The data couldn't be read because it isn't in the correct format.

Only string values decode. The capability name is irrelevant — "foo" fails exactly
like "codex/auth-change", so this is not a key-format (slash) problem.

Root cause

This matches a known upstream defect in the official Swift MCP SDK, which models the
field as [String: String]? instead of a map to arbitrary JSON values:

  • modelcontextprotocol/swift-sdk#287 — ClientCapabilities.experimental fails to decode object-valued capabilities (open, affects 0.12.1 and HEAD)

The same bug has hit several other Swift-based MCP servers, all of which fixed it on
their side while the SDK issue remains open:

  • openclaw/Peekaboo#745 (fixed)
  • repoprompt/repoprompt-ce#995 (fixed)
  • MongLong0214/logic-pro-mcp#1051 (fix PR)
  • openai/codex#45269, openai/codex#45889 (Codex-side reports)

Expected behavior

Per the MCP spec, experimental values are arbitrary objects. An unknown or
unparseable optional capability must not fail initialize
— it should be ignored so
the handshake completes and tools become available.

Suggested fix

Decode experimental as [String: JSONValue]? (or equivalent), or decode it leniently
and drop entries the server does not understand. The workaround adopted by the other
affected servers is to keep string values and discard every other type rather than
failing the whole request; decoding to a permissive JSON value type is cleaner and
spec-correct.

Because the field is optional and Proxyman does not appear to consume it, simply
ignoring undecodable entries would be sufficient.

Current workaround (user side)

A stdio shim that strips the offending key from initialize before forwarding to
mcp-server restores full functionality — after it, tools/list returns all 72 tools
and tools/call works normally. This confirms the failure is isolated to decoding this
one optional field, and that nothing else in the server is affected.

Lingua principale
Nessun dato sulla lingua
Stelle
7.1k
Fork
238
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ProxymanApp/Proxyman

Tutte le issue di ProxymanApp/Proxyman

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.