[BUG] Cannot get any MCP tool calls working at all in Claude Code, despite them working in Claude Desktop
Environment
- Platform (select one):
- [ X] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 0.2.39
- Operating System: Mac OS 15.3.1
- Terminal: iTerm2
Bug Description
I have tools for say Google Searches and Web Scraping which both work fine in Claude Desktop app.
I then added these tools to Claude Code using claude mcp add-from-claude-desktop.
I see those servers as connected when I run Claude Code. E.g. google-search "connected"
However, when I try and get claude code to run these tools I always get the same error no matter my prompt:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools.11.custom.name: String should match pattern '^[a-zA-Z0-9_-]{1,64}$'"}}
Steps to Reproduce
- Add a tool to local Claude desktop app. E.g. https://github.com/adenot/mcp-google-search
- Confirm tool works in Claude desktop
- Add tool to Claude Code and try and make it work.
Expected Behavior
I expect Claude Code to run the Google Search
Actual Behavior
Claude Code produced the folowing error:
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools.11.custom.name: String should match pattern '^[a-zA-Z0-9_-]{1,64}$'"}}
Additional Context
No other context.
<img width="1334" alt="Image" src="https://github.com/user-attachments/assets/bc403226-32d4-4770-97a9-683580cdfeab" />
6 Comments
When you see them called in Claude Desktop, what are the tool names that you see? Can you include a screenshot?
Ok, I worked this out. Claude Desktop supports a server name with spaces e.g. "sams Server". Claude Code will error if there is a space in the name.
Also, more importantly, if one server for Claude Code has an invalid name, ALL tool calls will fail with the above error:
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools.11.custom.name: String should match pattern '^[a-zA-Z0-9_-]{1,64}$'"}}
So if I have an MCP server called "sams Server", it will cause errors with another working server called "googleTools" for example.
Once I rename my server config "samsServer" and reimport it to Claude Code (after deleting it), all tools in Claude Code work.
This should be fixed now! Servers with spaces in the name no longer break.
Hi everyone,
I'm trying to understand how I can use MCP tools without needing Claude Desktop. Is it possible to use MCP with just a Claude API key? If so, could someone please guide me or share a general idea of how to set that up?
no spaces in name. just plain broken
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.