loading…
Search for a command to run...
loading…
A stateful, AST-aware MCP server for structured code review workflows. It enables iterative review sessions with AST-based context localization and provides str
A stateful, AST-aware MCP server for structured code review workflows. It enables iterative review sessions with AST-based context localization and provides structured feedback with verdicts and patch suggestions for JavaScript/TypeScript code.
codeviewer-mcp is a TypeScript MCP server for stateful, AST-aware code review workflows.
It runs over STDIO and is designed for MCP clients and LLM harnesses that can launch local MCP servers.
register_planreview_code_chunkcleanup_expired_sessionscleanup_sessionlist_sessionslist_indexing_errorslist_prompt_profilesget_prompt_profilehealth_checkThese prerequisites are required for this MCP to install and run correctly.
| Requirement | Why it is needed |
|---|---|
| Node.js 20+ | Runtime for server and MCP SDK |
| pnpm 9+ | Dependency install and build workflow |
| Git | Clone/update repository for auto-install flows |
| Native build toolchain | Required by better-sqlite3 native module |
Native build toolchain by OS:
xcode-select --install)build-essential python3 make g++If native builds are missing, pnpm install can fail while compiling better-sqlite3.
git clone https://github.com/Master0fFate/codeviewer-mcp.git
cd codeviewer-mcp
pnpm install
pnpm build
pnpm start
Development mode:
pnpm dev
| Variable | Description | Default |
|---|---|---|
MCP_PROJECT_PATH |
Project root for AST indexing and path containment checks | Current working directory |
MCP_REVIEWER_DB_PATH |
SQLite database path | <MCP_PROJECT_PATH>/.codeviewer-mcp.sqlite |
MCP_PROMPTS_DIR |
Directory containing *.md prompt profiles |
<server_root>/prompts |
MCP_DEFAULT_PROMPT_PROFILE |
Default prompt profile ID used when register_plan omits prompt_profile |
universal-auditor-general-v2.1 if present, else first profile |
MCP_SESSION_TTL_HOURS |
Session TTL in hours, positive integer only | 168 |
MCP_AUTH_TOKEN |
Optional bearer token for shared environments. If set, every tool call must include auth_token. |
unset |
MCP_CLEANUP_ON_STARTUP |
Cleanup expired sessions on process start (true or false) |
false |
LOG_LEVEL |
Log level (trace, debug, info, warn, error) |
info |
Example:
MCP_PROJECT_PATH=/absolute/path/to/repo \
MCP_SESSION_TTL_HOURS=24 \
LOG_LEVEL=info \
node dist/index.js
Authentication example when MCP_AUTH_TOKEN is set:
{
"session_id": "11111111-1111-1111-1111-111111111111",
"plan_step": 1,
"target_file": "src/example.ts",
"code_chunk": "export const ok = true;",
"modification_type": "MODIFY",
"auth_token": "your-shared-secret"
}
This MCP now supports session-level prompt compartmentalization from the prompts folder.
*.md in the prompts directory.prompts/cybersec.md -> prompt_profile: "cybersec"register_plan and optional prompt_profile.review_code_chunk call in that session.review_code_chunk output includes:active_prompt_profileactive_prompt_titleactive_prompt_headingsUse helper tools:
list_prompt_profiles to see available profiles.get_prompt_profile to read full prompt content for a profile.Example register_plan payload with specialization profile:
{
"project_path": "/absolute/path/to/repo",
"prompt_profile": "cybersec",
"steps": [
"Review auth and secrets handling",
"Check unsafe execution paths"
]
}
This section is written for autonomous LLM installers and MCP harnesses.
node /absolute/path/to/codeviewer-mcp/dist/index.js
set -euo pipefail
INSTALL_ROOT="${HOME}/mcp-servers"
SERVER_DIR="${INSTALL_ROOT}/codeviewer-mcp"
mkdir -p "${INSTALL_ROOT}"
if [ ! -d "${SERVER_DIR}/.git" ]; then
git clone https://github.com/Master0fFate/codeviewer-mcp.git "${SERVER_DIR}"
else
git -C "${SERVER_DIR}" pull --ff-only
fi
cd "${SERVER_DIR}"
pnpm install
pnpm build
$InstallRoot = Join-Path $HOME "mcp-servers"
$ServerDir = Join-Path $InstallRoot "codeviewer-mcp"
New-Item -ItemType Directory -Path $InstallRoot -Force | Out-Null
if (-not (Test-Path (Join-Path $ServerDir ".git"))) {
git clone https://github.com/Master0fFate/codeviewer-mcp.git $ServerDir
} else {
git -C $ServerDir pull --ff-only
}
Set-Location $ServerDir
pnpm install
pnpm build
Use the same STDIO launch values in every harness.
Canonical server block:
{
"name": "codeviewer-mcp",
"transport": "stdio",
"command": "node",
"args": ["/absolute/path/to/codeviewer-mcp/dist/index.js"],
"env": {
"MCP_PROJECT_PATH": "/absolute/path/to/target/repo",
"MCP_REVIEWER_DB_PATH": "/absolute/path/to/target/repo/.codeviewer-mcp.sqlite",
"LOG_LEVEL": "info"
}
}
codeviewer-mcp under mcpServers with the canonical command/args/env values.Example:
{
"mcpServers": {
"codeviewer-mcp": {
"command": "node",
"args": ["/absolute/path/to/codeviewer-mcp/dist/index.js"],
"env": {
"MCP_PROJECT_PATH": "/absolute/path/to/repo"
}
}
}
}
codeviewer-mcp.node, point args to built dist/index.js, and set MCP_PROJECT_PATH.If your version supports JSON settings, map the canonical server block into your MCP settings schema.
codeviewer-mcp.node + built dist/index.js.MCP_PROJECT_PATH and optional DB/log env vars.Any client that supports local STDIO MCP servers can use the canonical block above. If field names differ, map the same values into your client schema.
register_plan, review_code_chunk, cleanup_expired_sessions, cleanup_session, list_sessions, list_indexing_errors, list_prompt_profiles, get_prompt_profile, health_checkregister_plan returns a valid session_idreview_code_chunk returns structured verdict outputhealth_check reports healthy database/session statuspnpm test
pnpm build
MCP_AUTH_TOKEN) and should be enabled in shared environments.MCP_SESSION_TTL_HOURS./src/index.ts - Process entrypoint and STDIO transport/src/server.ts - MCP server and tool registration/src/schemas.ts - Zod tool contract schemas/src/state.ts - SQLite state store and session lifecycle/src/ast.ts - AST indexing and context localization/src/preflight.ts - Static preflight checks/src/reviewer.ts - Review decision and output shaping/src/logger.ts - Structured logging/tests - Vitest test suiteGNU v3
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"codeviewer-mcp": {
"command": "npx",
"args": []
}
}
}