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 and signs in with your MewCP account, so there is nothing to install and no API key to paste.
Before you start
- OpenCode installed (install guide)
- A MewCP account with at least one app connected under Apps
Set up MewCP
-
Open your config
Edit one of these files, or create it if it does not exist. OpenCode reads both 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 -
Add the server
CodeAlready have an
mcpsection? Add only the"mewcp": { ... }entry inside it. -
Sign in
CodeSign in to MewCP in the browser window and click Allow access.
This is the entire configuration. One entry reaches every app you have connected, and connecting another app later needs no change here. The file holds no secret, so a project's opencode.json can go into git, and each person signs in with their own account.
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, manage_connections 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
Use an API key instead
To send an API key from Dashboard → API Keys instead of signing in, add "oauth": false and a header. Replace API_KEY with your key:
Code
Keep "oauth": false with a key. Without it, OpenCode starts a sign-in whenever MewCP answers 401.
To keep the key out of the file, use "Bearer {env:MEWCP_API_KEY}" with MEWCP_API_KEY set in your shell profile, or "Bearer {file:~/.secrets/mewcp-key}" with the key alone in that file.
Troubleshooting
opencode mcp list shows MewCP needs authentication
OpenCode has not signed in yet, or the sign-in has expired. Run opencode mcp auth mewcp again. See OAuth Sign-In for errors on the sign-in page.
MewCP returns 401 or 403
- With an API key, check the header reads
Bearerfollowed by the whole key, which starts withmewcp_proj_. With{env:MEWCP_API_KEY}, check the variable is set in the terminal you start OpenCode from: OpenCode replaces an unset variable with an empty string, so MewCP receives no key. - A
403that says your plan's billing period has ended means your MewCP plan needs renewing under Billing.
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 updated on 29 November 2026.