Add the Tokonomix consensus MCP server to a Claude Code project — step by step.
This guide walks you through adding the Tokonomix consensus MCP server to a Claude Code project so your coding agent can call a multi-model council for review gates, security checks, and fact-checking.
tok_live_...) — obtain one from https://tokonomix.ainpx)In the project root, run:
claude mcp add tokonomix-council-mcp -- npx tokonomix-mcp
Or add it manually to .claude/settings.json:
{
"mcpServers": {
"tokonomix": {
"command": "npx",
"args": ["tokonomix-mcp"],
"env": {
"TOKONOMIX_API_KEY": "tok_live_..."
}
}
}
}
Security: store the key in an env var from your shell, not in the JSON file itself. In
.claude/settings.jsonyou can reference shell env vars:"TOKONOMIX_API_KEY": "${TOKONOMIX_API_KEY}".
Inside a Claude Code session:
/mcp
You should see tokonomix listed with status
connected. If not, check that npx resolves
correctly (which npx) and that
TOKONOMIX_API_KEY is set in your shell.
The MCP server exposes these tools (usable directly in Claude Code prompts):
| Tool | What it does |
|---|---|
tokonomix_consensus_ask |
Send a question to a multi-model council and get a synthesised answer |
tokonomix_single_ask |
Send a question to a single model (no council) |
tokonomix_rate_consensus |
Rate a previous consensus answer (thumbs up/down + optional note) |
tokonomix_get_balance |
Check your remaining credit balance |
tokonomix_list_models |
List available models with their capabilities |
tokonomix_get_skill |
Fetch a named skill document |
Use tokonomix_consensus_ask to review this function for security issues:
<paste function here>
Claude Code will call the tool, send the code to a multi-model council, and return the synthesised review with any disagreements surfaced.
The Agents
Never Sleep harness uses tokonomix_consensus_ask as its
built-in review gate. When you run ANS with a council credential
configured, each ticket automatically goes through a 5-model/3-judge
gate before commit.
To set up the credential for ANS:
mkdir -p ~/.tokonomix
echo '{"apiKey":"tok_live_..."}' > ~/.tokonomix/credentials.json
chmod 600 ~/.tokonomix/credentials.json
ANS reads this file; it does NOT use ANTHROPIC_API_KEY
for council calls.
The gateway is also available as a plain HTTP endpoint from within scripts or tools. Use the OpenAI SDK pointed at the Tokonomix base URL:
import OpenAI from "openai";
const toko = new OpenAI({
baseURL: "https://tokonomix.ai/api/v1",
apiKey: process.env.TOKONOMIX_API_KEY ?? "",
});
// Single-model chat
const resp = await toko.chat.completions.create({
model: "claude-sonnet-4-6",
messages: [{ role: "user", content: "Summarise this diff: ..." }],
});
// Embeddings
const emb = await toko.embeddings.create({
model: "text-embedding-3-small",
input: "some text to embed",
});
| Symptom | Likely cause | Fix |
|---|---|---|
tokonomix not listed in /mcp |
npx not on PATH |
Run which npx; install Node.js |
401 Unauthorized |
Wrong or missing key | Check TOKONOMIX_API_KEY in shell |
402 Payment Required |
Credit balance exhausted | Top up at https://tokonomix.ai |
429 during council call |
Rate limit | Reduce concurrency or space out calls |
| Council returns no answer | All proposers refused | Rephrase the prompt; check for disallowed content |
Latest published version: 1.6.2 (npm:
tokonomix-council-mcp).
npx tokonomix-mcp --version
Registry metadata:
GET https://tokonomix.ai/.well-known/mcp/server.json