bruno-mcp

macarthy/bruno-mcp

3.2

If you are the rightful owner of bruno-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

Bruno MCP Server is a tool for generating API testing files programmatically using the Model Context Protocol.

Tools
  1. create_collection

    Create a new Bruno collection with configuration.

  2. create_environment

    Create environment configuration files.

  3. create_request

    Generate .bru request files.

  4. create_crud_requests

    Generate complete CRUD operation sets.

  5. add_test_script

    Add test scripts to existing requests.

  6. get_collection_stats

    Get statistics about a collection.

Bruno MCP Server

A Model Context Protocol (MCP) server for generating Bruno API testing files programmatically.

Overview

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.

Features

  • šŸ“ 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

Installation

# 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

Client Integration

The Bruno MCP Server can be integrated with various AI clients that support the Model Context Protocol:

Quick Setup for Claude Desktop

  1. 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
  2. Add Bruno MCP Server:

    {
      "mcpServers": {
        "bruno-mcp": {
          "command": "node",
          "args": ["/absolute/path/to/bruno-mcp/dist/index.js"],
          "env": {}
        }
      }
    }
    
  3. Restart Claude Desktop

Supported Clients

  • āœ… 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

Usage

With Claude Code or MCP Inspector

  1. Start the MCP server:
npm start
  1. Use the MCP Inspector to test tools:
npx @modelcontextprotocol/inspector

Available MCP Tools

create_collection

Create a new Bruno collection with configuration.

Parameters:

  • name (string): Collection name
  • description (string, optional): Collection description
  • baseUrl (string, optional): Default base URL
  • outputPath (string): Directory to create collection
  • ignore (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

Create environment configuration files.

Parameters:

  • collectionPath (string): Path to Bruno collection
  • name (string): Environment name
  • variables (object): Environment variables

Example:

{
  "collectionPath": "./collections/my-api-tests",
  "name": "production",
  "variables": {
    "baseUrl": "https://api.example.com",
    "apiKey": "prod-key-123",
    "timeout": 30000
  }
}
create_request

Generate .bru request files.

Parameters:

  • collectionPath (string): Path to collection
  • name (string): Request name
  • method (string): HTTP method
  • url (string): Request URL
  • headers (object, optional): HTTP headers
  • body (object, optional): Request body
  • auth (object, optional): Authentication config
  • folder (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"
}
create_crud_requests

Generate complete CRUD operation sets.

Parameters:

  • collectionPath (string): Path to collection
  • entityName (string): Entity name (e.g., "Users")
  • baseUrl (string): API base URL
  • folder (string, optional): Folder name

Example:

{
  "collectionPath": "./collections/my-api-tests",
  "entityName": "Products",
  "baseUrl": "{{baseUrl}}/api/v1",
  "folder": "products"
}
add_test_script

Add test scripts to existing requests.

Parameters:

  • bruFilePath (string): Path to .bru file
  • scriptType (string): Script type (pre-request, post-response, tests)
  • script (string): JavaScript code
get_collection_stats

Get statistics about a collection.

Parameters:

  • collectionPath (string): Path to collection

Generated File Structure

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

Bruno BRU File Format

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);
  });
}

Testing

Run Unit Tests

npm test

Run Integration Tests

npm run test:integration

Test with Bruno CLI

# Generate a collection first
# Then run tests with Bruno CLI
bruno-cli run ./collections/my-api-tests/

Examples

See the examples/ directory for complete usage examples:

  • examples/jsonplaceholder/ - JSONPlaceholder API testing
  • examples/authentication/ - Authentication workflows
  • examples/complex-workflows/ - Multi-step API scenarios

Development

Project Structure

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

Building

npm run build      # Build TypeScript
npm run dev        # Development mode
npm run clean      # Clean build artifacts

Code Quality

npm run lint       # ESLint
npm run format     # Prettier

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Links


Generated with Bruno MCP Server šŸš€