Before you start

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.

json
{
  "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.

bash
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.

bash
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.

  1. create_task needs task:create.

  2. open_case needs case:create.

  3. start_mission needs mission:assign and spends your AI allowance. Start with create_task. Ask your agent to create a task in a test project and check it in the app.

Three signs.

  1. tools/list returns the tools you expect for that key and no more.

  2. A write call under the read-only key answers "The tool is not available." (code -32602).

  3. In Administration, API keys, the key shows a recent "Last used".

When it does not connect.

  1. 401. The key is wrong, revoked or expired, or does not start with qk_. This server does not accept OAuth tokens.

  2. 403. The Origin header was foreign. Call from a server, not a web page.

  3. 405. Your client sent GET or opened a stream. Only POST is accepted.

  4. 413. The request body is over 65,536 bytes.

  5. 429. The key's 100 requests a minute are spent. Wait for Retry-After.

  6. "busy". Four tool runs are active in the service, or two for your organisation. Retry.

  7. "too large". The result is over 60,000 characters. Ask for a smaller page.

  8. A tool is missing. The key lacks a scope. Make a key with it.

Then.