Search⌘ K
AI Features

External Tool Integration with MCP

Discover how to use MCP servers to add prebuilt external tool integrations into OpenCode. Learn configuration methods for local and remote MCP servers, manage authentication including OAuth, control available tools, and understand best practices to enhance your AI coding agent's capabilities within your workflow.

So far, we’ve extended OpenCode with custom tools and commands. But what if you want to integrate with services like Sentry, GitHub, or internal APIs without building and maintaining your own tools? That’s where MCP (Model Context Protocol) servers come in.

MCP servers provide prebuilt integrations that we can add to OpenCode through configuration. They extend OpenCode’s capabilities by connecting it to external systems, giving the model access to tools it wouldn’t have otherwise.

What are MCP servers?

MCP servers are external programs that expose tools to OpenCode through a standard protocol. Instead of writing custom tool code, we configure OpenCode to connect to an MCP server, and all of that server’s tools are automatically available to the model.

Think of MCP servers as plugin systems. A Sentry MCP server provides OpenCode tools for querying issues and projects. A GitHub MCP server provides OpenCode tools for searching code and managing repositories. These tools work exactly like built-in tools; OpenCode decides when to call them based on context.

The key advantage is reusability. Someone else has already written and maintained these integrations. We just configured OpenCode to use them.

What types of MCP servers exist?

MCP servers come in two forms:

  • Local MCP servers run on our machine as separate processes. OpenCode starts them using a command (like npx or bun), and they communicate over standard input/output. Local servers are good for tools that need access to our filesystem or local resources.

  • Remote MCP servers run on external infrastructure, and OpenCode connects to them over HTTP. These servers are typically managed by service providers and handle authentication, scaling, and maintenance for us.

Both types expose tools in the same way. The difference is where the code runs and how we configure the ...