AI Agents
Arslan
ArslanOct 7, 2026

Compare the 7 best MCP servers for OpenCode in 2026 for documentation, code examples, browser testing, GitHub, errors, databases, and live web data.

Best MCP Servers for OpenCode in 2026: 7 Top Picks by Use Case

The best MCP servers for OpenCode are the few that cover a job your agent does every week. For most users, that means Context7 for library docs, Grep by Vercel for code examples, and Playwright MCP or Chrome DevTools MCP for browser tests. Then add GitHub's MCP server (scoped), Sentry for errors, Supabase for databases, and a web data server such as Olostep for live pages.

Keep two or three on in every session. Turn the rest on only for the agents that need them, because each server adds tool descriptions to the model's context.

MCP (Model Context Protocol) is an open standard that lets an AI app call outside tools. An MCP server is a program that offers those tools, such as "search the docs." Our Model Context Protocol explainer covers how the protocol works.

OpenCode is an open-source AI coding agent for the terminal and desktop. As of October 2026, OpenCode says on OpenCode's homepage: "With over 208,000 GitHub stars, 950 contributors, and over 13,000 commits, OpenCode is used and trusted by over 16M developers every month." These figures are self-reported by OpenCode.

Choosing matters because the field is crowded. A count appears in Anthropic's December 2025 announcement: "There are now more than 10,000 active public MCP servers, covering everything from developer tools to Fortune 500 deployments". That count dates from December 2025.

How to Choose MCP Servers for OpenCode

Judge each server on five criteria before you compare names. Every connected server registers its tools when a session starts, next to OpenCode's built-in tools.

  • Job coverage: The server does a job your agent can't already do with built-in tools or the shell.
  • Context weight: More tools mean more text in the context window, which is everything the model can see at once.
  • Transport: A remote server runs on the vendor's machines. A local server runs as a process on your computer.
  • Auth model: Servers use OAuth (a browser sign-in), an API key, or no auth at all.
  • Write access: A server that can change data, such as editing tables, carries more risk than a read-only one.

Context weight is the risk OpenCode flags first. The OpenCode MCP documentation warns: "Certain MCP servers, like the GitHub MCP server, tend to add a lot of tokens and can easily exceed the context limit."

Context Weight: Why Fewer Servers Often Work Better

Tool definitions use up tokens before your agent reads a single file. A tool definition is the name, description, and input format the model needs to call a tool. Tokens are the small chunks of text a model reads, up to a fixed limit.

Anthropic showed the cost with a five-server setup: GitHub, Slack, Sentry, Grafana, and Splunk. Anthropic's tool-use engineering post puts it this way: "That's 58 tools consuming approximately 55K tokens before the conversation even starts." This is Anthropic's example on its own platform, not an OpenCode measurement, so your numbers will differ.

Many similar tools also make tool selection harder. When two servers both offer a search tool, the model has more chances to call the wrong one.

Remote vs Local Servers in OpenCode

OpenCode supports two server types, set with the type field in opencode.json. The type decides where the server runs and how it gets credentials.

  • Remote ("type": "remote"): OpenCode connects to a url and sends any headers or OAuth tokens you set up. Nothing extra runs on your machine.
  • Local ("type": "local"): OpenCode starts the server from a command array and passes secrets through environment. The process runs on your computer.

Remote fits hosted SaaS servers like Sentry. Local fits offline work, corporate proxies that block outside connections, and tools that need your filesystem. Local servers talk to OpenCode over stdio, the process's standard input and output.

The Best MCP Servers for OpenCode, by Job

Each pick covers one job and includes a config snippet in OpenCode's stable (V1) syntax. The picks are editorial, and context weight is our estimate from tool counts. For options beyond OpenCode-specific setup, see our broader MCP server roundup.

JobServerTransportAuthContext weight
Current library docsContext7RemoteOptional API keyLow
Real-world code examplesGrep by VercelRemoteNoneLow
Browser testingPlaywright MCP or Chrome DevTools MCPLocalNoneHigh
Repository workGitHub MCP serverRemotePersonal access tokenHigh
Production errorsSentryRemoteOAuthMedium
Database workSupabaseRemoteOAuthMedium
Live web pages and searchOlostepRemote or localAPI keyMedium (10 tools)

Each snippet is a complete opencode.json file. To run several servers, merge their entries under one mcp key.

Context7 for Up-to-Date Library Docs

Context7 gives your agent current library and framework docs, so it relies less on old training data. The server is remote, and the API key header is optional.

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "context7": {
      "type": "remote",
      "url": "https://mcp.context7.com/mcp",
      "headers": {
        "CONTEXT7_API_KEY": "{env:CONTEXT7_API_KEY}"
      }
    }
  }
}

{env:CONTEXT7_API_KEY} reads the key from your environment. Delete the headers block if you have no key.

Add "use context7" to a prompt, or put this rule in AGENTS.md, the project instruction file OpenCode reads:

markdown
When you need to search docs, use `context7` tools.

Its low tool count suits an always-on slot.

Grep by Vercel for Real-World Code Examples

Grep by Vercel searches public GitHub code, so your agent sees how real projects use an API. It's remote and needs no auth.

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "gh_grep": {
      "type": "remote",
      "url": "https://mcp.grep.app"
    }
  }
}

Pair it with this AGENTS.md rule from the OpenCode docs, and keep the server name gh_grep so the rule matches.

markdown
If you are unsure how to do something, use `gh_grep` to search code examples from GitHub.

Playwright MCP or Chrome DevTools MCP for Browser Testing

Playwright MCP lets the agent drive a real browser to click, type, and check pages. It reads pages through the accessibility tree, the structured list of elements that screen readers use.

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "playwright": {
      "type": "local",
      "command": ["npx", "@playwright/mcp@latest"]
    }
  }
}

Chrome DevTools MCP connects the agent to Chrome's developer tools. It adds performance traces, console messages, and network inspection.

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "chrome-devtools": {
      "type": "local",
      "command": ["npx", "-y", "chrome-devtools-mcp@latest"]
    }
  }
}

Pick one, since their jobs overlap. Both expose many tools, so enable your choice only for a QA agent (see Step 3).

GitHub MCP Server for Repository Work (Scoped)

GitHub's MCP server lets the agent work with issues, pull requests, and repositories. It authenticates with a personal access token (PAT) you create in GitHub settings.

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "github": {
      "type": "remote",
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "Authorization": "Bearer {env:GITHUB_TOKEN}"
      }
    }
  },
  "tools": {
    "github*": false
  }
}

The OpenCode docs single out this server for heavy token use. The "github*": false line turns its tools off globally, ready to re-enable per agent in Step 3.

The gh CLI is another option, run through OpenCode's shell tool with no tool definitions loaded. For the trade-offs, read when to use MCP vs an API.

Sentry for Production Errors

Sentry's MCP server lets the agent pull issues and stack traces from your error tracking. It's remote and uses OAuth, so you sign in through the browser.

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "sentry": {
      "type": "remote",
      "url": "https://mcp.sentry.dev/mcp",
      "oauth": {}
    }
  }
}

Then sign in from the terminal:

bash
opencode mcp auth sentry

The command opens your browser, and OpenCode stores the tokens in ~/.local/share/opencode/mcp-auth.json.

Supabase for Database Work

Supabase's MCP server lets the agent work with the database in your Supabase project. It's remote and uses OAuth.

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "supabase": {
      "type": "remote",
      "url": "https://mcp.supabase.com/mcp"
    }
  }
}
bash
opencode mcp auth supabase

Write access is the main risk here. Connect a development project, and use read-only mode where Supabase's setup allows it.

Olostep for Live Web Pages, Search, and Answers

Coding agents often need pages no docs index covers, such as changelogs, API docs missing from Context7, pricing pages, and competitor sites. The Olostep MCP server gives OpenCode access to those publicly accessible pages.

Olostep's 10 tools split web work into separate steps. The agent calls only the step it needs, which keeps raw HTML out of context.

  • Discovery: search_web finds pages, while create_map and get_website_urls list the URLs on a site.
  • Extraction: scrape_website and get_webpage_content return a page's content as clean Markdown.
  • Bulk jobs: batch_scrape_urls and create_crawl handle many pages at once. get_batch_results and get_crawl_results fetch the output.
  • Answers: answers returns a source-cited answer to a question.

Hosted setup:

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "olostep": {
      "type": "remote",
      "url": "https://mcp.olostep.com/mcp",
      "headers": {
        "Authorization": "Bearer {env:OLOSTEP_API_KEY}"
      }
    }
  }
}

Local setup (requires Node.js 18 or later):

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "olostep": {
      "type": "local",
      "command": ["npx", "-y", "olostep-mcp"],
      "environment": {
        "OLOSTEP_API_KEY": "{env:OLOSTEP_API_KEY}"
      }
    }
  }
}

Don't mix auth modes. Olostep's docs say the wrong auth mode is the #1 onboarding error, so use the header for hosted and environment for local.

Batch and crawl jobs are async: they run in the background and return an ID the agent uses to fetch results later. Olostep's free tier covers personal use.

Firecrawl and Exa are alternatives for this job. Our comparison of web search MCP servers weighs them in more depth.

How to Add MCP Servers to OpenCode

Add a server with the opencode mcp add command or by editing opencode.json. Then sign in if needed, check the connection, and scope heavy servers per agent.

Step 1: Add the Server With the CLI or opencode.json

Run the add command from the terminal:

bash
opencode mcp add

To edit by hand, add the server under the mcp key. The global file at ~/.config/opencode/opencode.json applies to every project. A file named opencode.json in the project root applies to that project only.

Write secrets as {env:VAR}, as in "Bearer {env:GITHUB_TOKEN}". OpenCode doesn't expand shell-style $VAR, so "Bearer $GITHUB_TOKEN" sends the wrong value.

Step 2: Authenticate and Verify the Connection

Sign in to OAuth servers, then confirm each connection:

bash
opencode mcp auth sentry     # sign in to an OAuth server
opencode mcp list            # list servers and their status
opencode mcp debug sentry    # diagnose a server that fails
opencode mcp logout sentry   # remove stored tokens

According to the OpenCode docs, opencode mcp debug "shows the current auth status, tests HTTP connectivity, and attempts the OAuth discovery flow." Run it first when a server shows no tools.

Restart OpenCode, including the Desktop app, after every config edit, because servers connect at startup. If a local server starts slowly, raise its timeout field (V1 defaults to 5000 ms). The setup worked when the agent can call the server's tools.

Step 3: Scope Heavy Servers to Specific Agents

Per-agent scoping keeps a heavy server installed but loads its tools for one agent only. An OpenCode agent is a named setup with its own instructions and tools.

Turn the server's tools off globally with a glob pattern, where * matches any characters. Then turn them back on under agent.<name>.tools:

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "playwright": {
      "type": "local",
      "command": ["npx", "@playwright/mcp@latest"]
    }
  },
  "tools": {
    "playwright*": false
  },
  "agent": {
    "qa": {
      "tools": {
        "playwright*": true
      }
    }
  }
}

Only the qa agent now sees Playwright's tools, and the same pattern works for "github*".

Moving Claude Code or Cursor MCP Configs to OpenCode

OpenCode doesn't read the mcpServers block that Claude Code and Cursor use, so a pasted config won't load. Rename a few keys and reshape the command. For broader context on the two agents, see how OpenCode compares to Claude Code.

Claude Code or CursorOpenCode
mcpServersmcp
command plus argsOne command array
envenvironment
Server type often impliedAdd "type": "local" or "type": "remote"
urlurl (unchanged)
headersheaders (unchanged)
Secret pasted as plain text{env:VAR}

Before (Claude Code or Cursor):

json
{
  "mcpServers": {
    "olostep": {
      "command": "npx",
      "args": ["-y", "olostep-mcp"],
      "env": {
        "OLOSTEP_API_KEY": "YOUR_OLOSTEP_API_KEY"
      }
    }
  }
}

After (OpenCode):

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "olostep": {
      "type": "local",
      "command": ["npx", "-y", "olostep-mcp"],
      "environment": {
        "OLOSTEP_API_KEY": "{env:OLOSTEP_API_KEY}"
      }
    }
  }
}

What Changes for MCP in OpenCode V2

OpenCode V2 moves servers in the config and turns on Code Mode by default. Code Mode exposes a server's tools through code, grouped by server name, in place of direct tool calls.

  • Config location: Servers move under mcp.servers and no longer sit directly under mcp.
  • Disabling: A disabled field replaces enabled.
  • Code Mode: It's on by default, and "codemode": false on a server exposes its tools directly.
  • In-app setup: /mcps lets you select a server and sign in.
  • Timeouts: Startup and catalog timeouts default to 30 seconds, and tool execution can run up to 12 hours.
  • Permissions: Rules can hide or deny tools by pattern without disconnecting the server.
  • Tool names: OpenCode names each tool <server>_<tool>.
  • Session ID: OpenCode sends your session ID to servers in _meta["ai.opencode/sessionID"].

This V2 config adds Context7, then denies its tools while it stays connected:

json
{
  "mcp": {
    "servers": {
      "context7": {
        "type": "remote",
        "url": "https://mcp.context7.com/mcp"
      }
    }
  },
  "permissions": [
    { "action": "context7_*", "resource": "*", "effect": "deny" }
  ]
}

Check the session ID behavior before adding a remote server. OpenCode's V2 docs state: "Remote servers receive the raw ID and may log or retain it."

Anthropic tested a similar approach. Anthropic's code execution write-up reports one example workflow: "This reduces the token usage from 150,000 tokens to 2,000 tokens—a time and cost saving of 98.7%." That figure comes from one Anthropic workflow, so OpenCode savings will differ.

Security Checks Before You Connect a Server

An MCP server runs with the credentials you give it, so a flawed server can misuse them. Treat each one like a dependency with access to your accounts.

In a study of 1,899 MCP servers, the authors report: "Additionally, 7.2% of servers contain general vulnerabilities, and 5.5% exhibit MCP-specific tool poisoning." The study is a preprint, and its figures apply only to those 1,899 open-source servers. Tool poisoning means hidden instructions in a tool's description that try to steer the model.

  • Official servers: Prefer vendor-hosted servers, such as Sentry's, over unknown forks.
  • Narrow tokens: Give PATs and API keys read-only or minimal scopes.
  • Development projects: Point database servers at a dev project, not production.
  • Denied write tools: Set unneeded write tools to false in the tools map, or deny them in V2.

Start Small and Add Servers When a Task Needs Them

Start with Context7 and one web data server always on, and scope everything else per agent. Add a server when a task keeps failing without it, and remove ones your agents stop calling.

A lean setup also matches where most developers are. Stack Overflow's 2025 Developer Survey found: "A majority of developers (52%) either don't use agents or stick to simpler AI tools, and a significant portion (38%) have no plans to adopt them." Agent tooling is still early, so a small setup you can measure is easier to trust and fix.

FAQ

How Many MCP Servers Should I Run in OpenCode?

Run two or three servers always on and scope the rest to specific agents. The OpenCode docs warn that heavy servers like GitHub's can exceed the context limit.

Where Is the OpenCode MCP Config File?

The global config is ~/.config/opencode/opencode.json, and a project config is opencode.json in the project root. Add servers under the mcp key in either file.

Can I Paste a Claude Code mcpServers Config Into OpenCode?

No, OpenCode doesn't read mcpServers. Rename it to mcp, merge command and args into one command array, rename env to environment, and add a type.

Why Does My MCP Server Show No Tools in OpenCode?

Usual causes are a wrong key or auth mode, an expired OAuth token, or a timeout. Run opencode mcp debug <name>, then re-run opencode mcp auth <name> if the token expired.

Do MCP Servers Work in OpenCode Desktop?

Yes, OpenCode Desktop uses the same opencode.json config as the terminal app. Restart the app after every change, because servers connect at startup.

Is MCP Better Than Using a CLI Tool in OpenCode?

It depends on the task. A CLI like gh adds no tool-definition tokens, while MCP gives structured tools and handles auth.

About the Author

Arslan Ali

Co-Founder, Olostep · San Francisco, CA

Arslan is the co-founder of Olostep, a web data infrastructure platform that helps developers and teams access, extract, and structure web data at scale. He works closely on the product and technology behind Olostep, with a focus on building reliable infrastructure for web scraping, search APIs, and structured web data.

Read more