codeviewer-mcp
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.
README
codeviewer-mcp
codeviewer-mcp is a TypeScript MCP server for stateful, AST-aware code review workflows.
It is designed for clients that can run MCP servers over STDIO (local command execution) and call tools in iterative review loops.
What this repository provides
- A local MCP server process (
dist/index.js) that exposes review tools - Stateful review sessions stored in SQLite
- AST-based context localization for JS/TS code
- Deterministic preflight checks (TypeScript diagnostics + basic security pattern checks)
- Structured review output with verdicts, categorized feedback, and optional search/replace patch suggestions
MCP tools exposed by the server
1) register_plan
Registers a review session and its ordered plan steps.
Input:
project_path(optional string)steps(string array, required, at least 1)
Output:
session_id(UUID)steps_registered(number)status(ACTIVE)
2) review_code_chunk
Reviews one code chunk against a specific plan step.
Input:
session_id(UUID)plan_step(positive integer)target_file(string)code_chunk(string)modification_type(INSERT|MODIFY|DELETE|REPLACE)target_node(optional string)active_skills(optional string array)
Output:
verdict(PASSorNEEDS_WORK)critical_issues(number)feedback(array)patches(array)plan_step_status(PENDING|IN_PROGRESS|VALIDATED)
Runtime behavior
- On startup, the server initializes a SQLite database (default:
.codeviewer-mcp.sqlitein project root). - For each
review_code_chunkrequest, the server:- Validates the session and plan step
- Re-indexes project AST context
- Runs preflight checks on the submitted chunk
- Produces a structured review response
- Logs chunk + review data and updates plan step status
Requirements
- Node.js 20+ (recommended)
- npm
- Build tools required by native Node modules (for
better-sqlite3)
Installation (manual/local)
This repository is intended to run as a local MCP server process.
- Clone the repository
git clone https://github.com/Master0fFate/codeviewer-mcp.git
cd codeviewer-mcp
- Install dependencies
npm install
- Build
npm run build
- Start server
npm start
Development mode (no prebuild step):
npm run dev
Environment variables
MCP_PROJECT_PATH(optional): project root used for AST indexing. Defaults to current working directory.MCP_REVIEWER_DB_PATH(optional): SQLite DB path. Defaults to<MCP_PROJECT_PATH>/.codeviewer-mcp.sqlite.
Example:
MCP_PROJECT_PATH=/absolute/path/to/target/repo \
MCP_REVIEWER_DB_PATH=/absolute/path/to/reviewer.sqlite \
node dist/index.js
Installing into MCP clients / LLM harnesses
The server uses STDIO transport, so integration is done by registering a local command.
Canonical command
Use this command in your MCP client configuration:
node /absolute/path/to/codeviewer-mcp/dist/index.js
Recommended args/env form:
{
"command": "node",
"args": ["/absolute/path/to/codeviewer-mcp/dist/index.js"],
"env": {
"MCP_PROJECT_PATH": "/absolute/path/to/target/project",
"MCP_REVIEWER_DB_PATH": "/absolute/path/to/target/project/.codeviewer-mcp.sqlite"
}
}
Claude Code
- Open your Claude Code MCP/server configuration file.
- Add a new server entry using the canonical STDIO command.
- Set
MCP_PROJECT_PATHto the repository Claude Code should review. - Save config and restart Claude Code.
- Confirm the server appears and exposes
register_planandreview_code_chunk.
Example server block:
{
"name": "codeviewer-mcp",
"command": "node",
"args": ["/absolute/path/to/codeviewer-mcp/dist/index.js"],
"env": {
"MCP_PROJECT_PATH": "/absolute/path/to/repo"
}
}
OpenCode
- Open OpenCode MCP settings.
- Register a new STDIO MCP server named
codeviewer-mcp. - Point
command/argsto your builtdist/index.js. - Provide
MCP_PROJECT_PATHin environment settings. - Restart OpenCode and validate tool discovery.
Example entry:
{
"mcpServers": {
"codeviewer-mcp": {
"command": "node",
"args": ["/absolute/path/to/codeviewer-mcp/dist/index.js"],
"env": {
"MCP_PROJECT_PATH": "/absolute/path/to/repo"
}
}
}
}
Droid(factory)
- Open Droid(factory) MCP connector configuration.
- Add a local STDIO server entry.
- Use
nodeas command anddist/index.jsas the argument. - Configure environment variables for project/database paths.
- Restart Droid(factory) runtime and verify tool availability.
Use the canonical JSON block shown above.
Kilo Code CLI
- Open Kilo Code CLI MCP configuration.
- Add a new server alias (for example
codeviewer-mcp). - Register the same STDIO launch command.
- Set
MCP_PROJECT_PATHfor the target repository. - Restart the CLI session and list MCP tools to confirm connection.
Use the canonical JSON block shown above.
Note: client config schema and config file location can vary by version. If your MCP client expects different key names, map the same command/args/env values into its schema.
Verification checklist after integration
- Server process starts without error
- Client shows connected MCP server
- Tools discovered:
register_planreview_code_chunk
- A sample
register_plancall returns asession_id - A sample
review_code_chunkcall returns a structured verdict
Development and validation
Run tests:
npm test
Build:
npm run build
Repository layout
/src/index.ts- process entrypoint and STDIO transport/src/server.ts- MCP server + tool registration/src/schemas.ts- zod schemas for tool contracts/src/state.ts- SQLite state store/src/ast.ts- AST indexing and context localization/src/preflight.ts- static preflight checks/src/reviewer.ts- review decision + output shaping/tests- vitest test suite/prompts/universal-auditor-general-v2.1.md- audited prompt artifact
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.