CodePecker
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CodePeckerReview this code for security and standards issues and fix them."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
CodePecker
An MCP server that reviews a piece of code across four dimensions — security, standards, production readiness, sustainability — automatically fixes the issues, verifies the fix by running the code's tests, and reports what it did. Any MCP-capable agent (Claude Code, Codex, Copilot) can call it as a tool; there's also a CLI for local demos.
review → remediate → run tests → repeat (bounded) → findings + scorecard + fixed code + diff + citationsQuickstart (30 seconds)
git clone <this repo> && cd CodePecker
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt && pip install -e . --no-deps
cp .env.example .env # add a free Groq key — see Setup
codepecker examples/urlshortener_sample/store.py # review a flawed sample fileNo key yet? pytest -q runs the whole suite fully offline. Full details, other
providers, and MCP client wiring are below.
Related MCP server: code-review-mcp-server
How it works
For each of the four dimensions, CodePecker gathers findings two ways:
Deterministic checks (regex/code) for rules that must be caught reliably — hardcoded secrets,
eval/unsafe deserialization, bareexcept, missing tests. No LLM, so they never "forget".An LLM judge for the nuanced rules (input validation, logging, timeouts, N+1 queries, …), with guardrails: it may only cite rules from the batch it was given, any evidence it quotes must appear in the code, and severity/dimension come from the rule metadata — hallucinated findings are dropped in code.
Each rule lives in a markdown file in codepecker-skill/rules/ (RAG), tagged
deterministic: true|false so it's enforced by exactly one path. A hand-written,
bounded agent loop then asks the model to remediate and re-runs the tests — a fix
that resolves a finding but breaks the tests is not accepted.
The rule corpus is packaged as an Agent Skill: codepecker-skill/ is a valid
skill (a SKILL.md entry point over the same rules/ folder). So the same corpus
serves two surfaces from one source of truth — a Claude agent can load it as a skill
to suggest fixes at the desk, and the MCP server reads the same rules/ to
enforce them (deterministic checks, guardrails, test-verified remediation). One
corpus, no drift: the skill suggests, the MCP tool guarantees.
Setup
Requires Python 3.10+.
git clone <this repo> && cd CodePecker
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
pip install -e . --no-deps # makes `codepecker` + `python -m codepecker.*` work
cp .env.example .env # then add your key (below)Verify the install (fully offline — no key needed):
pytest -q # the test suite should passKeys — the default needs just one. Text runs on Groq (fast Llama 3.3 70B) and
embeddings run locally (no key). Put your Groq key in .env:
GROQ_API_KEY=... # free key at https://console.groq.com/keysProvider-agnostic via LiteLLM — switch model or provider with no code change,
e.g. CODEPECKER_TEXT_MODEL=openai/gpt-4o (one key does both), or go fully offline
with CODEPECKER_TEXT_MODEL=ollama/llama3.1. See .env.example.
Usage
CLI (local demo)
codepecker examples/urlshortener_sample/store.py
# or: python -m codepecker.cli examples/urlshortener_sample/store.pyPrints the findings, a rule-coverage scorecard (how the code did against all
rules per dimension — passes included, so you can attest coverage, not just
violations), the remediated code, a unified diff, the rules cited, and a metrics
summary. Each run is appended to metrics.jsonl.
If the file imports sibling modules, pass them with --support (repeatable) so the
sandbox can run the code's tests instead of failing on the import:
python -m codepecker.cli examples/urlshortener_sample/service.py \
--support examples/urlshortener_sample/store.py \
--support examples/urlshortener_sample/shortener.pyUseful flags:
Flag | What it does |
| run the code's test file (it should import the code as |
| confirm tests exist (rule RDY-03) without running them — the way to attest coverage in detect-only mode |
| add a sibling module the code imports (repeatable) |
| detect-only: report findings but never call the model to rewrite the code — bounds token burn when you just want a report |
A realistic, multi-file example. examples/auth_sample/ is an auth module split
across several files (hardcoded secrets, weak crypto, missing validation) — closer to
real code than a single snippet. Review its entry point, bringing the siblings it
imports so the sandbox can run the tests:
python -m codepecker.cli examples/auth_sample/auth.py \
--support examples/auth_sample/crypto.py \
--support examples/auth_sample/db.pySee examples/GROUND_TRUTH.md for the exact issues this auth sample is seeded with.
Reliable live demo: the loop makes many LLM calls, so a free tier's tokens-per-minute cap can throttle a full run. The loop is resilient — a mid-run rate limit is recorded and the review still completes (with degraded coverage noted) rather than crashing. For a smooth end-to-end demo, use a higher-limit tier or run the text model locally:
CODEPECKER_TEXT_MODEL=ollama/llama3.1(no key, no limits).
MCP server (in a coding agent)
CodePecker speaks MCP over stdio — no ports, no daemon. Every client points at the same command; only the config file and its shape differ:
command
/absolute/path/to/CodePecker/.venv/bin/pythonargs
["-m", "codepecker.server"]env
GROQ_API_KEY(or whichever provider key your model IDs need)
Use the absolute path to the venv's Python so the agent inherits CodePecker's dependencies. Sanity-check that it launches (it waits on stdio; Ctrl-C to exit):
python -m codepecker.serverclaude mcp add codepecker \
--env GROQ_API_KEY=your-key \
-- /absolute/path/to/CodePecker/.venv/bin/python -m codepecker.serverAdd --scope project to share it with your team via a checked-in .mcp.json.
Create .vscode/mcp.json in the workspace — note the top-level servers key and
the type field (VS Code's shape differs from the mcpServers one below):
{
"servers": {
"codepecker": {
"type": "stdio",
"command": "/absolute/path/to/CodePecker/.venv/bin/python",
"args": ["-m", "codepecker.server"],
"env": { "GROQ_API_KEY": "your-key" }
}
}
}Open Copilot Chat → switch to Agent mode → codepecker shows up in the tools
picker. (To avoid hardcoding the key, use VS Code's "inputs" secret prompt.)
Identical mcpServers block; only the file location differs:
Cursor —
.cursor/mcp.json(project) or~/.cursor/mcp.json(global)Windsurf —
~/.codeium/windsurf/mcp_config.jsonClaude Desktop —
claude_desktop_config.json(macOS:~/Library/Application Support/Claude/)
{
"mcpServers": {
"codepecker": {
"command": "/absolute/path/to/CodePecker/.venv/bin/python",
"args": ["-m", "codepecker.server"],
"env": { "GROQ_API_KEY": "your-key" }
}
}
}Add to ~/.codex/config.toml (TOML, not JSON):
[mcp_servers.codepecker]
command = "/absolute/path/to/CodePecker/.venv/bin/python"
args = ["-m", "codepecker.server"]
env = { GROQ_API_KEY = "your-key" }MCP config conventions move fast. If a client has renamed a key or moved its config file, check that client's own MCP docs — only the
command/args/envvalues above are CodePecker-specific.
The server exposes one tool:
review_and_remediate(code, language="python", tests="", tests_dir="", support_files={})code — the source to review.
tests (optional) — a separate test file; the code should import as
solution(from solution import ...). Passing it runs the tests and suppresses the "no tests" finding.tests_dir (optional) — path to the code's test directory; confirms tests exist (rule RDY-03) without running them. This is how coverage is attested in detect-only mode (
CODEPECKER_REMEDIATE=false), which skips test execution.support_files (optional) —
{"sibling.py": "<source>", …}for modules the code (or its tests) imports, so they resolve in the sandbox instead of crashing test collection.
Detect-only vs. remediate is controlled by the CODEPECKER_REMEDIATE env var (default
true); set it false to report findings without ever calling the model to rewrite
code — the same behaviour as the CLI's --no-remediate.
Evaluation
python eval/run_eval.pyRuns CodePecker over the labeled golden set (eval/golden/) and reports
precision/recall/F1 per dimension, remediation resolution + test-pass rates, and mean
iterations/latency; writes eval/report.json. This is the "how do I know it's good?"
evidence and is meant to run in CI. (It drives the full loop over every sample, so use
a decent rate-limit tier.)
Design decisions (the short "why")
Decision | Why |
MCP server, not a bot/CI check | Reusable across agents, and reviews in the loop rather than post-hoc |
Hand-written loop, no LangChain | Bounded task; transparent and testable control flow |
RAG over fine-tuning for rules | Rules stay editable, auditable, and citable (markdown files) |
Deterministic secrets/eval/except vs LLM for nuance | Reliability where it's non-negotiable, flexibility where it's fuzzy |
Tests gate success | A fix that breaks behavior is a failure, not a fix |
Judge guardrails (constrained citations + evidence grounding) | Hallucinated findings are dropped by code, not trusted |
One LLM seam (LiteLLM behind | Swapping provider — or going offline — is a config change |
Sandboxed test run (subprocess + timeout) | Executing untrusted code is a security boundary |
Project layout
src/codepecker/
config.py env-driven model IDs + tuning constants
types.py LLM Protocols (DIP/ISP) + the Finding type
llm_client.py the only module that talks to a provider (LiteLLM)
vector_store.py ChromaDB adapter (RAG index)
knowledge/loader.py parse + embed the markdown knowledge banks
tools/
deterministic_checks.py code checks, keyed by rule id
judge.py batched, guardrailed LLM judge
run_tests.py sandboxed pytest runner
agent.py review_and_remediate() — the bounded loop
metrics.py append-only metrics log + summary
evaluation.py pure detection/remediation metrics (used by eval/run_eval.py)
cli.py local demo runner
server.py FastMCP server (stdio)
codepecker-skill/ the corpus as an Agent Skill (one source of truth)
SKILL.md agent-facing entry point (the "suggest" surface)
rules/ the rules: security/ standards/ readiness/ sustainability/
eval/ golden samples + run_eval.py
tests/ the test suiteTesting
pytest -q # 97 offline tests (local embeddings, faked LLM)
pytest -m "live or not live" # + the 1 live acceptance test (needs GROQ_API_KEY)The default suite is fully offline and deterministic; the one live test is opt-in.
Non-goals / next steps
MVP simplifications, called out honestly:
Sandbox is a subprocess + timeout, not a container — production wants gVisor/a microVM with no network and resource limits.
Deterministic checks are regex-based — production would use AST analysis.
Local embeddings (all-MiniLM-L6-v2) trade recall for zero keys — swap in a hosted embedder for higher-quality retrieval at scale.
Not yet: metadata-routed retrieval for very large rule sets, a metrics dashboard, real GitHub integration, runtime energy profiling, remote HTTP/Cloud Run deploy.
Available Tools
1 toolreview_and_remediateA
Review code across security, standards, readiness, and sustainability; automatically fix the issues; verify the fix by running its tests; and return the findings, a per-dimension scorecard over all rules (passes included, for coverage attestation), the remediated code, a diff, citations, and a metrics-style summary.
Args:
code: the source code to review.
language: the source language (default: python).
tests: optional — the code's test suite if it lives in a separate file.
Provide it so the review runs the tests (they should import the code as
solution, e.g. from solution import ...) and doesn't false-positive on
"no tests detected".
tests_dir: optional — path to the code's test directory. Confirms tests are
present (RDY-03) WITHOUT running them; this is how coverage is attested in
detect-only mode (CODEPECKER_REMEDIATE=false), which skips test execution.
support_files: optional {filename: source} of sibling modules the code (or its
tests) imports — e.g. {"crypto.py": "...", "db.py": "..."}. They're written
into the sandbox next to the code so a local from crypto import ...
resolves instead of crashing test collection. Local files only; nothing is
installed from a package index.
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| tests | No | ||
| language | No | python | |
| tests_dir | No | ||
| support_files | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description fully carries the transparency burden. It discloses automatic fixing, test execution, sandbox writing of support files, the non-execution of tests_dir tests, and environment-variable-driven mode changes. No contradictions detected.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is long but appropriately so for a complex tool. The opening paragraph front-loads the overall pipeline, and the Args section uses a clear bulleted structure. Every sentence adds behavioral or parameter value without repeating schema defaults.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a high-complexity tool, the description covers the full workflow, return artifact categories, mode-specific behavior, and sandbox limitations. The output schema handles return-type details, while the description supplies usage context and edge-case guidance, making it complete enough for an agent to invoke correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, but the description compensates thoroughly. Each parameter gets practical context: language default, test import convention (as `solution`), tests_dir RDY-03 attestation, support_files usage with an example, and the 'local files only' constraint. This is far more than the schema alone provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific, multi-step purpose: review code across security, standards, readiness, and sustainability; automatically fix issues; verify via tests; and return findings, scorecard, remediated code, diff, citations, and metrics. This goes well beyond a vague verb+noun and clearly delineates the tool's end-to-end scope.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives clear context on when to supply optional inputs (tests, tests_dir, support_files) and how detect-only mode (CODEPECKER_REMEDIATE=false) changes behavior. Since there are no sibling tools, explicit alternatives are unnecessary, but it stops short of explicitly stating when not to use the tool.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
1 tool update
v0.1.0- First observed
review_and_remediate
TDQS
With only one tool, there is no possibility of selecting the wrong tool. The tool's purpose is clearly defined, covering review and remediation in a single action.
The single tool name 'review_and_remediate' follows a clear verb_noun pattern, and consistency is trivially maintained with only one tool.
The server has just one tool, which is below the typical 3-15 range. However, the tool is comprehensive, encapsulating review, remediation, verification, and reporting, so the thin count is acceptable for a focused purpose.
The tool covers the full lifecycle from code review to remediation to test verification, and returns a detailed scorecard and diff. Minor gaps include the inability to separate review-only from remediation, but an environment variable supports detect-only mode, so core workflows are covered.
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
Scan any public GitHub MCP-server repo for security issues. 37 MCP-specific L1 rules, 8 languages.
MCP-native AI SRE: ask what's broken in production, get a reviewed GitHub fix PR.
Scan any MCP server for tool-poisoning, security, auth & license. Trust score before install.
Conformance checker for MCP servers. Free, no key, verdicts recomputable and re-measured daily.
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server for comprehensive code analysis, navigation, and quality assessment across 25+ programming languages.988MIT
- AlicenseNot gradedqualityFmaintenanceAn MCP server that provides senior-level code review, quality checks, security analysis, and refactoring suggestions directly in your editor.1MIT
- FlicenseNot gradedqualityCmaintenanceMCP server for AI-powered code security, quality, and performance review. Enables auditing code directly from VS Code via right-click or MCP tools.-
- FlicenseNot gradedqualityDmaintenanceMCP server that provides code validation rules and analysis for various stacks/frameworks, enabling automated code reviews and reporting directly from VS Code and other editors.-
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/Abdul4code/CodePecker'
If you have feedback or need assistance with the MCP directory API, please join our Discord server