> ## Documentation Index
> Fetch the complete documentation index at: https://docs.initrepo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Server Integration Guide

> Complete setup guide for integrating InitRepo MCP Server with AI IDEs and development tools

## Integration Overview

The InitRepo MCP Server integrates with popular AI development tools to provide structured project context and intelligent assistance. This guide covers setup for all supported tools and platforms.

<Warning>
  **Prerequisites Required**: Your project must have InitRepo-generated documentation in the `/docs` folder with proper ID structure. Generate documentation at [initrepo.com](https://www.initrepo.com) first.
</Warning>

### Supported AI Development Tools

<CardGroup cols={2}>
  <Card title="Claude Code" icon="anthropic">
    Native MCP integration with Anthropic's AI coding assistant
  </Card>

  <Card title="Cursor" icon="cursor">
    Enhanced AI IDE with advanced MCP support
  </Card>

  <Card title="VS Code" icon="microsoft">
    Popular editor with MCP extension support
  </Card>

  <Card title="JetBrains IDEs" icon="jetbrains">
    IntelliJ, WebStorm, PyCharm, and other JetBrains tools
  </Card>
</CardGroup>

## Claude Code Integration

### Quick Setup (Recommended)

For the fastest setup, use Claude Code's built-in MCP integration command:

<Steps>
  <Step title="Quick Connection Command">
    ```bash theme={null}
    claude mcp add --transport http initrepo https://mcp.initrepo.com/
    ```

    **What happens when you run this:**

    1. Claude Code attempts to connect to the MCP server
    2. Server responds with "Authentication Required"
    3. Claude Code automatically opens [https://initrepo.com/mcp-auth](https://initrepo.com/mcp-auth) in your browser
    4. Sign in and generate your MCP token
    5. Claude Code detects successful authentication and connects automatically
  </Step>

  <Step title="Manual Token Setup (if needed)">
    If the automatic flow doesn't work, get your token manually:

    1. Visit: [https://initrepo.com/mcp-auth](https://initrepo.com/mcp-auth)
    2. Sign in with your account
    3. Generate your MCP token
    4. Use the token with Claude Code:

    ```bash theme={null}
    claude mcp add --transport http initrepo https://mcp.initrepo.com/?token=YOUR_TOKEN
    ```
  </Step>

  <Step title="Verify Connection">
    Ask Claude Code:

    ```
    "What InitRepo tools are available?"
    ```

    You should see a list of 37+ available tools including:

    * Project analysis and structure understanding
    * Context retrieval by ID (T-001, US-001, etc.)
    * Task management and prioritization
    * Documentation validation
    * Implementation guidance
  </Step>
</Steps>

### Alternative Manual Setup

If you prefer manual configuration or need custom settings:

<Steps>
  <Step title="Install InitRepo MCP Server">
    ```bash theme={null}
    npm install -g initrepo-mcp
    ```

    Verify installation:

    ```bash theme={null}
    initrepo-mcp --version
    ```
  </Step>

  <Step title="Configure Claude Code">
    Add to your Claude Code configuration file:

    ```json theme={null}
    {
      "mcp": {
        "servers": {
          "initrepo": {
            "command": "initrepo-mcp",
            "args": [],
            "env": {}
          }
        }
      }
    }
    ```
  </Step>

  <Step title="Verify Connection">
    Ask Claude Code:

    ```
    "What InitRepo tools are available?"
    ```

    You should see a list of 37+ available tools.
  </Step>

  <Step title="Test Intelligence">
    Try these example queries:

    ```
    "Show me the context for task T-001"
    "What are my highest priority tasks today?"
    "Generate an implementation brief for US-005"
    ```
  </Step>
</Steps>

### Claude Code Usage Examples

**Daily Development Planning:**

```
You: "What should I work on today?"

Claude Code (with MCP): Based on your InitRepo project documentation, here are your highest priority tasks:

1. T-003: Implement user authentication (blocking US-001)
2. T-007: Set up database schema (dependency for multiple stories)
3. T-012: Create API error handling middleware (high business value)

Each task includes full context with acceptance criteria, dependencies, and implementation guidance.
```

**Implementation Guidance:**

```
You: "How should I implement the user authentication system?"

Claude Code (with MCP): Based on T-003 and related technical architecture:

[Provides detailed implementation brief including:]
- Technical requirements from architecture docs
- Step-by-step implementation plan
- Code examples and best practices
- Testing strategies
- Integration points with other components
```

## Cursor Integration

### Setup Process

<Tabs>
  <Tab title="Configuration">
    Add to your Cursor settings or `.cursorrules`:

    ```json theme={null}
    {
      "mcpServers": {
        "initrepo-mcp": {
          "command": "initrepo-mcp",
          "args": []
        }
      }
    }
    ```
  </Tab>

  <Tab title="Workspace Setup">
    Create a `.cursor/mcp.json` file in your project root:

    ```json theme={null}
    {
      "servers": {
        "initrepo": {
          "command": "initrepo-mcp",
          "args": [],
          "cwd": ".",
          "env": {
            "INITREPO_PROJECT_PATH": "."
          }
        }
      }
    }
    ```
  </Tab>
</Tabs>

### Enhanced Cursor Workflows

**AI-Enhanced Code Completion:**

* Cursor automatically provides context-aware suggestions based on your project requirements
* Code completions include relevant user stories and acceptance criteria
* Intelligent variable and function naming based on project terminology

**Real-Time Context Sharing:**

* Cursor maintains awareness of current task context (T-001, US-005, etc.)
* Automatic cross-referencing between code changes and requirements
* Live validation against acceptance criteria during coding

**Smart Code Review:**

* Automatic checking of implementation against project requirements
* Suggestion of missing components based on user stories
* Integration testing recommendations based on technical architecture

## VS Code Integration

### Extension Installation

<Steps>
  <Step title="Install MCP Extension">
    Search for and install the "Model Context Protocol" extension in VS Code marketplace
  </Step>

  <Step title="Configure Settings">
    Add to your VS Code settings.json:

    ```json theme={null}
    {
      "mcp.servers": {
        "initrepo": {
          "command": "initrepo-mcp",
          "args": [],
          "env": {}
        }
      },
      "mcp.autoStart": true
    }
    ```
  </Step>

  <Step title="Restart VS Code">
    Restart VS Code to load the MCP server configuration
  </Step>

  <Step title="Verify Integration">
    Open the Command Palette (Ctrl/Cmd+Shift+P) and search for "MCP" commands
  </Step>
</Steps>

### VS Code Features

**Command Palette Integration:**

* `MCP: Get Task Context` - Retrieve context for specific tasks
* `MCP: Generate Implementation Brief` - Create detailed implementation guidance
* `MCP: Validate Documentation` - Check project documentation completeness
* `MCP: Show Project Map` - Display project structure and relationships

**Side Panel Integration:**

* **InitRepo Explorer**: Navigate project structure by epics, user stories, and tasks
* **Context Viewer**: Display relevant context for current file or selection
* **Progress Tracker**: Monitor task completion and dependencies

**Status Bar Information:**

* Current task context (T-001, US-005, etc.)
* Project completion percentage
* Next recommended task

## JetBrains IDEs Integration

### Plugin Installation

<AccordionGroup>
  <Accordion title="IntelliJ IDEA">
    1. Go to File → Settings → Plugins
    2. Search for "InitRepo MCP" plugin
    3. Install and restart IntelliJ IDEA
    4. Configure in Settings → Tools → InitRepo MCP
  </Accordion>

  <Accordion title="WebStorm">
    1. Open WebStorm → Preferences → Plugins
    2. Install "InitRepo MCP" plugin
    3. Configure server settings in Tools → InitRepo
  </Accordion>

  <Accordion title="PyCharm">
    1. Settings → Plugins → Install "InitRepo MCP"
    2. Configure Python project integration
    3. Enable AI assistant features
  </Accordion>
</AccordionGroup>

### JetBrains Configuration

```xml theme={null}
<!-- .idea/mcp.xml -->
<mcp>
  <servers>
    <server name="initrepo-mcp">
      <command>initrepo-mcp</command>
      <args></args>
      <workingDirectory>$PROJECT_DIR$</workingDirectory>
    </server>
  </servers>
</mcp>
```

### JetBrains Features

**Integrated AI Assistant:**

* Right-click context menus with InitRepo intelligence
* Inline code suggestions based on project requirements
* Automatic documentation generation for functions and classes

**Project Navigation:**

* Navigate between code and requirements using ID references
* Jump from implementation to related user stories
* Visualize dependencies between tasks and code components

**Code Quality Integration:**

* Real-time validation against acceptance criteria
* Suggestion of missing test cases based on requirements
* Architecture compliance checking

## Terminal Integration

### Setup for Command Line Usage

<Steps>
  <Step title="Install Terminal Client">
    ```bash theme={null}
    npm install -g @initrepo/mcp-client
    ```
  </Step>

  <Step title="Initialize Configuration">
    ```bash theme={null}
    initrepo-mcp-client init
    ```
  </Step>

  <Step title="Test Connection">
    ```bash theme={null}
    initrepo-mcp-client query "What tools are available?"
    ```
  </Step>
</Steps>

### Terminal Usage Examples

**Interactive Mode:**

```bash theme={null}
# Start interactive session
initrepo-mcp-client interactive

# Example queries in interactive mode
> get-context T-001
> generate-implementation-brief US-005
> validate-documentation
```

**Script Integration:**

```bash theme={null}
#!/bin/bash
# Get context for current sprint tasks

TASKS=("T-001" "T-002" "T-003")

for task in "${TASKS[@]}"; do
    echo "Getting context for $task..."
    initrepo-mcp-client query "get-context $task" > "context-$task.md"
done

echo "Task contexts generated!"
```

## Advanced Integration Scenarios

### CI/CD Pipeline Integration

**GitHub Actions Workflow:**

```yaml theme={null}
name: InitRepo MCP Analysis
on: [push, pull_request]

jobs:
  mcp-analysis:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '18'
          
      - name: Install InitRepo MCP
        run: npm install -g initrepo-mcp @initrepo/mcp-client
        
      - name: Validate Documentation
        run: |
          initrepo-mcp-client query "validateDocumentationCompleteness" > validation.json
          cat validation.json
          
      - name: Generate Progress Report
        run: |
          initrepo-mcp-client query "generateProgressReport" > progress.md
          
      - name: Upload Reports
        uses: actions/upload-artifact@v3
        with:
          name: mcp-analysis
          path: |
            validation.json
            progress.md
```

### Team Collaboration Setup

**Shared Configuration:**

```json theme={null}
// .initrepo/team-mcp-config.json
{
  "team": {
    "name": "Development Team Alpha",
    "members": ["dev1", "dev2", "dev3"],
    "shared_context": true,
    "progress_sync": true
  },
  "notifications": {
    "slack_webhook": "https://hooks.slack.com/...",
    "progress_updates": true,
    "blocker_alerts": true
  }
}
```

**Team Dashboard Integration:**

```javascript theme={null}
// team-dashboard.js
const MCPClient = require('@initrepo/mcp-client');

class TeamDashboard {
    async getTeamProgress() {
        const client = new MCPClient();
        
        const progress = await client.query('generateProgressReport', {
            scope: 'team',
            includeVelocity: true,
            includeBlockers: true
        });
        
        return this.formatDashboard(progress);
    }
    
    formatDashboard(progress) {
        return {
            completedTasks: progress.completed.length,
            inProgressTasks: progress.inProgress.length,
            blockers: progress.blockers,
            velocity: progress.teamVelocity,
            estimatedCompletion: progress.estimatedCompletion
        };
    }
}
```

## Troubleshooting Integration

### Common Issues

<AccordionGroup>
  <Accordion title="Server Not Detected">
    **Symptoms:** AI assistant doesn't recognize InitRepo tools

    **Solutions:**

    ```bash theme={null}
    # Verify installation
    which initrepo-mcp
    initrepo-mcp --version

    # Check if server starts
    initrepo-mcp --test

    # Restart your AI assistant/IDE
    ```
  </Accordion>

  <Accordion title="No InitRepo Documentation Found">
    **Symptoms:** Error message about missing documentation structure

    **Solutions:**

    * Ensure `/docs` folder exists in your project
    * Verify documentation was generated by InitRepo platform
    * Check for proper ID format (T-001, US-001, E-001)
    * Validate documentation completeness using CLI
  </Accordion>

  <Accordion title="Connection Timeout">
    **Symptoms:** MCP server connection fails or times out

    **Solutions:**

    ```bash theme={null}
    # Check system resources
    ps aux | grep initrepo-mcp

    # Restart server
    pkill initrepo-mcp
    initrepo-mcp --restart

    # Check logs
    initrepo-mcp --logs
    ```
  </Accordion>
</AccordionGroup>

### Performance Optimization

**For Large Projects:**

* Enable caching: Set `INITREPO_CACHE_ENABLED=true`
* Increase memory: `export NODE_OPTIONS="--max-old-space-size=2048"`
* Use specific context scopes to reduce processing time
* Configure background processing for non-critical queries

**For Teams:**

* Set up dedicated MCP server instance for team sharing
* Use WebSocket transport for real-time collaboration
* Configure load balancing for multiple concurrent users
* Implement progress synchronization across team members

## Best Practices

### Development Workflow Integration

1. **Start with Context**: Always get task context before beginning implementation
2. **Validate Frequently**: Use MCP tools to verify implementation against requirements
3. **Document Decisions**: Record architectural decisions using MCP intelligence
4. **Track Progress**: Regular progress updates maintain project visibility

### Team Collaboration

1. **Shared Standards**: Use consistent MCP queries across team members
2. **Regular Sync**: Schedule regular progress synchronization
3. **Communication**: Use MCP insights to inform team communications
4. **Knowledge Sharing**: Leverage MCP context for knowledge transfer

## Advanced Integration Scenarios

### CI/CD Pipeline Integration

**GitHub Actions Workflow:**

```yaml theme={null}
name: InitRepo MCP Analysis
on: [push, pull_request]

jobs:
  mcp-analysis:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '18'

      - name: Install InitRepo MCP
        run: npm install -g initrepo-mcp @initrepo/mcp-client

      - name: Validate Documentation
        run: |
          initrepo-mcp-client query "validateDocumentationCompleteness" > validation.json
          cat validation.json

      - name: Generate Implementation Brief
        run: |
          initrepo-mcp-client query "generateSmartImplementationBrief" --args '{"taskId": "T-001"}' > brief.md
          cat brief.md
```

**Jenkins Pipeline:**

```groovy theme={null}
pipeline {
    agent any

    stages {
        stage('MCP Analysis') {
            steps {
                sh 'npm install -g initrepo-mcp'

                sh 'initrepo-mcp validateDocumentationCompleteness > validation.json'

                sh 'initrepo-mcp generateProgressReport > progress.md'

                archiveArtifacts artifacts: '*.json,*.md', fingerprint: true
            }
        }
    }

    post {
        always {
            publishHTML(target: [
                allowMissing: false,
                alwaysLinkToLastBuild: true,
                keepAll: true,
                reportDir: '.',
                reportFiles: 'validation.json,progress.md',
                reportName: 'MCP Analysis'
            ])
        }
    }
}
```

### Team Collaboration Setup

**Shared Configuration:**

```json theme={null}
// .initrepo/team-mcp-config.json
{
  "team": {
    "name": "Development Team Alpha",
    "members": ["dev1", "dev2", "dev3"],
    "shared_context": true,
    "progress_sync": true
  },
  "notifications": {
    "slack_webhook": "https://hooks.slack.com/...",
    "progress_updates": true,
    "blocker_alerts": true
  }
}
```

**Team Dashboard Integration:**

```javascript theme={null}
// team-dashboard.js
const MCPClient = require('@initrepo/mcp-client');

class TeamDashboard {
    async getTeamProgress() {
        const client = new MCPClient();

        const progress = await client.query('generateProgressReport', {
            scope: 'team',
            includeVelocity: true,
            includeBlockers: true
        });

        return this.formatDashboard(progress);
    }

    formatDashboard(progress) {
        return {
            completedTasks: progress.completed.length,
            inProgressTasks: progress.inProgress.length,
            blockers: progress.blockers,
            velocity: progress.teamVelocity,
            estimatedCompletion: progress.estimatedCompletion
        };
    }
}
```

### Terminal Integration

**Setup for Command Line Usage:**

```bash theme={null}
# Install terminal client
npm install -g @initrepo/mcp-client

# Initialize configuration
initrepo-mcp-client init

# Test connection
initrepo-mcp-client query "What tools are available?"
```

**Interactive Mode:**

```bash theme={null}
# Start interactive session
initrepo-mcp-client interactive

# Example queries
> get-context T-001
> generate-implementation-brief US-005
> validate-documentation
```

**Script Integration:**

```bash theme={null}
#!/bin/bash
# Get context for current sprint tasks

TASKS=("T-001" "T-002" "T-003")

for task in "${TASKS[@]}"; do
    echo "Getting context for $task..."
    initrepo-mcp-client query "get-context $task" > "context-$task.md"
done

echo "Task contexts generated!"
```

## Performance Optimization

**For Large Projects:**

* Enable caching: Set `INITREPO_CACHE_ENABLED=true`
* Increase memory: `export NODE_OPTIONS="--max-old-space-size=2048"`
* Use specific context scopes to reduce processing time
* Configure background processing for non-critical queries

**For Teams:**

* Set up dedicated MCP server instance for team sharing
* Use WebSocket transport for real-time collaboration
* Configure load balancing for multiple concurrent users
* Implement progress synchronization across team members

## Troubleshooting Integration

### Common Issues

<AccordionGroup>
  <Accordion title="Server Not Detected">
    **Symptoms:** AI assistant doesn't recognize InitRepo tools

    **Solutions:**

    ```bash theme={null}
    # Verify installation
    which initrepo-mcp
    initrepo-mcp --version

    # Check if server starts
    initrepo-mcp --test

    # Restart your AI assistant/IDE
    ```
  </Accordion>

  <Accordion title="No InitRepo Documentation Found">
    **Symptoms:** Error message about missing documentation structure

    **Solutions:**

    * Ensure `/docs` folder exists in your project
    * Verify documentation was generated by InitRepo platform
    * Check for proper ID format (T-001, US-001, E-001)
    * Validate documentation completeness using CLI
  </Accordion>

  <Accordion title="Connection Timeout">
    **Symptoms:** MCP server connection fails or times out

    **Solutions:**

    ```bash theme={null}
    # Check system resources
    ps aux | grep initrepo-mcp

    # Restart server
    pkill initrepo-mcp
    initrepo-mcp --restart

    # Check logs
    initrepo-mcp --logs
    ```
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={3}>
  <Card title="Explore All 37+ Tools" icon="tools" href="/mcp/features">
    Learn about every MCP tool and advanced capabilities
  </Card>

  <Card title="Best Practices Guide" icon="lightbulb" href="/mcp/best-practices">
    Optimize your MCP integration for maximum productivity
  </Card>

  <Card title="Troubleshooting Guide" icon="wrench" href="/mcp/troubleshooting">
    Solve common issues and get help when needed
  </Card>
</CardGroup>

<Card title="Complete Quick Start" icon="rocket" href="/quickstart#mcp-server-quickstart">
  Follow our 5-minute setup guide to get started immediately
</Card>
