This example shows how GATE MCP protects a GitHub MCP server with role-based access control, approval workflows for high-risk operations, and complete audit logging.
An AI agent with access to a GitHub MCP server can:
- Delete repositories without review
- Merge pull requests to production branches
- Push commits directly
- Archive repos, delete branches
GATE MCP ensures every GitHub action is evaluated against your organization's policies before it reaches the API.
pnpm gate-mcp demo githubThis uploads the GitHub safety policy and simulates 5 scenarios:
| Scenario | Role | Decision | Rule |
|---|---|---|---|
| List repos | developer | ALLOW | allow-reads |
| Create PR on protected repo | developer | REQUIRE APPROVAL | require-approval-pr-protected |
| Merge pull request | developer | REQUIRE APPROVAL | require-approval-merge |
| Delete repository | developer | DENY | deny-repo-delete |
| Create issue | contributor | DENY | contributor-read-only |
13 GitHub tools classified by operation class and risk level:
| Tool | Operation | Risk |
|---|---|---|
github.list_repos |
read | low |
github.get_repository |
read | low |
github.search_code |
read | low |
github.get_pull_request |
read | low |
github.list_issues |
read | low |
github.create_issue |
write | low |
github.create_pull_request |
write | medium |
github.merge_pull_request |
write | high |
github.delete_branch |
write | medium |
github.push_commit |
write | medium |
github.delete_repository |
admin | high |
github.archive_repository |
admin | high |
github.update_repo_settings |
admin | medium |
| Rule | Action | What It Matches |
|---|---|---|
deny-repo-delete |
deny | Repo deletion/archival by non-admins |
require-approval-pr-protected |
require_approval | PRs on repos with -protected in name |
require-approval-merge |
require_approval | All PR merges |
require-approval-branch-delete |
require_approval | All branch deletions |
contributor-read-only |
deny | Any non-read operation by contributors |
warn-on-writes |
warn | All write operations (monitoring) |
allow-reads |
allow | All read operations |
12 test cases verify every decision path:
pnpm test --filter @gate-mcp/policy-testing- classifications.json — Tool operation/risk assignments
- ../../examples/policy-packs/github-safety.yaml — Policy pack
- ../../examples/policy-tests/github-safety.test.yaml — Policy test fixtures
- ../../docs/integrations/github.md — Full integration guide