GitHub Policy
MCPlexer can enforce organization and repository allowlists on GitHub tool calls. This prevents AI agents from accessing repositories outside of approved boundaries, even if the underlying credentials have broader access.
Configuration
Add allowed_orgs and allowed_repos to any route rule that handles github__* tools:
route_rules:
- id: github-restricted
workspace_id: ws-prod
server_id: github-mcp
tool_pattern: "github__*"
allowed_orgs:
- acme-corp
- acme-internal
allowed_repos:
- acme-corp/api-service
- acme-corp/web-app
- acme-internal/deploy-tools| Name | Type | Default | Description |
|---|---|---|---|
allowed_orgs | string[] | — | List of GitHub organization names. Tool calls targeting repos outside these orgs are blocked. |
allowed_repos | string[] | — | List of GitHub repositories in owner/repo format. Tool calls targeting unlisted repos are blocked. |
How Enforcement Works
When a tool call matches a route rule with GitHub policy fields, MCPlexer enforces the policy during dispatch:
- Tool prefix check — only
github__*prefixed tools are subject to policy enforcement - Argument extraction — MCPlexer extracts the
ownerandrepofields from the tool call arguments - Org check — if
allowed_orgsis set, theownermust match one of the listed organizations - Repo check — if
allowed_reposis set, theowner/repomust match one of the listed repositories - Combined check — if both are set, the repo must match
allowed_reposAND the org must matchallowed_orgs
If the check fails, the tool call is blocked and an error is returned to the client. The attempt is logged in the audit trail with status blocked.
Both fields must match
When both allowed_orgs and allowed_repos are configured on the same rule, a tool call must satisfy both constraints. The repo must appear in allowed_repos and its org must appear in allowed_orgs.
Examples
Organization-Only Policy
Allow any repository within approved organizations:
route_rules:
- id: github-org-only
workspace_id: ws-dev
server_id: github-mcp
tool_pattern: "github__*"
allowed_orgs:
- my-companyRepository-Only Policy
Restrict access to specific repositories regardless of organization:
route_rules:
- id: github-repo-only
workspace_id: ws-prod
server_id: github-mcp
tool_pattern: "github__*"
allowed_repos:
- acme-corp/api-service
- acme-corp/web-appCombined Policy
Require both organization and repository match for maximum control:
route_rules:
- id: github-strict
workspace_id: ws-prod
server_id: github-mcp
tool_pattern: "github__*"
allowed_orgs:
- acme-corp
allowed_repos:
- acme-corp/api-service
- acme-corp/deploy-toolsNo Policy (Default)
Without allowed_orgs or allowed_repos, no GitHub-specific enforcement is applied. The tool call is routed normally based on standard route matching.
route_rules:
- id: github-open
workspace_id: ws-dev
server_id: github-mcp
tool_pattern: "github__*"
# No allowed_orgs or allowed_repos — no policy enforcementDefense in depth
GitHub policy is an additional layer on top of route rules and auth scopes. Even without explicit policy, tools are still subject to workspace isolation, route matching, and credential scoping.
Non-GitHub tools
Policy enforcement only applies to tools with the github__ prefix. Other downstream server tools (e.g., slack__*, jira__*) are not affected by these fields.