GitHub MCP
How to restrict the GitHub MCP server to one repository
A fine-grained token limits what GitHub accepts. A Meandr policy limits which repository the agent may ask for, and records every call that tries another.
Setup
Two layers: a GitHub token and a Meandr policy
A GitHub token gives every agent the same repositories. Meandr policies can name a single agent, so each one reaches only the repository it needs.
-
01 Connect
Add GitHub's MCP server with a token for acme/webapp only
Create a fine-grained GitHub token for acme/webapp only, then add GitHub's server by URL in Servers with that token as a Bearer token, and Meandr becomes the MCP gateway for GitHub for every agent.
- Token permissions: Contents, Issues and Pull requests, read and write
- The token is sealed on save and never shown again, and agents hold only their own Meandr key
×Add MCP serverRegister an MCP server. Tool calls route through it with your policies enforced on the way.
Endpointhttps://api.githubcopilot.com/mcp/Edit URLNameGitHubAuthentication ?Bearer tokenCredentials ?Bearer token••••••••••••••••••••••••••••••••••••••••Custom trust roots ?Custom headers ?Health monitoring ?Per-server rate-limit override ?BackAdd server -
02 Tools
Switch off the GitHub tools the agent doesn't need
After saving, the Server catalog lists GitHub's tools with the hints GitHub declares, and you switch each one on or off.
- Delete file is the only default tool GitHub marks destructive
- Tools you switch off never reach the agent
Server catalogDiscover what
GitHubexposes — tools, resource templates, and prompts.Regionsgithub-mcp-server 2.0.2MCP 2025-06-18FRA · 45 tools iIAD · 45 tools iToolsResource templatesPrompts- Get file or directory contentsread-only
get_file_contents{ }› - List commitsread-only
list_commits{ }› - Push files to repository
push_files{ }› - Delete filedestructive
delete_file{ }›
ResyncCloseSaved -
03 Policies
Allow acme/webapp and deny every other repository
Add two policies with the GitHub server in Targets, and the first one that matches decides each call.
- webapp only: Allow, with an Arguments matcher where owner is acme and repo is webapp
- other repos: Deny below it, with a reason code, and a Default policy of Deny as a backstop
- Optional: an Approve policy on file and issue changes in acme/webapp, dragged to #1 in Sort policies, so writes wait for a person
PoliciesMainSort+ Add policyRules evaluated against every proxied call. Lower priority fires first. The default policy is the fallback when nothing else matches.
Default policyApplies when no other rule matches.Record responses ?ActionDeny- webapp writes#1ApproveView
- webapp only#2AllowView
- other repos#3DenyView
-
04 Verify
Ask the agent for a file in acme/billing
Meandr denies the read before it reaches GitHub, and the agent gets an error instead of a result.
- Traffic shows the denied call, the other repos policy and your reason code
- Calls to acme/webapp keep running
srv GitHub2026-10-09▸10:14:02200642msallow▸10:14:062001.07sallow▾10:14:114033msdeny:repo_not_allowedPolicy other reposFrom 203.0.113.24⌄Request 196 Btools/callget_file_contents#730184529owner: acmerepo: billingpath: README.md
Questions about an MCP gateway for GitHub
Isn't the fine-grained token enough?
Can two agents work in different repositories through one token?
What about GitHub tools that take no owner or repo?
What does the agent get on a denied call?
Keep your GitHub agent in one repository
One fine-grained token, an Allow policy for the repository and a Deny policy for the rest.
Try for freeQuestions? Email us