[BUG] Duplicate tools when using an "sdk" McpServer

Resolved 💬 6 comments Opened Sep 15, 2025 by benbrandt Closed Sep 19, 2025

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When passing an MCP server of type "sdk" into the TS SDK, on the second message of a multiturn chat, I am getting the problem:

API Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"tools: Tool names must be unique.\"},\"request_id\":\"req_011CTA5VA5xFXK2mkaw27P2y\"}

I added the oninitialize callback on my custom MCP server, and noticed that it is being initialized twice.

Not sure if this is a problem on how I've setup the server, or if there is a bug on the Claude Code side, but I am only creating the SDK server once and passing it into mcpServers once and I am getting this behavior.

The diff of our implementation is here, where we moved it from an HTTP server to an SDK one: https://github.com/zed-industries/claude-code-acp/pull/50/files#diff-8a5c4a5a3d949e31532fec3de206c63c156b3155181a27534871599db24c3899R149

What Should Happen?

I would expect when passing in an SDK MCP server it would only get initialized once, and the tools wouldn't get sent to the model more than once.

Error Messages/Logs

Steps to Reproduce

  • Pass in an MCP server of type "sdk" in the config
  • Send two subsequent messages to the SDK

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

1.0.113

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗