OpenCode
OpenCode: a remote MCP server in opencode.json, with the key read from an environment variable.
- API key (Bearer)
- OAuth sign-in
Config file
opencode.json
Recommended
{
"mcp": {
"aicharged": {
"type": "remote",
"url": "https://aicharged.io/api/v1/mcp",
"enabled": true,
"headers": {
"Authorization": "Bearer {env:AICHARGED_API_KEY}"
},
"oauth": false
}
}
}
OpenCode fills in the env: reference from your environment; oauth: false stops it from starting an OAuth sign-in.
Store the key in an environment variable
· macOS / Linuxexport AICHARGED_API_KEY="<API_KEY>"
Add the export line to your shell profile (e.g. ~/.zshrc) so new terminals see the key too.
Store the key in an environment variable — Windows (PowerShell)
· Windows[Environment]::SetEnvironmentVariable("AICHARGED_API_KEY", "<API_KEY>", "User")