Skip to main content
Glama

Bruno MCP Server

by jcr82
PHASE2-SUMMARY.md•10.1 kB
# Phase 2 Implementation Summary ## Overview Phase 2 focused on adding core features for production use: report generation, collection discovery, and environment management. This document summarizes what was implemented and tested. --- ## Phase 2.1 - Report Generation āœ… COMPLETE (Completed Previously) ### Implementation Details - Integrated Bruno CLI's native reporter flags - Added support for JSON, JUnit XML, and HTML report formats - All report formats can be generated simultaneously - Reports confirmed in output when generated **Files Modified:** - `src/index.ts` - Added reporter parameters to tool schemas - `src/bruno-cli.ts` - Added reporter options to Bruno CLI execution - `README.md` - Documented report generation features **Test Results:** - āœ… JSON report generation - āœ… JUnit XML report generation - āœ… HTML report generation - āœ… Multiple format generation simultaneously --- ## Phase 2.2 - Collection Discovery āœ… COMPLETE ### Implementation Details **New Tool: `bruno_discover_collections`** Recursively searches for Bruno collections (directories containing `bruno.json` files) in a workspace. **Features:** 1. **Recursive Search** - Configurable maximum depth (default: 5, max: 10) - Skips hidden directories (`.git`, etc.) - Skips `node_modules` directories - Stops recursion when collection found (doesn't search subdirectories of collections) 2. **Smart Detection** - Identifies collections by `bruno.json` file presence - Returns full absolute paths - Handles permission errors gracefully 3. **Security Integration** - Path validation via security module - Respects configured allowed paths **Code Added:** - [src/bruno-cli.ts:748-786](src/bruno-cli.ts#L748-L786) - `discoverCollections()` method - [src/index.ts:530-580](src/index.ts#L530-L580) - `handleDiscoverCollections()` handler **Example Usage:** ```typescript bruno_discover_collections({ searchPath: "/path/to/workspace", maxDepth: 5 }) ``` **Example Output:** ``` Found 3 Bruno collection(s): 1. /path/to/workspace/api-tests 2. /path/to/workspace/projects/integration-tests 3. /path/to/workspace/e2e-tests ``` --- ## Phase 2.3 - Environment Management āœ… COMPLETE ### Tool 1: `bruno_list_environments` Lists all environment files (`.bru`) in a collection's `environments` directory. **Features:** 1. **Environment Discovery** - Scans `environments` directory for `.bru` files - Parses variables from each environment file - Returns environment name, path, and variables 2. **Variable Parsing** - Parses `vars { ... }` blocks from `.bru` files - Extracts key-value pairs - Handles multi-line variable definitions 3. **Secret Masking** - Automatically masks variables with sensitive names: - `password`, `secret`, `token`, `key` - Shows `***` for masked values - Truncates long values in preview **Code Added:** - [src/bruno-cli.ts:791-831](src/bruno-cli.ts#L791-L831) - `listEnvironments()` method - [src/bruno-cli.ts:900-921](src/bruno-cli.ts#L900-L921) - `parseEnvironmentVariables()` helper - [src/index.ts:582-653](src/index.ts#L582-L653) - `handleListEnvironments()` handler **Example Usage:** ```typescript bruno_list_environments({ collectionPath: "/path/to/collection" }) ``` **Example Output:** ``` Found 2 environment(s): • dev Path: /path/to/collection/environments/dev.bru Variables: 3 - baseUrl: https://jsonplaceholder.typicode.com - apiKey: *** - timeout: 5000 • staging Path: /path/to/collection/environments/staging.bru Variables: 3 - baseUrl: https://api.staging.example.com - apiKey: *** - timeout: 10000 ``` ### Tool 2: `bruno_validate_environment` Validates an environment file's structure, syntax, and detects potential security issues. **Features:** 1. **Existence Check** - Verifies environment file exists - Returns clear error if not found 2. **Structure Validation** - Checks for `vars { }` block - Warns if no variables defined - Validates file readability 3. **Security Warnings** - Detects hardcoded sensitive data - Warns about password/secret/token variables with non-dynamic values - Checks if values use variable references (`{{...}}`) or env vars (`$...`) 4. **Variable Parsing** - Parses and displays all variables - Masks sensitive values in output - Returns full variable list **Code Added:** - [src/bruno-cli.ts:836-895](src/bruno-cli.ts#L836-L895) - `validateEnvironment()` method - [src/index.ts:655-733](src/index.ts#L655-L733) - `handleValidateEnvironment()` handler **Example Usage:** ```typescript bruno_validate_environment({ collectionPath: "/path/to/collection", environmentName: "dev" }) ``` **Example Output (Valid):** ``` === Environment Validation: dev === āœ… Status: Valid Variables: 3 baseUrl: https://jsonplaceholder.typicode.com apiKey: *** (masked) timeout: 5000 ``` **Example Output (Not Found):** ``` === Environment Validation: production === āŒ Status: Not Found Errors: • Environment file not found: /path/to/collection/environments/production.bru ``` ### Tool 3: Environment Switching Environment switching is already supported through the existing `bruno_run_request` and `bruno_run_collection` tools via the `environment` parameter. No additional implementation needed. **Usage:** ```typescript // Switch to different environments when running bruno_run_request({ collectionPath: "/path/to/collection", requestName: "Get Users", environment: "dev" // or "staging", "production", etc. }) ``` --- ## Test Results ### New Test Script: `test-phase2.js` Created comprehensive test suite covering: 1. **Test 1: Discover Collections** - āœ… Finds test collection in workspace - āœ… Returns correct path - āœ… Handles configurable depth 2. **Test 2: List Environments** - āœ… Lists all environments in collection - āœ… Parses variables correctly - āœ… Masks sensitive values 3. **Test 3: Validate Valid Environment** - āœ… Validates existing environment - āœ… Shows all variables - āœ… Masks secrets in output 4. **Test 4: Validate Non-Existent Environment** - āœ… Handles missing environment gracefully - āœ… Returns clear error message - āœ… Marks as invalid with errors **All Phase 2 tests: 4/4 passing āœ…** ### Integration Testing **MCP Server Test Suite:** - āœ… All 5 existing tests still passing - āœ… Tool count increased from 4 to 7 tools - āœ… No regressions in existing functionality **Total Test Coverage:** - Phase 1: 5 tests (MCP integration) - Phase 2: 4 tests (new features) + 2 tests (reports) - Phase 3: 13 tests (security) + 4 tests (config) + 4 tests (health) - **Grand Total: 32/32 tests passing āœ…** --- ## Files Created/Modified ### New Files - [test-phase2.js](test-phase2.js) - Phase 2 feature testing - [PHASE2-SUMMARY.md](PHASE2-SUMMARY.md) - This document ### Modified Files 1. **src/bruno-cli.ts** (+176 lines) - Added `discoverCollections()` method - Added `listEnvironments()` method - Added `validateEnvironment()` method - Added `parseEnvironmentVariables()` helper 2. **src/index.ts** (+213 lines) - Added 3 new tool schemas (DiscoverCollections, ListEnvironments, ValidateEnvironment) - Added 3 new tool definitions to TOOLS array - Added 3 new case statements in switch - Added 3 new handler methods 3. **README.md** - Added documentation for 3 new tools - Added example usage and outputs - Updated completed features list - Updated project structure 4. **ROADMAP.md** - Marked Phase 2 as 100% complete (10/10 items) - Added completion notes for each section - Updated implementation details --- ## Key Features & Highlights ### 1. Workspace-Wide Collection Discovery - Find all Bruno collections in a project automatically - No manual path specification needed - Intelligent recursion with safety limits ### 2. Environment Visibility - See all available environments at a glance - Preview variable names and values - Understand environment configuration before use ### 3. Environment Validation - Pre-flight checks before running tests - Catch configuration errors early - Security warnings for hardcoded secrets ### 4. Secret Protection - Automatic masking of sensitive variable values - Pattern-based detection (password, secret, token, key) - Prevents accidental credential exposure in logs ### 5. Developer Experience - Clear, formatted output - Helpful error messages - Example outputs in documentation --- ## Backward Compatibility All Phase 2 features are 100% backward compatible: - New tools are additive (existing tools unchanged) - No breaking changes to existing tool interfaces - Configuration is optional - Security validation integrated seamlessly --- ## Progress Summary ### Overall Project Status **Total Items: 57** - Phase 1: 7/7 (100%) āœ… - Phase 2: 10/10 (100%) āœ… - Phase 3: 12/26 (46.2%) šŸ”„ - Phase 4: 0/14 (0%) ā³ **Completed: 29/57 (50.9%)** ### Phase 2 Achievement - āœ… Report Generation (5 items) - āœ… Collection Discovery (2 items) - āœ… Environment Management (3 items) **Phase 2: 10/10 items (100%) COMPLETE!** --- ## Next Steps With Phase 2 complete, recommended next actions: 1. **Continue Phase 3** - 14 items remaining - Logging System (4 items) - Request Introspection (2 items) - Dry Run Mode (2 items) - Collection Validation (2 items) - Parallel Execution (3 items) - Optimization (2 items) 2. **Or Move to Phase 4** - Documentation & Testing - Testing Improvements (4 items) - Documentation (5 items) - Advanced Features (5 items) --- ## Conclusion Phase 2 successfully adds essential production features to the Bruno MCP Server: - āœ… Multi-format test reporting for CI/CD integration - āœ… Automatic collection discovery in workspaces - āœ… Complete environment management and validation - āœ… Security-first design with secret masking - āœ… Comprehensive testing (32 tests passing) The server now provides a complete toolkit for managing Bruno API testing workflows at scale!

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jcr82/bruno-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server