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:
- Sign up at codepeel.ai (free account works)
- 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
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
- Open the extension's MCP settings UI
- Add a new server:
- Server name:
codepeel - Command:
npx - Args:
@codepeel/mcp-server - Environment:
CODEPEEL_TOKEN=cpk_your-token-here
- Server name:
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.
| Parameter | Required | Description |
|---|---|---|
diff | Yes | Unified diff string (e.g., output of git diff) |
repo | No | Repository 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.
| Parameter | Required | Description |
|---|---|---|
file | Yes | File path where the issue exists |
issue | Yes | Description of the problem |
problemCode | No | The problematic code snippet |
line | No | Line number where the issue is |
severity | No | critical, 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.
| Parameter | Required | Description |
|---|---|---|
question | Yes | Your question about the code |
diff | No | Code 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.
| Parameter | Required | Description |
|---|---|---|
| (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
| Command | What it does |
|---|---|
init | Interactive setup — configures MCP in your editor |
init-config | Generates .codepeel.yml in the current directory from your dashboard settings |
review | Reviews a diff piped from stdin |
credits | Shows your account balance and usage |
help | Shows 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_TOKENset in your environment.
Environment Variables
| Variable | Required | Description |
|---|---|---|
CODEPEEL_TOKEN | Yes | Your API token from Settings → API Tokens (starts with cpk_) |
CODEPEEL_API_URL | No | Custom 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_creditsto 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