> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.labric.co/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.labric.co/_mcp/server.

# Connect an AI agent (MCP)

Labric hosts a [Model Context Protocol](https://modelcontextprotocol.io) server that exposes the Labric API as tools any MCP-compatible agent can call — Claude, Cursor, or your own agent framework.

## Endpoint

The server speaks streamable HTTP:

```
https://mcp.labric.co/mcp
```

## Authentication

Authenticate with a Labric API key, exactly as you would against the REST API:

```
Authorization: Bearer lbk_your_api_key
```

The MCP server holds no data of its own — every tool call forwards your key to the Labric API, which enforces scopes and row-level security. A read-scoped key can only call read tools.

## Connecting

### Claude Code

```bash
claude mcp add --transport http labric https://mcp.labric.co/mcp \
  --header "Authorization: Bearer lbk_your_api_key"
```

### Other MCP clients

Any client that supports streamable HTTP transport with custom headers works. A typical JSON configuration:

```json
{
  "mcpServers": {
    "labric": {
      "url": "https://mcp.labric.co/mcp",
      "headers": {
        "Authorization": "Bearer lbk_your_api_key"
      }
    }
  }
}
```

## Available tools

The tools mirror the [API Reference](/api-reference) one-to-one — they are generated from the same API schema.

| Tool                   | Description                                 | Scope |
| ---------------------- | ------------------------------------------- | ----- |
| `read`                 | Read records from a table with filters      | read  |
| `execute_sql`          | Run a read-only SQL query                   | read  |
| `get_schema`           | Inspect table schemas                       | read  |
| `list_files`           | List files in your organization             | read  |
| `get_file_content`     | Download a file's content                   | read  |
| `write`                | Write records to a table                    | write |
| `batch_write`          | Write records to multiple tables atomically | write |
| `upload_file`          | Upload a file                               | write |
| `revert_job_execution` | Revert the writes of a job execution        | write |