Connect an MCP client and let the agent quote itself
What you'll build: a working connection from an MCP-capable client to the hosted server, with a read-only scoped token, and a prompt pattern that makes the agent quote a job before it runs it.
| Section | Agents & MCP |
|---|---|
| Actions used | POST /mcp |
| Credits | Free — these endpoints never bill |
| Test-key safe | No — needs a live key |
| Time to complete | ~10 min |
| Prerequisites | Owner or admin access to a workspace, so you can mint a qm_ token, and a client that lets you set custom request headers. |
One endpoint, Streamable HTTP
The server speaks JSON-RPC 2.0 over Streamable HTTP at a single endpoint. Call tools/list to discover the tools your token can actually reach, rather than trusting a list copied from a page like this one.
# JSON-RPC 2.0 over Streamable HTTP, one endpoint.
curl -X POST https://api.qannasapi.com/mcp \
-H "Authorization: Bearer $QANNAS_MCP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}'
# Trust this over any tool list copied from a page — it reflects
# the scopes your token actually carries.Mint a scoped token
Tokens are shown once at creation and carry read-only scopes, deny-by-default. There is no write scope to withhold: a token can look things up and can never change, send, or delete anything. Revoke is instant.
// Any client with a custom-headers field connects today.
{
"mcpServers": {
"qannas": {
"url": "https://api.qannasapi.com/mcp",
"headers": {
"Authorization": "Bearer qm_…"
}
}
}
}
// The token is shown once at creation. Store it then.Make the agent quote first
Workflow tools accept a dry_run quote, and asking for one costs nothing. Put the instruction in the system prompt — quote first and wait for approval — so an agent proposes a cost before it spends anything.
# Put this in the agent's system prompt.
# A dry_run quote is free, so there is no reason not to.
Before running any QannasAPI workflow tool, call it once with
dry_run: true, show me the credit quote, and wait for my
approval before running it for real.Know what MCP does not carry
Delta tracking is REST-only: since_cursor and track_delta are not exposed over MCP. Consensus contact lookups are REST-only too. And MCP calls always bill real credits — there is no test-key mode on this surface.
Summary
| Pattern | How |
|---|---|
| Transport | Streamable HTTP, JSON-RPC 2.0, one endpoint |
| Discover tools | tools/list — trust the token, not a copied list |
| Token | qm_ prefix, shown once, read-only scopes, instant revoke |
| Quote a job | dry_run on any workflow tool, always free |
| Not on MCP | Delta tracking and consensus lookups are REST-only |
| Billing | Real credits, always — no test-key mode |
Production checklist
- Call tools/list on your own token instead of hard-coding a tool list.
- Put "quote first, wait for approval" in the agent's system prompt.
- Mint one token per agent so revoking one does not disturb the rest.
- Store the token at creation — it is never shown again.
Next steps
Run the estimate first. It costs nothing and it is the same arithmetic the meter will apply.