

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: MCP
incomplete
2: Configure MCP
incomplete
3: OAuth
incomplete
4: Code Mode
incomplete
5: Context Bloat
incomplete
This lesson's interactive features are locked, please to keep using them
OpenCode supports two forms of authentication:
For simple OAuth-enabled servers, OpenCode can detect the auth requirement, kick off the flow, and store the resulting tokens for future use. The config is usually simple:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"servers": {
"notion": {
"type": "remote",
"url": "https://mcp.notion.com/mcp",
},
},
},
}
When the server reports that it needs authentication, start the sign-in flow from OpenCode's MCP interface or with opencode mcp auth <name>. Open the authorization URL it gives you in a browser.
OpenCode stores the resulting credentials outside your project configuration. You shouldn't need to manage that storage directly. Use opencode mcp logout <name> when you want to remove credentials.
Where this gets a bit hairier is if the MCP server doesn't support Dynamic Client Registration. In that case (like with the GitHub MCP), you need to register and provide a client ID and secret in the config (guh):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"servers": {
"github": {
"type": "remote",
"url": "https://api.githubcopilot.com/mcp/",
"oauth": {
"client_id": "{env:GITHUB_MCP_CLIENT_ID}",
"client_secret": "{env:GITHUB_MCP_CLIENT_SECRET}",
},
},
},
},
}
If you're having trouble with authentication, here are a few of the commands that can help you debug:
opencode mcp list: List all servers and their authorization status.opencode mcp auth <name>: Authenticate with an MCP server.opencode mcp logout <name>: Remove stored credentials.Give OpenCode access to a Notion page through OAuth, then have it read the page.
Tell OpenCode to run and submit the CLI tests from the project root. Connection failures carry no penalty.