[PR #3842] fix: better mcp sanitization #10781

Closed
opened 2026-02-16 18:15:31 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/3842

State: closed
Merged: Yes


Closes #3354
Closes #3245

You may read those for further background.

Repro

  1. Use https://xmcp.dev to generate a dummy MCP server with a greet tool
  2. Rename that greet tool to include a slash "/", e.g.
// ...
export const metadata: ToolMetadata = {
  name: "greet/tool",
  description: "Greet the user",
// ...
  1. Add MCP server to opencode.json in the root of the repo.
  2. Run opencode using Anthropic and ask something
    New MCP server in opencode.json 👇
"test-mcp-server": {
      "type": "remote",
      "url": "http://localhost:3001/mcp"
}

Changelog

Applied further sanitization to both tool names and client names.
Note, that I've seen a number of issues related to tool name length, I haven't looked into that yet.

Successful scenario A

CleanShot 2025-11-03 at 9  34 53@2x

Small footnote: debugging bun is such a PITA

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/3842 **State:** closed **Merged:** Yes --- Closes #3354 Closes #3245 You may read those for further background. ## Repro 1. Use https://xmcp.dev to generate a dummy MCP server with a greet tool 2. Rename that greet tool to include a slash "/", e.g. ```typescript // ... export const metadata: ToolMetadata = { name: "greet/tool", description: "Greet the user", // ... ``` 4. Add MCP server to `opencode.json` in the root of the repo. 5. Run `opencode` using Anthropic and ask something New MCP server in `opencode.json` 👇 ```json "test-mcp-server": { "type": "remote", "url": "http://localhost:3001/mcp" } ``` ## Changelog Applied further sanitization to both tool names and client names. Note, that I've seen a number of issues related to tool name length, I haven't looked into that yet. ## Successful scenario A <img width="1472" height="820" alt="CleanShot 2025-11-03 at 9  34 53@2x" src="https://github.com/user-attachments/assets/448faeef-a3ff-4ef9-98b3-27f73109e4fd" /> _Small footnote: debugging bun is such a PITA_
yindo added the pull-request label 2026-02-16 18:15:31 -05:00
yindo closed this issue 2026-02-16 18:15:31 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10781