MCP workflow
Review a pull request with repository and Git context
Use GitHub for PR context, a local Git server for the diff and history, and a scoped filesystem server for surrounding code before writing a review.
The problem
A useful review needs more than a diff. An agent must understand the issue, the changed files, the repository history, and the surrounding code. Connecting GitHub, Git, and a restricted filesystem scope gives it those inputs while keeping the review grounded in the actual change.
Why these components
Each server contributes a specific capability. The workflow is the contract between them.
Repository, issue, pull request, and code search operations through GitHub's official MCP server.
Code search · Issue management · Pull request inspectionstdioGit MCP ServerLocal Git history, diffs, commits, and branch operations for repository-aware agents.
Show history · Inspect diffs · Create commitsstdioFilesystem MCP ServerScoped read and write access to local directories for reference and development workflows.
Directory listing · File read · File writePrerequisites
- A GitHub token scoped to the target repository with read access to pull requests.
- A local clone of the repository at the commit you intend to review.
- An MCP client that can run stdio servers and a model with enough context for the diff.
Step-by-step
Connect the three sources
Register the GitHub server with a read-only repository token, the Git server pointed at the local clone, and the filesystem server restricted to that clone. Keep the filesystem allow-list at the repository root rather than the whole home directory.
Verify: Each server lists its tools, and the filesystem server can only see the repository path.
Load the pull request and its intent
Ask the agent to fetch the pull request description, linked issue, changed files, and review comments. Summarize the intended behavior before looking at the code, so the review has an explicit standard to test against.
Verify: The summary names the intended behavior, affected surface, and any linked issue constraints.
Read the diff and surrounding code
Have the agent inspect the diff through the Git tools, then open the changed files and their immediate callers through the filesystem server. Require it to cite file paths and line ranges for every finding.
Verify: Every finding names a file and a concrete behavior that could go wrong.
Check history and test coverage
Ask for recent commits touching the same files and the tests that cover the changed behavior. If tests are absent, the review should say so explicitly rather than assuming coverage.
Verify: The review lists existing tests or states that no relevant test was found.
Draft findings by severity
Produce a review with blocking issues, non-blocking suggestions, and open questions. Do not post to GitHub until a human has reviewed the draft and the token has write permission intentionally enabled.
Verify: The draft is readable, cites evidence, and contains no invented test results.
Generate a configuration for this workflow
Choose the client you use. The generator will preload 3 componentsand produce that client's documented format. Review every placeholder before saving.
The workflow does not imply that all components support the same transports in every client. The generator validates each entry and reports incompatibilities.
Permissions and security
- Use a read-only GitHub token for review work; do not enable comment or merge tools until the process is trusted.
- The agent reads proprietary source code. Confirm your provider's data handling and avoid pulling secrets from the repository.
- Restrict the filesystem server to the repository and exclude .env, credential stores, and unrelated customer data.
Expected outcome
A prioritized review draft that references the PR intent, the actual diff, surrounding code, and history, with explicit gaps where evidence is missing. A human decides what to post or change.
Questions
Can the agent post the review automatically?
Yes, if you grant a write-capable GitHub token and use the appropriate tools, but it is not recommended for the first runs. Start with a draft that a human reviews.
Do I need the GitHub server if I already have the clone?
The GitHub server adds PR description, review threads, and issue context that may not be present locally. The local Git server remains useful for the actual diff and history.
Sources & evidence
- github.com/github/github-mcp-serverRepository · checked Oct 23, 2026 · documented
The GitHub MCP server documentation describes pull request, issue, and repository tools used by this workflow.
- github.com/modelcontextprotocol/servers/tree/main/src/gitRepository · checked Oct 23, 2026 · documented
The reference Git server documents history and diff tools used for local review context.