For more details on MCP server configuration in OpenCode, see the OpenCode MCP documentation.
Installation
Run the setup command to configure Context7 for OpenCode:Plugin
Install the plugin from your project directory:ctx7 setup that configures OpenCode in one command. It adds two things:
MCP Server
The tools for fetching documentation (
context7_resolve-library-id, context7_query-docs)Skills
context7-mcp auto-triggers documentation lookups when you ask about librariesopencode.json
API Key
The plugin uses OAuth by default and needs no configuration. To use an API key instead, for example on a headless machine, export it before launching OpenCode:CONTEXT7_API_KEY automatically and sends it as an Authorization header. You can also pass it through the plugin options:
opencode.json
opencode.json already defines an MCP server named context7, the plugin leaves it alone. It is also safe to run both ctx7 setup and the plugin, since OpenCode loads the context7-mcp skill once.
Using Context7
Withctx7 setup or the plugin, a skill is installed that triggers automatically when you ask about libraries. You can also invoke it explicitly:
AGENTS.md file:
AGENTS.md
Tips
Getting Better Results
Getting Better Results
- Be specific about what you’re trying to do, not just which library
- Mention versions when they matter
- If the first result isn’t right, ask for a different part of the docs
Project-Level Configuration
Project-Level Configuration
You can place your
opencode.json in your project directory to have project-specific configurations. This is useful when:- Different projects need different API keys
- You want to share the config with your team via version control
- A project requires specific Context7 settings