Every team building agents is wiring them to data, and most are doing it one integration at a time: a connector here, a hand-written tool there, a service account with too much access underneath. The Model Context Protocol gives agents a standard way to discover and call tools. InsightCompose uses it to serve the one thing agents most need and most often get wrong: governed, fresh context from your warehouses.
This post covers how published contexts become MCP tools, how an agent connects, and what happens on every call. It continues our context management series.
Contexts as tools
When a context is published in InsightCompose, it becomes available as a tool on the product's MCP server at /mcp. No separate integration is written. The context's declaration already contains everything a tool needs:
- Name and description. The tool's name comes from the context key; its description combines the title, the example phrasings and the freshness promise, so an agent knows both what the tool answers and how current the answer is.
- Input schema. The typed parameters, with their defaults, bounds and allowed values, become a JSON schema. A well-behaved client will not even offer an out-of-range value; if one arrives anyway, the layer refuses it with the field name.
- Output. Typed rows with labels and units, plus
as_of, the freshness promise, whether the result was truncated and whether masking applied.
Because the tool list is the list of published contexts the caller is allowed to see, an agent never sees a tool it cannot call. Retire a context and its tool disappears; publish a new version and the tool reflects it.
Connecting an agent
The Connect an agent panel in the product gives copy-ready setup for the common MCP clients: Claude Code, Claude Desktop, Cursor and VS Code, plus a generic configuration for your own agents. It shows the endpoint for your deployment and lets an administrator mint a key with the right scopes. The examples below use placeholder hosts and keys.
Claude Code
claude mcp add --transport http insightcompose https://compose.your-company.com/mcp \ --header "Authorization: Bearer $INSIGHTCOMPOSE_KEY"
Clients that read an mcpServers file
{
"mcpServers": {
"insightcompose": {
"type": "http",
"url": "https://compose.your-company.com/mcp",
"headers": { "Authorization": "Bearer ${INSIGHTCOMPOSE_KEY}" }
}
}
}
Keep the key in an environment variable or your client's secret store rather than in the file. For clients and environments that prefer a local process, the server also runs over stdio, either directly or as a thin proxy to your deployment, so a desktop client can talk to a local command that forwards to the governed endpoint.
Interactive clients can sign in instead. Alongside API keys, the server accepts OAuth 2.1 tokens from your identity provider. It publishes the standard protected-resource metadata, so a client that supports it can discover where to sign in, and the agent then acts as the person who signed in, with that person's scope.
What happens on every call
An MCP server that simply forwards tool calls to a database is a faster way to leak data. The InsightCompose server puts every call through one guarded path, the same pattern our platform uses for its catalog MCP server:
- Principal. The bearer token is resolved to a principal: an API key or an OAuth identity. No token, or an invalid one, gets a 401 with the header that tells a client how to authenticate.
- Scope per tool. Each tool requires a scope, and a key holds only the scopes it was granted. A key minted for one team's contexts cannot call another team's.
- Rate limit. Each key has a rate limit, so a looping agent slows down instead of hammering the warehouse.
- Tenant scope. The principal resolves to an organization, a book and a data-class ceiling. The server never accepts a request for another organization's data.
- Run the context. The context runs exactly as it would over REST: parameters validated and bound, row scope from the caller, read-only, statement timeout, row cap, masking for callers without clearance, served from cache when the freshness promise allows.
- Redaction and size cap. The result is redacted against the caller's ceiling and capped in size, so one call cannot flood a model's context window or carry more than it should.
- Audit. One audit row per call: principal, tool, a hash of the arguments, status, size and timing.
The server is stateless, so any replica can answer any request, and it sits behind the same network controls as the rest of your deployment.
Why not let the agent write SQL?
Agents can write SQL, and InsightCompose has a guarded SQL engine for open-ended questions. But for the questions your business asks every day, a tool that calls a reviewed context is better in every way that matters to an enterprise:
| Agent writes SQL | Agent calls a context | |
|---|---|---|
| Definition | Re-derived on each question | Reviewed once, versioned |
| Scope | Whatever the connection sees | The caller's book and organization |
| Personal data | Seen, then hopefully withheld | Masked before it leaves the server |
| Freshness | Unknown to the agent | as_of on every answer |
| Cost | Unbounded | Bounded parameters, timeout, row cap, cache |
| Audit | A query log, if any | Who, which context and version, what came back |
The agent still decides which context to call and with what parameters. That is the part models are good at. The definition, the scope and the safeguards stay with the layer.
Calling external MCP servers too
MCP runs in both directions. Besides serving contexts, InsightCompose can register external MCP servers, for example a ticketing system or a document store, as sources for its own assistant and insights. Those calls go through a registry with per-server allow-lists of tools, approval for tools that write, egress checks on every endpoint, result size limits and an audit row per call. Tool results are treated as data, capped and redacted, and never executed as instructions.
Getting started
Publish one context, mint a key scoped to it, paste the configuration into Claude Code or Cursor, and ask the agent the question in your own words. You will see it pick the tool, fill in the parameters and quote the answer with its as_of. The MCP for agents page has the details, and the docs list every field. If you would rather see it on your own data first, ask us for a working session.
Where people stay in charge
An administrator decides which agents may connect, by minting keys and granting scopes per tool, and can revoke a key at any time. Data owners decide which contexts are published, and so which tools exist. The agent decides only which published tool to call and which allowed values to pass. Every call is audited with the principal behind it, so a person can see exactly what each agent asked for, and what it was given.