For developers · Deutsch

Connect your own agents

You run your own AI agent, with n8n, LangGraph, a LiteLLM gateway or your own code? Connect it to Todokan through MCP. Your agent works with your model on your servers. Todokan enforces the rules and logs every step.

How it works

  1. Register the agent in Todokan: More › Governance › Agents › Your own agents.
  2. Todokan shows the credentials once: an API key and, for OAuth, a client ID with secret.
  3. Hand the agent a card with Send to AI. It learns about it by webhook or through the tool list_my_work.
  4. The agent reads the card, works and reports its result through MCP. In the end the card is done and waits for your approval.

Important: Todokan only sees what your agent reads and writes through MCP. Which model it uses and where that model runs is up to you.

Rules Todokan enforces

RuleWhat it does
One habitatThe agent sees and changes only cards in the habitat you registered it for.
Tool listA template (such as researcher or coder) sets the possible tools. You can shorten the list further. Anything else does not exist for the agent.
Protected cardsCards set to protected never reach an agent. Optionally it does not see read-only cards either.
Read or writeA read-only agent gets read tools only.
IP addressesOptional: calls only from given addresses or ranges (e.g. 203.0.113.0/24).
Expiry and revokeAn expired or revoked agent is refused on its next call, even with a token that has not expired.
Runs per dayCap on new runs per day (default 50).
Calls per minuteAt most 120 tool calls per minute per agent (configurable on your own server).
Kill switchIf you pause AI for the account, your agent stops on its next call too.
ApprovalAgents never close cards themselves. What they report as done is approved by a person.

Access: the MCP address

Todokan speaks the Model Context Protocol over HTTP (JSON-RPC 2.0, POST). The address is https://todokan.com/mcp; on your own server it is your installation's address plus /mcp.

Option A: API key

curl -s https://todokan.com/mcp \
  -H "Authorization: Bearer kb_live_…" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

Option B: OAuth client_credentials

For servers without a browser. The agent gets a token with its client ID and secret; it is valid for 60 minutes. After that it simply asks again.

curl -s https://todokan.com/oauth/token \
  -d grant_type=client_credentials \
  -d client_id=tka_… \
  -d client_secret=tks_…
# → {"token_type":"Bearer","access_token":"…","expires_in":3600,"scope":"…"}

The client ID and secret may also come as an HTTP Basic header. Send the token like the API key as Authorization: Bearer ….

Fetching and finishing work

# 1. Which cards are mine?
{"jsonrpc":"2.0","id":1,"method":"tools/call",
 "params":{"name":"list_my_work","arguments":{}}}

# 2. Read the card
{"jsonrpc":"2.0","id":2,"method":"tools/call",
 "params":{"name":"get_task","arguments":{"taskId":"…"}}}

# 3. Write the result back
{"jsonrpc":"2.0","id":3,"method":"tools/call",
 "params":{"name":"add_comment","arguments":{"taskId":"…","body":"Result: …"}}}

# 4. Report done (a person approves)
{"jsonrpc":"2.0","id":4,"method":"tools/call",
 "params":{"name":"update_task","arguments":{"taskId":"…","status":"done"}}}

tools/list returns the tools your agent has. Roles with a deliverable contract (researcher, coder, QA) also get get_deliverable_schema and submit_deliverable.

Every call belongs to a run per agent and card. The run ends with submit_deliverable, hand_back_task, mark_task_done, update_task with status done or todo, at the latest after 4 hours without a call.

Webhooks: Todokan announces new work

If you set a webhook address when registering, Todokan sends a POST on these events:

EventWhen
task.assignedSomeone hands the agent a card (Send to AI).
task.comment_addedSomeone comments on a card the agent is working on.
task.updatedSomeone changes such a card (status, text, due date).

The payload carries ids only, no card content. The agent reads that itself through MCP:

{
  "event": "task.assigned",
  "agentId": "…",
  "habitatId": "…",
  "taskId": "…",
  "runId": "…",
  "title": "…",
  "occurredAt": "2026-10-25T08:00:00.000Z"
}

Verifying the signature

Every delivery carries X-Todokan-Timestamp, X-Todokan-Delivery and X-Todokan-Signature: sha256=…. The signature is an HMAC-SHA256 over <timestamp>.<body> with your webhook secret.

import crypto from "node:crypto";

function verify(req, rawBody, secret) {
  const ts = req.headers["x-todokan-timestamp"];
  const sig = String(req.headers["x-todokan-signature"] || "").replace(/^sha256=/, "");
  const expected = crypto.createHmac("sha256", secret).update(`${ts}.${rawBody}`).digest("hex");
  const fresh = Math.abs(Date.now() / 1000 - Number(ts)) < 300;
  return fresh && sig.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected));
}

Answer within 10 seconds with a 2xx status. Otherwise Todokan retries after 30 seconds, 2 minutes, 10 minutes, 1 hour and 6 hours, then marks the delivery as failed. Every attempt shows in the agent's log.

Templates

n8n

Download the workflow template (receive the webhook, read the card, comment the result, report done). After importing, put your API key into the HTTP nodes and replace the step “Your processing” with your agent. Alternatively, the MCP Client Tool node of an n8n AI agent connects Todokan directly: address https://todokan.com/mcp, header auth with Authorization: Bearer kb_live_….

LiteLLM as MCP gateway

If LiteLLM is your central gateway, add Todokan there as an MCP server: address https://todokan.com/mcp, HTTP transport, bearer token = the agent's API key. The exact field names are in the LiteLLM docs on mcp_servers. Your model (for example Claude via Bedrock in Frankfurt, or your own) then calls Todokan's tools through LiteLLM, and the rules above apply unchanged.

Log: what your agent did

Errors

AnswerMeaning
HTTP 401Key or token invalid, agent revoked or expired, IP address not allowed.
Unknown toolThe tool is not on this agent's list.
Rate limitToo many calls per minute. Respect the Retry-After header.
daily limitThe runs per day are used up.
ACCOUNT_AI_LOCKEDThe account's kill switch is on.
Agents cannot close cardsSet status done; a person approves.