npm package: @rectify-so/mcp
Description: Rectify MCP Server for IDE integration
Author: Rectify
Latest version: 1.0.8

# Rectify MCP Server

An MCP (Model Context Protocol) server to access Rectify project resources from IDEs.

## Install

```bash
npm i -g @rectify-so/mcp
```

## Production Usage

### Command Line

```bash
rectify-mcp --token mcp_xxx:userId
```

### IDE Configuration

Copy just the top-level `rectify` block (do not wrap in `mcpServers` unless your IDE requires it):

```json
{
  "rectify": {
    "command": "npx",
    "args": ["-y", "@rectify-so/mcp", "--token", "mcp_xxx:userId"]
  }
}
```

#### Claude Desktop

Add to Claude Desktop config:

**Windows:** `%APPDATA%/Claude/claude_desktop_config.json`  
**macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`

```json
{
  "mcpServers": {
    "rectify": {
      "command": "npx",
      "args": [
        "-y",
        "@rectify-so/mcp",
        "--token",
        "mcp_xxx:userId",
      ]
    }
  }
}
```

#### Cursor

Add to Cursor settings:

```json
{
  "mcp.servers": {
    "rectify": {
      "command": "npx",
      "args": [
        "-y",
        "@rectify-so/mcp",
        "--token",
        "mcp_xxx:userId",
      ]
    }
  }
}
```

## Local Development

### Prerequisites
- Node.js (v18 or higher)
- npm or yarn
- A valid Rectify MCP token (get from https://app.rectify.so)

### Setup

1. **Clone and install dependencies:**
```bash
cd rectify-mcp
npm install
```

2. **Build the project (optional):**
```bash
npm run build
```

### Running Locally

#### Option 1: Using npm dev script
```bash
npm run dev -- --token mcp_xxx:userId
```

#### Option 2: Using the built CLI
```bash
node dist/cli.js --token mcp_xxx:userId
```

#### Option 3: Test with tsx locally
```bash
npx tsx src/cli.ts --token mcp_xxx:userId
```

### Testing with MCP Inspector

Run the server inside MCP Inspector:

```bash
npx @modelcontextprotocol/inspector node dist/cli.js --token mcp_xxx:userId
```

### Testing in IDE (Local Development)

#### Windsurf Local Testing
Update `~/.codeium/windsurf/mcp_config.json` to use the compiled CLI:
```json
{
  "rectify": {
    "command": "node",
    "args": [
      "/absolute/path/to/rectify-mcp/dist/cli.js",
      "--token",
      "mcp_xxx:userId"
    ]
  }
}
```

#### Claude Desktop Local Testing
Update Claude config (`%APPDATA%/Claude/claude_desktop_config.json` on Windows or `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
```json
{
  "rectify": {
    "command": "node",
    "args": [
      "/absolute/path/to/rectify-mcp/dist/cli.js",
      "--token",
      "mcp_xxx:userId"
    ]
  }
}
```

### Debugging

Enable verbose logging to see detailed output:
```bash
node dist/cli.js --token mcp_xxx:userId --verbose
```

Check logs for:
- Token validation status
- Organization and project IDs
- Resource requests
- API errors

### Common Issues

**Token validation fails:**
- Verify the token format is correct: `mcp_xxx:userId`
- Confirm the backend MCP endpoints are reachable
- Check network connectivity from your environment to the API

**Resources not showing:**
- Ensure the MCP token has permissions for feedbacks and scan data
- Inspect backend logs for API errors

**IDE not connecting:**
- Rebuild the project after code changes: `npm run build`
- Restart your IDE after updating the config
- Check IDE logs for MCP connection errors
- Verify the absolute path to `dist/cli.js` is correct when running locally

## Options

- `--token <token>` - MCP authentication token (required, format: mcp_xxx:userId)

## Available Resources

### Feedback Resources
- `rectify://{orgId}/{projectId}/feedbacks` - List feedbacks with optional filters (assets excluded)
- `rectify://{orgId}/{projectId}/feedbacks/{id}` - Get feedback detail (bug-type includes debugDataUrl if available)
- `rectify://{orgId}/{projectId}/feedbacks/{id}/analyze-debug-data` - Analyze debug logs for a bug-type feedback
- `rectify://{orgId}/{projectId}/feedbacks/overview` - Get feedback overview statistics

### Scan Job Resources (when enabled)
- `rectify://{orgId}/{projectId}/scan/job` - Current scan job
- `rectify://{orgId}/{projectId}/scan/issues` - List scan issues
- `rectify://{orgId}/{projectId}/scan/issues/{key}` - Get issue detail
- `rectify://{orgId}/{projectId}/scan/issues/by-file` - Get issues by file
- `rectify://{orgId}/{projectId}/scan/metrics` - Scan metrics
- `rectify://{orgId}/{projectId}/scan/history` - Scan history

## Tools

- `rectify-feedbacks-analyze-debug-url`
  - Analyze compressed technical logs from a debugDataUrl.
  - Inputs: `debugDataUrl?`, `feedbackId?` (server resolves URL when an ID is given).
  - Note: debugDataUrl is only available for bug-type feedbacks.

## License

MIT