
How to add MCP servers to OpenCode
Add MCP servers to OpenCode with opencode mcp add or the mcp section of opencode.json, for one project or every project.
- Local servers
- Yes
- runs stdio servers
- Hosted servers
- Yes
- connects by URL
- Config
- JSON
- how servers are added
- Picks
- 8
- ranked
In OpenCode 2, opencode mcp add <name> --url <address> adds a hosted server to the project, and --global adds it to every project. By hand, servers go under mcp.servers in opencode.json; OpenCode 1 put them directly under mcp, so check which version you run before copying a config. Every server adds to the model's context, so add only the ones you need.
Good for
- Developers who want OpenCode to reach docs, a browser, GitHub or their database
- Teams that keep shared servers in a project opencode.json in git
- People upgrading from OpenCode 1 whose config stopped working
- Anyone whose server keeps asking to sign in
Install OpenCode
OpenCode
- 1
Copy this prompt.
Add the OpenCode MCP server to OpenCode. Run this command: curl -fsSL https://opencode.ai/v2/install | bash Then check that it loaded and tell me if I need to sign in or restart.
- 2
Paste it into OpenCode. It shows the change and asks before running it.
OpenCode 2 and OpenCode 1 use different MCP config shapes. The OpenCode 1 installers can replace an OpenCode 2 install. OpenCode 2 does not support Windows package managers; download the standalone Windows binary instead.
From the vendor's docs. Source.
At a glance
- Add a hosted server
- opencode mcp add <name> --url <address> [--global]
- Add a local server
- opencode mcp add <name> -- <command>
- Global config
- ~/.config/opencode/opencode.json
- Project config
- opencode.json or .opencode/opencode.json in the project
- Config key (OpenCode 2)
- mcp.servers.<name>
- Config key (OpenCode 1)
- mcp.<name>
- Check servers
- opencode mcp list
- Default timeouts
- 30 s startup, 30 s tool list, 12 h tool call
Add an MCP server to OpenCode
- 1
Add a hosted server from your project folder
opencode mcp add context7 --url https://mcp.context7.com/mcpThis writes the server to the project config. Add
--globalto use it in every project. Pass keys with--header 'CONTEXT7_API_KEY={env:CONTEXT7_API_KEY}'(keep the single quotes).Uses Context7
- 2
Or add a local server by its command
Put the launch command after
--, with keys as repeated--envflags:opencode mcp add everything --env LOG_LEVEL=info -- npx -y @modelcontextprotocol/server-everything - 3
Or edit opencode.json by hand
Project:
opencode.json(or.opencode/opencode.json) in the project root. Every project:~/.config/opencode/opencode.json. In OpenCode 2, servers sit undermcp.servers:{ "$schema": "https://opencode.ai/config.json", "mcp": { "servers": { "context7": { "type": "remote", "url": "https://mcp.context7.com/mcp" }, "playwright": { "type": "local", "command": ["npx", "-y", "@playwright/mcp@latest"] } } } }Use
{env:NAME}for secrets;$NAMEis not expanded.Uses Playwright MCP
- 4
Check the connection
Run
opencode mcp list. A working server shows✓ context7 connected; one that needs sign-in says so. - 5
Sign in if it asks
Open OpenCode, type
/mcps, select the server and finish the sign-in in your browser. From the shell,opencode mcp auth <name>does the same.opencode mcp logout <name>clears it so you can switch accounts. - 6
Use it by name
OpenCode names each tool
<server>_<tool>, so short server names keep prompts readable.PromptUse context7 to look up the current Astro docs for content collections, then update src/content/config.ts.Uses Context7
- 7
Turn a server off without deleting it
In OpenCode 2 add
"disabled": trueto the server. OpenCode 1 uses"enabled": falseinstead.
Best MCP servers for OpenCode
Official servers with an approved PlugWiki page whose setup for this client is documented by the vendor or client; ordered by GitHub stars, then weekly downloads, then name.
- 1
Chrome DevTools MCPOfficialLocalLets OpenCode inspect and debug pages in Chrome on your computer.
54,537 GitHub stars - 2
Playwright MCPOfficialLocalDrives a real browser so OpenCode can test what it builds.
38,887 GitHub stars - 3
GitHub MCP ServerOfficialHosted or LocalOAuthPull requests, issues and code search; OpenCode warns it uses a lot of context.
34,115 GitHub stars - 4
SupabaseOfficialHosted or LocalOAuthQuery and manage your Supabase database and project from OpenCode.
2,988 GitHub stars - 5
Figma MCP ServerOfficialHostedOAuthReads Figma designs so OpenCode can build from them.
2,136 GitHub stars - 6
ZapierOfficialHostedOAuthReaches thousands of apps through the actions you set up in Zapier.
452 GitHub stars - 7
Firecrawl MCP ServerOfficialHosted or LocalAPI keyTurns web pages into clean text, using your Firecrawl key.
190,711/wk downloads a week - 8
Exa MCP ServerOfficialHosted or LocalOAuthWeb search built for AI, hosted by Exa.
5.2K GitHub stars
MCP servers that work in OpenCode
40 · official first, then servers with a page, then by stars
Scrapling MCP ServerOfficialLocalNo sign-inWeb scraping with stealth HTTP, real browsers, and Cloudflare bypass. CSS selectors supported.
90.6K GitHub stars
Context7OfficialHosted or LocalAPI keyUp-to-date docs for AI agents
64K GitHub stars
Chrome DevTools MCPOfficialLocalMCP server for Chrome DevTools
54.5K GitHub stars
Playwright MCPOfficialLocalPlaywright MCP server
38.9K GitHub stars
GitHub MCP ServerOfficialHosted or LocalOAuthGitHub's official MCP server. Lets an AI assistant read code, manage issues and pull requests, check Actions runs and security alerts. Hosted at api.githubcopilot.com/mcp or run locally with Docker or a Go binary.
34.1K GitHub stars
OpenWork MCP GatewayOfficialHostedOAuthYour OpenWork org's skills, plugins, workflows, and connections through one OAuth MCP URL.
24.3K GitHub stars
MCP Toolbox for DatabasesOfficialLocaltoken in envMCP Toolbox for Databases enables your agent to connect to your database.
16.8K GitHub stars
apify-mcp-serverOfficialHosted or LocalOAuthExtract data from any website with thousands of scrapers, crawlers, and automations on Apify Store ⚡
14K GitHub stars
SeleniumBase MCPOfficialLocalNo sign-inStealthy browser automation, testing, and web-scraping via CDP Mode.
13.2K GitHub stars
AutoClipOfficialLocalNo sign-inClip long videos into short clips with covers and captions. Local CLI and MCP.
9.9K GitHub stars
Firecrawl MCP ServerOfficialHosted or LocalAPI keyFirecrawl, the context API for AI agents: search, scrape, interact with the web, plus paper search.
7.7K GitHub stars
firecrawl-mcp-serverOfficialLocalAPI keyOfficial Firecrawl MCP server, the context API for AI agents: search, scrape, and interact with the web, plus parse, crawl, map, Agent and Monitor, from any MCP client.
7.7K GitHub stars
MobileBuildMCPOfficialLocalBuild, run and test iOS and macOS apps, drive the simulator and debug with LLDB from your AI assistant. Formerly XcodeBuildMCP.
6.5K GitHub stars
magic-mcpOfficialLocalAPI keyIt's like v0, but in your Cursor / Claude Code / Windsurf: search 10,000+ React/Tailwind components, generate new UI with AI, and publish your own — right from your editor. Magic MCP is now the 21st MCP; this package keeps old configs working. Setup: 21st.dev/mcp
6.3K GitHub stars- Excalidraw MCPOfficialHosted or LocalNo sign-in
Official Excalidraw MCP App server: streams hand-drawn diagrams into the chat with interactive fullscreen editing. Hosted or local.
5.6K GitHub stars
Exa MCP ServerOfficialHosted or LocalOAuthConnect AI agents to Exa for web search, content fetching, and multi-step research.
5.2K GitHub stars
notion-mcp-serverOfficialLocaltoken in envOfficial Notion MCP Server
4.7K GitHub stars
mcp-grafanaOfficialHosted or LocalAn MCP server giving access to Grafana dashboards, data and more.
3.6K GitHub stars- Google Analytics MCP ServerOfficialLocaltoken in env
Google's official Google Analytics MCP server: runs locally and queries GA4 reports and property settings with your Google credentials. Read-only unless you add the --allow-write flag.
3.6K GitHub stars
SupabaseOfficialHosted or LocalOAuthMCP server for interacting with the Supabase platform
3K GitHub stars
Show all 40Show fewer
brightdata-mcpOfficialLocaltoken in envA powerful Model Context Protocol (MCP) server that provides an all-in-one solution for public web access.
2.7K GitHub stars
Perplexity MCP ServerOfficialHosted or LocalOAuthConnector for Perplexity API, to enable real-time, web-wide research.
2.6K GitHub stars
tavily-mcpOfficialLocalProduction ready MCP server with real-time search, extract, map & crawl.
2.5K GitHub stars
Solana MCP by VybeOfficialHostedOAuthSolana MCP developer toolkit: wallets, trades, markets, PnL, transfers, onchain, swaps & API tools.
2.2K GitHub stars
Azure DevOps (ADO)OfficialHostedOAuthThe MCP server for Azure DevOps, bringing the power of Azure DevOps directly to your agents.
2.1K GitHub stars
Azure DevOps Local MCP ServerOfficialLocalOAuthThe MCP server for Azure DevOps, bringing the power of Azure DevOps directly to your agents.
2.1K GitHub stars
anysearch-mcp-serverOfficialHostedAPI keyUnified real-time search MCP server supporting general web search, vertical domain search, parallel batch search, and full-page URL content extraction.
2.1K GitHub stars
Microsoft Learn MCPOfficialHostedNo sign-inOfficial Microsoft Learn MCP Server – real-time, trusted docs & code samples for AI and LLMs.
2K GitHub stars- WordPress MCP AdapterOfficialLocal
The official WordPress plugin that turns a self-hosted site into an MCP server, exposing Abilities API actions from core, plugins and themes over STDIO (WP-CLI) or HTTP.
1.9K GitHub stars
MeiGen-AI-Design-MCPOfficialHosted or LocalOAuthDiscover inspiration and create images and videos with the latest AI models. Works with ChatGPT, Claude, Cursor, and other MCP clients.
1.8K GitHub stars
MATLAB MCP ServerOfficialLocalNo sign-inConnect AI coding agents to MATLAB. Run code, tests, and analysis via MCP.
1.7K GitHub stars
datagouv-mcpOfficialHostedNo sign-inOfficial data.gouv.fr Model Context Protocol (MCP) server that allows AI chatbots to search, explore, and analyze datasets from the French national Open Data platform, directly through conversation.
1.6K GitHub stars
MiniMax-MCPOfficialLocalAPI keyOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
1.6K GitHub stars
mcp-server-qdrantOfficialLocalAPI keyAn official Qdrant Model Context Protocol (MCP) server implementation
1.6K GitHub stars
TerraformOfficialHosted or LocalAPI keyGenerate more accurate Terraform and automate workflows for HCP Terraform and Terraform Enterprise
1.6K GitHub stars
@brave/brave-search-mcp-serverOfficialLocalBrave Search MCP Server: web results, images, videos, rich results, AI summaries, and more.
1.5K GitHub stars
IDA MCPOfficialLocalNo sign-inOfficial Hex-Rays MCP server that lets AI agents open, decompile and annotate binaries in IDA, alongside you in the IDA GUI or headless.
1.5K GitHub stars- X MCP (X API)OfficialHosted or LocalOAuth
X's hosted MCP server for the X API at api.x.com/mcp: AI clients search posts, read users, trends and news, manage bookmarks and publish Articles through your X developer app, directly or via the xurl mcp bridge.
1.4K GitHub stars
Power BI Authoring MCP Server (Local)OfficialLocalOAuthThe Power BI Authoring MCP server lets an AI agent create and change Power BI semantic models.
1.3K GitHub stars
ref-tools-mcpOfficialLocalAPI keyToken efficient search for coding agents over public and private documentation.
1.2K GitHub stars
Common errors and fixes
Servers from an old config are ignored after upgrading
Cause: OpenCode 2 reads servers under mcp.servers, not directly under mcp.
Fix: Move each server into mcp.servers and change enabled: false to disabled: true.
opencode Source
An env var like $API_KEY is sent as literal text
Cause: OpenCode does not expand shell expressions in JSON strings.
Fix: Write {env:API_KEY} instead.
opencode Source
Server keeps saying it needs authentication
Cause: OAuth is on for remote servers and you have not signed in, or the token expired.
Fix: Run /mcps or opencode mcp auth <name>; for key-only servers set oauth to false and send a header.
opencode Source
Sign-in fails for a remote server
Cause: The authorization server supports neither of the sign-up methods OpenCode tries.
Fix: If the provider gave you client credentials, add them as a pre-registered client with client_id. In OpenCode 1, opencode mcp debug <name> shows where sign-in fails.
opencode Source
Model runs out of context with MCP servers on
Cause: Each server adds its tools to the context, some by a lot.
Fix: Remove unused servers or deny their tools with permissions.
opencode Source
A project server overrides your global one and breaks
Cause: A project entry with the same name replaces the whole server object.
Fix: Use a different name, or repeat every required field in the project entry.
opencode Source
Verdict
OpenCode supports local and hosted MCP servers with automatic sign-in and a simple opencode mcp add command. The main limit is that OpenCode 2 changed the config shape to mcp.servers, so many guides and OpenCode 1 configs no longer work as written.
OpenCode supports local and hosted MCP servers with automatic sign-in and a simple opencode mcp add command. The main limit is that OpenCode 2 changed the config shape to mcp.servers, so many guides and OpenCode 1 configs no longer work as written.
Best for
- Developers who want an open source terminal agent with MCP
- People who keep project servers in a committed opencode.json
Skip it if
- You are copying an old mcpServers or OpenCode 1 config without converting it
- You install on Windows through a package manager, which OpenCode 2 does not support
Questions
How do I add an MCP server to OpenCode?
Run opencode mcp add <name> --url <address> for a hosted server or opencode mcp add <name> -- <command> for a local one, from your project folder. Add --global for every project.
Where is the OpenCode config file?
For every project it is ~/.config/opencode/opencode.json. For one project it is opencode.json or .opencode/opencode.json in the project root, and closer files win. JSONC with comments works too.
What does the OpenCode MCP config look like?
In OpenCode 2, each server is a named entry under mcp.servers with type set to local (plus command) or remote (plus url). OpenCode 1 puts the named entries directly under mcp.
Why did my MCP config stop working after upgrading OpenCode?
OpenCode 2 expects servers under mcp.servers, not directly under mcp, and uses disabled instead of enabled. OAuth fields also changed to snake_case, such as client_id.
How do I sign in to an MCP server in OpenCode?
Type /mcps in OpenCode, pick the server and sign in in your browser, or run opencode mcp auth <name>. Hosted servers try sign-in automatically unless you set oauth to false.
How do I use an API key instead of sign-in?
Set "oauth": false and send the key as a header, for example "Authorization": "Bearer {env:MCP_API_KEY}". Keep the key in an environment variable, not in the file.
Why does an MCP server use so much context in OpenCode?
Every server's tools are sent to the model. OpenCode's docs warn that some, like the GitHub MCP server, add many tokens; add only what you need or deny tools you do not use with permissions.
How long does OpenCode wait for a server?
30 seconds to start and 30 seconds to list tools, and up to 12 hours for a tool call in OpenCode 2. Change them under mcp.timeout or a server's own timeout.
Information
updated Nov 1, 2026
- Transports
- stdio, Streamable HTTP
- Config file (all)
opencode.json (mcp)- MCP docs
- opencode.ai
Sources
Docs, issue trackers and discussions this page is built from.
Show all 5Hide
- Intro (OpenCode 2) · opencode.ai
- Intro (OpenCode 1) · opencode.ai
- MCP servers (OpenCode 2) · opencode.ai
- MCP servers (OpenCode 1) · opencode.ai
- Config (OpenCode 2) · opencode.ai