-
Notifications
You must be signed in to change notification settings - Fork 37
fix: use mcp_ prefix for tools (port from pi-coding-agent) #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Change TOOL_PREFIX from 'oc_' to 'mcp_' - Add prefix to tool_use blocks in messages, not just tool definitions - Update stream transform regex to strip mcp_ prefix from responses
|
Question guys, im just getting used to use opencode could i temporarily clone this and test it locally like this ? so far is not working for me |
|
Use {
"plugin": [
"file://<path-to>/opencode-anthropic-auth/index.mjs"
]
} |
|
You such a genius. I can confirm this works. |
|
should i select use api keys or claude pro sub when i connect, so far is not working for me |
|
Ah yes, you should run it like this: OPENCODE_DISABLE_DEFAULT_PLUGINS=true opencode |
|
confirm !! it works ! thanks so much ! |
|
We’re so back! |
|
hi @lenstr , thanks for this solution but im getting this error: "ish: Job 1, 'OPENCODE_DISABLE_DEFAULT_PLUGIN...' terminated by signal SIGABRT (Abort)" |
|
This should be fixed in the latest opencode version. Try updating. |
Summary
Fixes the OAuth tool calling that broke after PR #10's
oc_prefix was blocked by Anthropic.This is a port of the solution from pi-coding-agent which encountered and fixed the same issue.
Changes
Changed prefix from
oc_tomcp_- This is what pi-coding-agent uses for Anthropic OAuth.Added prefix to
tool_useblocks in messages - PR fix: claude oauth by renaming tools on in/out #10 only prefixed tool definitions, but not tool calls in conversation history. This caused issues when the model tried to continue conversations with previous tool calls.Testing locally
git clone https://github.com/lenstr/opencode-anthropic-auth.git cd opencode-anthropic-auth git checkout fix/mcp-tool-prefixopencode.json:{ "plugin": [ "file://<path-to>/opencode-anthropic-auth/index.mjs" ] }Reference
mcp_prefix handling for OAuth tokens