leveret
Self-hosted MCP engine for private code reviews, providing deterministic static analysis and AST-level search over diffs, with findings passed to a review agent of your choice.
README
<p align="center"> <img src="assets/logo.svg" width="360" alt="Leveret logo"> </p>
Leveret
A leveret is a young hare — small, fast, and born with its eyes open.
Leveret is a self-hosted, hybrid engine for private code reviews: the successor to hosted AI review bots for teams whose code stays home. It combines a deterministic static-analysis layer, a code graph built into every checkout, a graded noise filter with durable memory, and adversarial agent contracts — driven by the AI you bring (BYOAI: your provider and model — Anthropic or OpenAI by API key or subscription, or a local OpenAI-compatible endpoint). The engine layer itself never calls an LLM, and nothing leaves your infrastructure.
How a review works
flowchart TD
D[/"📄 PR diff"/]:::gh
S["🔍 scan<br>engines + delta vs base<br>+ profile + memory"]:::core
R["🐇 review agent<br>five lenses,<br>cross-file blast radius"]:::agent
V["⚖️ verification agent<br>refute or evidence,<br>three grades"]:::agent
T[/"📋 tiered findings<br>+ walkthrough report"/]:::gh
D --> S -- leads --> R -- concerns --> V -- survivors only --> T
classDef gh fill:#6ea8fe,stroke:#3d6fd9,color:#111
classDef tun fill:#ffc86b,stroke:#cc8f22,color:#111
classDef core fill:#7ed6a2,stroke:#3d9e6a,color:#111
classDef agent fill:#c9a0f5,stroke:#9059d1,color:#111
classDef store fill:#9fd8e3,stroke:#4d9aab,color:#111
- Deterministic first pass. Engines run only against what the change touches:
semgrep (registry security + per-language rulesets, offline-capable), gitleaks
(secrets over the commit range), shellcheck, ruff, actionlint, zizmor (workflow
security), osv-scanner (lockfile CVEs), typos, jscpd (duplication, corpus-gated),
custom semgrep/ast-grep rule packs, and any SARIF-emitting command via profile
custom:entries (recipes: psalm taint, hadolint, trivy, …). Delta scanning is on by default with a base ref: findings already present at the base tree are dropped as pre-existing — counted, never silent — with multiset identity (a copy of a known-bad line still surfaces), rename tracking, and surfaced base-pass failures. A code graph is generated into the checkout at the exact reviewed commit, so agents query structure instead of grepping for it. - Three-grade filter. Every lead ends as
actionable,priced-noise(true, but the repo has ruled fixing it buys nothing), orfalse-positive— assigned cheapest-first by the repo profile (.leveret.yml: path scopes, severity floors, reasoned suppressions), the memory store, and finally the verification agent. Nothing is dropped silently: suppressions come back tallied with their reasons. - Memory that learns from humans.
.leveret/memory.jsonl, versioned in the reviewed repo: fingerprint verdicts (optionally anchored to a source line — the memory dies when the line changes) plus conventions — free-text rulings taught by maintainers vialearn, injected into the agent prompts as repo case law, able both to suppress noise and to raise findings that violate them. - Adversarial contracts. The review agent runs five lenses (correctness and hostile inputs, contract conformance, test honesty, blast radius, leads triage) and must trace changed symbols to call sites outside the diff. The verification agent then tries to refute every concern; claims it can neither refute nor ground in executed evidence are dropped, not published.
- Reporting. Findings publish in importance tiers (
critical / major / minor / nit, distinct from engine severity), out-of-diff findings appear with their stated correlation to the change, pre-existing defects adjacent to edited lines return as reminders, and every review carries a walkthrough: per-lens outcomes (clean included), per-file verdicts, the engine table, and a run-configuration line naming the harness, model, and thinking level that produced the review.
Ways to run it
GitHub App (autonomous). A self-hosted App layer receives PR webhooks, checks
out the head, builds the code graph, runs the scan, drives the standardized runner,
and posts the review — inline comments plus walkthrough. The App holds only a GitHub
App key and webhook secret; model credentials live exclusively in the runner. Human
replies on findings feed learn. Getting started + diagram: docs/app.md.
Standardized runner. leveret-runner-pi drives the review/verify contracts
through a pinned Pi runtime. Leveret supplies
the system prompt and an exact read-only toolset; Pi supplies the provider/model
runtime. Project settings, extensions, skills, prompt templates, context files and
sessions are not discovered. You choose provider, model, and effort (--model /
--effort / --provider, or the matching LEVERET_RUNNER_* env vars; defaults
openai/gpt-5.6-sol at high). Every walkthrough records the effective client,
model, prompt hash, capabilities, and tool metrics. A custom LEVERET_RUNNER
remains the bring-your-own-harness escape hatch.
Interactive (MCP). Register the server in any MCP-capable client and drive
reviews yourself — the served review/verify prompts arrive with your repo's
accumulated rulings substituted in (getting started + diagram:
docs/interactive.md):
npm install && npm run build
claude mcp add leveret -- node /path/to/leveret/dist/server.js
MCP tools: scan, ast_search (structural search via ast-grep), context
(per-function complexity, churn, recency — prioritization signal, not findings),
remember (persist a graded verdict), memory (inspect the store), learn
(persist a human-taught convention); MCP prompts: review, verify.
The reviewer toolbelt
The engines and the code graph are capabilities of the reviewer, not the reviewed
repository: install them beside Leveret. Full belt: codegraph, semgrep,
gitleaks, shellcheck, ruff, actionlint, zizmor, osv-scanner, typos,
jscpd, ast-grep, lizard, and a pre-staged Serena LSP bundle for semantic
navigation. From a clone, build one with
node dist/runner/prefetch-serena.js --home /opt/leveret/serena-home and run with
the same SERENA_HOME (the installed package also exposes
leveret-prefetch-serena). Runtime downloads are refused. A missing tool degrades
loudly — the walkthrough reports which surfaces were live.
npm test # integration suite; exercises the real tools
Design and status
DESIGN.md holds the architecture and decisions: the three-grade filter, memory and learnings, runner standardization, the GitHub App split, and the validation benchmark that gates replacing a hosted review bot with Leveret.
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。