-
Notifications
You must be signed in to change notification settings - Fork 7k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Claude Desktop MCP Runtime Bug Report
Summary
Claude Desktop's MCP client corrupts execution environment for file operations, causing "bytes-like object is required, not 'str'" errors in working code.
Bug Details
- Component: Claude Desktop MCP client execution environment
- Error:
a bytes-like object is required, not 'str'
- Scope: File operations only (text operations work fine)
- Reproducibility: 100% reproducible
Environment
- Claude Desktop Version: [Current version]
- MCP Framework: FastMCP 1.0
- Python: 3.13.3
- Platform: macOS 15.3.1
Reproduction Steps
1. Create MCP Server
from fastmcp import FastMCP
mcp = FastMCP("Test Server")
@mcp.tool()
async def send_file_message(file_path: str) -> dict:
from threema.gateway import Connection
from threema.gateway.e2e import FileMessage
async with Connection(identity="*ID", secret="secret", key="key") as conn:
message = FileMessage(
connection=conn,
to_id="TESTID01",
file_path=file_path
)
result = await message.send()
return {"success": True, "id": result}
2. Test Direct vs MCP
- Direct call:
await send_file_message("/path/to/file")
→ ✅ Works - Claude MCP call: Same parameters → ❌ Fails with bytes error
Evidence
Working Contexts
All these work perfectly with identical code:
- Direct function calls
- MCP handler calls (
server._handle_tool()
) - FastMCP tool calls outside Claude
- Minimal reproduction tests
Failing Context
Only fails when invoked through Claude Desktop's MCP client:
{"method":"tools/call","params":{"name":"send_file_message","arguments":{"file_path":"/path/to/file"}}}
Console Output
ERROR: a bytes-like object is required, not 'str'
Analysis
- Parameters arrive correctly: JSON shows proper string values
- No parameter corruption: All types are correct strings
- Environment-specific: Only Claude's MCP runtime fails
- SDK-agnostic: Same error across different libraries
Impact
- File operations completely broken in Claude Desktop MCP
- Text operations work fine through same MCP channel
- Workaround: Use CLI tools instead of Claude integration
Expected Behavior
File operations should work through Claude Desktop MCP like they do in all other contexts.
Additional Notes
This appears to be a runtime environment corruption in Claude Desktop's proprietary MCP execution context, not a parameter serialization issue.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working