Skip to content

fix: Claude Code MCP compatibility (Tokio panic + capabilities format)#6

Open
billy-and-the-oceans wants to merge 2 commits intodirvine:mainfrom
billy-and-the-oceans:fix/claude-code-mcp-compatibility
Open

fix: Claude Code MCP compatibility (Tokio panic + capabilities format)#6
billy-and-the-oceans wants to merge 2 commits intodirvine:mainfrom
billy-and-the-oceans:fix/claude-code-mcp-compatibility

Conversation

@billy-and-the-oceans
Copy link
Copy Markdown

Summary

Two fixes to enable Claude Code CLI compatibility:

  1. Tokio runtime nesting panic - Tool handlers were calling runtime.block_on() inside an async context, causing "Cannot start a runtime from within a runtime" panic. Fixed by wrapping with tokio::task::block_in_place().

  2. Capabilities null vs empty object - Claude Code's MCP client fails to connect when capabilities fields (resources, prompts, logging) are null. Changed to empty objects {} to match other working MCP servers like narsil-mcp.

Test plan

  • claude mcp list shows "✓ Connected" instead of "✗ Failed to connect"
  • Server responds correctly to initialize, tools/list, and tools/call
  • All 12 tool handlers work without Tokio panic

Before

tauri: /path/to/tauri-mcp --log-level error serve - ✗ Failed to connect

After

tauri: /path/to/tauri-mcp --log-level error serve - ✓ Connected

🤖 Generated with Claude Code

billy-and-the-oceans and others added 2 commits January 12, 2026 02:58
Replace direct `runtime.block_on()` calls with `tokio::task::block_in_place()`
wrapper in all 12 tool handler methods in McpServerImpl.

The previous implementation would panic with "Cannot start a runtime from
within a runtime" when any tool was called via tools/call, because the
JSON-RPC handlers run inside an async context but the tool methods were
trying to block on the current runtime.

The fix uses `block_in_place()` which is designed for this exact scenario -
it moves the blocking operation to a blocking thread pool while allowing
the async runtime to continue processing.

Affected methods:
- launch_app
- stop_app
- get_app_logs
- take_screenshot
- get_window_info
- send_keyboard_input
- send_mouse_click
- execute_js
- get_devtools_info
- monitor_resources
- list_ipc_handlers
- call_ipc_command

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Claude Code's MCP client fails to connect when capabilities fields
(resources, prompts, logging) are null. Other working MCP servers
like narsil-mcp use empty objects {} instead.

This fix changes the initialize response from:
  "resources": null,
  "prompts": null,
  "logging": null

To:
  "resources": {},
  "prompts": {},
  "logging": {}

Tested with `claude mcp list` - server now shows "✓ Connected".

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant