[BUG]  API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools.26.custom.name: String should match pattern '^[a-zA-Z0-9_-]{1,64}$'"}}

Status Fixed / completed
Maintainer reply None cached
Activity 6 comments · opened Apr 23, 2025 · closed Apr 25, 2025

Environment

  • Platform (select one):
  • Anthropic API
  • Claude CLI version: 0.2.79
  • Operating System: Mac OS
  • Terminal: Zsh

Bug Description

I recently added context7 mcp server which is when this issue started happening. This is the mcp-server.json in my local project. It's unclear as to where the global settings are stored.

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/{username}/PycharmProjects/",
        "/Users/{username}/Documents/"
      ]
    },
    "sequential-thinking": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sequential-thinking",
        "/Users/{username}/PycharmProjects/servers/src/sequentialthinking"
      ]
    },
    "memory": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-memory"
      ]
    },
    "github.com/modelcontextprotocol/servers/tree/main/src/puppeteer": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-puppeteer"
      ],
      "disabled": false,
      "autoApprove": []
    },
    "github.com/JetBrains/mcp-jetbrains": {
      "command": "npx",
      "args": [
        "-y",
        "@jetbrains/mcp-proxy"
      ],
      "disabled": false,
      "autoApprove": []
    },
    "github.com/zcaceres/fetch-mcp": {
      "command": "node",
      "args": [
        "/Users/{davidandrews}/PycharmProjects/fetch-mcp/dist/index.js"
      ],
      "disabled": false,
      "autoApprove": []
    },
    "github.com/upstash/context7-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@upstash/context7-mcp@latest"
      ],
      "disabled": false,
      "autoApprove": []
    }
  }
}


## Steps to Reproduce
1. Update `mcp-server.sjon` in local project.
2. Add literally any text to the prompt.

## Expected Behavior
I expect it to handle the prompt properly without an error.

## Actual Behavior
3. Receive the error: `API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools.26.custom.name: String should match pattern '^[a-zA-Z0-9_-]{1,64}$'"}}
`

## Additional Context
I'd love to know where Claude Coder's global mcp settings.json is stored...

View original on GitHub ↗

6 Comments

micheledicosmo · 1 year ago

Hmm

tshtark · 1 year ago

same for me after installing context7.. but I removed it and claude still gives me this error..

iamkucuk · 1 year ago

Same here

dkapellusch · 1 year ago

Still was happening to me today with version 1.0.7 (Claude Code) I was able to fix on my install, by going to ~/.claude.json and removing context7 from everywhere I had it installed. Also check the .mcp.json file (if it exists) in whatever dir you're running claude code.

martinemde · 1 year ago

One data point: the presence of an absolute path in the command was causing this issue. I had /Users/name/.local/bin/command as the mcp command to run, changing this to bash -lc command fixed it.

github-actions[bot] · 1 year ago

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.