bru-mcp
Exposes Bruno CLI as tools for AI agents, allowing them to discover, inspect, and execute Bruno API collections through the MCP protocol.
README
bru-mcp
An MCP (Model Context Protocol) server that exposes the Bruno CLI (bru) as tools for AI agents. It allows agents like Claude, GitHub Copilot, and others to discover, inspect, and execute Bruno API collections directly through the MCP protocol.
Requirements
Install the Bruno CLI globally if you haven't already:
npm install -g @usebruno/cli
Installation
Option A — Clone and build
git clone https://github.com/h-mergel/bru-mcp.git
cd bru-mcp
npm install
npm run build
Option B — Install globally from the cloned repo
After cloning and building, install the bru-mcp binary globally so it is available on your PATH:
npm install -g .
This makes bru-mcp available as a standalone command, which simplifies the MCP configuration (see below).
MCP Configuration
Add bru-mcp as an MCP server in your client's configuration. The server communicates over stdio.
Via npx — no local clone needed (recommended)
Since the compiled output is included in the repository, you can run bru-mcp directly from GitHub without cloning or building manually:
{
"mcpServers": {
"bru-mcp": {
"command": "npx",
"args": ["github:h-mergel/bru-mcp"]
}
}
}
Via global install
If you installed with npm install -g .:
{
"mcpServers": {
"bru-mcp": {
"command": "bru-mcp"
}
}
}
Via local path
If you cloned the repository and prefer a direct path:
{
"mcpServers": {
"bru-mcp": {
"command": "node",
"args": ["/absolute/path/to/bru-mcp/dist/src/index.js"]
}
}
}
Claude Desktop
The configuration file is located at:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
OpenCode
Add the server to your OpenCode MCP configuration (.opencode/config.json or the global config). Any of the three snippets above works.
Tools
The server exposes four tools. For single-collection setups, auto-detection runs automatically — just call bru_list_requests, bru_run, or bru_run_collection directly and the collection is resolved from the current working directory. Use bru_find_collections only when multiple collections are present or auto-detection fails.
bru_find_collections
Recursively scans a directory for Bruno collections (identified by bruno.json files). Use this only when working with multiple collections or when auto-detection fails.
| Parameter | Type | Required | Description |
|---|---|---|---|
startPath |
string | No | Directory to search from. Defaults to the current working directory. |
Returns: A list of collection paths, their available environments, and the number of requests in each.
bru_list_requests
Lists all .bru request files in a collection, grouped by folder. Also shows available environments. The collection is auto-detected if collectionPath is omitted.
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionPath |
string | No | Path to the Bruno collection directory (the folder containing bruno.json). Reuse from a previous response to skip auto-detection. Takes precedence over startPath. |
startPath |
string | No | Directory to search for a Bruno collection. Checks well-known subdirectories (bruno, .bruno, api-tests, api, tests) first, then falls back to a recursive search. Defaults to the current working directory. |
Returns: A grouped list of requests and available environments, plus a structured JSON representation.
bru_run
Runs a specific request file or folder within a collection using the bru CLI. The collection is auto-detected if collectionPath is omitted.
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionPath |
string | No | Path to the Bruno collection directory. Reuse from a previous response to skip auto-detection. Takes precedence over startPath. |
startPath |
string | No | Directory to search for a Bruno collection. Defaults to the current working directory. |
target |
string | Yes | Relative path to a .bru file or subfolder (e.g. cards/find-cards.bru or cards). |
env |
string | No | Environment name to use (e.g. dev, prod). Must exist in environments/. |
envVars |
object | No | Key-value pairs to override environment variables (e.g. {"baseUrl": "http://localhost:3000"}). |
recursive |
boolean | No | Run requests in subfolders recursively. Default: false. |
insecure |
boolean | No | Allow insecure (self-signed) TLS connections. Default: false. |
testsOnly |
boolean | No | Only run requests that have tests or assertions. Default: false. |
bail |
boolean | No | Stop after the first failing request. Default: false. |
tags |
string[] | No | Only run requests with these tags. |
excludeTags |
string[] | No | Exclude requests with these tags. |
verbose |
boolean | No | Enable verbose output. Default: false. |
Returns: The full CLI output, the constructed command, and parsed JSON results if available.
bru_run_collection
Runs all requests in a collection recursively. Supports tag filtering and all the same options as bru_run (except target and recursive, which are implicit). The collection is auto-detected if collectionPath is omitted.
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionPath |
string | No | Path to the Bruno collection directory. Reuse from a previous response to skip auto-detection. Takes precedence over startPath. |
startPath |
string | No | Directory to search for a Bruno collection. Defaults to the current working directory. |
env |
string | No | Environment name to use. |
envVars |
object | No | Key-value pairs to override environment variables. |
tags |
string[] | No | Only run requests with these tags. |
excludeTags |
string[] | No | Exclude requests with these tags. |
insecure |
boolean | No | Allow insecure TLS connections. Default: false. |
testsOnly |
boolean | No | Only run requests that have tests. Default: false. |
bail |
boolean | No | Stop after first failure. Default: false. |
verbose |
boolean | No | Enable verbose output. Default: false. |
Returns: A summary with total/passed/failed/skipped counts, the full CLI output, and parsed JSON results.
Development
# Compile TypeScript to dist/
npm run build
# Watch mode (recompiles on changes)
npm run dev
# Run tests (builds first)
npm test
Project structure
bru-mcp/
├── src/
│ ├── helpers.ts # Pure helper functions (collection discovery, arg building, JSON extraction)
│ └── index.ts # MCP server setup and tool definitions
├── test/
│ ├── helpers.test.ts # Unit tests for all helper functions
│ └── fixtures/ # Static Bruno collections used by tests
├── dist/src/ # Compiled output (committed to repo for npx usage)
├── package.json
├── tsconfig.json
├── AGENTS.md
├── LICENSE
└── README.md
Running tests
Tests use the built-in node:test runner and run against the compiled output in dist/. No additional test framework is needed.
npm test
Contributing
After making changes to the source code:
# 1. Run tests — must all pass before committing
npm test
# 2. Stage the updated compiled output along with the source changes
git add src/ dist/src/
# 3. Commit and push
git commit -m "..."
git push
The compiled dist/src/ is committed to the repository so that users can run the server via npx github:h-mergel/bru-mcp without a local build step.
Security notes
- Path traversal: The
targetparameter inbru_runis validated to ensure it cannot escape the collection directory (e.g.../../etc/passwdis rejected). - Shell injection: The
bruprocess is spawned without a shell on Linux/macOS (shell: trueis only enabled on Windows where.cmdwrappers require it), so shell metacharacters in arguments are not interpreted.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。