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

# Local MCP Server

> Run the open-source Bronto MCP server locally with Python and connect Claude Code or any MCP agent to your datasets, API keys, and log search tools.

<Note>
  The local MCP server is open source and available on
  [GitHub](https://github.com/brontoio/bronto-mcp-server). If you prefer not
  to run infrastructure locally, see the [Hosted MCP Server](./hosted-mcp)
  instead.
</Note>

## Overview

The Bronto MCP server is a local Python server that exposes Bronto's dataset and log search capabilities to any MCP-compatible AI agent. Once running, it gives agents the tools to answer questions against your live log data, for example:

> *"Can you provide some log events from datasets in the ingestion collection, except for the ones related to garbage collection? The data should be between 2025-05-10 16:05:45 and 2025-05-10 16:25:05."*

The server has been tested with Claude Code and should work with any agent that supports the MCP protocol.

***

## Prerequisites

* Python 3 installed on your machine
* A Bronto API key (see [API Keys](../Account-Management/API-Keys))
* Your Bronto API endpoint URL

***

## Installation

<Steps>
  <Step title="Clone the repository">
    Check out the project from GitHub:

    ```bash theme={"dark"}
    git clone https://github.com/brontoio/bronto-mcp-server.git
    cd bronto-mcp-server
    ```
  </Step>

  <Step title="Create a virtual environment">
    Create a Python virtual environment at the root of the project:

    ```bash theme={"dark"}
    python3 -m venv env
    ```
  </Step>

  <Step title="Install dependencies">
    Install the required packages into the virtual environment:

    ```bash theme={"dark"}
    env/bin/pip install -r requirements.txt
    ```
  </Step>
</Steps>

***

## Configuration

The MCP server is configured using environment variables. Set both before starting the server.

| Variable              | Description                             | Example                    |
| --------------------- | --------------------------------------- | -------------------------- |
| `BRONTO_API_KEY`      | A valid Bronto API key                  | `68ba7ae3-...`             |
| `BRONTO_API_ENDPOINT` | The Bronto API endpoint for your region | `https://api.eu.bronto.io` |

| Region | API Endpoint               |
| ------ | -------------------------- |
| US     | `https://api.us.bronto.io` |
| EU     | `https://api.eu.bronto.io` |

***

## Starting the Server

Run the following command from the root of the project, substituting your API key and endpoint:

```bash theme={"dark"}
BRONTO_API_KEY=<your-api-key> \
BRONTO_API_ENDPOINT=https://api.eu.bronto.io \
PYTHONPATH=src/main/ \
env/bin/python src/main/brmcpserver/main.py
```

The server starts on `http://localhost:8000` by default.

<Warning>
  Keep your terminal session open while using the MCP server. Closing it will
  stop the server and disconnect any connected agents.
</Warning>

***

## Connecting Claude Code

Once the server is running, register it with Claude Code using the following command:

```bash theme={"dark"}
claude mcp add --transport http bronto http://localhost:8000
```

This makes the Bronto MCP server available for your current project folder. To make it available globally across all projects, add the `--scope user` flag:

```bash theme={"dark"}
claude mcp add --transport http bronto http://localhost:8000 --scope user
```

<Info>
  Full documentation on managing MCP servers in Claude Code is available at
  [docs.anthropic.com](https://docs.anthropic.com/en/docs/claude-code/mcp).
</Info>

### Verify the connection

Launch Claude Code and run the `/mcp` command to confirm the Bronto MCP server is available and connected:

```
/mcp
──────────────────────────────────────
  Manage MCP servers
  1 servers     Local MCPs

  ❯ bronto · ✓ connected
```

***

## Capabilities

Once connected, the server exposes the following tools to your AI agent.

| Tool                    | Description                                                                                                                                                                                                           | When to use                                                                                                                                  |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `get_datasets`          | Fetches all datasets in your Bronto account, including name, collection, log ID, and tags. Tags such as `description`, `service`, `team`, and `environment` are especially useful for understanding dataset contents. | When you need to discover what data sources are available, or find datasets by owner or environment.                                         |
| `get_datasets_by_name`  | Fetches a specific dataset by its exact name and collection name. A dataset is uniquely identified by the combination of both.                                                                                        | When you already know the dataset and collection name and need its log ID or tag metadata.                                                   |
| `get_keys`              | Returns all field names present in a specific dataset, identified by its log ID.                                                                                                                                      | To inspect a single dataset's schema before querying or filtering it.                                                                        |
| `get_all_datasets_keys` | Returns a map of dataset IDs to their field names across all datasets.                                                                                                                                                | To identify which datasets contain a particular field, or to determine the exact field name from a description.                              |
| `get_key_values`        | Returns the available values for a specific field in a specific dataset.                                                                                                                                              | To discover valid field values and build precise filters before running a search.                                                            |
| `search_logs`           | Searches raw log events across one or more datasets over a time range. Supports SQL-style `WHERE` filters, multiple dataset IDs, and returns full log events including the `@raw` field.                              | Event-level investigations where you need to inspect individual log entries — for example, finding errors or warnings in a specific service. |

***

## Frequently Asked Questions

**Which AI agents are supported?**

The server implements the MCP protocol and should work with any MCP-compatible agent. It has been tested with Claude Code.

**Can I make the server available across all my projects?**

Yes. Add `--scope user` when registering the server with Claude Code and it will be available globally rather than only for the current project folder.

**Where do I find my API key?**

API keys can be created and managed in **Settings → API Keys** in the Bronto UI. See [API Keys](../Account-Management/API-Keys) for details.

**What is the difference between the local server and the hosted MCP server?**

The local server runs on your machine and requires Python, a virtual environment, and a running terminal session. The [hosted MCP server](./hosted-mcp) is managed by Bronto — there is nothing to install or run locally. For most teams the hosted option is simpler; the local server is useful if you need to run in an air-gapped environment or want to inspect or modify the server code directly.
