Claude Code
Set up Claude Code to build with anfra, and connect it to anfra's MCP server
Claude Code can build your whole anfra project: connect your warehouse, write models and datasets, query them and build data apps. It needs two things from anfra: the anfra plugin, which teaches it how, and optionally the MCP server, which lets it query a published project on anfra BI Cloud or a running anfra serve.
Set up
Step 1: Install the CLI
The plugin drives the anfra binary, so install it first:
curl -fsSL https://anfra.ai/install.sh | bashOpen a new terminal afterwards so anfra is on your PATH. On Windows, install it inside WSL2, and run Claude Code there too. See Install the CLI for Windows and the installer options.
Step 2: Install the anfra plugin
anfra agent setup --agent claude-codeThis installs the anfra plugin from holistics/anfra-skills through Claude Code's own CLI, for your user, so it works in every project. Without --agent, it sets up every coding agent it finds on your machine. Run it again to update to the latest version.
Restart Claude Code to load the plugin. It brings:
- Skills to set up a project, write AML, write, check and run AQL queries, build data apps, and convert a Looker project.
- An
aql-writeragent that writes and validates a query in its own context, so several queries can be written in parallel. - Hooks that validate AML files as Claude edits them, and tell Claude at the start of a session when a newer anfra release is out.
Run in an anfra project, the command also writes an anfra block into the project's AGENTS.md, which tells Claude to use the skills there.
Step 3: Check the installation
anfra agent setup checkIt changes nothing. It reports the plugin installed in Claude Code and its version, and whether it is behind the latest release.
Use the skills
Claude picks the right skill for most requests on its own. To be sure, name the skill in your prompt. In Claude Code, the plugin's skills show with the plugin's name in front, such as anfra:anfra-build-data-app.
Example prompt
Use the anfra-build-data-app skill. Build a revenue overview with a monthly trend and revenue by region. Clicking a region should filter the trend.To start a new project, open an empty folder in Claude Code and ask it to use the anfra-setup-repo skill.
Connect to the MCP server
The skills work with the project on disk, through the anfra CLI. Add the MCP server when you want Claude to query data it can't reach that way, such as your organization's published project on anfra BI Cloud. Run it yourself, or connect to anfra BI Cloud, which hosts it for your organization. To compare, see Where your MCP server runs.
anfra BI Cloud
claude mcp add --transport http --scope user anfra https://us.anfra.ai/mcpThen run /mcp in Claude Code, select anfra and sign in in the browser it opens. When you approve the connection, you pick one organization, and Claude acts as you there, with your role.
--scope user makes the server available in every project. Leave it out to add it to the current project only, or use --scope project to save it in the project's .mcp.json and share it with your team.
If sign-in fails with a callback error, your admin may have limited where clients can return after sign-in. Ask them to allow http://localhost:*/* under Settings → Organization → MCP → Allowed callbacks. See MCP access.
Your machine or server
To query the project on your machine, run anfra serve and add the address it prints:
claude mcp add --transport http anfra http://127.0.0.1:7878/mcpIt needs no sign-in. For a self-hosted server behind your own authentication, pass the token with --header:
claude mcp add --transport http anfra https://data.example.com/mcp \
--header "Authorization: Bearer <token>"If you self-host with the anfra-hosting image, see Coding agents with MCP for the header to send.
Check the connection
Run /mcp in Claude Code. anfra should show as connected, with its tools. Then ask a question about your data.
Example prompt
Using the anfra MCP server, list the datasets I can query, then show last month's revenue by region.See Tools for what the server offers.
Related resources
- Install the CLI: the CLI, on every platform
- Set up your coding agent: the skills for every agent
- MCP on anfra BI Cloud: address, sign-in and admin controls
- MCP on anfra Core: address, self-hosting and tools
- OpenAI Codex and Cursor: the same setup for those agents