MCP on anfra Core
Run anfra Core's MCP server yourself, and connect AI agents to the project on your machine or server
Run anfra Core's MCP server yourself to connect AI clients such as Claude, Cursor and Codex to the project on your machine or server, so they can browse your datasets and query your semantic layer.
Where your MCP server runs
anfra Core exposes the MCP server. Run it yourself, or publish your project to anfra BI Cloud, which hosts the server for your organization.
| Where it runs | Address | Sign-in | Data |
|---|---|---|---|
| Your machine or server | http://127.0.0.1:7878/mcp with anfra serve, or your own host when self-hosted | None, or a password when self-hosted | The project on your machine or server |
| anfra BI Cloud | https://us.anfra.ai/mcp | OAuth, as you | Your organization's project published to anfra BI Cloud |
It uses streamable HTTP in both places. To add the server to a coding agent, see Claude Code, OpenAI Codex, Cursor or other agents.
Connect to anfra Core
anfra serve serves MCP alongside your apps and the API:
anfra serve
# MCP http://127.0.0.1:7878/mcpclaude mcp add --transport http anfra http://127.0.0.1:7878/mcpIf another project's server already holds port 7878, anfra serve picks a free port. Use the address it prints, or run anfra status.
It needs no sign-in and uses the credentials in .anfra/data_sources.yml, so anyone who can reach it can query your warehouse. It listens on 127.0.0.1 only. Don't widen it with --addr unless you trust the network. Pass --no-mcp to turn it off.
Behind your own authentication
To self-host with a login page and passwords for agents already set up, see Self-host. This section is for running the plain image behind your own authentication instead.
The Docker image serves MCP at /mcp on port 7878, on every interface. Since it has no sign-in, put it behind your own authentication, such as an SSO proxy or a private network, and publish it only to people who may query all of the project's data.
If the proxy runs on the same host, publish the port on loopback only, with -p 127.0.0.1:7878:7878 instead of -p 7878:7878. If the proxy is a container on the same Docker network, don't publish the port at all. If you publish it with -p 7878:7878, anyone who can reach the host can skip the proxy and connect to port 7878 directly.
Clients that support custom headers can pass the proxy's token:
claude mcp add --transport http anfra https://data.example.com/mcp \
--header "Authorization: Bearer <token>"When serving others, also set ANFRA_HIDE_ERROR_CAUSES=1 so errors don't reveal SQL, database messages or file paths. For a role per person and OAuth sign-in, publish to anfra BI Cloud instead.
Tools
Each operation is a tool, with read-only hints so your client can approve reads without asking. The main ones:
| Tool | What it does |
|---|---|
show | List datasets, or one dataset's models, fields and metrics |
search | Search the catalog for models, fields and metrics |
lineage | Trace a field back to what it's built from |
query | Run an AQL query and return rows and SQL |
query.validate, query.compile | Check a query, or compile it to SQL, without running it |
query.export | Export a query's full result as a file |
On anfra BI Cloud, these are prefixed with core. (for example core.query), and there are tools for the organization's connections (called data sources in the tools), Data Apps and jobs. Which ones you see depends on your role.
Two more tools describe the rest: list_operations lists every tool you can call, and describe_operation explains one.
Teach your agent AQL
MCP gives an agent access, not fluency. Install the anfra skills so it writes correct AQL the first time.