repo-doctor

repo-doctor

MCP server that produces scored, evidence-cited audits of public GitHub repos via tools for fetching metadata, reading files, scanning git history, and checking hygiene.

Category
访问服务器

README

Repo Doctor

A hand-written agent loop drives a custom MCP server over stdio to produce scored, evidence-cited audits of public GitHub repos - benchmarked for run-to-run score stability, not just demoed once.

Repo Doctor is a small, from-scratch agent: no LangChain, no SDK tool-runner, no agent framework. The loop itself is 115 lines (agent/loop.py, the whole package under 1,000) implementing tool use directly - call an LLM, execute whatever tools it asks for, feed the results back, repeat until it emits one JSON-schema-validated structured output. The tools themselves live behind a custom MCP server, the same protocol Claude Desktop speaks, so the identical four tools work whether the agent driving them is this CLI or Claude Desktop's own agent (see docs/claude-desktop.md).

What's inside

GitHub repo URL
      |
      v
repo-doctor CLI -- hand-written agent loop (no framework, no SDK tool-runner)
      |
      +-- Claude claude-opus-4-8  --or--  Ollama llama3.1:8b (tool-use turns)
      |
      v
    stdio  <-- MCP protocol -->  repo-doctor MCP server (FastMCP)
                                    |
                                    +-- fetch_repo_meta      GitHub API: description, topics, license, stars
                                    +-- read_repo_files      README, .gitignore, LICENSE, 2-level file tree
                                    +-- scan_git_history     full history: secrets, emails, large binaries
                                    +-- check_repo_hygiene   CI workflows, tests dir, pinned deps, demo media
      |
      v
submit_report -- client-side tool, JSON-schema-validated structured output
      |
      +-- repo-doctor audit <url>       one markdown report: score /100, evidence per line, proposed fixes
      +-- repo-doctor bench --runs 3    the same audit repeated per repo, for score stability

Plain Python on purpose - anthropic, mcp, requests, jsonschema, and nothing that hides the tool-use loop from you.

Results

repo-doctor bench audits a fixed list of 8 public repos, 3 times each, on claude-opus-4-8, and reports the mean score, the spread (max - min) across runs, mean latency, tokens, estimated cost, and failures, per repo:

Repo Runs Mean score Spread Mean s Tokens in/out Est. cost Failures
Infojitsu/nn-digit-recognition 3 69 1 32.2 41702/7116 $0.39 0
Infojitsu/face-recognition-from-scratch 3 75 6 36.3 66220/7942 $0.53 0
psf/requests 3 72 3 51.2 100569/11752 $0.80 0
pallets/flask 3 69 6 51.4 124802/11412 $0.91 0
tiangolo/fastapi 3 79 9 49.2 97767/7265 $0.67 0
karpathy/micrograd 3 68 5 28.9 41465/6151 $0.36 0
kennethreitz/setup.py 3 55 4 33.2 58267/7262 $0.47 0
openai/gpt-2 3 53 0 41.6 64776/9551 $0.56 1

23 of 24 audits completed; the one failure (a gpt-2 run) is counted in the table, not discarded. The full 24-audit bench cost $4.69 in API usage.

The spread column is the point: a rubric graded by an LLM does not return the same number twice, and burying that fact would make the tool look more precise than it is. For grounding, one real single-repo audit outside the bench loop: auditing Infojitsu/nn-digit-recognition scored 65 / 100 (identity 15/20, README 17/20, hygiene 3/20, history safety 20/20, reproducibility 10/20) in 3 agent-loop iterations, using 13,659 input / 2,945 output tokens (about $0.14 on claude-opus-4-8) - the same audit repo-doctor audit <url> reproduces on demand.

Quickstart

Prereqs: Python 3.11+, a public GitHub repo to audit, and either an Anthropic API key or Ollama for a free local fallback.

python -m venv .venv && .venv/Scripts/activate    # or source .venv/bin/activate
pip install -e .

export ANTHROPIC_API_KEY=sk-ant-...   # never commit this; rotate any key you've shared or demoed with
repo-doctor audit https://github.com/Infojitsu/nn-digit-recognition

Prefer a file? cp .env.example .env and put the key there instead - the CLI loads .env from the directory you run it in (the file is gitignored, and a real environment variable always wins over a .env entry).

No API key, no cost - run entirely local instead:

ollama pull llama3.1:8b
repo-doctor audit https://github.com/Infojitsu/nn-digit-recognition --provider ollama

Write a report to a file with -o report.md, or run the stability bench with repo-doctor bench --runs 3 -o docs/bench.md. To drive the same MCP server from Claude Desktop instead of this CLI, see docs/claude-desktop.md.

Honest evaluation, by construction

  • Every score line in a report cites the exact tool output it came from (the schema's evidence field) - the agent cannot hand out unearned points without pointing at where they came from.
  • submit_report is validated against a JSON Schema (Draft 2020-12) before it is accepted; a report that fails validation gets one corrective retry, and a second failure ends the run as a documented failure rather than a silently wrong score.
  • History safety is graded from a deterministic scanner over the full git history (regex-matched secrets, personal emails, large binaries), not LLM judgment - the model only reads the (capped) findings, it does not decide what counts as a secret.
  • repo-doctor bench always audits the same 8 repos in the same order and counts failures explicitly, rather than only reporting the runs that happened to succeed.
  • 85 pytest tests (84 offline + 1 live-marked) cover the tool loop, both providers, all four MCP server tools, the hygiene/history/file scanners, a real-stdio findings round-trip, and a pure-ASCII policy for every tracked text file.

Limitations

  • LLM judgment varies run to run - see the spread column above; a score is a snapshot from one run, not a certified measurement.
  • The git-history secret scan is regex-based over known key/token shapes, not entropy-based, so it will miss high-entropy secrets that don't match a known pattern.
  • Public GitHub repos only - no private repos, no non-GitHub hosts.
  • Scores are a rubric, not ground truth: a low score means the repo is missing rubric items, not that the underlying code doesn't work.
  • --provider ollama runs fully local and free (llama3.1:8b via Ollama), but local-model tool-calling is noticeably less reliable than Claude's. In our own smoke test, llama3.1:8b made three tool calls and then failed submit_report schema validation twice; the run ended with the loop's honest-failure exit (audit failed: submit_report failed schema validation twice, exit code 1) rather than a report. Treat Ollama as a zero-cost way to try the tool, not a like-for-like substitute for the bench numbers above (which are all claude-opus-4-8).

License

Code is MIT. Repo Doctor reads public GitHub repositories at audit time (via the GitHub API and a local clone into a gitignored cache, .repodoctor_cache/) and never redistributes repo contents; note the clone cache persists on disk under .repodoctor_cache/ until you delete it manually.

<!-- GitHub About: LLM agent with a hand-written tool loop and a custom MCP server that produces scored, evidence-cited audits of GitHub repos. Topics: mcp, llm-agents, tool-use, anthropic, claude, ollama, python, github-api, developer-tools -->

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选