Skip to main content
Glama

Brex MCP Server

COMPLETION_SUMMARY.md4.04 kB
# Card Transactions Expand Parameter Fix - Completion Summary ## Original Task Fix the `get_card_transactions` tool to prevent 400 "Unsupported entity expansion" errors when users pass expand parameters. The Brex API endpoint `/v2/transactions/card/primary` does not support expand parameters, but users expect to be able to use `expand=["merchant"]` like other tools. ## Implemented Solution ### Problem Analysis - The Brex card transactions API endpoint does not support the `expand` parameter - When users pass `expand=["merchant"]`, the API returns a 400 error: "Unsupported entity expansion" - Other Brex API endpoints support expand, creating inconsistent user experience - Merchant information is already included by default in card transaction responses ### Implementation Approach 1. **Preserve Interface Compatibility**: Kept the `expand` parameter in the interface to maintain backward compatibility 2. **Filter at API Call**: Removed the expand parameter when calling the Brex API 3. **Added Documentation**: Clear comments explaining why expand is not supported 4. **Comprehensive Testing**: Created tests to verify the fix works correctly ## Files Changed ### Modified Files 1. **src/tools/getCardTransactions.ts** - Lines 31: Added comment that expand is kept for compatibility but not used - Lines 46-50: Added detailed comment explaining why expand is ignored - Lines 59-65: Removed expand parameter from API call, added explanatory comment ### New Test Files 2. **src/tools/__tests__/getCardTransactions.test.ts** - Comprehensive test suite with 8 tests - Tests verify expand parameters are handled gracefully - Tests confirm merchant information is still returned ### Supporting Files 3. **jest.config.mjs** - Jest configuration for ESM modules 4. **verify_fix.cjs** - Verification script to confirm the fix 5. **DEVELOPMENT.md** - Task tracking and implementation details ## Test Coverage ### Test Results ``` ✅ All 8 tests passing - Registration tests (1) - Expand parameter handling tests (4) - Merchant information inclusion tests (1) - Other parameters compatibility tests (2) ``` ### Key Test Scenarios 1. ✅ Tool works with `expand=["merchant"]` (parameter ignored, no error) 2. ✅ Tool works without expand parameters 3. ✅ Merchant information is included by default 4. ✅ Multiple expand values are handled gracefully 5. ✅ Other parameters (cursor, limit, etc.) continue to work correctly ## Verification Status ### Build Status ✅ TypeScript compilation successful ✅ No type errors or warnings ### Manual Verification ✅ Verification script confirms: - Expand parameter is not passed to API - Comments explaining the behavior are present - Interface maintains backward compatibility ## Success Criteria Met - ✅ get_card_transactions works with expand=["merchant"] (ignores the parameter) - ✅ get_card_transactions works without expand parameters - ✅ Tool returns merchant information in responses (already included by default) - ✅ No 400 errors when expand parameters are provided - ✅ Comprehensive tests verify both scenarios work correctly ## Merge Instructions ### Branch Information - Branch Name: `feature/fix-card-transactions-expand` - Worktree Location: `/Users/dennisonbertram/Develop/ModelContextProtocol/.worktrees-mcp-brex/fix-card-transactions-expand` ### To Merge Back to Main ```bash # From main repository git checkout main git merge feature/fix-card-transactions-expand git worktree remove /Users/dennisonbertram/Develop/ModelContextProtocol/.worktrees-mcp-brex/fix-card-transactions-expand git branch -d feature/fix-card-transactions-expand ``` ## Summary The fix successfully prevents 400 errors when users pass expand parameters to the get_card_transactions tool. The implementation maintains backward compatibility while ensuring the tool works correctly with the Brex API limitations. Users can continue to pass expand parameters without errors, and merchant information remains available in the response as it's included by default.

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/crazyrabbitLTC/mcp-brex-server'

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