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クエリ、メモリリーク、冗長な計算
その他の問題 + 修正必須項目(優先順位順)
インストール — 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
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Hosted MCP server for structured code review passes on human- and AI-written code. Free tier.
Scans MCP servers for tool poisoning, prompt injection and supply chain risks.
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/layermedya/Critic-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server