Skip to main content
Glama
Feat_MCPCommandGating.md1.86 kB
# Feature: MCP Command Gating ## Feature Description Intelligent command gating system that prevents MCP client commands when browser command buffer contains content, returning structured error responses with complete command history for intelligent retry logic. ## Technical Architecture ### Gating Logic Flow ``` MCP Command Request → Buffer Check → [Buffer Empty: Execute] OR [Buffer Content: Error Response + History] ``` ### Error Response Structure ``` { success: false, error: 'BROWSER_COMMANDS_ACTIVE', message: 'User executed commands directly in browser', browserCommands: ['pwd', 'ls -la', 'whoami'], retryAllowed: true } ``` ## Story Implementation Order - [ ] 01_Story_MCPCommandInterception - [ ] 02_Story_StructuredErrorResponse - [ ] 03_Story_BufferClearingMechanism - [ ] 04_Story_NormalCommandExecution ## Dependencies **Prerequisites**: 01_Feat_BrowserCommandTracking (requires command buffer) **Enables**: Command state synchronization and conflict prevention ## Integration Requirements ### MCP Protocol Enhancement - Preserve existing success response format - Add new error response type for buffer conflicts - Maintain JSON-RPC 2.0 compliance ### CommandGatekeeper Component ``` PSEUDOCODE Gatekeeper Logic: function checkCommandGate(sessionName, source) { if (source === 'claude') { buffer = getSessionCommandBuffer(sessionName) if (buffer.hasContent()) { throw CommandGatingError(buffer.getCommands()) } } return allowExecution() } ``` ## Success Criteria - ✅ **Zero State Conflicts**: MCP blocked when browser commands present - 🔍 **Complete Context**: Full command history in error responses - ⚙️ **Protocol Compliance**: MCP JSON-RPC 2.0 standards maintained - 📊 **Intelligent Retry**: Claude Code can make informed decisions with history

Latest Blog Posts

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/LightspeedDMS/ssh-mcp'

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