For everything not covered here, the human-facing docs are authoritative: see
README.md for modes, tools, flags, and usage, and CONTRIBUTING.md for the
development setup, the script list, and the release process.
ReviewGuard MCP (npm package @eclipsesource/review-guard-mcp, binary
review-guard-mcp, MCP server name review-guard) is a TypeScript MCP server
that lets AI agents work on GitHub PR reviews behind a safety boundary. In the
default pending mode agents read PR discussion context and create draft
(pending) reviews but cannot submit them. In the opt-in submit mode
(--allow-submit) an agent may also submit the review, restricted to an allowed
action set and always prefixed with a fixed disclaimer. Two transports: stdio
(for IDE-managed lifetime) and HTTP (remote server).
src/github.ts:GitHubReviewClientclass. The ONLY file that touches GitHub APIs. Uses GraphQL for resolved review-thread context and mutations, and REST for review summaries and general PR comments. Review-thread comments (GraphQLreactionGroups) and conversation comments (RESTreactions) expose a normalizedreactionsmap (content -> count, e.g.THUMBS_DOWN) so agents can see downvotes. ThreadisResolved/resolvedByare also returned. Review comments, review summaries and conversation comments all carry their GitHub permalink asurl, so an agent can link an earlier discussion (a thread's permalink is its first comment'surl). The field is namedurleverywhere even though it comes from GraphQLurlfor review comments and RESThtml_urlfor the REST-sourced ones, since the output shape should be more consistent than the GitHub API is. A pending review comment already carries its final permalink, which starts resolving when the review is submitted, so an agent can cross-link its own findings while drafting. TheReviewComment.urldoc comment and the pending tool descriptions say so, and the integration suite asserts that a comment's permalink survives submission unchanged. Safety boundary: comment/thread mutations exclude theeventfield, a post-creation tripwire verifiesPENDINGstate (its error message tells the agent to stop and alert the human, since many MCP clients do not surface tool errors), and write operations are limited to the authenticated user's review. Submission is gated:submitReview(the only placesubmitPullRequestReviewis called) refuses any action not in theallowSubmitset passed to the constructor, and always prefixes the review body with the fixedsubmitBody(an optional calleradditionalBodyis appended below it, never replacing it). Thread resolution is gated too:resolveReviewThreadruns only whenallowResolveis set AND the thread's first comment is authored by the authenticated user (it refuses others' threads), so a bot can tidy up its own now-fixed findings but not close anyone else's conversations. PR scoping is enforced here too: when the client is constructed with ascope(owner/repo/PR), every public method callsassertInScopeand refuses input targeting a different PR/repo, andresolveReviewThreadverifies the thread's PR matches the scope. This is the authoritative boundary. The server-side schema change is convenience on top of it.src/server.ts:createMcpServer(client)factory. Registersget_pr_review_context,list_pending_review,add_review_comments,modify_review_comment, anddelete_pending_reviewwith Zod schemas. Additionally registerssubmitonly whenclient.allowedSubmitActionsis non-empty (itsactionenum is restricted to that set), andresolve_review_threadonly whenclient.resolveEnabled(started with--allow-resolve). Whenclient.scopedPullRequestis set, the PR tools omit theirowner/repo/pull_numberarguments and act on the scoped PR implicitly. Shared by both transports.src/stdio.ts: Stdio transport entry point. Connects the MCP server to stdin/stdout for IDE-managed lifetime (Theia, VS Code).src/http.ts: HTTP transport. A plainnode:httpserver exposing stateless Streamable HTTP at/mcp(POST only, GET/DELETE return 405, other paths 404). No web framework: the MCP transport parses the request body and enforces the Host header itself. Receives{ port, host }from the entry point and binds that address (default127.0.0.1). Validates the Host header of incoming requests (DNS rebinding protection): loopback aliases only for a loopback bind, plus the bind address and the container-runtime host names (host.docker.internal,host.containers.internal) for a non-loopback bind.src/index.ts: Thin dispatcher. Parses the CLI viaparseCliOptions, resolves the GitHub token, applies the default submit disclaimer, creates the client, then delegates to--stdioor HTTP mode.src/args.ts:parseCliOptions, the single place that knows every CLI flag. Accepts--flag valueand--flag=value. ThrowsCliUsageErroron unknown flags, missing values, or duplicates (the entry point prints it and exits non-zero), so a typo'd hardening flag (e.g. the--repo/--prscope) can never be silently ignored.test/: vitest suite.args.test.tscovers CLI validation.github.test.tscovers the safety gates (submit refusal, fixed-body prefixing, scope assertion, own-thread resolve, PENDING tripwire) with mockedgql/octokitinternals.server.test.tscovers tool registration and dispatch over an in-memory MCP transport.server-json.test.tscovers the MCP Registry entry (see Key conventions). Changes to the safety boundary must keep this coverage.test/integration/review-guard.itest.tsis a manual end-to-end suite (npm run test:integration, own config invitest.integration.config.ts) that drives every tool against a real GitHub repository with two accounts and verifies the results through direct API reads. It is excluded fromnpm testand CI, setup is documented in CONTRIBUTING.md.
server.json: the MCP Registry entry, published by the release workflow ascom.eclipsesource/review-guard. Metadata only, so nothing is hosted for users and theremotesfield stays unused: the entry describes the npm package and--stdio, which the client runs locally. It deliberately declares no--allow-submitor--allow-resolveargument, so the registry install path is the safe pending mode. Itsnamemust stay equal tomcpNameinpackage.json(how the registry verifies package ownership) and both of its versions must match the published npm version.test/server-json.test.tsenforces all of this and validates the file against the schema pinned in its$schemafield (vendored verbatim undertest/fixtures/, so validation stays offline), since otherwise it would only fail mid-release. The publishing job pins and checksums themcp-publisherbinary and refuses to run when the tag'sserver.jsondoes not declare the version being listed- ESM (
"type": "module"in package.json), NodeNext module resolution - Strict TypeScript. ESLint (type-checked) and Prettier are enforced in CI, so run
npm run lintandnpm run formatbefore committing - No em dashes and no semicolons in prose. This applies to docs, code comments, and user-facing strings. Write plain sentences instead
- Tool errors returned as
{ isError: true }content, not thrown - Server binds to
127.0.0.1by default, or the one specific address given with--host. Unspecified addresses (0.0.0.0,::) are refused at CLI parsing. The HTTP transport validates the Host header (DNS rebinding protection) submitPullRequestReviewlives ONLY insubmitReviewand runs ONLY whenallowSubmitis non-empty and the requested action is in it. Do not add submission anywhere else, do not bypass theallowSubmitgate. ThesubmitBodyprefix stays server-controlled: a caller may passsummary(thesubmittool) which is APPENDED below the prefix, but the prefix is always present and can never be replaced or removed.