
This playbook is part of our MCP playbooks, within The MCP Guide. Want help setting it up for your team? Request a free MCP readiness review.
Pull request review is the daily job of reading someone's change, checking it against the codebase and CI results, and leaving useful comments. Reviewers usually flip between the diff, the files around it and the checks tab. With MCP (Model Context Protocol), a coding agent can read the same pull request through the official GitHub MCP Server and draft a review for a person to edit and submit.
This playbook uses tool names from GitHub's README as of October 2026. The agent prepares the review. A maintainer decides what gets posted and what gets merged.
Key Takeaways
- GitHub's
pull_request_readtool covers the pull request, its diff, changed files, commits, reviews, comments and CI check runs. - Reviews can be built as a pending draft:
pull_request_review_writecreates one,add_comment_to_pending_reviewadds line comments, and a human can submit it. - Start with the remote server in read-only mode (
X-MCP-Readonly: trueor a/readonlyURL) and add write tools later. - On public repos, lockdown mode filters comments from people without push access, but GitHub says it is "not an authorization boundary."
- Keep
merge_pull_requestout of the agent's reach. Merging stays a human decision.
What you need
- The GitHub MCP Server. See our GitHub MCP server profile. The README says the remote server runs at
https://api.githubcopilot.com/mcp/, and that the default toolsets arecontext,repos,issues,pull_requestsandusers. - A coding agent. Claude Code, VS Code with Copilot, Cursor and others connect to the remote server. Setup steps are in connecting Claude Code to GitHub and connecting VS Code to GitHub.
- A token or OAuth sign-in with the right scope. The README lists the
repoOAuth scope for the pull request tools. Use a fine-grained token limited to the repos you review, where you can.
The workflow
- Pick the pull requests. Ask the agent to use
list_pull_requests(filter by state or base branch) orsearch_pull_requestswith GitHub's search syntax, such as open PRs waiting on your team. - Read the summary.
pull_request_readwith thegetmethod returns the title, description, author and branches. - Read the change.
pull_request_readwithget_diffreturns the diff, andget_fileslists changed files with pagination for large PRs.get_commitsshows how the change was built. - Read the surrounding code. Use
get_file_contentsfor files the diff touches andsearch_codeto find other callers of a changed function. This is where an agent saves the most clicking. - Check CI.
pull_request_readwithget_check_runsreturns the check runs on the head commit, andget_statusreturns the combined status. If a job failed and theactionstoolset is on,get_job_logspulls the log. - Read the existing discussion.
get_reviews,get_review_commentsandget_commentsshow what other reviewers already said, so the agent doesn't repeat them. - Draft the review. Once you allow writes,
pull_request_review_writecreates a pending review, andadd_comment_to_pending_reviewadds comments tied to a file path and line. The README describes the latter as adding to "the requester's latest pending pull request review." - A human submits. The reviewer reads the draft in GitHub, edits or deletes comments, picks approve or request changes, and submits.
pull_request_review_writecan also submit, but this playbook leaves that click to a person.
If your org uses Copilot code review, the README's request_copilot_review tool asks Copilot to review as well.
Example prompts
- "List open pull requests in acme/web that target main and have no reviews yet."
- "Read PR 412: summarize what it changes, list the files, and flag anything that touches auth or billing."
- "For PR 412, find every caller of
calculateTaxoutside the changed files and check whether the new signature breaks any of them." - "Show the check runs on PR 412. If any failed, pull the job log and explain the failure in two sentences."
- "Start a pending review on PR 412 with line comments for the three issues you found. Do not submit it."
Guardrails
- Read-only first. GitHub's server configuration guide gives two ways to make the remote server read-only: the
X-MCP-Readonly: trueheader or a URL ending in/readonly. It says read-only mode "takes priority" and disables write tools even if you request them. - Load only the toolsets you need. Use the
X-MCP-Toolsetsheader (for examplerepos,pull_requests) or a/x/{toolset}URL path. Fewer tools means fewer ways to go wrong. - Treat PR text as untrusted. Titles, descriptions and comments on public repos can carry instructions aimed at the agent. Lockdown mode filters content from users without push access on tools such as
pull_request_read:get_commentsandget_review_comments. The README calls it "a best-effort content filter," not an authorization boundary. See prompt injection through MCP. - Never let the agent merge.
merge_pull_requestandupdate_pull_requestare write tools. Keep them out of the agent's toolset, and keep branch protection and required reviews on in GitHub. - Scope tokens tightly. The agent can do whatever the token allows. Read excessive permissions in MCP and the MCP Security Center.
What to measure
- Time from "ready for review" to first review, before and after you add the agent.
- Share of agent comments kept after human edits, as a rough signal of usefulness.
- Defects found after merge in PRs the agent pre-reviewed versus those it didn't.
- CI failure explanations that were correct, judged by the PR author.
- Write tool calls the agent attempted, from your client's logs, to confirm guardrails hold.
Collect your own baseline first. There is no industry number to aim for here.
Next step
Browse more workflows in the MCP playbooks hub. If you want an AI review step set up in your repos with sensible scopes and branch rules, see our Claude Code consulting service.
Frequently asked questions
Can the agent approve pull requests?
Technically, pull_request_review_write can submit a review if write tools are enabled. This playbook keeps submission and approval with a human, and branch protection rules in GitHub still apply.
Does the agent see CI results?
Yes. pull_request_read has a get_check_runs method for the head commit's check runs and a get_status method for the combined status. With the actions toolset enabled, get_job_logs can read the failing job's log.
Is the GitHub MCP Server free?
GitHub's docs say the server "is available to all GitHub users regardless of plan type." Tools tied to paid features, such as Copilot coding agent, need the matching license.
What about GitHub Enterprise Server?
The README says the remote server doesn't support GitHub Enterprise Server, so those teams run the local server (Docker image or binary) with their own token or app.











