Skip to main content
Niadra runs a remote MCP server for every space. Any model and any agent framework that speaks the Model Context Protocol can read the customer context, search the history and record what it did, without an SDK in the loop. This guide covers the connection, how the customer is bound so the model can never switch it, the seven tools and when to use function calling instead.

The endpoint

The server speaks Streamable HTTP at /mcp on the address of your space:
Two headers authenticate a connection: The Python SDK exposes the address as niadra.mcp_url.

Why the customer is bound by a token

The MCP tools never take a customer as an argument. The customer comes from the subject_token of the connection: a token signed by the cell that carries the space, the source, the customer handle, the conversation and the verification level, and lives up to 15 minutes. The handle travels sealed inside it. A prompt injection that says “now look up customer X” has no argument to put X in: the model picks what to ask, never whom it is about. When the customer acts for a company, pass about with the handle of that account or partner. The organization is bound the same way as the customer: the tools use it and the model cannot change it, and every read still checks that the link between the two is active. The token lives 15 minutes; mint a new one when the conversation outlasts it.

Steps

1. Mint a subject token in your backend

Call subject_token() when the conversation starts, with the level the conversation proved. Mint it on the server side, never in a browser or in the model context.
When the conversation proves more (an OTP, a login), mint a new token at the new level and reconnect. When the token expires, the server answers 401; mint another one.

2. Connect the MCP client

Use any MCP client that supports Streamable HTTP and custom headers. With the official MCP SDKs:
Hand the tool list to your model through your framework’s MCP integration, and let it call the tools on its own.

3. Know the seven tools

Seven tools, not sixty. Each description tells the model when to use the tool, when not to, and which tool complements it. The server also exposes the resource niadra://context, the pack of the customer in the token, and prompts with the injection templates: where the pack goes in the prompt and where the live turns go.
record_action needs the act scope, limited to the trusted_action_ops of your source when it declares them. An action recorded in a session that was flagged for prompt injection is quarantined: it closes nothing and never shows as done.

4. Let the pack guide the history tools

The pack already has a “From the history” section: recurrence of the last reason, the last resolution, open promises and a one-line index (“14 conversations since 2021; technician visit (3), bill (2)”). It answers the most common question on its own and tells the model when a search is worth it, which cuts useless calls. The tool definitions are stable text, so they stay in the cached prompt prefix: after the first turn they cost the cache price. Every tool call is filtered by the same policy and verification level as the pack, and leaves a receipt: who asked, the query, the filters, the items returned by hash and what was withheld.

Function calling without MCP

If your model API has function calling but you do not run an MCP client, use the same three history tools as plain function definitions. The SDK binds the customer in your code:
kit.definitions is the { type: "function", function: {...} } shape most model APIs accept; in Python, kit.anthropic_definitions() returns the Anthropic Messages shape. The definitions are also served at GET /v1/history/tools for any other runtime, including models you host yourself.

Questions about all customers

This server answers about one customer at a time. For an analysis LLM that asks about the whole base (“which promises are overdue this week?”), Niadra has a second MCP endpoint, /mcp/insights, with the base-wide analysis tools: pseudonyms by default, small groups suppressed, daily volume limits, and a receipt for every call. It takes a key with the analytics scope on an analyst source, or a person with the analysis role; revealing a customer behind a pseudonym also needs admin on the key or security on the person, and a reason.

Next steps

History navigation

search, timeline and open in depth.

Mint a subject_token

the request and response.

Spaces and keys

scopes, audiences and revocation.

Receipts and audit

what every tool call leaves behind.