# How code-review-graph Integrates with AI Coding Platforms (Copilot & Cursor): MCP Server Setup

> Learn how code-review-graph integrates with AI coding platforms like Copilot and Cursor using an MCP server. Get token-efficient, graph-aware coding assistance with auto-detected configurations.

- Repository: [Tirth Kanani/code-review-graph](https://github.com/tirth8205/code-review-graph)
- Tags: how-to-guide
- Published: 2026-08-13

---

**code-review-graph exposes your code review knowledge graph to AI assistants via a lightweight MCP (Multi-Coding-Platform) server that auto-detects local installations, writes platform-specific configs, and injects project instructions enabling token-efficient, graph-aware coding assistance.**

The `code-review-graph` repository bridges static code review data and AI coding platforms through a standardized protocol layer. Rather than requiring custom plugins for each editor, it implements a single MCP server that GitHub Copilot, Cursor, and compatible tools discover through JSON configuration files.

## Understanding the MCP Integration Architecture

The integration follows a five-stage pipeline defined in [`code_review_graph/skills.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/skills.py) and orchestrated through [`code_review_graph/cli.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/cli.py). Each stage handles platform detection, configuration persistence, instruction injection, optional runtime hooks, and server execution.

### Stage 1: Platform Detection

Before writing any configuration files, the installer verifies that the target AI platform exists on the developer’s machine. In [`code_review_graph/skills.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/skills.py), the `_copilot_vscode_detected` function checks for the Copilot VS Code extension, while the `cursor` entry in the `PLATFORMS` registry verifies the presence of a `~/.cursor` directory.

```python

# From skills.py - Platform detection logic

_copilot_vscode_detected()  # Checks VS Code extension installation

Path.home() / ".cursor"     # Cursor detection path

```

This detection prevents orphaned configuration files and ensures the MCP server only targets active toolchains.

### Stage 2: MCP Configuration Installation

Once detected, the `install_platform_configs` function (lines 5-71 in [`skills.py`](https://github.com/tirth8205/code-review-graph/blob/main/skills.py)) writes platform-specific JSON or TOML files that tell the AI tool how to launch the graph server:

- **GitHub Copilot (VS Code)**: Creates [`.vscode/mcp.json`](https://github.com/tirth8205/code-review-graph/blob/main/.vscode/mcp.json) with the server command and arguments
- **GitHub Copilot CLI**: Writes to `~/.copilot/mcp-config.json`
- **Cursor**: Generates `~/.cursor/mcp.json`

```bash

# Install Copilot support (VS Code)

code-review-graph install --platform copilot

# Install Cursor support

code-review-graph install --platform cursor

```

The resulting configuration files specify the command `code-review-graph serve` as the entry point, allowing the AI tool to spawn the server process when needed.

### Stage 3: Instruction Injection

After configuration installation, the CLI injects standardized markdown instruction sections into project documentation files. The `inject_claude_md` and `inject_platform_instructions` functions (lines 260-273 in [`skills.py`](https://github.com/tirth8205/code-review-graph/blob/main/skills.py)) append content from the `_CLAUDE_MD_SECTION` and `_COPILOT_SECTION` constants (lines 135-185) to files like [`CLAUDE.md`](https://github.com/tirth8205/code-review-graph/blob/main/CLAUDE.md), [`AGENTS.md`](https://github.com/tirth8205/code-review-graph/blob/main/AGENTS.md), or hidden `.github` instruction files.

These instructions tell the AI assistant to prioritize graph-specific tools—`semantic_search_nodes_tool`, `query_graph_tool`, and `detect_changes_tool`—over naive file searches when answering questions about code review history or codebase structure.

### Stage 4: Optional Runtime Hooks

For platforms supporting event-driven interactions, the installer creates hook definitions in platform-specific [`settings.json`](https://github.com/tirth8205/code-review-graph/blob/main/settings.json) files. The `install_cursor_hooks` function (referenced in [`cli.py`](https://github.com/tirth8205/code-review-graph/blob/main/cli.py) lines 86-90) writes configurations that invoke `code-review-graph` on edit, write, or tool-use events within Cursor IDE.

This enables real-time graph updates as the developer modifies code, keeping the knowledge base synchronized with the AI assistant’s context window.

### Stage 5: Running the MCP Server

The final component is the server itself, implemented in [`code_review_graph/main.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/main.py) and launched via the CLI ([`cli.py`](https://github.com/tirth8205/code-review-graph/blob/main/cli.py) lines 154-150). The server communicates via JSON-RPC over stdin/stdout by default, or over HTTP when started with the `--http` flag.

```bash

# Standard MCP mode (stdio)

code-review-graph serve --auto-watch

# HTTP mode for remote debugging

code-review-graph serve --http --port 5555

```

Once running, the AI coding platform reads the previously installed configuration, connects to the server, and begins dispatching tool requests.

## Platform-Specific Setup Examples

### GitHub Copilot Integration

For VS Code Copilot users, the integration writes a workspace-level configuration file and injects project-wide instructions:

```json
// .vscode/mcp.json
{
  "servers": {
    "code-review-graph": {
      "command": "code-review-graph",
      "args": ["serve", "--auto-watch"]
    }
  }
}

```

The installer also adds the MCP-tools markdown section to a hidden `.github` directory, ensuring Copilot Chat applies graph-aware instructions across the entire workspace without modifying visible project documentation.

### Cursor IDE Integration

Cursor receives both an MCP configuration and optional user-level hooks. The configuration resides in the user's home directory rather than the workspace, applying the graph tools globally across all Cursor projects:

```json
// ~/.cursor/mcp.json
{
  "mcpServers": {
    "code-review-graph": {
      "command": "code-review-graph",
      "args": ["serve"]
    }
  }
}

```

If the `~/.cursor` directory exists during installation, the CLI additionally creates hook definitions in [`.cursor/settings.json`](https://github.com/tirth8205/code-review-graph/blob/main/.cursor/settings.json) that trigger graph updates on file modifications.

## Summary

- **MCP Protocol**: code-review-graph implements a Multi-Coding-Platform server that standardizes communication between your knowledge graph and AI coding assistants.
- **Auto-Detection**: The `_copilot_vscode_detected` function and `PLATFORMS` registry in [`skills.py`](https://github.com/tirth8205/code-review-graph/blob/main/skills.py) verify local installations before writing configs.
- **Configuration Generation**: `install_platform_configs` creates [`.vscode/mcp.json`](https://github.com/tirth8205/code-review-graph/blob/main/.vscode/mcp.json) for Copilot and `~/.cursor/mcp.json` for Cursor, specifying the `serve` command entry point.
- **Instruction Injection**: Constants `_CLAUDE_MD_SECTION` and `_COPILOT_SECTION` provide markdown templates that prioritize graph tools over file searches.
- **Runtime Hooks**: Optional Cursor hooks in `install_cursor_hooks` enable real-time synchronization between code edits and the knowledge graph.
- **Server Execution**: The `serve` command in [`cli.py`](https://github.com/tirth8205/code-review-graph/blob/main/cli.py) launches the JSON-RPC server accessible via stdin/stdout or HTTP on port 5555.

## Frequently Asked Questions

### What AI platforms are compatible with code-review-graph?

Any AI coding tool supporting the MCP protocol can integrate, including GitHub Copilot (VS Code extension and CLI), Cursor, Claude Code, CodeBuddy, and Codex. The `PLATFORMS` dictionary in [`code_review_graph/skills.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/skills.py) defines specific detection logic and configuration paths for each supported tool.

### How does the AI assistant know when to use graph tools versus regular file search?

The `inject_platform_instructions` function appends markdown sections to [`CLAUDE.md`](https://github.com/tirth8205/code-review-graph/blob/main/CLAUDE.md), [`AGENTS.md`](https://github.com/tirth8205/code-review-graph/blob/main/AGENTS.md), or `.github` instruction files that explicitly instruct the AI to call `semantic_search_nodes_tool` or `query_graph_tool` before falling back to file system operations. This ensures token-efficient retrieval of code review context.

### Can I run the MCP server on a different port or machine?

Yes. While the default mode uses stdio for local tool communication, you can expose the server over HTTP using `code-review-graph serve --http --port 5555`. This is useful for remote development environments or when debugging the graph tool responses outside of the IDE.

### Does the integration modify my AI tool's core settings?

No. code-review-graph only writes to platform-specific configuration directories (`.vscode`, `~/.cursor`, `~/.copilot`) and optional project markdown files. It does not modify the AI platform's executable or core settings, and changes can be reverted by deleting the generated MCP config files.