anthropics / anthropics/claude-agent-sdk-python
MCP server tools fail to register on Windows: server config visible to agent but tools return "No such tool available"
- 主要言語
- Python
- スター
- 8.1k
- フォーク
- 1.3k
- 平均マージ
- 2日 31分
- マージ済み PR(30日)
- 1
説明
## Summary
When the Claude Agent SDK spawns a worker with an MCP server configured via
`mcp_servers={...}` (stdio transport), the MCP server's instructions appear in
the agent's system context, but none of the server's tools are registered as
callable. Every tool call returns `No such tool available`. The agent itself
diagnoses the situation, stating "this session appears to be a standard Claude
Code session rather than one launched through [the runner]."
The same runner code, on the same machine, worked successfully on
2026-04-30 (processed 13 vendors end-to-end). It began failing on 2026-04-30
evening with no code changes between the working and failing runs. Failure has
been 100% reproducible across ~6 attempts since.
## Environment
- **OS:** Windows 11, build 26200.8246
- **Python:** 3.14
- **claude-agent-sdk:** tested on both 0.1.71 (current) and 0.1.65 — same
failure on both
- **Node.js:** v24.15.0
- **npm/npx:** 11.12.1
- **MCP server:** `@supabase/mcp-server-supabase@latest` (stdio transport, spawned via npx)
- **Shell:** Windows Command Prompt (cmd.exe), not PowerShell
## Repro
Minimal runner config that reproduces the failure:
```python
options = ClaudeAgentOptions(
system_prompt=system_prompt,
model="claude-sonnet-4-6",
permission_mode="acceptEdits",
allowed_tools=[
"WebSearch",
"WebFetch",
"mcp__supabase__execute_sql",
],
mcp_servers={
"supabase": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@supabase/mcp-server-supabase@latest",
"--project-ref="
],
"env": {
"SUPABASE_ACCESS_TOKEN": os.environ["SUPABASE_ACCESS_TOKEN"]
}
}
},
)
async for message in query(prompt="Run", options=options):
...
```
Run via `python runner.py` from CMD with both `ANTHROPIC_API_KEY` and
`SUPABASE_ACCESS_TOKEN` set in the environment.
## Expected behavior
`mcp__supabase__execute_sql` is available to the agent and SQL queries execute
against the configured Supabase project. (This is what occurred on 2026-04-30
morning.)
## Actual behavior
The agent reports the MCP server's instructions are visible in its context,
but the actual tools are not callable. Every attempt to call
`mcp__supabase__execute_sql` returns `No such tool available`. The agent
exits without performing any work.
A representative full agent diagnostic message:
> "The Supabase MCP server's guidelines are visible in this session (it's
> connected at the interface level), but none of its callable tools are
> reachable — every attempt returns `No such tool available`. ... This session
> appears to be a standard Claude Code session rather than one launched
> through [the runner]."
## Manual verification of MCP server
Running the same npx command directly outside the SDK works as expected — the
server starts and waits on stdin (standard stdio MCP behavior):
npx -y @supabase/mcp-server-supabase@latest --project-ref=
[hangs waiting on stdin, as expected]
This rules out the MCP server itself being broken.
## Configurations attempted that did not fix the issue
| Attempt | Result |
|---|---|
| Pin `claude-agent-sdk` to 0.1.65 (down from 0.1.71) | Same failure |
| Change `allowed_tools` from specific name to `mcp__supabase__*` wildcard | Same failure |
| Change MCP `env` block from token-only to `dict(os.environ)` (full env passthrough) | Same failure |
| Create `.claude/settings.json` in working directory | Same failure |
| Move project out of OneDrive to plain `C:\` path | Same failure |
| Restart machine | Same failure |
## Hypothesis
The SDK's stdio-mode MCP-injection path on Windows + Python 3.14 appears to
be silently failing to spawn the configured server, while still injecting the
server's *instructions* into the agent's context. The agent then sees a
"connected" server with no callable tools.
I cannot rule out that this is a recent change in the bundled Claude Code CLI
inside the SDK package rather than the SDK Python code itself.
## Impact
This blocks all agentic workflows that depend on stdio MCP servers when run
via the SDK on this environment. Direct Claude Code sessions (not via the SDK)
appear unaffected.
## Additional notes
Happy to provide full runner source, full agent transcripts from failed runs,
or run additional diagnostics if useful.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。