Connect Claude Code to Kojen over MCP
Add Kojen's MCP server to Claude Code with one command and sign in with OAuth, or use an API key header, so Claude Code can train, evaluate, red-team and deploy your agents.
- 1Add the server. Run: claude mcp add --transport http kojen https://kojen.ai/api/mcp
- 2Sign in. In Claude Code, run /mcp, choose kojen and authenticate. A browser opens the Kojen sign-in; allow the connection.
- 3Use it. Ask Claude Code to summarise your Kojen workspace or run an evaluation. It asks before calling tools.
Add Kojen and sign in
claude mcp add --transport http kojen https://kojen.ai/api/mcp
# Then, inside Claude Code:
# /mcp → select "kojen" → Authenticate → sign in to Kojen and allow the connectionClaude Code discovers Kojen's OAuth server from the 401 the MCP endpoint returns, registers itself and opens the sign-in in your browser. There's no key to copy. Add --scope user to make Kojen available in every project.
With an API key instead
For CI or headless use (claude -p), where nobody can click a sign-in, pass an account key from Settings → API Keys & MCP:
claude mcp add --transport http kojen https://kojen.ai/api/mcp \
--header "Authorization: Bearer kojen_…"To share the server with your team, commit a project .mcp.json. Claude Code expands ${KOJEN_KEY} from each person's environment, so the key itself stays out of the repo:
// .mcp.json at the repo root (shared with your team; add with --scope project)
{
"mcpServers": {
"kojen": {
"type": "http",
"url": "https://kojen.ai/api/mcp",
"headers": { "Authorization": "Bearer ${KOJEN_KEY}" }
}
}
}Sign-in, keys and scopes
- Kojen's MCP server is streamable HTTP at
https://kojen.ai/api/mcp. Clients that support MCP authorization need only that URL: they open a Kojen sign-in and ask you to allow the connection. Kojen is the OAuth authorization server, with discovery at/.well-known/oauth-protected-resource/api/mcp, dynamic client registration and Client ID Metadata Documents. - An OAuth connection gets the
readandwritescopes. Starting paid GPU runs or buying credits needs an API key with thebillingscope. - Clients without sign-in support send
Authorization: Bearer kojen_…: create a key under Settings → API Keys & MCP. Keys expire (90 days by default) and can be revoked any time. - Disconnect an OAuth client under Settings → Connected apps. Its tokens stop working at once.
- Paid or destructive tools (deploy_model, start_training_run, delete_record, …) need
confirmed: true, which the agent should only set after you approve that exact action.
Things to ask once it's connected
- “Summarise my Kojen workspace.” (get_workspace_summary)
- “Create a dataset from these 20 support tickets and tune a prompt that classifies them.” (create_dataset, train_model, wait_for_run)
- “Evaluate the tuned model and tell me its trust score.” (evaluate_model)
- “Red-team my support agent for prompt injection.” (run_simulation)
- “Deploy the best version and give me the endpoint URL.” (deploy_model, which asks you to confirm first)
The full tool list, with each tool's inputs, is on the developer docs.
Get an API key
Kojen is free to start, no card needed. Train and evaluate an agent, deploy it behind an OpenAI-compatible endpoint, and connect your tools over MCP.