GitHub MCP server security: tools, token scopes and lockdown

The GitHub MCP server limits agent actions through toolsets, token scopes, read-only mode, tool exclusions and a best-effort lockdown mode. This page shows what each control does, where it falls short and what reviewers should verify.

On this page

Does the GitHub MCP server let security teams limit what agents can do?

GitHub documents four server-side controls that limit what an agent can do through the GitHub MCP server: read-only mode, toolset selection, tool exclusion and lockdown mode. Read-only mode disables every write tool even when a request asks for one, and GitHub describes it as a strict filter that overrides other tool settings. Excluded tools are removed even when their toolset is enabled or the tool is added explicitly. Lockdown mode limits public-repository content to users with push access, but GitHub calls it a best-effort content filter rather than a security boundary. These are controls on the server, not a complete security boundary, so they should sit alongside least-privileged tokens and API permission checks. The remote and local servers also expose different tool sets, so a policy written for one deployment must be checked against the other.

Read-only mode is set with the X-MCP-Readonly header or a /readonly URL on the remote server, and with the --read-only flag or the GITHUB_READ_ONLY variable on the local server. Pull request tools are a common candidate for exclusion: GitHub's documented example removes create_pull_request and merge_pull_request while leaving the other pull request tools available. Under a classic personal access token, the repo scope also reaches tools that need public_repo and security_events, so the token scope should be reviewed before relying on tool hiding. Fine-grained tokens do not report their scopes to the server, so every tool is listed and the GitHub API rejects calls the token cannot perform. Confirm which of these behaviors applies to each token type your staff will use, and test the chosen configuration against both the remote and local servers. Verify that the default toolsets (context, issues, pull_requests, repos and users) are narrowed as intended.

Admin enforcement sits in enterprise managed settings, where allowedMcpServers and deniedMcpServers control which MCP servers GitHub Copilot clients may run. GitHub says these policies fail closed and that a server must pass every policy layer when several apply. The allowlist is enforced on the GitHub Copilot app, Copilot CLI and VS Code, so confirm which clients your organization uses. Secret scanning on tool calls covers public repositories only, and GitHub's August 2025 changelog states it does not cover private repositories yet or stop every non-secret data leak. Confirm with GitHub which plan and license include the admin allowlist and secret scanning for your organization, and whether your data residency setup limits the remote endpoint. Ask GitHub for written confirmation of each control before you approve broader access.

Which GitHub MCP server controls are documented, and for which deployment

This table compares the GitHub MCP server controls GitHub documents for the remote endpoint, the local server and GitHub Enterprise Server. Each cell starts with a status word: built in, plan-dependent, outside the server, or to confirm, where the sources do not state the deployment. Use it to find which controls you can rely on for each deployment and which ones to verify with GitHub before approval.

ControlRemote serverLocal serverGitHub Enterprise Server
Read-only modeBuilt in. Set with the X-MCP-Readonly header or a /readonly URL. Disables every write tool.Built in. Set with the --read-only flag or GITHUB_READ_ONLY. Disables every write tool.To confirm. Only the local server runs on GitHub Enterprise Server, so test the flag in your build.
Default toolsetsBuilt in. With no configuration, enables context, issues, pull_requests, repos and users.Built in. The configuration guide documents the same defaults. Confirm for your version.To confirm. Check which toolsets are enabled by default in your deployment.
Tool exclusionTo confirm. The configuration guide covers excluded tools, but confirm how remote endpoint settings apply.Built in. Excluded tools are removed even if their toolset is enabled or the tool is added explicitly.To confirm. Test that exclusions apply to the local server build you run.
Classic PAT scope filteringTo confirm. Scope filtering is documented for classic tokens. Confirm behavior on the remote endpoint.Built in. Tools whose OAuth scopes the classic token lacks are hidden from the client.To confirm. Test scope filtering with your token type on your instance.
Fine-grained token behaviorBuilt in. All tools are listed. The GitHub API rejects any call the token cannot perform.Built in. All tools are listed. The GitHub API rejects any call the token cannot perform.To confirm. Check API permission enforcement on your instance.
OAuth scope promptsBuilt in with OAuth. The client asks the user to authorize each extra scope when a tool needs it.To confirm. Local OAuth login is documented. Confirm on-demand scope prompts for your build.To confirm. Confirm whether OAuth sign-in and scope prompts are available on your instance.
Lockdown modeDocumented as a best-effort content filter, not a security boundary. Limits public-repository content to users with push access.To confirm. Confirm the setting and its behavior for the local server.To confirm. Confirm availability and behavior on your instance.
Secret scanning on tool callsBuilt in for public repositories on all plan types, at no extra license cost. Blocks detected secrets by default. Private repositories are not yet covered.To confirm. The sources describe the remote server scanning. Confirm local coverage with GitHub.To confirm. The sources do not document scanning for this deployment.
Enterprise MCP allowlistsOutside the server. Enterprise owners set allowedMcpServers and deniedMcpServers. Enforced on the Copilot app, Copilot CLI and VS Code.Outside the server. The allowlist controls which servers Copilot clients may run. Confirm coverage for your local configuration.To confirm. The sources do not document allowlists for this deployment. Confirm with GitHub.

How toolsets, token scopes and read-only mode filter what the agent sees

The GitHub MCP server applies its filters in a fixed order, and a reviewer should read them as layers. The first layer is the toolset. With no configuration, the server enables the default toolsets: context, issues, pull_requests, repos and users. That set defines the first list of tools an agent can see. The second layer is the token type. With a classic personal access token, the server hides any tool whose OAuth scope the token lacks. Fine-grained personal access tokens and GitHub App tokens do not report their scopes to the server, so the server lists every tool and relies on the GitHub API to reject any call the token cannot perform. A security review should therefore treat the token as the real boundary for fine-grained and App credentials, and confirm the permissions granted to each one before rollout.

Classic tokens carry a scope trap. Under a classic token, the repo scope also includes public_repo and security_events, so a token that looks like it only covers private repositories can still reach tools that need those scopes. Reviewers should check which scopes each classic token holds, not only the scope named in the request. The reader should confirm how the team's tokens are issued and whether any classic tokens with broad scopes exist. The PAT Scope Filtering documentation explains how the server maps scopes to tools.

Read-only mode and exclusions sit above both layers. GitHub documents read-only mode as a strict filter that disables every write tool, even when a request asks for one, and it overrides other tool settings. Excluded tools are removed even when their toolset is enabled or the tool is added explicitly. GitHub's own example excludes create_pull_request and merge_pull_request while leaving other pull request tools available. Because exclusions beat explicit additions, a team can rely on them to hold a write tool out of reach even when a developer's configuration adds it back. Reviewers should still confirm which deployment they are assessing, since the remote server offers tools the local server does not, such as create_pull_request_with_copilot, and the exclusion list must match the tool set of the deployment in use. The Server Configuration Guide lists the keys and the tool names.

Which GitHub MCP tools carry the most risk

The GitHub MCP server exposes read and write tools across repositories, issues and pull requests, and some of them reach content or permissions an agent should not use freely. The cards below group the capabilities that deserve the most scrutiny, the failure mode each one creates, and the control GitHub documents to limit it. Confirm each item against the tool list your own deployment actually exposes.

Pull request write actions

Tools that create and merge pull requests can change code paths that reach production. A misdirected or injected instruction could open or merge a change without a human reviewing it. GitHub's documented example excludes create_pull_request and merge_pull_request while leaving the other pull request tools available, which shows how exclusion works at the tool level. Confirm in your tool list whether these two tools are present and excluded, and whether branch protection on your repositories still requires review before merge.

Configuration guide

Repository content changes

Write tools that update files, branches or repository settings let an agent alter source that other people build on. The main control is read-only mode, which disables every write tool even when a request asks for one. GitHub documents it as a strict filter that overrides other tool settings. On the remote server it is set with the X-MCP-Readonly header or a /readonly URL, and on the local server with the --read-only flag or the GITHUB_READ_ONLY variable. Confirm which deployment your staff use and that read-only is applied there.

Security events access

Under a classic personal access token, the repo scope also includes public_repo and security_events, so a token that looks like it only covers code can reach security alert data. Tools that read or act on security events expose vulnerability findings that are useful to an attacker. Fine-grained tokens do not report their scopes to the server, so every tool appears and the GitHub API rejects calls the token cannot perform. Confirm which token type each user holds, and remove classic tokens with repo scope where a narrower token will do.

Public content that carries instructions

Public READMEs, issues and pull request comments are written by people outside your organization, and they can contain instructions that push an agent to paste credentials into tool calls. GitHub's secret scanning for tool calls covers public repositories and blocks detected secrets by default, but it does not cover private repositories yet and does not stop every non-secret data leak. Lockdown mode limits public-repository content to users with push access, though GitHub calls it a best-effort content filter, not a security boundary. Confirm whether lockdown is enabled for your staff and test with a planted instruction in a public issue.

Secret scanning changelog

Remote-only Copilot pull request tool

The remote server offers tools the local server does not, including create_pull_request_with_copilot. Because the two deployments expose different tool sets, a control that you verified on the local server may not apply to the remote endpoint. This tool hands pull request creation to a Copilot-driven workflow, so it changes the review path as well as the repository. Confirm whether it appears in your remote tool list, exclude it if your policy requires human-initiated pull requests, and re-check the list after GitHub updates the hosted server.

Remote server docs

How the server filters a tool request

The request starts with an agent's tool call and passes the token type check first, since a classic personal access token hides tools its OAuth scopes do not cover, while fine-grained tokens and GitHub App tokens show every tool. Next, the toolset and exclusion filters decide which tools exist, and excluded tools stay removed even when explicitly added. The read-only filter then strips write tools as a strict override. For public repositories, the lockdown content filter and secret scanning on tool call inputs run before the call reaches the GitHub API permission check, which is the final gate. Check each layer separately, because the earlier filters only narrow what is offered and do not replace the API check.

Layers a GitHub MCP server tool call passes through before reaching GitHub.

Where the GitHub MCP server controls fall short

The GitHub MCP server offers read-only mode, tool exclusions, token scope filtering and lockdown, but several of these controls are narrower than their names suggest. The cards below set out where each gap sits and the controls most teams pair with it, so reviewers can decide what to restrict before approval.

Lockdown mode is not a boundary

GitHub describes lockdown mode as a best-effort content filter, not a security boundary. It limits public-repository content to users with push access, but it does not replace access control on private repositories. Treat it as one layer. Confirm with your security team which repositories the agent can reach, and keep tokens scoped to the repositories the task needs.

Configuration guide

Secret scanning has limited coverage

Secret scanning on tool calls applies to public repositories only. GitHub's August 2025 changelog states it does not yet cover private repositories and does not stop every non-secret data leak. For private code, the main controls are least-privileged tokens and a policy for what the agent may paste into tool inputs. Ask GitHub which features apply to your plan before relying on them.

August 2025 changelog

Public content can steer credential use

GitHub warns that READMEs, issues and pull request comments can contain instructions that push an agent to paste credentials into tool calls. Because the agent reads this content as context, a crafted comment can act as an instruction. Reduce exposure by limiting write tools, excluding those the task does not need, and reviewing agent approvals before any write action runs.

Secret scanning changelog

Fine-grained token scopes stay hidden

Fine-grained personal access tokens do not report their scopes to the server. The server lists every tool, and the GitHub API rejects only the calls the token cannot perform. Classic tokens behave differently: the server hides tools whose scopes are missing, but a token with repo also reaches tools that need public_repo and security_events. Audit which token type each agent uses and rotate credentials on a set schedule.

Scope filtering docs

Remote and local tool sets differ

The remote server offers tools the local server does not, including create_pull_request_with_copilot. A policy written for one deployment may not cover the other. Review the remote and local deployments separately, list the tools each exposes, and apply exclusions such as create_pull_request and merge_pull_request to each one. Re-check the list after GitHub updates the hosted server.

Remote server docs

How the control set changes by deployment and plan

On GitHub Enterprise Cloud, staff can connect to the hosted remote server, which GitHub updates automatically. This deployment has the widest set of documented controls, because the remote server carries sign-in, read-only, exclusion and secret scanning features that the local server does not document in the same way.

  • Sign-in: OAuth 2.0 is the method GitHub recommends for most users, personal access tokens are also supported, and the OAuth sign-in supports SAML enforcement.
  • Read-only and exclusions: Read-only mode is set with the X-MCP-Readonly header or a /readonly URL, and excluded tools are removed even when their toolset is enabled or the tool is added explicitly.
  • Toolsets and token scopes: With no configuration, the default toolsets are context, issues, pull_requests, repos and users. Classic tokens hide tools whose scopes they lack, while fine-grained tokens list every tool and rely on API permission checks.
  • Secret scanning on tool calls: For public repositories, the server scans tool call inputs and blocks detected secrets by default, on all plan types at no extra license cost. It does not yet cover private repositories.
  • Admin allowlists: Enterprise owners can use allowedMcpServers and deniedMcpServers in enterprise managed settings, and the policy fails closed.

Confirm with GitHub which plan includes the managed settings feature for your enterprise, and confirm that your staff's clients are among those where the allowlist is enforced.

Order of work to lock down the server before staff use it

This sequence moves from deciding what the server may reach to proving that each control blocks what it should. Each step ends with a check the security reviewer can sign off before staff connect.

  1. Inventory the toolsets and tools the team needs

    The platform owner and team leads list which tasks staff will do through the server, such as reading issues, reviewing pull requests or managing repositories. Map each task to a default toolset (context, issues, pull_requests, repos and users are enabled when no configuration is set) and note any tool that a task does not need. Decide between the remote endpoint and the local server first, because the remote server offers tools the local server does not, including create_pull_request_with_copilot. Done means a written tool list per role, signed off by the owner of the repositories involved.

  2. Choose the token type and least-privilege scopes

    The identity team selects OAuth or a personal access token for each group, then sets the narrowest scopes that the listed tasks require. Under a classic personal access token, the repo scope also brings public_repo and security_events, so a broad token reaches more tools than the task needs. Fine-grained tokens do not report scopes to the server, so every tool appears and GitHub's API checks each call. Confirm with the GitHub documentation which token behavior applies to your deployment. Done means each token type is recorded with its scopes, its owner and a rotation plan.

  3. Apply read-only mode and tool exclusions by use case

    The platform owner sets read-only mode for groups that only need to read, using the X-MCP-Readonly header or /readonly URL on the remote server, or the --read-only flag or GITHUB_READ_ONLY variable on the local server. Read-only mode overrides other tool settings. For groups that need some writes, use the documented exclusion setting, such as removing create_pull_request and merge_pull_request while leaving other pull request tools available. Excluded tools stay removed even when their toolset is enabled or the tool is added explicitly. Done means each group's configuration is saved and a test request for an excluded write tool returns no tool.

  4. Decide the lockdown setting for public repositories

    The security lead decides whether lockdown mode is needed for any public repositories the agent may read. Lockdown mode limits public-repository content to users with push access. GitHub describes it as a best-effort content filter, not a security boundary, so it cannot replace scope or exclusion decisions. The remote server's secret scanning on public repositories is on by default and blocks detected secrets, but it does not cover private repositories and does not stop every non-secret leak. Done means a written decision per repository class, with the reason recorded.

  5. Configure enterprise allowlists for approved servers

    An enterprise owner uses allowedMcpServers and deniedMcpServers in enterprise managed settings so that GitHub Copilot clients run only approved MCP servers. The allowlist is enforced on the GitHub Copilot app, Copilot CLI and VS Code, and it fails closed, so a malformed or unverifiable configuration is blocked. Where several policy layers apply, a server must pass every layer. Confirm that each client type your staff use appears in the enforcement list before you rely on it. Done means a test configuration with an unapproved server is blocked on each client type.

  6. Verify each control with a test agent session and retest

    The security reviewer runs a test agent session for each role and checks that the tool list, scopes, read-only behavior, exclusions and allowlist match the decisions above. Include a prompt-injection case, such as a public issue asking the agent to paste a credential into a tool call, and confirm that secret scanning or the agent's own controls stop it. Record the results and rerun the same tests after any change to scopes, tokens or managed settings. Done means a signed test record exists for each role and a retest is scheduled after every configuration change.

What a security reviewer asks to see for these controls

This table lists the evidence a reviewer should request for each GitHub MCP server control, what to inspect in it, and where the setting lives. Use it to build the review file before approving the server for staff. Rows marked as admin evidence need the organization's own records, since GitHub's sources describe the settings but not the organization's chosen values.

ControlWhat to inspectWhere it comes from in the tool
Approved toolset and exclusion listEnabled toolsets against the default set of context, issues, pull_requests, repos and users, plus every excluded tool nameServer configuration settings; excluded tools are removed even when their toolset is enabled or the tool is added explicitly
Read-only configuration per environmentSeparate records for development, staging and production showing read-only is on where writes are not neededX-MCP-Readonly header or /readonly URL on the remote server; --read-only flag or GITHUB_READ_ONLY on the local server
Token type and scope inventoryEach token in use, whether it is a classic personal access token, fine-grained token, GitHub App token or OAuth grant, and the scopes it holdsToken settings in GitHub; classic tokens expose scopes that the server uses to hide tools, fine-grained tokens rely on API permission checks
Rotation scheduleWritten rotation interval for each credential, the owner of each token, and the record of the last rotationOrganization credential policy; GitHub's August 2025 changelog advises least-privileged tokens and regular rotation
Lockdown settingWhether lockdown mode is enabled where public repositories are in scope, and which users hold push access to those repositoriesLockdown mode setting; GitHub describes it as a best-effort content filter, not a security boundary
Allowlist policy exportExported allowedMcpServers and deniedMcpServers entries from enterprise managed settings, with the date of the last changeEnterprise managed settings; GitHub says policies fail closed and every applicable layer must pass
Secret scanning coverage for tool callsConfirmation of which repositories are covered, since tool call scanning does not yet cover private repositoriesGitHub MCP server changelog from August 2025 and the plan details in the server's documentation; confirm current coverage with GitHub
GitHub Copilot Trust Center materialSecurity, privacy, compliance and transparency documents filed in the review package, with the date each was retrievedGitHub Copilot Trust Center; these documents cover Copilot, so confirm which ones apply to the MCP server

Questions buyers ask before approving GitHub MCP server access

Are the GitHub MCP server's security controls free to use?

The controls described in GitHub's documentation, including read-only mode, toolsets, tool exclusions and lockdown mode, are configuration options on the server itself, and the sources reviewed do not attach a separate fee to them. The secret scanning for tool calls on public repositories is offered on all plan types at no extra license cost, according to GitHub's August 2025 changelog. Your recurring costs are the GitHub plan and Copilot licenses your staff already use, plus the staff time to set up and review configurations. Confirm with GitHub whether any control depends on a specific plan or edition before you budget, and ask for that answer in writing.

What drives the effort to configure GitHub MCP server controls?

Effort rises with the number of deployments and the number of tool sets you need to restrict. The remote server and the local server expose different tool sets, so each deployment needs its own review. Token type matters as well: a classic personal access token hides tools whose OAuth scopes it lacks, while fine-grained tokens list every tool and rely on API permission checks, so you must test each token type separately. Enterprise allowlists add a policy review step, and because the policy fails closed, malformed configurations need debugging before rollout. Ask for a written list of every deployment, token type and policy layer in scope before you estimate effort.

Can our team configure these controls without outside help?

Many of the settings are simple to apply, such as a read-only header or flag, an exclusion list or an enterprise allowlist, so an internal platform or security team can manage them without an outside partner. The harder part is verification: confirming that a read-only configuration actually blocks writes, that an excluded tool stays unavailable under every toolset, and that a fine-grained token cannot perform a restricted call. DeployOpen can plan, implement and test these configurations under a fixed scope agreed in writing, and it offers retests and retainers for ongoing review. Decide which checks your team can run and which need an independent tester before you sign off.

Does read-only mode stop every write from the GitHub MCP server?

GitHub documents read-only mode as a strict filter that disables every write tool, even when a request asks for one, and it overrides other tool settings. You turn it on with the X-MCP-Readonly header or a /readonly URL on the remote server, and with the --read-only flag or the GITHUB_READ_ONLY variable on the local server. Read-only mode limits what the server exposes through MCP, but it does not replace token scoping, because a token with broader rights can still be used by other clients. Test the setting in your own environment and confirm with GitHub's configuration documentation that the behavior matches your deployment.

Is lockdown mode enough to protect public repositories?

No. GitHub describes lockdown mode as a best-effort content filter, not a security boundary. It limits public-repository content to users with push access, which reduces exposure to untrusted text such as issues and pull request comments, but it does not remove the risk. GitHub's August 2025 changelog warns that public content such as READMEs, issues and pull request comments can carry instructions that push an agent to paste credentials into tool calls. Pair lockdown mode with least-privileged tokens, regular credential rotation, tool exclusions for risky write actions, and the secret scanning that the remote server applies to public repositories. Secret scanning does not cover private repositories yet and does not stop every non-secret leak, so treat it as one layer.

What should we confirm about data leaving the organization?

Start by confirming whether the deployment is remote or local, because the remote server runs at GitHub's hosted endpoint, while the local server runs in your environment from the container image or release binaries. GitHub Enterprise Cloud with data residency uses its own copilot-api endpoint, and GitHub Enterprise Server supports only the local server. The sources reviewed do not give a retention period for MCP data, so ask GitHub for that answer in writing and check GitHub's Copilot Trust Center for security, privacy and compliance material. Your review should also cover which repositories the agent can read, because tool call inputs and outputs carry that content.

Which MCP token type should our rollout use for tool restriction?

The answer depends on whether you need the server to hide tools or rely on API checks. With a classic personal access token, the server hides tools whose OAuth scopes the token lacks, but the repo scope also includes public_repo and security_events, so a token with repo reaches more tools than its name suggests. Fine-grained tokens do not report scopes to the server, so every tool appears and the GitHub API rejects any call the token cannot perform. GitHub recommends OAuth 2.0 for most users, and the remote server requests extra scopes on demand, with the MCP client asking the user to authorize each one. Confirm your choice with GitHub's scope filtering documentation and test it against the tools you plan to exclude.

How DeployOpen tests and hardens a GitHub MCP server rollout

DeployOpen tests the GitHub MCP server in the setup your organization actually runs, including the toolsets, token type, read-only and exclusion settings, and admin allowlists in place. We then deliver a findings report with fixes and a retest, so your security and engineering reviewers can decide what staff may use.

How we scope

  • Written scope names the deployment type, remote or local, and the token method in use.
  • Scope lists which toolsets, write tools and excluded tools are in the review.
  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.

How we build

  • We test prompt injection paths that try to make the agent paste credentials into tool calls.
  • We check whether token scopes, fine-grained permissions and API checks match the intended access.
  • We verify read-only, exclusion and lockdown settings behave as documented in your environment.

How we hand over

  • Deliverables include a findings report with severity, evidence and a recommended configuration.
  • Fixes are documented so your administrators can apply and reproduce the hardened settings.
  • A retest confirms that the agreed fixes work before the engagement is closed.

How we support

  • Ongoing support is available as a retainer for changes to toolsets, tokens or allowlists.
  • Retainers can include continuous testing as the GitHub MCP server and your policies change.
  • Confirm with DeployOpen in the written scope which support and retesting terms apply to your rollout.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.