Skip to main content

MCP Server

Use CodePeel as a tool inside your AI coding agent. Your AI writes code, then reviews its own output for bugs and security issues before showing it to you.

Compatible with Kiro, Claude Code, Cline, Roo, Augment, and any MCP-compatible client.


Prerequisites

Before setting up the MCP server:

  1. Sign up at codepeel.ai (free account works)
  2. Create an API token:
    • Go to Settings in the sidebar → API Tokens
    • Click Create new token
    • Copy the token (starts with cpk_) — you won't see it again
Settings page showing API Tokens section with Create new token button

API tokens don't expire unless you manually revoke them. Store yours securely. Do not use Firebase session tokens — those expire after 1 hour.


Setup

Quick Install (recommended)

Use the install-mcp CLI to auto-configure any editor:

npx install-mcp @codepeel/mcp-server --client cursor --header "Authorization: Bearer cpk_your-token-here"

Replace cursor with your editor: claude-desktop, claude-code, cline, roo-cline, windsurf, vscode, codex, goose, zed

For Claude Code (CLI)

claude mcp add codepeel --env CODEPEEL_TOKEN=cpk_your-token-here -- npx @codepeel/mcp-server

For Kiro

Add to .kiro/settings/mcp.json:

{
  "mcpServers": {
    "codepeel": {
      "command": "npx",
      "args": ["@codepeel/mcp-server"],
      "env": {
        "CODEPEEL_TOKEN": "cpk_your-token-here"
      }
    }
  }
}

For Cursor

Add to .cursor/mcp.json in your project root:

{
  "mcpServers": {
    "codepeel": {
      "command": "npx",
      "args": ["@codepeel/mcp-server"],
      "env": {
        "CODEPEEL_TOKEN": "cpk_your-token-here"
      }
    }
  }
}

For Cline / Roo / Other Extensions

  1. Open the extension's MCP settings UI
  2. Add a new server:
    • Server name: codepeel
    • Command: npx
    • Args: @codepeel/mcp-server
    • Environment: CODEPEEL_TOKEN=cpk_your-token-here

Available Tools

Once connected, your AI agent has access to 4 tools:

review_code

Review a unified diff for bugs, security issues, and best practice violations.

ParameterRequiredDescription
diffYesUnified diff string (e.g., output of git diff)
repoNoRepository name for context (default: "local")

Returns: Structured findings with severity, file, line, explanation, and suggested fixes.

Example prompts:

  • "Review my uncommitted changes using CodePeel"
  • "Run a code review on my staged changes"
  • "Check this diff for security issues"

fix_code

Generate a fix for a specific code issue.

ParameterRequiredDescription
fileYesFile path where the issue exists
issueYesDescription of the problem
problemCodeNoThe problematic code snippet
lineNoLine number where the issue is
severityNocritical, high, medium, or low (default: medium)

Returns: Generated fix code with explanation.

Example prompts:

  • "Use CodePeel to fix the memory leak in timer.dart"
  • "Fix the SQL injection in getUserById"

ask_codepeel

Ask questions about code patterns, architecture, or get explanations.

ParameterRequiredDescription
questionYesYour question about the code
diffNoCode context to analyze (diff or file contents)

Returns: AI-generated answer with code context.

Example prompts:

  • "Ask CodePeel if there are race conditions in my auth flow"
  • "Ask CodePeel to explain the payment processing logic"

check_credits

Check your account balance and usage. Free — does not consume a review.

ParameterRequiredDescription
(none)No parameters needed

Returns: Plan tier, reviews used, reviews remaining, reset date.


Common Workflows

Self-reviewing AI code

The most powerful pattern — your AI reviews its own output:

You: Build a payment processing function
AI: [writes code]
AI: [calls review_code on its own diff]
AI: I found a potential SQL injection. Let me fix that...
AI: Here's the corrected payment function.

Pre-commit quality gate

You: Review my staged changes before I commit
AI: [runs git diff --cached, calls review_code]
AI: Found 2 issues — a null pointer in user.ts and a missing
    error handler in api.ts. Should I fix them?

Fix a specific issue

You: Fix the N+1 query in src/services/orders.ts
AI: [calls fix_code with file and issue description]
AI: Here's the fix — I've batched the queries using Promise.all...

Architecture review

You: Ask CodePeel if my new service layer architecture makes sense
AI: [calls ask_codepeel with the relevant code]
AI: CodePeel suggests extracting the validation logic into middleware...

The same rate limits apply (3/10/20 per hour based on plan). Additionally, MCP calls have a burst limit of 20 requests per minute.


CLI Commands

The @codepeel/mcp-server package also works as a standalone CLI tool:

npx @codepeel/mcp-server help
CommandWhat it does
initInteractive setup — configures MCP in your editor
init-configGenerates .codepeel.yml in the current directory from your dashboard settings
reviewReviews a diff piped from stdin
creditsShows your account balance and usage
helpShows all available commands

Review from the terminal

Pipe any diff into the review command for instant feedback:

git diff | npx @codepeel/mcp-server review
git diff --cached | npx @codepeel/mcp-server review

Check your balance

npx @codepeel/mcp-server credits

Generate config

npx @codepeel/mcp-server init-config

Creates a .codepeel.yml in the current directory based on your dashboard settings. See Configuration docs for all options.

All CLI commands require CODEPEEL_TOKEN set in your environment.


Environment Variables

VariableRequiredDescription
CODEPEEL_TOKENYesYour API token from Settings → API Tokens (starts with cpk_)
CODEPEEL_API_URLNoCustom API URL (default: https://codepeel.ai/api)

Troubleshooting

"CODEPEEL_TOKEN not set"

The environment variable isn't reaching the MCP server. Double-check your config file has the env block with CODEPEEL_TOKEN.

"Token expired" or "Invalid token"

Make sure you're using a permanent API token (starts with cpk_) from Settings → API Tokens. These don't expire unless manually revoked.

Common mistake: using a Firebase session token (from browser dev tools) instead of an API token. Session tokens expire after 1 hour. Always use cpk_ tokens.

"No reviews remaining"

You've used all reviews for this billing period. Options:

  • Wait for reset (1st of each month)
  • Upgrade your plan
  • Run check_credits to see your exact usage

"Rate limit exceeded"

You've hit either the hourly plan limit or the burst limit (20 requests/minute). The server will tell you how long to wait. See rate limits.

Server not starting

Run the server manually to see error output:

CODEPEEL_TOKEN=cpk_your-token npx @codepeel/mcp-server

Common causes:

  • Node.js not installed — requires Node.js 18+
  • Network issues — the server needs internet access to reach the CodePeel API
  • Invalid token — check that your token starts with cpk_

Server starts but tools don't appear

  • Restart your AI editor after adding the MCP config
  • Check that the config file path is correct for your editor
  • Look for error messages in your editor's MCP server logs
← All docsCodePeel