A Model Context Protocol (MCP) server for generating Bruno API testing files programmatically.
Bruno MCP Server enables you to create, manage, and generate Bruno API testing collections, environments, and requests through standardized MCP tools. This allows for automated setup of API testing workflows and integration with Claude and other MCP-compatible clients.
- π Collection Management: Create and organize Bruno collections
- π Environment Configuration: Manage multiple environments (dev, staging, prod)
- π§ Request Generation: Generate .bru files for all HTTP methods
- π Authentication Support: Bearer tokens, Basic auth, OAuth 2.0, API keys
- π Test Scripts: Add pre/post request scripts and assertions
- π CRUD Operations: Generate complete CRUD request sets
- π Collection Statistics: Analyze existing collections
# Clone the repository
git clone https://github.com/macarthy/bruno-mcp.git
cd bruno-mcp
# Install dependencies
npm install
# Build the project
npm run build
The Bruno MCP Server can be integrated with various AI clients that support the Model Context Protocol:
-
Edit Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%/Claude/claude_desktop_config.json
- Linux:
~/.config/Claude/claude_desktop_config.json
- macOS:
-
Add Bruno MCP Server:
{ "mcpServers": { "bruno-mcp": { "command": "node", "args": ["/absolute/path/to/bruno-mcp/dist/index.js"], "env": {} } } }
-
Restart Claude Desktop
- β Claude Desktop App - Full support
- β Claude Code (VS Code) - Full support
- β Continue - Tools and resources
- β Cline - Tools and resources
- β LM Studio - Tools support
- β MCP Inspector - Development/testing
- β Custom MCP Clients - via SDK
π For detailed integration instructions with all clients, see INTEGRATION.md
- Start the MCP server:
npm start
- Use the MCP Inspector to test tools:
npx @modelcontextprotocol/inspector
Create a new Bruno collection with configuration.
Parameters:
name
(string): Collection namedescription
(string, optional): Collection descriptionbaseUrl
(string, optional): Default base URLoutputPath
(string): Directory to create collectionignore
(array, optional): Files to ignore
Example:
{
"name": "my-api-tests",
"description": "API tests for my application",
"baseUrl": "https://api.example.com",
"outputPath": "./collections"
}
Create environment configuration files.
Parameters:
collectionPath
(string): Path to Bruno collectionname
(string): Environment namevariables
(object): Environment variables
Example:
{
"collectionPath": "./collections/my-api-tests",
"name": "production",
"variables": {
"baseUrl": "https://api.example.com",
"apiKey": "prod-key-123",
"timeout": 30000
}
}
Generate .bru request files.
Parameters:
collectionPath
(string): Path to collectionname
(string): Request namemethod
(string): HTTP methodurl
(string): Request URLheaders
(object, optional): HTTP headersbody
(object, optional): Request bodyauth
(object, optional): Authentication configfolder
(string, optional): Folder organization
Example:
{
"collectionPath": "./collections/my-api-tests",
"name": "Get User Profile",
"method": "GET",
"url": "{{baseUrl}}/users/{{userId}}",
"headers": {
"Authorization": "Bearer {{token}}"
},
"folder": "users"
}
Generate complete CRUD operation sets.
Parameters:
collectionPath
(string): Path to collectionentityName
(string): Entity name (e.g., "Users")baseUrl
(string): API base URLfolder
(string, optional): Folder name
Example:
{
"collectionPath": "./collections/my-api-tests",
"entityName": "Products",
"baseUrl": "{{baseUrl}}/api/v1",
"folder": "products"
}
Add test scripts to existing requests.
Parameters:
bruFilePath
(string): Path to .bru filescriptType
(string): Script type (pre-request, post-response, tests)script
(string): JavaScript code
Get statistics about a collection.
Parameters:
collectionPath
(string): Path to collection
my-collection/
βββ bruno.json # Collection configuration
βββ environments/ # Environment files
β βββ development.bru
β βββ staging.bru
β βββ production.bru
βββ auth/ # Authentication requests
β βββ login.bru
β βββ get-profile.bru
βββ users/ # User management
βββ get-all-users.bru
βββ get-user-by-id.bru
βββ create-user.bru
βββ update-user.bru
βββ delete-user.bru
Generated .bru files follow the Bruno markup language specification:
meta {
name: Get Users
type: http
seq: 1
}
get {
url: {{baseUrl}}/users
body: none
auth: none
}
headers {
Content-Type: application/json
Authorization: Bearer {{token}}
}
script:pre-request {
bru.setVar("timestamp", Date.now());
}
script:post-response {
if (res.status === 200) {
bru.setVar("userId", res.body[0].id);
}
}
tests {
test("Status should be 200", function() {
expect(res.status).to.equal(200);
});
}
npm test
npm run test:integration
# Generate a collection first
# Then run tests with Bruno CLI
bruno-cli run ./collections/my-api-tests/
See the examples/
directory for complete usage examples:
examples/jsonplaceholder/
- JSONPlaceholder API testingexamples/authentication/
- Authentication workflowsexamples/complex-workflows/
- Multi-step API scenarios
src/
βββ index.ts # Main entry point
βββ server.ts # MCP server implementation
βββ bruno/
β βββ types.ts # TypeScript interfaces
β βββ generator.ts # BRU file generator
β βββ collection.ts # Collection management
β βββ environment.ts # Environment management
β βββ request.ts # Request builder
βββ tools/ # Individual MCP tools
npm run build # Build TypeScript
npm run dev # Development mode
npm run clean # Clean build artifacts
npm run lint # ESLint
npm run format # Prettier
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
MIT License - see LICENSE file for details.
Generated with Bruno MCP Server π