Metadata-Version: 2.4
Name: bruno-mcp
Version: 0.1.3
Summary: MCP server for Bruno API collections
Author: Jack Mulligan
License: MIT
Project-URL: Repository, https://github.com/jackmulligan-ire/bruno-mcp
Keywords: mcp,bruno,api
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: fastmcp>=0.4.0
Requires-Dist: httpx>=0.25.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: python-dotenv>=1.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.4.0; extra == "dev"
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
Requires-Dist: respx>=0.20.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: mypy>=1.5.0; extra == "dev"

# Bruno MCP

MCP server for Bruno API collections that executes requests via the Bruno CLI tool.

## Prerequisites

### 1. Install Bruno CLI

The Bruno CLI tool (`bru`) must be installed and available in your PATH.

1. Install Bruno CLI using npm 
  ```bash
  npm install -g @usebruno/cli
  ```

2. Verify installation:
   ```bash
   bru --version
   ```

### 2. Install uv (recommended)

[uv](https://docs.astral.sh/uv/) is the recommended way to install and run bruno-mcp. It includes `uvx`, which handles package installation and execution automatically.

```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```

## Setup

### MCP Configuration (uvx)

Configure the MCP server by adding an entry to your IDE. For Cursor, create or edit the configuration file at `~/.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "bruno-mcp": {
      "command": "uvx",
      "args": ["bruno-mcp"],
      "env": {
        "BRUNO_COLLECTION_PATH": "/path/to/your/bruno/collection"
      }
    }
  }
}
```

The only configuration required is `BRUNO_COLLECTION_PATH`, which should point to your Bruno collection directory.

### Alternative: Run Server Manually

If you prefer not to use `uvx`, you can clone the repository and run the server directly:

```bash
git clone https://github.com/jackmulligan-ire/bruno-mcp.git
cd bruno-mcp
uv sync
```

Then configure your MCP client with the full paths:

```json
{
  "mcpServers": {
    "bruno-mcp": {
      "command": "/path/to/bruno-mcp/.venv/bin/python",
      "args": ["-m", "bruno_mcp"],
      "cwd": "/path/to/bruno-mcp",
      "env": {
        "BRUNO_COLLECTION_PATH": "/path/to/your/bruno/collection",
        "PYTHONPATH": "/path/to/bruno-mcp/src"
      }
    }
  }
}
```

After updating the configuration file, enable the server in your IDE's MCP settings.

## Usage Notes

### Variable Overrides

The `run_request_by_id` tool accepts a `variable_overrides` parameter that maps to the Bruno CLI's `--env-var` flag. This allows you to substitute `{{variable}}` placeholders in your `.bru` files at runtime.

**Important limitation:** `--env-var` can only override variables that are already defined in a Bruno environment. It cannot introduce new variables, or replace the values of pre-request and post-request variables. If a variable is not defined in any environment, the override will be silently ignored and the placeholder will resolve to an empty string.

To use variable overrides:

1. Define the variable in a Bruno environment file (even as an empty string):
   ```
   vars {
     postId:
   }
   ```
2. Pass `variable_overrides` when calling the tool. For example, if you have a `.bru` file with the URL `https://api.example.com/posts/{{postId}}` and an environment called `dev` that defines `postId`, you would call:
   - `variable_overrides`: `{"postId": "42"}`
