We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Configure MCP

You configure MCP servers in your OpenCode config:

  • Project-level: opencode.jsonc (in the project root)
  • Global: ~/.config/opencode/opencode.jsonc

It ends up looking something like this:

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

Context7 is a remote MCP documentation server that gives current library/framework docs and examples on demand.

Keep credentials out of the file with {env:CONTEXT7_API_KEY}. OpenCode reads the value from the environment when it loads the config.

Authentication

Most remote MCP servers require authentication of some sort. After all, the big idea behind MCP is usually to provide "programmatic" access to some data or service, and those services are almost always gated behind some kind of auth.

API keys are common for internal/dev tools for their simplicity. They require you to manage the key yourself and don't have a built-in flow for refreshing tokens.

Context7 also offers access without an API key, but at a lower rate limit.

Assignment

Connect OpenCode to Context7 so it can look up library documentation.

Tell OpenCode to run and submit the CLI tests from the project root. Connection failures carry no penalty.