Skip to main content
Glama

mcp-repo-devtools

CI npm License: MIT node >= 20.11 M8ven Verified

An agent that can read a whole log file will read a whole log file.

mcp-repo-devtools is the tool surface a coding agent calls before it touches a repository — working tree, history, issues, failing CI, pull-request context — plus a reference loop that uses those tools and a forty-fixture eval that scores that loop against a model holding nothing but git. The eval publishes both halves of the answer: the raw command is 2.1× cheaper whenever the history survives the clone, and cannot answer at all when a depth-1 checkout leaves the CI log as the only evidence. Every result has a hard budget, every query has a hard boundary, and both are measured rather than asserted.

It is built for the agent end of MCP, not for a human clicking through a UI: six tools declared read-only, structured results a host can read as fields, progress and cancellation for calls that take twenty seconds, a human gate in front of a write, and a byte budget on every answer. Works with Claude Code, Cursor, Codex, Copilot and any other MCP host.

  • Bounded, and measured. On a real failed CI run, reading the logs it needed cost 405,577 bytes raw; the tool returned 12,218 (97.0% less). Issue search over a busy repository: 176,170 → 4,371 (97.5%). Twenty commits with git log -p: 19,300 → 992 (94.9%). The numbers, the fixtures and the caveats are in bench/README.md; the script that produced them is bench/measure.mjs.

  • Read-only by construction. Thirteen git subcommands, an argv array, no shell anywhere. The three write tools exist only when MCP_ENABLE_WRITE=1, and each one logs a line to stderr before the request goes out.

  • Rooted, not vibes. MCP_ALLOWED_ROOTS is required; paths are realpath-resolved before the containment check, filesystem roots are refused, and model-supplied refs cannot start with -.

  • Small surface, honest failures. Six tools by default. Errors say what to do next (Error: GitHub rate limit exhausted; resets at … Set GITHUB_TOKEN …), and truncation is never silent — the last line names the argument that narrows the next call.

Built for an agent

The protocol is the product here: every feature below exists because a model, not a person, is on the other end of the call.

What the agent needs

What the server gives it

choose a tool without reading prose

readOnlyHint, destructiveHint, idempotentHint, openWorldHint on all nine tools, plus one paragraph of usage instructions at initialize

read fields, not lines

outputSchema and structuredContent on the six read tools; the text stays for hosts that only render text

not look dead during a 20 s call

one notifications/progress per GitHub hop when the client sends a progressToken; the last event equals the total

stop work it no longer needs

the caller's abort signal reaches fetch and execFile; a cancel is reported as cancelled by the client, not as a timeout

keep its context small

64 KB / 200 lines per result, and a tail line that names the argument narrowing the next call

trade a lossy clip for a summary

MCP_SAMPLING_COMPRESSION=1 lets the client's own model summarise an over-budget result, with the clip as the fallback

act only when a human says so

elicitation puts a person in front of all three writes; MCP_CONFIRM_WRITES=1 fails closed when the client cannot ask

know the order to call things in

three prompts (diagnose-ci, review-pr, triage-issues) that render a plan, not a tool

prove the tool helped

src/agent/ is a loop over the same tools, and eval/ scores it against raw git — publishing the result even when it loses

Related MCP server: Local Commander

Quickstart

The package is not on npm yet, so the release tarball is the installable artifact today:

npm install -g https://github.com/MAOLVLHL/mcp-repo-devtools/releases/download/v0.3.0/mcp-repo-devtools-0.3.0.tgz
mcp-repo-devtools --version        # 0.3.0
mcp-repo-devtools --help           # prints the env contract and exits

Until the publish lands, use the global binary mcp-repo-devtools wherever a client config below says npx -y mcp-repo-devtools. Once it is on npm, npx is the zero-install path and nothing else changes.

The server speaks MCP over stdio. Three variables matter:

Variable

Required

Meaning

MCP_ALLOWED_ROOTS

yes

Directories the server may read, separated by the platform separator (: on Unix, ; on Windows). A filesystem root is refused.

GITHUB_TOKEN

no

Raises the GitHub limit from 60 to 5000 requests/hour and is required for log tails and for writes. Fine-grained, read-only is enough for the read tools.

MCP_ENABLE_WRITE

no

1 adds gh_pr_create, gh_issue_create, gh_pr_comment. Anything else keeps the server read-only.

Configure a client

Claude Code

claude mcp add repo-devtools -s project \
  -e MCP_ALLOWED_ROOTS=/home/you/code \
  -e GITHUB_TOKEN=$GITHUB_TOKEN \
  -- npx -y mcp-repo-devtools
claude mcp list        # repo-devtools: … ✓ Connected

Cursor — .cursor/mcp.json in the project, or the same shape in ~/.cursor/mcp.json:

{
  "mcpServers": {
    "repo-devtools": {
      "command": "npx",
      "args": ["-y", "mcp-repo-devtools"],
      "env": {
        "MCP_ALLOWED_ROOTS": "/home/you/code",
        "GITHUB_TOKEN": "${env:GITHUB_TOKEN}"
      }
    }
  }
}

Codex — ~/.codex/config.toml:

[mcp_servers.repo-devtools]
command = "npx"
args = ["-y", "mcp-repo-devtools"]
env = { MCP_ALLOWED_ROOTS = "/home/you/code", GITHUB_TOKEN = "ghp_…" }

Restart the host, then ask it to "check the git status of this repo". Tool names appear exactly as listed below. From a checkout instead of npm: npm install && npm run build and point the client at /absolute/path/to/mcp-repo-devtools/dist/index.js.

The tools

Tool

One call returns

Notes

git_status

branch, upstream, ahead/behind, up to 200 changed paths

Start here; it tells you what to diff

git_log

the newest commits, one line each, optionally scoped to a path

No patches — that is the point

git_diff

--stat by default, unified patch on request

base accepts a rev, tag or sha

gh_issue_search

issues in one repo, newest activity first, body excerpt

Pull requests are filtered out

gh_ci_failures

only failing checks, failed step names, optional log

include_logs: true for 40 lines around the first error

gh_pr_context

title, body, size, files, review states, review comments

Replaces four REST calls

gh_pr_create

opens a PR from a branch already pushed

write mode only

gh_issue_create

files an issue

write mode only

gh_pr_comment

comments on an issue or PR

write mode only

Every tool also answers a machine, not only a model. The six read tools declare an outputSchema and return the same data as structuredContent next to the text, so a host can read fields instead of parsing lines; all nine tools carry readOnlyHint/destructiveHint/idempotentHint/openWorldHint, and the server sends one paragraph of usage instructions when a client connects. Annotations are hints, not permissions — write tools stay unregistered unless MCP_ENABLE_WRITE=1.

A call that spans several GitHub hops can take ten to thirty seconds. If the client sends a progressToken, gh_ci_failures reports one progress notification per hop (check runs, then each run's jobs, then each job's log), so the host can show the step instead of a spinner; the last notification equals the total. Without a token nothing is sent and the result is unchanged. Cancelling the call aborts the in-flight fetch and the running git process.

Full argument tables, example output, the exact truncation notes and what each layer carries: docs/tools.md.

If you are the agent reading this

Five rules that keep a call cheap, learned from the eval rather than guessed:

  1. git_status first. It names the branch and the changed paths, which is how you choose between git_diff and git_log instead of calling both.

  2. When a result says truncated, narrow it. The tail line names the argument — pass path=, base= or a smaller log_lines. Re-running the same call wider spends the same budget again.

  3. gh_ci_failures without include_logs is one round trip. Ask for the log only after the failing job is known, and ask for 40 lines, not the archive — the 40 lines come from around the first error, because the last 40 are teardown.

  4. gh_pr_context replaces four REST calls. If you are about to fetch a PR, then its files, then its reviews separately, call this instead.

  5. A write returns isError: true when a human declined it. Read the note and change the plan; do not send the same call again.

Three prompts, two optional client features

A tool list is not a workflow. The server also registers three prompts — diagnose-ci, review-pr and triage-issues — that a host can offer as slash commands. Each renders a short, ordered plan over the read tools ("call gh_ci_failures with include_logs=true, then map the log line to a file with git_log") and ends by saying what not to do: no edits, no comments, no issues. They are prompts, not tools: nothing runs until the model calls one.

Two client capabilities change how calls behave, and both are off unless you ask for them, so the default surface is unchanged:

  • Confirmation before a write. If the client advertises elicitation, the three write tools ask a human first ("Approve this GitHub write?" with the action, target and title) and send nothing when the answer is no — the refusal comes back as a normal tool error with the reason. MCP_CONFIRM_WRITES=1 refuses when the client cannot ask (fail closed); MCP_CONFIRM_WRITES=0 never asks. Unset means: ask when possible, proceed when the client has no way to ask.

  • Summarising instead of clipping. MCP_SAMPLING_COMPRESSION=1 lets an over-budget result be summarised by the client's own model instead of cut at 64 KB / 200 lines. The summary keeps identifiers, paths and error strings, is labelled …compressed from N bytes by the client model, and falls back to the ordinary clip if the model fails, times out or returns nothing. Results that already fit are byte-identical and never sent to the model.

Redaction runs before either feature, so a summary cannot bring back a secret the clip path would have removed.

Reference agent

The server is not an agent: it holds no loop, no planning and no memory between calls. src/agent/ is the smallest loop that is one, built on the same six read tools, answering one question — which commit introduced this CI failure?

npm run demo:agent     # offline: a failing CI call, a real git log, a report
src/agent/provider.ts   Provider seam; OpenAI-compatible and scripted implementations
src/agent/mcp-tools.ts  the server's tools as a toolbox a model can call
src/agent/loop.ts       turn/tool loop with turn, call and byte caps
src/agent/diagnose.ts   the CI-failure task: system prompt, target, run
src/agent/cli.ts        node dist/agent/cli.js --repo owner/name --ref main

runAgent sends the conversation, executes the tool calls that come back, appends the results, and stops when the model answers without calling a tool. Caps: 8 turns, 4 calls per turn, 24 KiB per result. The run is read-only by construction — it connects with enableWrite: false, so the three write tools are never registered — and it reports why it stopped (final, max-turns, cancelled). A tool that throws, or a call whose arguments were not valid JSON, becomes a tool result with isError: true rather than an exception. The provider seam is one method, so the same loop runs against OpenAI, an Ollama or vLLM endpoint, or a scripted list of turns in the tests.

Details, including how to point it at any OpenAI-compatible gateway: docs/agent.md.

Measured, not estimated

The baseline in every row is the good version of what an agent does without this server: the same command, the same endpoint, no truncation. Measured 2026-11-11 on Windows 11, Node 22.14, git 2.56; tokens are bytes / 4.

Case

Naive

Tool

Saved

gh_ci_failures — 3 failed jobs, real run

405,577 B

12,218 B

97.0%

gh_issue_search — 30 raw results vs 10 formatted

176,170 B

4,371 B

97.5%

git_log — 20 commits, git log -p

19,300 B

992 B

94.9%

git_diff — 400 dirty files, patch vs stat

75,960 B

5,236 B

93.1%

git_diff — HEAD~5, patch vs stat

3,641 B

290 B

92.0%

git_status — 400 dirty files, capped at 200

8,320 B

5,621 B

32.4%

Caveats, stated rather than buried: n = 1 per cell; the git rows use generated fixtures so they reproduce anywhere, the GitHub rows hit a live public repository; and gh_ci_failures is slower than the naive path (15.9 s vs 4.7 s) because it resolves ref → commit → checks → jobs → logs before it decides what to download. Bytes and latency trade against each other, and the table only measures one side. Full method: bench/README.md.

An eval that can fail me

Most tool READMEs quote a benchmark their tool wins. This one runs mine against the boring alternative, and publishes both halves: one raw git command is 2.1× cheaper on a repository with its history intact, and cannot answer at all when the checkout is a depth-1 clone and the only evidence is a CI log. Which half matters depends on the incident, so neither half is tuned away.

eval/ measures answers, not bytes: forty offline fixtures, each a real repository baked from a few commits with one regression in it, the failing test as a user would report it, and the sha that introduced it. Both arms run the same loop, the same prompt and the same 8-turn cap; the only variable is the tool surface — the six MCP tools, or one raw git tool that returns its output verbatim.

npm run eval             # scripted oracle, offline, must be 40/40
npm run eval:baseline    # the raw git tool over the thirty git cases, 30/30
npm run eval:check       # the run above, per fixture, against eval/baseline.json
npm run eval -- --kind github                        # the ten that need a CI log
OPENAI_API_KEY=… npm run eval -- --provider openai   # a real model, real numbers

Scored from the trajectory, not a second opinion: success@1 (does the report name the culprit commit), turns, tool calls, duplicate calls, tokens, and read-only violations. No judge model, so the number cannot drift with the grader. The scripted oracle run must stay 40/40 — it proves fixtures, tool names and grader agree before a token is spent. Ten of the forty are kind: "github": a real repository plus a stubbed workflow run, so a regression whose only evidence is a CI log is scored through gh_ci_failures. Four of those ten are shallow: the checkout is a depth-1 clone of the commit the run tested, the culprit came earlier and was never fetched, and the job log's git blame/show --stat lines are the only surviving pointer to it.

Three runs per arm, 2026-11-11, deepseek-flash at temperature 0, turn cap 8, forty fixtures — 120 cases per arm:

six MCP tools

one raw git tool

success@1

120/120 (100%)

108/120 (90%)

mean turns

4.68

4.72

mean tool calls

6.97

9.18

mean tokens per case

13,898

8,534

— thirty git cases

13,567

6,548

— six CI-log cases

16,964

8,076

— four shallow cases

11,779, 12/12

24,118, 0/12

On a repository whose history is intact, both arms name the right commit every time and one raw command does it for 2.1× fewer tokens. The six schemas cost about 1,073 tokens on every turn before a single result is read; the raw arm pays that once for one tool. That is the task git was built for — log -p and show are one call each — so a typed surface has to earn its overhead somewhere else.

The four shallow cases are where it does, and the first version of them did not. They were built to be answerable only from a CI log: the checkout is a depth-1 clone of the commit the workflow tested, the breaking commit came earlier and was never fetched, and the log's git blame/ show --stat lines are the only place its sha survives. The first attempt made that head sha the culprit's own sha, so the raw arm simply cited the only commit it could see and scored 10/10 — a fixture that graded nothing. Moving the culprit one commit back made the raw arm answer none of the twelve, at 24.1k tokens and 24.8 tool calls per case: it hunts for a commit that is not on disk. The typed arm answered all twelve, cheaper than it answers the git cases, because gh_ci_failures hands it the log that still names the change.

An eval you are willing to lose is the only kind worth quoting, and this one has already paid for itself five times:

  • it caught the harness being unfair to its own author: the first table read 87% for the typed arm because the task demanded a full sha while git_log prints seven characters, so models padded the right commit with 33 invented ones. The prompt was wrong, not the models; fixing it moved that arm from 87% to 100% and left the token gap untouched;

  • it caught a broken fixture — the "culprit" commit could not fail the failing test, and the model said so; the oracle could never have caught it, because it cites the expected sha by construction;

  • it caught a loop bug — a reply with no text was scored as an answer, so a model that stopped mid-thought looked wrong when the harness was wrong;

  • it put a number on the schema tax, which decides whether a seventh tool is worth its tokens;

  • it falsified its own hypothesis, twice. Six fixtures were built to need a CI log, on the theory that one git tool could never answer them: a model holding only git solved all eighteen anyway, from the diffs, at 8.1k tokens against 17.0k. That result is published rather than tuned away, and it is the reason the seventh fixture family deletes the history instead of asking a leading question. The four shallow fixtures then failed their author a second time — the first version let the raw arm score 10/10 — before the blame line closed it.

Method, the forty regressions, the per-fixture table and the caveats: docs/eval.md.

Safety model

Control

Implementation

No shell

execFile("git", argv); nothing is interpolated into a command line

No write commands

ALLOWED_SUBCOMMANDS (13 entries) in src/git.ts

No config injection

FORBIDDEN_FLAGS: -c, -C, --exec-path, --upload-pack, --git-dir, --work-tree, --config-env, --output, …

No path escape

realpath + path.relative containment against MCP_ALLOWED_ROOTS

No inherited git state

child env limited to PATH, HOME, USERPROFILE, SystemRoot, TMP, TEMP, LANG, LC_ALL

No secrets in output

every git stderr and GitHub response passes redact()

No token to the blob host

job-log redirects are followed by hand, without Authorization

No hanging

10 s git, 15 s GitHub, 30 s log download

Every benchmark run also fires four boundary probes (path escape, --output, shell metacharacters in a ref, a malformed owner/name) and requires all four to be refused — see bench/README.md. The full threat model, including what these controls do not cover, is in docs/security.md.

What this is not

  • Not a sandbox. It reads the roots you configure, with your permissions. Point it at a code directory, not at your home directory.

  • Not an agent runtime. The server has no loop, no planning and no memory between calls. src/agent/ is a client of it — read-only, one task, not exposed as a tool — and eval/ is how that client is judged, against a baseline that wins on cost wherever the git history survives the clone — and loses outright where it does not.

  • Not a GitHub client. No push, merge, close, branch creation, or file editing. Those belong to the agent's own git client, where the human already watches.

  • Not an injection filter. Commit messages, issue bodies and log lines are returned as data; a string that says "ignore previous instructions" is still a string.

  • Not an HTTP service. stdio only. A hosted mode needs an auth design before it can be safe, and that design is not in this repository.

Development

npm install
npm run build        # tsc -> dist/
npm test             # build + node:test, 155 tests
npm run snapshot     # rewrite tests/fixtures/tool-surface.json after a surface change
npm run bench        # the measurement above (needs a checkout, and a token for GitHub rows)
npm run inspect      # MCP Inspector against the built server
npm run demo:agent   # the reference loop, offline, no key
npm run eval         # the forty fixtures through the oracle, offline
npm run eval:check   # the gate: no fixture the recorded baseline solved got worse
npm run eval -- --kind github   # only the ten that need a CI log

The tool surface is a contract: tests/contract.test.ts fails if a tool appears, disappears, or changes its arguments without the snapshot being updated on purpose.

If you are a coding agent working in this repository rather than installing it, read AGENTS.md: the commands, the eight rules a change must not break, and where each layer lives.

src/config.ts   MCP_ALLOWED_ROOTS parsing and realpath containment
src/git.ts      execFile wrapper, allowlists, status/log/diff
src/github.ts   REST reads, CI log download, opt-in writes
src/zip.ts      minimal zip reader for Actions log archives
src/text.ts     output budget, error window, credential redaction
src/version.ts  the version, read from package.json, and the User-Agent GitHub sees
src/server.ts   tool registration and text formatting
src/agent/      reference loop: provider, toolbox, loop, diagnose task, CLI
src/eval/       task-level eval: fixtures, grading, two arms, CLI
src/index.ts    stdio entry point

Docs: architecture · tool reference · reference agent · eval · security model · measurements.

Roadmap

  • gh_issue_search: ETag caching between calls

  • git_blame / git_show: already allowed at the transport layer, not exposed yet

  • eval: PR-shaped fixtures, so gh_pr_context is scored the way gh_ci_failures now is

  • HTTP transport: out of scope until there is an auth design worth shipping

Contributing

Issues and pull requests are welcome. Please run npm test before opening a PR, and if you change the tool surface, include the tests/fixtures/tool-surface.json diff — that diff is the review record. Security reports: see SECURITY.md.

License

MIT

Available Tools

6 tools
gh_ci_failuresGitHub CI failuresA
Read-onlyIdempotent

List failing check runs for a commit or branch/PR head, with the failed step names when GitHub exposes them. Read-only. Set include_logs=true to also get the tail of the failing job's log, which is usually where the error is; that costs one extra request per job (up to three jobs).

Inputs: ref (required), repo (required), log_lines, include_logs. Returns: ref, sha, repo, failures, +1 more

gh_pr_contextGitHub pull request contextA
Read-onlyIdempotent

Fetch everything needed to review a pull request in one call: title, body excerpt, base/head, size, changed files, review states and review comments. Read-only.

Inputs: repo (required), number (required). Returns: base, head, repo, draft, +12 more

git_diffgit diffA
Read-onlyIdempotent

Diff the working tree against a base revision (default HEAD). Read-only. mode='stat' (default) returns file names with line counts; mode='patch' returns the unified diff. If the output ends with a truncation note, narrow with path= or reduce context_lines=.

Inputs: repo (required), base, mode, path, +1 more. Returns: base, diff, mode, path, +1 more

git_loggit logA
Read-onlyIdempotent

List the newest commits (hash, date, author, subject), newest first. Read-only. Use path= to scope to a file or directory, limit= to cap the number of commits (max 100).

Inputs: repo (required), path, limit. Returns: path, commits

git_statusgit statusA
Read-onlyIdempotent

Summarise a repository's working tree: current branch, upstream, ahead/behind counts and changed paths. Read-only. Use this before deciding what to look at with git_diff.

Inputs: repo (required). Returns: ahead, behind, branch, changes, +2 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool targets a distinct artifact: working-tree state (git_status), history (git_log), changes (git_diff), issues (gh_issue_search), CI checks (gh_ci_failures), and PR review context (gh_pr_context). The descriptions even cross-reference each other (git_status tells you to use git_diff next), which resolves the only plausible overlap. No two tools would be reasonably confused by an agent.

    Naming Consistency4/5

    A clear prefix convention separates local git operations (git_*) from GitHub API operations (gh_*), and all names are lower snake_case. Minor deviation: some names are prefix+noun (git_status, git_diff, gh_pr_context) while one embeds a verb (gh_issue_search), so the grammatical shape of the suffix is not fully uniform.

    Tool Count5/5

    Six tools is well within the sweet spot for a focused inspection server, and each one covers a genuinely different question an agent asks when orienting in a repo. There are no near-duplicate or filler tools.

    Completeness3/5

    The surface is deliberately read-only, so missing write operations are defensible, but there are real dead ends for investigation: no way to read a file's contents, no branch/tag listing, no PR listing (only single-PR context), and no log/diff against arbitrary commit ranges beyond a base revision. An agent can diagnose a failing build but not fully explore the repo.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables LLM clients to search, read, and patch a trusted source repository with rollback-safe edits, Git operations, and allowlisted validation over stdio or OAuth-protected HTTP. Keeps secrets and arbitrary shell access out of reach while enforcing bounded batched I/O and operator-controlled workspace trust.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      For people who want their AI to run the build, read the error and check the dev server itself, instead of pasting output into chat. Works with Claude Desktop (one-click installer), Cursor, Claude Code and Cline. Runs locally over stdio or HTTP, no telemetry. A seatbelt for everyday mistakes, not a sandbox.
      20
      49 npm
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI assistants to turn local git history into answers about recent activity, file hotspots, change coupling, stale or already-merged branches, contributors, ref comparisons, and drafted release notes. It runs locally over stdio with a git subcommand allowlist, so it is read-only, works offline and without shell access, and is safe to auto-approve.
      13
      51 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables an agent to mine a repository's git history and answer questions a new teammate would ask: which files are riskiest based on churn, recency and author breadth, who actually knows each file based on surviving lines, which files secretly change together, which directories depend on one person, and what recent commits mean for release notes. All analysis runs through a read-only server sandboxed to a single directory.
      MIT