Connect an agent over MCP
What you need.
Read first.
In Administration, API keys, make a key named "MCP read-only". Tick customer:read and any other read scopes you want the agent to see. Copy it once and keep it in $TERANIA_KEY. See Authentication.
One address and one header.
Most clients accept a JSON config. The shape differs between clients, so treat this as the generic form and map it to yours.
{
"mcpServers": {
"terania": {
"url": "https://app.terania.ai/api/v1/mcp",
"headers": {
"Authorization": "Bearer ${TERANIA_KEY}"
}
}
}
}Ask what the key allows.
You can test without a client. This shows the raw call: it starts with initialize, then asks for the tool list.
curl -s "https://app.terania.ai/api/v1/mcp" \
-H "Authorization: Bearer $TERANIA_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"quickstart","version":"1"}}}'
curl -s "https://app.terania.ai/api/v1/mcp" \
-H "Authorization: Bearer $TERANIA_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'List customers.
Ask your agent to list customers, or call the tool directly.
curl -s "https://app.terania.ai/api/v1/mcp" \
-H "Authorization: Bearer $TERANIA_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"list_records","arguments":{"kind":"customer","limit":5}}}'Add one scope, not all of them.
Make a second key. For tasks tick task:create. An act tool is listed only when the key holds every scope its actions need, so create_task stays hidden from a key that holds only mission:assign.
create_taskneedstask:create.open_caseneedscase:create.start_missionneedsmission:assignand spends your AI allowance. Start withcreate_task. Ask your agent to create a task in a test project and check it in the app.
Three signs.
tools/listreturns the tools you expect for that key and no more.A write call under the read-only key answers "The tool is not available." (code -32602).
In Administration, API keys, the key shows a recent "Last used".
When it does not connect.
401. The key is wrong, revoked or expired, or does not start with qk_. This server does not accept OAuth tokens.
403. The
Originheader was foreign. Call from a server, not a web page.405. Your client sent GET or opened a stream. Only POST is accepted.
413. The request body is over 65,536 bytes.
429. The key's 100 requests a minute are spent. Wait for
Retry-After."busy". Four tool runs are active in the service, or two for your organisation. Retry.
"too large". The result is over 60,000 characters. Ask for a smaller page.
A tool is missing. The key lacks a scope. Make a key with it.