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

# Local MCP server

> Let your AI agent query data with Chowder.

Connect an MCP client to a local Chowder MCP server. The client launches a local `chowder mcp` process that exposes a `query` tool.

## Configure your client

Follow [Installation](https://docs.chowder.ai/installation.md#install-the-cli) to set up Chowder, then check the command:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
chowder mcp --help
```

Add Chowder to an MCP client that supports stdio servers. For clients that use an `mcpServers` configuration object:

```json theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
{
  "mcpServers": {
    "chowder": {
      "command": "chowder",
      "args": ["mcp"]
    }
  }
}
```

If your client cannot find `chowder` on its PATH, replace `command` with the absolute path to the executable. This is especially useful for desktop clients and source or virtual-environment installations.

The client starts the server and communicates over stdin and stdout. Let the client manage the process.

## Choose a working directory

Set an explicit working directory so relative data paths resolve consistently:

```json theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
{
  "mcpServers": {
    "chowder": {
      "command": "/absolute/path/to/bin/chowder",
      "args": [
        "mcp",
        "--directory",
        "/path/to/project",
        "--cache-dir",
        ".chowder-cache"
      ]
    }
  }
}
```

Replace the example paths with your executable and project directory. Relative source paths and the relative cache directory resolve from `/path/to/project`. Without `--directory` (or `-C`), the server uses the working directory supplied by the client.

> [!WARNING]
>
> The server executes SQL with the process's filesystem access and credentials. `--directory` sets path resolution; it does not restrict access to that directory. Queries can have side effects, including creating session views and contacting remote sources or AI compute. Connect clients you trust to use those permissions.

## Run a query

Ask your agent to use Chowder's `query` tool with these arguments:

```json theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
{
  "sql": "SELECT 42 AS answer;",
  "max_rows": 100
}
```

The tool returns this structured result, also available as JSON text:

```json theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
{
  "schema": [
    {"name": "answer", "type": "int64"}
  ],
  "rows": [[42]],
  "row_count": 1,
  "truncated": false
}
```

Each row is an array in `schema` order. `row_count` counts returned rows. `truncated` indicates whether more rows exist.

For a multimodal task, ask your agent to read the first five pages of a document with this SQL:

```chowder-sql theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
SELECT
    source,
    page_number,
    content
FROM read_documents('hf://buckets/chowderai/chowder-demo/pdf/data/att-management-discussion-and-analysis-2020.pdf')
LIMIT 5;
```

You can use the same [multimodal table functions](https://docs.chowder.ai/reference/table-functions/overview.md), [inference](https://docs.chowder.ai/guides/inference.md), and [embeddings](https://docs.chowder.ai/guides/embeddings.md) as other Chowder queries. Local AI processing may download model artifacts on first use.

## Bound results and query work

| Tool argument | Behavior |
| - | - |
| `sql` | Required, nonempty SQL string |
| `max_rows` | Maximum returned rows; defaults to `100`, with an allowed range of `1` through `10000` |

The server also caps each tool result at 1 MiB. Results can be truncated before reaching `max_rows` when values are large. If a schema or single row cannot fit, the tool returns an error. Select fewer columns or smaller values, especially when querying binary media columns.

`max_rows` limits returned output, not SQL execution cost. Add SQL `LIMIT` and appropriate filters, and project only the columns you need. Increasing `max_rows` does not remove the byte cap.

Binary values use base64 strings. Nested structs and lists retain their structure. Dates, times, timestamps, decimals, and non-finite floats use strings; durations use ISO 8601 strings.

## Reuse the session

The server creates an engine on the first query and reuses it until the process exits. Session views persist across tool calls until the server exits. Restarting the server creates a new session.

The server runs queries one at a time. A query error is returned as a tool error. Cancelling a request interrupts its execution; later requests can reuse the session. The server closes the engine when it exits.

## Use remote AI compute

The server uses local AI compute by default. To use remote AI compute, configure the environment passed to the server process before its first query:

* Set `CHOWDER_REMOTE=1` to opt in.
* Set `CHOWDER_API_TOKEN` to your client credential.
* Set `CHOWDER_API_URL` to the endpoint from your Cloud dashboard or self-hosted server operator.

A URL and token alone do not enable remote compute. Restart the server after changing its compute configuration. SQL planning and relational execution stay in the MCP process, including when AI compute runs remotely.

See [Connect to remote AI compute](https://docs.chowder.ai/guides/remote-compute.md) for connection settings and [Chowder Cloud](https://docs.chowder.ai/cloud/quickstart.md) for managed compute onboarding. For terminal queries and exports, see [CLI](https://docs.chowder.ai/guides/cli.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.