# AI agents and MCP

How to let an AI coding agent such as Claude Code, Cursor, Claude Desktop or Windsurf work on your Solidafy project: the knowledge files `solidafy init` writes for it, the Solidafy MCP server, how to connect each client, and which tools the server exposes.

## What the agent gets

An agent working on a Solidafy project draws on two things:

1. **Knowledge in the project folder.** `solidafy init` writes files that explain Solidafy's conventions, so the agent does not have to guess.
2. **Tools over MCP.** The Model Context Protocol (MCP) is a standard way for an AI client to call tools. The Solidafy MCP server gives the agent tools to list tables, run queries, push pipelines, test charts and more, as you.

With both in place you can open the project in your agent and describe what you want, for example "add a weekly chart of merged pull requests per team to the delivery dashboard and test it". The agent reads the rest itself.

## The knowledge files

| Path | What it is |
| --- | --- |
| `CLAUDE.md` | The entry point. Orients the agent, points it at the skills and guides, and lists the everyday commands. Despite the name, any agent can read it. |
| `.claude/skills/solidafy-cli/SKILL.md` | Operating the CLI safely: the command model, the standard edit, validate, test, push, run loop, and the rules to follow. |
| `.claude/skills/solidafy-dsl/SKILL.md` | DSL syntax, output modes, functions, and the mistakes that cause silent bugs. Agents are told to read it before writing any DSL. |
| `.claude/skills/solidafy-medallion/SKILL.md` | Building a pipeline chain from raw to bronze, silver and gold: choosing output modes, resolving the same person across systems, and keeping non-work out of metrics. |
| `docs/` | The full reference guides (DSL, charts, filters, alerts, liveboards, reports, security policies, API). |
| `examples/` | Example pipelines, liveboards and reports to copy and modify. |

Claude Code loads the skills on its own when they are relevant. Other agents follow the pointers in `CLAUDE.md`.

These files belong to the CLI. `solidafy update` rewrites them to match the installed version, regenerates `CLAUDE.md`, and deletes a top-level `AGENT.md` and the `.claude/agents/` folder if they exist. Put your own project notes in a different file.

## Local or hosted server

You can run the Solidafy MCP server in two ways. Both expose the same toolkit.

![Local or hosted MCP server, with the same toolkit. Local runs as solidafy mcp serve, started by your AI client, signs in with your project's environment token, uses the project's active environment, needs the CLI and a project, and can read and write project files; best for Claude Code and Cursor. Hosted runs at mcp.solidafy.com/mcp on Solidafy's servers, signs in with a token or OAuth in the browser, has its environment fixed when you connect, needs nothing installed and has no access to project files; best for Claude Desktop.](/illustrations/mcp-local-hosted.svg)

Use the local server when the agent works inside your project folder (Claude Code, Cursor). Use the hosted server for a chat client that has no project folder (Claude Desktop).

## Connecting Claude Code

From the root of your project:

```bash
solidafy mcp install
```

This registers the local server in `.mcp.json` in the current directory. The entry runs your `solidafy` binary with `mcp serve`. It contains no token, but it does contain the full path to the binary on your machine, so each person on the team should run `solidafy mcp install` themselves. Restart Claude Code to pick it up.

With `--global` it registers the server in `~/.claude.json` instead, for every project. The local server always uses the project of the directory the client starts it in.

To use the hosted server instead:

```bash
solidafy mcp install --http
```

> **Warning:** With `--http`, the configuration file contains your personal access token in plain text. Do not commit a `.mcp.json` that has a token in it.

`solidafy init` also records the server in `.claude/settings.json`. `solidafy mcp install` is the command that registers it with Claude Code.

## Connecting Cursor

```bash
solidafy mcp install --client cursor
```

This registers the hosted server in `.cursor/mcp.json` in the current directory, or in `~/.cursor/mcp.json` with `--global`. The entry includes your personal access token, so keep the file out of git.

Alternatively, add the server through Cursor's own MCP settings with the URL `https://mcp.solidafy.com/mcp` and no token. Cursor then opens a browser so you can sign in (see [Signing in with OAuth](#signing-in-with-oauth)).

## Connecting Claude Desktop

The simplest way is to add Solidafy as a custom connector in Claude Desktop's settings, with:

- **Name:** `Solidafy`
- **URL:** `https://mcp.solidafy.com/mcp`

Claude Desktop opens a browser so you can sign in (see [Signing in with OAuth](#signing-in-with-oauth)). No token is stored on your machine.

If you prefer a token, run:

```bash
solidafy mcp install --client claude-desktop
```

Claude Desktop's configuration is global, so this applies everywhere. The entry connects through `mcp-remote`, a small bridge program: the CLI uses `mcp-remote` if it is on your `PATH`, and otherwise `npx -y mcp-remote`, which needs Node.js. Installing it once (`npm install -g mcp-remote`) makes start-up faster. Quit Claude Desktop completely and reopen it afterwards.

## Connecting Windsurf

```bash
solidafy mcp install --client windsurf
```

Windsurf has one global configuration file, `~/.codeium/windsurf/mcp_config.json`. Like Claude Desktop, it connects through `mcp-remote` with your token. Restart Windsurf afterwards.

## Which token `mcp install` uses

For the hosted server, `mcp install` takes the token from, in order:

1. `--token <token>`
2. The active environment's `.env` file, when you run it inside a project
3. The `SOLIDAFY_PAT` environment variable

`--url <url>` points the configuration at a different server URL.

## Checking and removing

```bash
solidafy mcp status                       # which clients have Solidafy registered, and how
solidafy mcp uninstall                    # remove it from every known client config
solidafy mcp uninstall --client cursor    # or from one client only
```

`mcp status` and `mcp uninstall` look at the project-level config in the current directory and at each client's global config.

## Signing in with OAuth

When a client connects to `https://mcp.solidafy.com/mcp` without a token, the server tells it where to sign in, and the client opens a browser:

1. Sign in to Solidafy if you are not already.
2. On the **Connect ... to Solidafy** page, pick the **Environment** the client may act on. Environments are grouped by organisation.
3. Choose **Authorize**.

The connection stays tied to that environment. Switching environments in the portal does not move it; to use a different one, remove the connector and connect again. Access tokens from this flow last 30 days and refresh tokens 90 days. If the page says you do not belong to any environments, ask an admin to add you to one.

What the connection may do depends on the scopes the client was granted. A grant with only `mcp:read` can read, run DSL queries, and run Data Explorer and app tools, but any tool that changes something fails with `This MCP authorization cannot call that operation`. A grant that includes `mcp:write` has no such limit, and it is what clients get unless they ask for less. The connection also stops working as soon as you are deactivated or lose access to its organisation or environment.

## What the agent can do

The server registers these tools. The agent sees each tool's description and arguments, so you rarely need to name them yourself.

**Exploring data**

| Tool | What it does |
| --- | --- |
| `list_tables` | Every table, with namespace and column count. |
| `get_table_schema` | Column names and types for one table. |
| `query_dsl` | Runs a read-only DSL query. |
| `execute_dsl` | Runs a DSL query that writes (ends in `.output(...)`), as a temporary job. |
| `get_environment` | The environment and API URL the server is bound to. |
| `switch_environment` | Changes the active environment (local server only). |

**Pipelines and runs**

| Tool | What it does |
| --- | --- |
| `list_pipelines`, `get_pipeline` | List pipelines, or fetch one in full. |
| `pull_pipelines` | Pipelines as YAML, returned inline or written to a folder. |
| `get_pipeline_index` | A summary of one pipeline: steps, charts and filters. |
| `validate_pipeline` | Checks pipeline YAML before pushing. |
| `push_pipeline` | Creates or updates a pipeline from YAML. |
| `delete_pipeline` | Deletes a pipeline permanently. |
| `get_step_dsl`, `update_step_dsl` | Read or change one step's DSL. |
| `trigger_run`, `get_run_status`, `wait_for_run` | Start a run, read run history, or wait for a run to finish. |
| `check_seeds` | Checks that a pipeline's seed tables are in sync, and can fix them. |
| `list_triggers` | Pipeline-to-pipeline triggers. |
| `enable_webhook`, `get_webhook` | Turn on, or read, a pipeline's webhook. |

**Dashboards, liveboards and reports**

| Tool | What it does |
| --- | --- |
| `list_dashboards`, `get_dashboard` | List dashboards, or fetch one in full. |
| `get_dashboard_context` | A dashboard's chart titles, working DSL, result columns and filters, as examples for writing new queries. |
| `push_dashboard` | Publishes a dashboard from a pipeline YAML file. |
| `get_chart_dsl`, `update_chart_dsl`, `test_chart_dsl` | Read, change, or run one chart's query against live data. |
| `get_filter`, `update_filter` | Read or change a dashboard filter. |
| `push_liveboard` | Creates or updates a liveboard from a file. |
| `list_reports`, `get_report`, `create_report`, `update_report`, `delete_report` | Manage reports. |
| `list_report_versions`, `get_report_version`, `restore_report_version` | Report version history. |
| `publish_report`, `share_report`, `unshare_report` | Publish a report, or create and revoke a public link. |

**Sources, catalog and access**

| Tool | What it does |
| --- | --- |
| `list_connectors`, `get_connector` | Available connectors, and one connector's configuration fields. |
| `list_pipeline_templates`, `get_pipeline_template` | Ready-made pipeline templates. |
| `list_products` | Solidafy products. |
| `list_datasources` | Data sources, with credentials hidden. |
| `create_datasource` | Creates a data source without credentials and returns a portal link where you enter them yourself. |
| `list_channels` | Notification channels. |
| `list_policies`, `list_security_groups` | Row-level policies and security groups. |
| `clean_table`, `purge_table` | Remove stale snapshot files from a table, then delete them for good. `clean_table` has a dry run. |

Tools that take a `file` argument read and write files in your project, which only the local server can do. Most of them also accept a `pipeline_id` instead, which works on both.

### Write guards for agents

`execute_dsl`, `clean_table` and `purge_table` take a `force` argument. Against an environment named `production` or `prod` they refuse to run unless `force` is true, the same rule as `solidafy dsl -x --force` (see [Write guards](/docs/cli/environments#write-guards)). On the hosted server, these tools always require `force: true`.

The server also sends the agent a short set of instructions when it connects: start from the curated tables, check a table's schema before querying it, and treat an empty result as a finding rather than an error.

## Data Explorer tools for a wider audience

The full toolkit is for people who build on Solidafy. For everyone else, an environment can publish **Data Explorer** tools: a fixed set of named questions, each backed by a query you write, with typed filters the caller can set. A caller never sees or writes DSL. These tools are served at a separate address, `https://mcp.solidafy.com/mcp-public`, which offers none of the full toolkit. They run with the caller's own permissions, so row-level policies apply. The same address also serves [app tools](#app-tools).

You describe the set in an `mcp.yml` file and sync it with `solidafy mcp push`:

```yaml
tools:
  - name: open_pull_requests
    description: Open pull requests, newest first
    base_dsl: 'source("silver.pull_requests").filter(state == "open")'
    filterable_fields:
      - field: repo
        type: string
        operators:
          - "="
          - in
      - field: created_at
        type: date
        operators:
          - ">="
          - between
    order_by:
      - created_at
    default_limit: 50
    max_limit: 500
```

| Field | Description |
| --- | --- |
| `name` | Tool name. Must be unique in the file. |
| `kind` | `query` (the default) or `action`. |
| `base_dsl` | The query the tool runs. Required for `query` tools. |
| `description` | What the tool answers. The caller's AI picks tools by this. |
| `filterable_fields` | The fields a caller may filter on. Each has a `field`, a `type` (`string`, `number`, `boolean` or `date`), the allowed `operators` (any of `=`, `!=`, `<`, `>`, `>=`, `<=`, `in`, `between`, `contains`), and optionally `options` (a closed list of allowed values) and `required`. |
| `default_limit`, `max_limit` | Row limits. |
| `order_by` | Columns to sort by. |
| `enabled` | Set `false` to publish the tool switched off. |
| `action` | For `kind: action` only: `type` (`write` or `read`), `dataset`, and `key_field`, which must be one of the tool's `filterable_fields`. |

Callers can pass `filters`, `limit`, `offset` and `count_only` to every query tool.

```bash
solidafy mcp push mcp.yml --dry-run   # show what would be created, updated or disabled
solidafy mcp push mcp.yml             # apply, after a confirmation prompt
```

Tools in the environment that are missing from the file are disabled. With `--prune` they are deleted instead. `--yes` skips the confirmation prompt. The CLI checks the whole file before sending anything and rejects it if any tool is invalid.

### App tools

`https://mcp.solidafy.com/mcp-public` also serves the tools of every installed app the caller can open. Each tool answers as that person, with the app's own access checks, so nobody gets more than they could see in the app itself. Every argument is optional and narrows the answer.

| App | Tools | Arguments |
| --- | --- | --- |
| [Engineering Delivery](/docs/engineering-delivery/overview) | `get_delivery_update`, `get_review_update`, `get_worth_a_look`, `list_goals`, `get_standup`, `get_retro` | `team` |
| [Review Agents](/docs/code-review/review-agents-app) | `get_review_agents_overview`, `list_review_agents_pull_requests`, `get_review_agents_supply_chain` | `repo`, `team`, `days` (`7`, `30` or `90`) |
| [FinOps](/docs/finops/overview) | `get_finops_overview`, `list_finops_spend`, `list_finops_savings`, `run_finops_savings_review` | `team`, `period`, `group` |
| [SecOps](/docs/secops/overview) | `get_security_overview`, `list_urgent_fixes`, `get_security_finding` | `team`, `source`, `severity`, `target`, `ref` |

App tools are not part of your `mcp.yml`, so `solidafy mcp push` never disables or deletes them, not even with `--prune`. If a Data Explorer tool has the same name as an app tool, the app tool wins and the Data Explorer tool is left out.

When there are neither Data Explorer tools nor app tools for the caller, `/mcp-public` offers a single `data_explorer_status` tool instead. It tells the agent that no data views are published for the environment yet and that an admin can publish them.
