fix(mcp): Claude Code compatible tool names via transformer#3121
Merged
amitksingh1490 merged 5 commits intomainfrom Apr 22, 2026
Merged
fix(mcp): Claude Code compatible tool names via transformer#3121amitksingh1490 merged 5 commits intomainfrom
amitksingh1490 merged 5 commits intomainfrom
Conversation
Convert MCP tool names between internal legacy format (`mcp_{server}_tool_{tool}`) and Claude Code format (`mcp__{server}__{tool}`) for OAuth-authenticated sessions. Add bidirectional conversion utilities to support both naming conventions in tool discovery and execution.
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
Make MCP tools work with Claude Code's
mcp__{server}__{tool}naming convention while preserving Forge's internal legacy MCP registration format and backward-compatible execution behavior.Context
Claude Code expects MCP tool names to use double underscores between the
mcpprefix, server name, and tool name. Forge internally stores MCP tools using the legacymcp_{server}_tool_{tool}format, and a direct rename would have rippled through registration, lookup, and existing agent behavior. This change bridges the two formats so Claude Code compatibility is added without forcing an internal migration.Changes
_tool_separator format for compatibility with existing lookup and storage behavior_tool_edge casesKey Implementation Details
The compatibility layer is intentionally asymmetric:
mcp_{server}_tool_{tool}tomcp__{server}__{tool}The name conversion logic uses the last
_tool_separator so server names that themselves contain_tool_are still parsed correctly.Use Cases
Testing
cargo build cargo test -p forge_app mcp_tool_names --lib forge mcp reload cargo build