anthropics / anthropics/claude-code
HTTP MCP: "Error POSTing to endpoint" despite server returning a valid tools/list result (Google Docs MCP docsmcp.googleapis.com)
- Lingua principale
- Python
- Stelle
- 145k
- Fork
- 23.1k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
### Environment
- **Claude Code version:** 2.1.259 (native install)
- **OS:** Windows 11
- **MCP server:** `google-docs` → `https://docsmcp.googleapis.com/mcp/v1` (Google's official Docs MCP), configured in project `.mcp.json` as `"type": "http"` with an OAuth desktop client.
### What happens
1. OAuth completes successfully (browser flow, consent granted).
2. `/mcp` reports: **"Reconnected to google-docs, but fetching tools failed (detail withheld on this connection)."**
3. No `mcp__google-docs__*` tools are ever exposed. `claude mcp list` shows the server as `! Needs authentication` even right after a successful auth.
### Log evidence
From `~/AppData/Local/claude-cli-nodejs/Cache//mcp-logs-google-docs/*.jsonl`:
```
"debug": "Connection error: Error POSTing to endpoint: {"id":1,"jsonrpc":"2.0","result":{"tools":[ ... ]}}"
"error": "Failed to fetch tools: Error POSTing to endpoint: {"id":1,"jsonrpc":"2.0","result":{"tools":[{"name":"read_doc",...},{"name":"update_doc",...}]}}"
```
The payload attached to the error is a **complete, well-formed JSON-RPC `result`** containing the full tool catalog (`read_doc`, `update_doc`). The transport layer rejects the response anyway. Note there is **no `(HTTP nnn)`** in the error string, unlike the usual `StreamableHTTPError` path — so it does not look like a plain non-2xx rejection.
### Likely cause
The client appears to mishandle how Google's endpoint frames the `tools/list` response — e.g. an SSE-framed (`text/event-stream`) body where plain JSON is expected on that code path, or a 2xx response whose `Content-Type` the POST handler doesn't accept. The server side is clearly returning a valid result.
### Expected
Tools registered from `result.tools`; `mcp__google-docs__read_doc` / `mcp__google-docs__update_doc` available.
### Repro
1. Add Google's Docs MCP as an `http` server in `.mcp.json`.
2. Authenticate via `/mcp`.
3. Run `/mcp` again → "fetching tools failed".
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Reproduce the failure using the project .mcp.json entry for Google's HTTP server, then inspect the /mcp flow and the mcp-logs-google-docs/*.jsonl files under the stated cache path. Compare the successful tools/list JSON-RPC result with the response framing and content type; done means read_doc and update_doc are exposed as MCP tools after authentication.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Ambito
- api, cli
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 50/100