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

# MCP server

> Connect an agent to bryel over MCP — query traces, build datasets, fine-tune, and run evals, scoped to one project.

bryel exposes a remote [MCP](https://modelcontextprotocol.io) server so an agent
(Claude, Cursor, or your own) can work with your data directly: explore traces,
turn them into fine-tune datasets, kick off training, and run evals — all scoped
to a single project, with read or write access you grant at connect time.

```
https://app.bryel.ai/api/mcp
```

## Connect

Add the server URL in any MCP client that supports remote servers with OAuth:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "mcpServers": {
    "bryel": { "url": "https://app.bryel.ai/api/mcp" }
  }
}
```

On first connect you're sent through OAuth: sign in, **pick a project**, and
choose **read** or **read + write**. The connection is bound to that project — the
agent never names one, and every call is re-checked against your access.

<Note>Write tools (creating datasets, starting training/evals) only work if you granted **write** at consent. To change it, reconnect and re-consent.</Note>

## Tools

### Explore

<ParamField path="bryel_get_schema" type="read">The queryable trace fields, their types/operators, and this project's live intent labels + model names. Call it first.</ParamField>
<ParamField path="bryel_validate_query" type="read">Check a BQL filter for errors (with did-you-mean) without running it.</ParamField>
<ParamField path="bryel_query_traces" type="read">Run a BQL filter over the project's traces — match count + a sample.</ParamField>
<ParamField path="bryel_trace_stats" type="read">The project's inefficiency + cost breakdown, aggregated in ClickHouse.</ParamField>

### Datasets

<ParamField path="bryel_list_datasets" type="read">List the project's fine-tune (SFT) datasets with record counts.</ParamField>
<ParamField path="bryel_inspect_dataset" type="read">A dataset's training-data quality: intent distribution, redundancy, trajectory health.</ParamField>
<ParamField path="bryel_create_dataset" type="write">Create a new empty SFT dataset.</ParamField>
<ParamField path="bryel_add_records" type="write">Add `{messages, tools?}` trajectories to a dataset.</ParamField>
<ParamField path="bryel_add_from_query" type="write">Build a dataset from real runs — every trace matching a BQL filter, reconstructed into a training record.</ParamField>
<ParamField path="bryel_export_dataset" type="write">Export a dataset as fine-tune JSONL to bryel storage. Returns a `jobId`.</ParamField>
<ParamField path="bryel_export_status" type="read">Poll an export job; once succeeded, a presigned download URL.</ParamField>

### Training

<ParamField path="bryel_list_presets" type="read">The fine-tune presets (recipes): slug, base model, loop kind, expected data shape.</ParamField>
<ParamField path="bryel_start_training" type="write">Start a fine-tune from a dataset + preset. Metered — pass `max_spend_usd` to cap it. Returns a `runId`.</ParamField>
<ParamField path="bryel_training_status" type="read">Poll a training run: status, progress, loss, cost, and the weights download when done.</ParamField>

### Evals

<ParamField path="bryel_list_eval_suites" type="read">The eval suites (benchmarks) in the project: slug, name, default judge model.</ParamField>
<ParamField path="bryel_start_eval" type="write">Create one run per case × model for a suite. Returns each run's `sessionId` + case `prompt` for your harness to drive (see [evals](/guides/evals)).</ParamField>
<ParamField path="bryel_eval_results" type="read">A suite's leaderboard over scored runs — overall, by model, and by case.</ParamField>

<Note>These are the same operations as the [dashboard](https://bryel.ai) — the MCP server just lets an agent drive them.</Note>
