summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDmytro Tiapukhin <[email protected]>2025-11-03 22:19:49 +0100
committerGitHub <[email protected]>2025-11-03 15:19:49 -0600
commite5a651eef780576da1fbeca816535700772d734a (patch)
treefaa4a96339410dcbdd0e9311b0bbf25911a67553
parentd26605aa56d4a4443ee46f95274be70a7645a127 (diff)
downloadopencode-e5a651eef780576da1fbeca816535700772d734a.tar.gz
opencode-e5a651eef780576da1fbeca816535700772d734a.zip
fix: better mcp sanitization (#3842)
Co-authored-by: Aiden Cline <[email protected]>
-rw-r--r--packages/opencode/src/mcp/index.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/opencode/src/mcp/index.ts b/packages/opencode/src/mcp/index.ts
index 6b153e39d..d6de4a59b 100644
--- a/packages/opencode/src/mcp/index.ts
+++ b/packages/opencode/src/mcp/index.ts
@@ -242,8 +242,8 @@ export namespace MCP {
continue
}
for (const [toolName, tool] of Object.entries(tools)) {
- const sanitizedClientName = clientName.replace(/\s+/g, "_")
- const sanitizedToolName = toolName.replace(/[-\s]+/g, "_")
+ const sanitizedClientName = clientName.replace(/[^a-zA-Z0-9_-]/g, "_")
+ const sanitizedToolName = toolName.replace(/[^a-zA-Z0-9_-]/g, "_")
result[sanitizedClientName + "_" + sanitizedToolName] = tool
}
}