> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usecroma.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP

> Call Croma's data sources as tools over MCP, using your API key.

Croma exposes every data source as a tool over the [Model Context
Protocol](https://modelcontextprotocol.io) (MCP), served over Streamable HTTP
at:

```
https://api.croma.run/mcp
```

Any MCP client can connect. Interactive clients (Claude, ChatGPT, Cursor) use
the OAuth flow, but for your own code you authenticate with the **same API key
as the REST API**: send it as a bearer token and the tools run scoped to your
organization, sharing the same [rate limits](/rate-limits) and usage.

## Use it from the AI SDK

The [AI SDK](https://ai-sdk.dev) can load the Croma tools directly and hand them
to a model for tool calling. Pass your key in the `Authorization` header of the
transport:

```ts theme={"dark"}
import { experimental_createMCPClient as createMCPClient, generateText } from "ai";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
import { anthropic } from "@ai-sdk/anthropic";

const mcp = await createMCPClient({
  transport: new StreamableHTTPClientTransport(
    new URL("https://api.croma.run/mcp"),
    {
      requestInit: {
        headers: { Authorization: `Bearer ${process.env.CROMA_API_KEY}` },
      },
    },
  ),
});

// Every data source, exposed as a tool the model can call.
const tools = await mcp.tools();

const { text } = await generateText({
  model: anthropic("claude-opus-4-8"),
  tools,
  // Let the model call tools and then answer. Consult the AI SDK docs for the
  // multi-step setting in your version (`stopWhen` / `maxSteps`).
  prompt: "Consulta los antecedentes de la Policía Nacional para la cédula 1234567890.",
});

await mcp.close();
console.log(text);
```

<Warning>
  Treat the key as a secret: load it from an environment variable or secrets
  manager, never commit it, and close the client (`mcp.close()`) when you are
  done so the connection is released.
</Warning>

## Tool names

Tools are named after their source, with underscores instead of hyphens, for
example `policia_criminal_records`, `rues_entity_by_nit`, and
`rama_judicial_cases_by_radicado`. Call `mcp.tools()` to list the full set with
their input schemas, or browse the [API reference](/api-reference) for the
fields each one accepts.

[Async lookups](/async-jobs) always wait inline over MCP: the tool call returns
the finished result, with no `202`, polling, or callbacks.

## Any MCP client

The AI SDK is one option. Because the endpoint speaks standard MCP over
Streamable HTTP, the official
[MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk),
LangChain, and other MCP-aware frameworks connect the same way: point them at
`https://api.croma.run/mcp` and set the `Authorization: Bearer` header.
