opencode
Connect opencode to OnyxMetric's MCP server with OAuth or an API key
Connecting opencode to OnyxMetric lets it pull analytics into your terminal workflow — verifying an error fix in production, checking a route's traffic before removing it, or wiring up goals and funnels as you ship.
This page covers client setup only. The MCP overview covers the endpoint, API keys and scopes, the full tool list, and troubleshooting.
Connect with OAuth
Add the server to opencode.json at your project root (or your global opencode config):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"onyxmetric": {
"type": "remote",
"url": "https://app.onyxmetric.com/api/mcp",
"enabled": true
}
}
}Then authenticate:
opencode mcp auth onyxmetricYour browser opens OnyxMetric's OAuth flow — log in and approve access. The connection acts with your user's role, and the committed config carries no secret. opencode mcp logout onyxmetric removes the stored credential.
Connect with an API key
To use an API key instead — for non-interactive runs or a narrower, scoped credential — add a headers block that reads the key from the environment, so the config stays committable:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"onyxmetric": {
"type": "remote",
"url": "https://app.onyxmetric.com/api/mcp",
"enabled": true,
"headers": {
"Authorization": "Bearer {env:ONYX_API_KEY}"
}
}
}
}Verify
Run opencode mcp list to see the server and its authentication status (opencode mcp debug onyxmetric gives detailed diagnostics), then try:
List my OnyxMetric sites and summarize last week's traffic for each.