fix: Claude Code MCP compatibility (Tokio panic + capabilities format)#6
Open
billy-and-the-oceans wants to merge 2 commits intodirvine:mainfrom
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two fixes to enable Claude Code CLI compatibility:
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 withtokio::task::block_in_place().Capabilities null vs empty object - Claude Code's MCP client fails to connect when capabilities fields (
resources,prompts,logging) arenull. Changed to empty objects{}to match other working MCP servers like narsil-mcp.Test plan
claude mcp listshows "✓ Connected" instead of "✗ Failed to connect"Before
After
🤖 Generated with Claude Code