MCP Integration - editor2 vs gograb-modules

Comprehensive analysis of MCP implementations and integration strategy

MCP Integration: editor2 vs gograb-modules

Key Insight: These are NOT competing implementations - they serve different architectural roles and are designed to work together.


Executive Summary

Component Role Location Purpose
mcp-gograb-ai MCP SERVER (Provider) editor2/MCP/mcp-gograb-ai Provides 40+ AI tools to agents
ai-gateway MCP bridge MCP CLIENT (Consumer) gograb-modules/apps/ai-gateway/src/mcp Consumes tools from MCP servers

Recommended Strategy: Integrate them - ai-gateway should connect to mcp-gograb-ai as one of its MCP servers.


Port Configuration (Resolved)

Current Port Layout

Monorepo Service Port Purpose Status
editor2 backend-api 3000 Core platform API ✅ Keep
editor2 backend-ai-api 3001 AI services, MCP gateway ✅ Keep
gograb-modules ai-gateway 3021 Module generation CLI ✅ Keep

Decision Rationale

Per Session 54.14, gograb-modules' PhaseExecutor should eventually be integrated INTO backend-ai-api (port 3001). The ai-gateway is a development tool, not a permanent production service.

See: MCP-ARCHITECTURE-DECISION.md for related decisions.


MCP Architecture Comparison

mcp-gograb-ai (editor2) - MCP SERVER

Type: Full-featured MCP Server providing tools to AI agents

Location: editor2/MCP/mcp-gograb-ai/

Transport: STDIO (local process communication)

Tools Provided: 40+ tools including:

Category Tools Purpose
Decision Tracking preflight, log_decision, find_similar, report_outcome Learning loop
Session Management get_session_info, set_session, register_chat_context Context continuity
Code Operations code_review, test_gen, self_healing Code quality
Knowledge Graph graph (7 operations) Relationship mapping
AI Modes behavior_mode, persona, token_efficiency Agent behavior
Generation space_generate, analyze_requirement, validate_module Code generation
Search web_search, docs_search External knowledge

Storage:

Key Features:

ai-gateway MCP Bridge (gograb-modules) - MCP CLIENT

Type: MCP Client that consumes tools from external MCP servers

Location: gograb-modules/apps/ai-gateway/src/mcp/

Transport: STDIO client connections to MCP servers

Currently Connects To:

Server Enabled Purpose
claude-agent ✅ Yes Full agent execution (Claude Code tools)
gograb-mcp ⚠️ Optional Local GoGrab MCP server
mcp-gograb-ai ❌ Not connected OPPORTUNITY

Key Features:


Integration Strategy

Phase 0: Documentation (Current - Session 58)

Status: 📋 In Progress

Deliverables:

Phase 1: Prerequisites Assessment

Status: ⏳ Not Started

Before connecting ai-gateway to mcp-gograb-ai, verify:

Prerequisite Status Notes
mcp-gograb-ai builds successfully ⏳ TBD nx build mcp-gograb-ai
Server can run standalone ⏳ TBD Test STDIO transport
Path resolution works cross-repo ⏳ TBD Absolute vs relative paths
Environment variables aligned ⏳ TBD Compare .env files
Authentication compatible ⏳ TBD JWT tokens, tenant context

Phase 2: Connection Implementation

Status: ⏳ Not Started

Implementation Steps (when ready):

  1. Add mcp-gograb-ai server config to mcp.module.ts
  2. Configure environment variables in gograb-modules
  3. Test connection health
  4. Verify tool discovery
  5. Test tool execution
  6. Update documentation

Phase 3: Integration Validation

Status: ⏳ Not Started

Validation Points:


Technical Details

ai-gateway MCP Module Architecture

apps/ai-gateway/src/mcp/
├── mcp.module.ts           # NestJS module, server configuration
├── mcp-bridge.service.ts   # High-level service, multi-server support
├── mcp-client.factory.ts   # Client creation and management
├── mcp-multi-server.types.ts # Type definitions
├── stdio-client.ts         # STDIO transport client
├── tool-handler.service.ts # Tool call routing
└── index.ts                # Barrel exports

Connection Configuration Pattern

// Example: How ai-gateway connects to MCP servers
// In mcp.module.ts useFactory:

const servers: Record<string, MCPServerConfig> = {};

// Existing: Claude Agent
if (claudeAgentEnabled) {
  servers['claude-agent'] = {
    name: 'claude-agent',
    command: 'node',
    args: ['dist/apps/claude-agent-mcp/main.cjs'],
    cwd: moduleGenWorkspace,
    connectionTimeout: 30000,
    enabled: true,
  };
}

// FUTURE: mcp-gograb-ai connection
// if (mcpGograbAiEnabled) {
//   servers['mcp-gograb-ai'] = {
//     name: 'mcp-gograb-ai',
//     command: 'node',
//     args: ['/path/to/editor2/dist/MCP/mcp-gograb-ai/server.js'],
//     cwd: '/path/to/editor2',
//     connectionTimeout: 30000,
//     enabled: true,
//   };
// }

Environment Variables (Future)

# In gograb-modules/.env (future addition)
MCP_GOGRAB_AI_ENABLED=true
MCP_GOGRAB_AI_COMMAND=node
MCP_GOGRAB_AI_PATH=/absolute/path/to/editor2/dist/MCP/mcp-gograb-ai/server.js
MCP_GOGRAB_AI_CWD=/absolute/path/to/editor2
MCP_GOGRAB_AI_TIMEOUT=30000

Key Decisions Log

Decision 1: Port Strategy

Field Value
Question Should we revert ai-gateway from port 3021 to 3001?
Answer NO - Keep at 3021
Confidence 95%
Reasoning Avoids conflict with backend-ai-api (3001), allows concurrent development

Decision 2: MCP Architecture Roles

Field Value
Question Are mcp-gograb-ai and ai-gateway MCP bridge competing?
Answer NO - They are complementary (server vs client)
Confidence 95%
Reasoning Different architectural roles: one provides tools, one consumes tools

Decision 3: Integration Approach

Field Value
Question How should ai-gateway integrate with mcp-gograb-ai?
Answer Add as additional MCP server connection
Confidence 90%
Reasoning ai-gateway already supports multi-server; adding another is straightforward

Related Documentation


Open Questions

Question Priority Status
Should mcp-gograb-ai be built as part of gograb-modules CI? Medium Open
How to handle workspace-specific paths in multi-repo setup? High Open
Should shared MongoDB connection use same database? Medium Open
How to handle session ID conflicts between monorepos? Medium Open

Next Steps

  1. Complete overall integration plan - Before MCP connection
  2. Map dependencies - What does ai-gateway need from editor2?
  3. Test standalone - Verify mcp-gograb-ai works in isolation
  4. Document prerequisites - Clear checklist before implementation

Document created: Session 58.1 Last updated: 2026-01-22 Status: Planning phase - implementation blocked on integration plan