-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Summary
The buckaroo-table MCP server (installed via claude mcp add) fails to connect in Claude Code CLI. The server process starts successfully and the asyncio event loop runs, but the MCP JSON-RPC handshake never completes. Claude Code reports "Failed to reconnect to buckaroo-table."
This works on another machine — need to diagnose what differs.
Install command
claude mcp add buckaroo-table -- uvx \
--from "buckaroo[mcp]==0.12.9.dev22314929241" \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple/ \
--index-strategy unsafe-best-match \
buckaroo-tableEnvironment
- macOS Darwin 25.0.0 (Apple Silicon)
- Claude Code CLI (Opus 4.6)
- Python 3.13 via uv/uvx 0.9.28
mcppackage version: 1.26.0buckaroo[mcp]version: 0.12.9.dev22314929241
Observed behavior
What the logs show (~/.buckaroo/logs/mcp_tool.log)
The server process starts fully — all handlers register, parent watcher starts, event loop begins:
12:04:34 [INFO] MCP tool starting — server=http://localhost:8700 session=6e90500d8185
12:04:34 [DEBUG] Initializing server 'buckaroo-table'
12:04:34 [DEBUG] Registering handler for ListToolsRequest
12:04:34 [DEBUG] Registering handler for CallToolRequest
12:04:34 [DEBUG] Registering handler for ListResourcesRequest
12:04:34 [DEBUG] Registering handler for ReadResourceRequest
12:04:34 [DEBUG] Registering handler for PromptListRequest
12:04:34 [DEBUG] Registering handler for GetPromptRequest
12:04:34 [DEBUG] Registering handler for ListResourceTemplatesRequest
12:04:34 [INFO] Parent watcher: original ppid=95944
12:04:34 [DEBUG] Using selector: KqueueSelector
But no MCP protocol messages are ever processed — no ListToolsRequest, no initialize response. The server is alive and listening on stdio, but the handshake never happens.
What Claude Code reports
Failed to reconnect to buckaroo-table.
Manual testing works fine
Running the exact same command manually with an initialize message piped to stdin works perfectly:
echo '{"jsonrpc":"2.0","id":0,"method":"initialize","params":{...}}' | \
uvx --from "buckaroo[mcp]==0.12.9.dev22314929241" ... buckaroo-table
# Returns valid JSON-RPC response immediatelyWhat has been ruled out
| Hypothesis | Result |
|---|---|
| uvx pollutes stdout | Ruled out — 0 bytes to stdout during install/resolution. All output goes to stderr. |
| Startup too slow | Ruled out — uvx launches in ~0.4s (warm cache), well under any timeout. |
| Port conflict on :8700 | Ruled out — MCP uses stdio, data server only starts on-demand. |
| Code bugs in buckaroo_mcp_tool.py | Ruled out — logging goes to file only, no stdout leaks, clean stdio transport. |
| Python/package not found | Ruled out — process starts and event loop runs. |
Suspected root cause
The stdio_server() in mcp 1.26.0 creates a new TextIOWrapper(sys.stdout.buffer) for the transport. There may be a buffering or timing issue where:
- Claude Code sends the
initializemessage before the server's wrapped stdin reader is fully ready - The message gets consumed by the old
sys.stdinwrapper and is lost before the newanyio.wrap_file()wrapper takes over - The server blocks waiting for a message that was already consumed, and Claude Code times out waiting for a response
This would explain why:
- Manual testing works (the message is already in the pipe when the server starts)
- Claude Desktop works (it does a probe-close-reconnect dance that retries the init)
- Claude Code fails (it may send init once and expect a response within a tight window)
Diagnostic request
This artifact works on another machine. To diagnose the difference, on the working machine please check:
mcppackage version:python -c "from importlib.metadata import version; print(version('mcp'))"buckaroopackage version:python -c "from importlib.metadata import version; print(version('buckaroo'))"- OS and Python version
- Contents of
~/.buckaroo/logs/mcp_tool.log— does it show protocol messages being processed? uvx --version- Does
~/.buckaroo/logs/mcp_tool.logshowProcessing request of type ListToolsRequestetc. after startup?
Related
- Branch:
mcp_punchlist/feat_mcp_punclist - PR: fix: summary stats inherit alignment for count and freq rows #545