Critic-MCP
Critic-MCP — 容赦ないコード批評家
他のAIコーディングアシスタント(Cursor、OpenCode、Clineなど)が生成したコードを、読み取り専用でレビューするオープンソースのModel Context Protocol(MCP)サーバーです。
Critic-MCPは「第二の目」です。コードを修正することは決してなく、容赦なく批評するだけです。単一のツール(review_code)を公開し、ファイル書き込み機能は一切ありません。
何をするのか?
review_codeツールは、送信されたコードを元の要件(意図)と比較し、LLMを通じて以下のセクションからなるレビューレポートを生成します。
判定:
APPROVED|MODIFICATION_REQUIRED|REJECTED欠落している要件 — 意図とコードのギャップ
セキュリティ上の問題 — SQLインジェクション、XSS、権限昇格、ハードコードされたシークレット
エッジケースの問題 — null/空の入力、境界値、オフバイワン、競合状態
パフォーマンスの問題 — N+1クエリ、メモリリーク、冗長な計算
その他の問題 + 修正必須項目(優先順位順)
Related MCP server: codereview-mcp
インストール — 2ステップ
要件: Node.js >= 20
ステップ1: 認証(1回のみ)
インタラクティブなセットアップを実行します。これはaws configureやgh auth loginと同様に動作します。
npx -y critic-mcp auth使用するプロバイダー(gemini / openai / deepseek)を尋ね、APIキーを入力するよう促し、両方をホームディレクトリの~/.critic-mcp.jsonに保存します(Unixではパーミッション0600)。
ステップ2: IDEに追加する
IDEのMCP設定に以下だけを追加します。
{ "command": "npx", "args": ["-y", "critic-mcp"] }クライアント固有の詳細については、AIアシスタント統合セクションを参照してください。これで完了です。キーは1か所に保存され、すべてのIDE設定の外部に置かれます。
キーがIDE設定に書き込まれることはありません。サーバー起動時には最初に
process.envを確認し、次に~/.critic-mcp.jsonを確認します。どちらにもキーが見つからない場合は、npx critic-mcp authを実行するよう指示されます。
ローカル開発(ソースからインストール)
git clone https://github.com/layermedya/Critic-MCP.git
cd Critic-MCP
npm ci
npm run build
node dist/index.js auth # authenticate against your own buildコマンド
npm run build # TypeScript compilation
npm run typecheck # Type checking
npm test # Vitest unit tests
npm run test:watch # Tests in watch mode
npm start # Start the server on stdio
npm run inspect # Manual testing in the browser via MCP Inspector環境変数(オプション)
これらはすべてオプションです。APIキーの通常のパスはnpx critic-mcp authです。環境変数は常に設定ファイルよりも優先されます(CI/サーバー設定用)。
変数 | 説明 |
|
|
| Geminiキー(設定されている場合、ファイルを上書き) |
| OpenAI/DeepSeekキー(設定されている場合、ファイルを上書き) |
| Geminiモデル名(デフォルト: |
| モデル名(デフォルト: |
| DeepSeekなどのベースURL(deepseekのデフォルトは |
| LLMリクエストのタイムアウト(デフォルト: |
| チャンク分割の制限(デフォルト: |
| チャンクレビュー中の並列リクエスト数(デフォルト: |
| 設定ファイルの場所を上書き(デフォルト: |
AIアシスタント統合
以下の設定はいずれもキーを保持しません。authコマンド(上記ステップ1)で一度認証するだけです。npxを使用するにはパッケージがnpmに公開されている必要があります。ローカルクローンの場合は、代わりに"command": "node", "args": ["ABSOLUTE_PATH/dist/index.js"]を使用できます。
Cursor
プロジェクトレベルの.cursor/mcp.json(またはグローバルの~/.cursor/mcp.json)に以下を追加します。
{
"mcpServers": {
"critic": {
"command": "npx",
"args": ["-y", "critic-mcp"]
}
}
}または、設定 → MCP → Add new MCP server に進み、JSONを貼り付けます。
OpenCode
プロジェクトレベルの.opencode/opencode.jsonまたはグローバルの~/.config/opencode/opencode.jsonに以下を追加します。
{
"mcp": {
"critic": {
"type": "local",
"command": ["npx", "-y", "critic-mcp"],
"enabled": true
}
}
}OpenCodeは
mcpServersではなくmcpキーを使用し、envではなくenvironmentフィールドを使用します。commandは配列である必要があります。environmentブロックにキーを書き込む必要はなくなりました。
Cline(VS Code拡張機能)
Clineパネルを開き → MCP Serversタブ → Edit Global MCPまたはEdit Project MCPを選択し、JSONを編集します。
{
"mcpServers": {
"critic": {
"command": "npx",
"args": ["-y", "critic-mcp"],
"disabled": false,
"autoApprove": ["review_code"]
}
}
}
autoApproveを使用すると、Clineは確認なしでreview_codeを実行できます。このツールはファイルを書き込むことがないため安全です。
Continue.dev
MCPサーバーを~/.continue/config.jsonに追加します(Continueのバージョンに関係なくstdioトランスポートがサポートされています)。
{
"experimental": {
"modelContextProtocolServers": [
{
"transport": {
"type": "stdio",
"command": "npx",
"args": ["-y", "critic-mcp"]
}
}
]
}
}手動テストシナリオ
examples/bad_code.jsは、SQLインジェクション、XSS、N+1クエリを意図的に含むExpressの例です。examples/intent.txtには元の要件が含まれています。任意のクライアントから次のように呼び出します。
"Review the code in examples/bad_code.js with the review_code tool. Requirement: examples/intent.txt"
批評家が少なくとも以下を検出することを期待します。
CRITICAL:
db.query("SELECT * FROM users WHERE email = '" ...)— SQLインジェクションCRITICAL:
res.send(comment.body)— 保存型XSSHIGH: ユーザーごとに個別のクエリ — N+1問題
アーキテクチャ
src/index.ts -> MCP server, zod validation, error handling + `auth` argv routing
src/cli.ts -> Interactive authentication flow (`critic-mcp auth`)
src/config.ts -> Global config (~/.critic-mcp.json) + credential resolution (env → file)
src/prompt.ts -> Ruthless Critic system prompt + chunked-review prompts
src/llm.ts -> Provider layer + timeout protection + map-reduce orchestration
src/chunker.ts -> Line-ending based chunking (for code above the limit)チャンクレビュー(マップリデュース)
code_snippetがCHUNK_SIZE(デフォルト30,000文字)を超えると、システムは自動的にマップリデュースフローに切り替わります。
マップ: コードを行境界で分割し、各チャンクをLLMに同時に送信します(デフォルト3並列リクエスト、
CRITIC_CONCURRENCYで設定可能)。単一のチャンクの失敗がレビュー全体を停止することはありません。リデュース: 返されたすべての部分分析は、「シンセサイザー」プロンプトによって統合されます。このプロンプトは、発見事項を弱めることはなく、単一の部分がCRITICALを報告した場合にAPPROVEDを返すことは決してありません。最終的に1つの最終レポートが生成されます。
サーバーは文字列レポートのみを返します。ファイル書き込み機能はなく、外部へのネットワーククライアントを公開することもありません。
ライセンス
MIT
Available Tools
1 toolreview_codeA
Read-only code critic. Analyzes the provided code snippet against its stated intent and returns a detailed, ruthless review report: missing requirements, security vulnerabilities (SQLi, XSS, privilege escalation), edge cases and performance issues (N+1, memory leaks). Never writes files — returns the report as text only.
Inputs: intent (required), code_snippet (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
With only one tool, there is no possibility of confusion between tools. The single tool's purpose is clearly defined in great detail.
Naming consistency is not applicable as a concept with a single tool. It cannot be penalized and defaults to the highest score.
A single tool severely limits the server's functionality. While the tool is comprehensive, it would benefit from being broken down into more focused tools (e.g., review_security, review_performance).
The server covers only the 'review' aspect. For a code review tool, this is acceptable, but it lacks any supporting tools for follow-up actions like re-review, fetching additional context, or managing review sessions.
Related MCP Connectors
Audit your MCP servers for poisoned tools and leaked secrets, and check AI-generated code for flaws.
Scan AI agent skills, MCP server packages and MCP configs before you install them. Static analysis.
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
One MCP server for all your MCP servers: code mode, per-tool permissions, approvals and audit.
Related MCP Servers
- AlicenseAqualityBmaintenanceAn MCP server that provides local code quality analysis for AI coding assistants, supporting file analysis, git diff review, and full project scanning with quality scoring.559 PyPI3MIT
- AlicenseAqualityCmaintenanceAn MCP server that lets AI agents review code using language models, supporting git diffs, files, and snippets with severity levels. Works with Ollama (local) and hosted providers like OpenAI, Anthropic, and OpenRouter.3MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for automated code review using AI agents. It analyzes code diffs or file paths for bugs, security issues, and style violations.MIT
- AlicenseAqualityDmaintenanceDeterministic code review MCP server that provides tools for file selection, rule matching, comment positioning, and reflection, ensuring stable review quality without LLM calls.51MIT