anthropics / anthropics/claude-agent-sdk-typescript
`type: "url"` MCP servers fail silently with no error thrown
- Langage dominant
- Shell
- Étoiles
- 1.8k
- Forks
- 226
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
**Result:** no error thrown, query hangs or returns no output
### Description
When configuring an MCP server with `type: "url"` (Streamable HTTP transport), the SDK fails to connect silently. No error is thrown and no messages are emitted from the `query()` async iterator.
The MCP server itself is confirmed working — it correctly implements the Streamable HTTP transport spec and responds successfully to properly formed requests.
### Steps to Reproduce
1. Stand up or use any MCP server that enforces the Streamable HTTP spec
2. Configure it in `query()` with `type: "url"`:
```javascript
for await (const message of query({
prompt: "Do something",
options: {
mcpServers: {
"my-server": {
type: "url",
url: "https://mcp.example.com/mcp",
headers: {
Authorization: `Bearer ${process.env.TOKEN}`
}
}
}
}
})) {
console.log(message);
}
```
3. Observe: query hangs or emits no messages, no error is thrown
### Expected Behavior
- SDK successfully connects to Streamable HTTP MCP servers
- If the connection fails, an error is thrown from the `query()` async iterator OR reports fail MCP connection in the message
### Server Verification
Confirmed the MCP server works correctly when called directly:
```bash
curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}},"id":1}' \
https://mcp.example.com/mcp
# Returns HTTP 200 with proper SSE initialize response
```
### Workaround
Use `mcp-remote` as a stdio proxy:
```javascript
mcpServers: {
"my-server": {
type: "stdio",
command: "npx",
args: [
"mcp-remote@latest",
"https://mcp.example.com/mcp",
"--header",
`Authorization:Bearer ${process.env.TOKEN}`
]
}
}
```
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.