How to Connect OpenCode to MewCP
Add MewCP to OpenCode once, and OpenCode can use every app you have connected in MewCP: Gmail, Calendar, Slack, GitHub and the rest. OpenCode connects to MewCP directly over HTTP, so there is nothing to install.
Before you start
- OpenCode installed (install guide)
- A API Key from Dashboard → API Keys, see API Key
- At least one app connected in the dashboard under Servers
Set up MewCP
-
Open the config file
OpenCode reads its config from these files and merges them:
File MewCP loads in ~/.config/opencode/opencode.jsonEvery project opencode.jsonin a project rootThat project only, for everyone who opens it from git Create the file if it does not exist.
-
Add MewCP
Paste this into the file and replace
API_KEYwith your key:CodeAlready have an
mcpsection? Add only the"mewcp": { ... }entry inside it.Keep
"oauth": false. MewCP signs in with your key, not OAuth, and without this line OpenCode tries to start an OAuth sign-in whenever MewCP answers401. -
Restart OpenCode
Quit OpenCode and start it again so it loads the new server.
This is the entire configuration. One entry reaches every app you have connected, and connecting another app later needs no change here.
Keep the key out of the file
OpenCode can read the key from an environment variable or a file instead. Use either value for the header:
Code
Code
For {env:MEWCP_API_KEY}, set export MEWCP_API_KEY="API_KEY" in your shell profile. For {file:...}, the file holds the key alone. Either way, a project's opencode.json can then go into git without your key.
Check it works
Run:
Code
mewcp should be listed. To test the connection itself, run opencode mcp debug mewcp.
You will see four tools, not the tools of every app: search, get_schema, list_accounts and call_tool. That is expected. OpenCode uses them to find and run the right tool for whatever you ask. See How MewCP works.
Then ask for something from an app you have connected. Adding use mewcp tells OpenCode which tools to reach for:
Code
Troubleshooting
OpenCode asks you to sign in, or opens a browser for MewCP
OpenCode starts an OAuth sign-in when a server answers 401. Add "oauth": false to the mewcp entry, then fix the key as below.
MewCP returns 401 or 403
MewCP rejected the key.
- Check the header reads
Bearerfollowed by the whole key, which starts withmcp_live_. - With
{env:MEWCP_API_KEY}, check the variable is set in the terminal you start OpenCode from:echo $MEWCP_API_KEY. OpenCode replaces an unset variable with an empty string, so MewCP receives no key. - A
403that says the billing period is not active means your MewCP plan needs renewing in the dashboard.
MewCP's tools do not load on a slow connection
OpenCode waits 5 seconds for a server's tools. Raise the limit with timeout, in milliseconds:
Code
A change to the config does nothing
OpenCode merges the global and project files, and the project's opencode.json wins for the same key. If MewCP is defined in both, edit the project's entry. Run opencode debug config to see the config OpenCode actually uses.
Last checked against OpenCode's documentation on 13 October 2026.