Claude Code MCP Integration Setup

Complete guide to enable mcp-gograb-ai in Claude Code extension without affecting Cursor

🔌 Claude Code MCP Integration Setup

Enable mcp-gograb-ai natively in Claude Code extension (running inside Cursor) without breaking Cursor's MCP integration.


🎯 Overview

What This Achieves

Architecture

┌─────────────────────────────────────────────────────────────┐
│                    MULTI-PLATFORM MCP                        │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│  Cursor Native MCP          Claude Code Extension           │
│  ~/.cursor/mcp.json         .claude/mcp.json                │
│         │                           │                        │
│         └───────────┬───────────────┘                        │
│                     │                                        │
│              MCP Server (stdio)                              │
│       MCP/mcp-development-ai/src/server.ts                   │
│                     │                                        │
│              Platform Detection                              │
│         (CURSOR_AGENT vs CLAUDE_CODE_AGENT)                  │
│                     │                                        │
│         Unified Decision Database                            │
│         docs/data/decisions/*.json                           │
│                                                              │
└─────────────────────────────────────────────────────────────┘

🚀 Quick Setup (2 minutes)

Option 1: Automated Setup (Recommended)

# From workspace root
yarn setup:claude-code-mcp

# Or directly
./scripts/setup-claude-code-mcp.sh

This automatically:

Option 2: Manual Setup

  1. Create configuration directory:

    mkdir -p .claude
    
  2. Create .claude/mcp.json:

    {
      "mcpServers": {
        "mcp-gograb-ai": {
          "command": "/absolute/path/to/MCP/mcp-development-ai/start-server.sh",
          "args": [],
          "env": {
            "WORKSPACE_ROOT": "/absolute/path/to/workspace",
            "CLAUDE_CODE_AGENT": "true",
            "MCP_WORKSPACE": "/absolute/path/to/workspace"
          }
        }
      }
    }
    
  3. Add to .gitignore:

    echo ".claude/" >> .gitignore
    

✅ Verification

Step 1: Open Claude Code

In Cursor, press Cmd+Shift+Escape (or Ctrl+Shift+Escape on Windows/Linux) to open Claude Code.

Step 2: Check MCP Servers

Type /mcp in Claude Code chat to see available MCP servers. You should see:

Step 3: Test MCP Tools

Try using an MCP tool:

Can you run preflight({ task: "test MCP integration" })?

Expected response:

Step 4: Verify Platform Detection

Check the MCP server logs to confirm platform detection:

# The server should log:
# 🖥️  Platform: claude-code (cursor)

🔧 Configuration Details

Configuration Files

Platform Configuration File Scope
Cursor Native ~/.cursor/mcp.json Global (all workspaces)
Claude Code .claude/mcp.json Workspace-local

Environment Variables

Variable Purpose Set By
CURSOR_AGENT Identifies Cursor platform setup-mcp.sh (Cursor)
CLAUDE_CODE_AGENT Identifies Claude Code setup-claude-code-mcp.sh
WORKSPACE_ROOT Workspace path for session detection Both scripts
MCP_WORKSPACE Alternative workspace identifier Both scripts

Platform Detection Logic

The MCP server automatically detects which platform is calling:

function detectPlatform() {
  if (process.env.CURSOR_AGENT === 'true') {
    return { type: 'cursor', environment: 'cursor' };
  }
  if (process.env.CLAUDE_CODE_AGENT === 'true') {
    return { type: 'claude-code', environment: 'cursor' };
  }
  // ... other platforms
}

📊 How It Works

Shared Learning System

Both Cursor and Claude Code contribute to the same decision database:

  1. Decision Logging:

    • Cursor logs decision → docs/data/decisions/cursor_*.json
    • Claude Code logs decision → docs/data/decisions/claude-code_*.json
  2. Decision Retrieval:

    • Both platforms query the same database
    • preflight() returns decisions from all platforms
    • find_similar() searches across all platforms
  3. Platform Analytics:

    • Track which platform made which decisions
    • Compare success rates across platforms
    • Identify platform-specific patterns

Session Detection

The MCP server detects the current session from:

  1. sessions/active.json (auto-generated cache)
  2. sessions/sessions-history/{workspace}/history.json (source of truth)
  3. Falls back to workspace name if no session found

🐛 Troubleshooting

Issue: Claude Code doesn't see MCP server

Solution 1: Reload Cursor window

Cmd+Shift+P → Developer: Reload Window

Solution 2: Verify configuration file exists

cat .claude/mcp.json

Solution 3: Check file permissions

ls -la .claude/
# Should show mcp.json with read permissions

Issue: MCP tools return errors

Solution 1: Check MCP server logs

# Look for startup errors in Cursor's Output panel
# View → Output → Select "MCP: mcp-gograb-ai"

Solution 2: Verify workspace path

# In .claude/mcp.json, ensure paths are absolute
# Use full paths like /Users/username/... not relative paths

Solution 3: Test MCP server directly

# Run the server manually to see errors
./MCP/mcp-development-ai/start-server.sh

Issue: Conflicts with Cursor's MCP

This should never happen because:

If you see conflicts:

  1. Check that .claude/mcp.json doesn't exist in ~/.cursor/
  2. Verify Cursor's config is in ~/.cursor/mcp.json
  3. Restart Cursor completely

📚 Related Documentation


🎯 What's Next?

After setup, you can:

  1. Use MCP tools in Claude Code:

    • preflight({ task: "your task" }) - Get context before starting
    • log_decision({ ... }) - Record architectural decisions
    • find_similar({ query: "..." }) - Search past decisions
    • get_stats() - View system statistics
  2. Contribute to shared learning:

    • All decisions logged from Claude Code benefit Cursor
    • All decisions logged from Cursor benefit Claude Code
    • Cross-platform pattern recognition
  3. Track platform performance:

    • Compare success rates between platforms
    • Identify which platform excels at which tasks
    • Optimize workflow based on platform strengths

✅ Verification Checklist


Last Updated: January 8, 2026 (Session 28.1) Status: ✅ Production Ready Tested: macOS (Cursor + Claude Code extension)