Alter GitHub MCP Server
v0.1.0Multi-user GitHub MCP server with zero tokens on server, PR/merge approvals, and audit.
A multi-user GitHub MCP server for AI agents that lists repositories, searches issues, reads pull requests and source files, opens issues and PRs, comments, and merges — where the server never holds a GitHub PAT or OAuth token, every call respects the signed-in engineer's exact repo permissions, and comments, PRs and merges wait for a person's approval. It is backed by Alter: Alter stores each user's GitHub OAuth credential, enforces policies, holds risky writes for approval, and records every call as that engineer.
Summary extracted from the README.
GitHub MCP server with approvals (@alter-ai/github-mcp)
A multi-user GitHub MCP server for AI agents that lists repositories, searches issues, reads pull requests and source files, opens issues and PRs, comments, and merges — where the server never holds a GitHub PAT or OAuth token, every call respects the signed-in engineer's exact repo permissions, and comments, PRs and merges wait for a person's approval. It is backed by Alter: Alter stores each user's GitHub OAuth credential, enforces policies, holds risky writes for approval, and records every call as that engineer.
What the server holds vs. never holds
- Holds: Only an Alter agent key (
ALTER_AGENT_API_KEY) — plusALTER_SIGNIN_KEYwhen hosted on Cloudflare. - Never holds: GitHub OAuth tokens, personal access tokens (PATs), SSH keys, or your IdP secret.
Tools
| Tool | What it does | With the recommended policy |
|---|---|---|
list_repos |
Lists repositories the signed-in user can access | Allowed |
search_issues |
Searches issues and pull requests with GitHub search syntax | Allowed |
get_issue |
Reads an issue's details, labels, assignees and body | Allowed |
list_pull_requests |
Lists pull requests in a repository | Allowed |
get_pull_request |
Reads a PR's branches, diff stats and description | Allowed |
get_file_contents |
Reads a UTF-8 file or lists a directory in a repository | Allowed |
create_issue |
Opens a new issue as the signed-in user | Allowed (or hold issues/create) |
comment_on_issue |
Comments on an issue or PR as the signed-in user | Held until you approve it |
create_pull_request |
Opens a new pull request as the signed-in user | Held until you approve it |
merge_pull_request |
Merges a pull request (merge, squash, or rebase) |
Held until you approve it |
check_approval |
Reports what happened to a held request: waiting, done, denied, expired or failed | Allowed |
Deleting repositories, branches, or releases is not a tool, and the recommended policy also denies GitHub delete and admin operations.
Two-user isolation demo
Deploy one Cloudflare Worker URL (https://alter-github-mcp.<your-subdomain>.workers.dev/mcp) for your engineering org:
- Alice (security engineer with access to private repo
acme/security-incidents) and Bob (contractor without access) both connect to the same hosted Worker URL via your OIDC IdP. - Both ask "Read issue #1 in
acme/security-incidents." Alice reads the issue; Bob gets404because Alter proxies every call with each engineer's own GitHub OAuth grant. - Alice asks her agent to merge PR #42 (
merge_pull_request). Alter holds the merge until Alice approves it in the Alter Wallet (orslack-approvals), merges it as Alice, and writes an audit row namingalice@acme.com.
Set up
You need an Alter account and the alter CLI (0.10 or later). Replace <app-id> and <agent-id> below. Every step can also be done in the Alter portal.
1. An Alter app with an identity provider (Auth0, Clerk, Okta, WorkOS, Entra ID, or another OIDC provider). See identity providers or the 5-minute Auth0 / Okta quickstart.
2. GitHub as a provider. Create a GitHub OAuth App under GitHub Developer Settings (leave Expire user access tokens enabled so Alter refreshes 8-hour tokens automatically) and add GitHub (github) to your Alter app with scopes repo and read:user (or public_repo for public-only repos). See GitHub provider setup.
3. An agent. The key is printed once, in the api_key field:
alter agents create --app <app-id> --name github-agent \
--scopes '{"github":["repo","read:user"]}' \
--output json | jq -r '.api_key'
4. Connect GitHub and delegate it to the agent:
alter connect create --provider github --user-token "$USER_JWT" --agent github-agent --output json
5. Recommended policy. Allow reads and searches, hold comments (send), PR opens (pulls/create), and PR merges (pulls/merge) for human approval, and block deletes and admin changes:
echo '{"effect": "require_approval", "when": {"match": {"families": ["send"], "operations": ["pulls/create", "pulls/merge"]}}, "approval": {"channels": ["email"], "expires_in_seconds": 86400}}' | \
alter policy rules create --app <app-id> --agent <agent-id> --type require_approval --body - --name "Approve GitHub comments, PRs and merges"
echo '{"when": {"family": ["delete", "admin"]}, "effect": "deny"}' | \
alter policy rules create --app <app-id> --agent <agent-id> --body - --name "No deletes or admin changes"
6. Connect your MCP client.
claude mcp add github --env ALTER_AGENT_API_KEY=<agent key> -- npx -y @alter-ai/github-mcp
Until the first npm release, build from source (pnpm install && pnpm build at the repository root) and run node packages/github-mcp/dist/index.js.
Host on Cloudflare (remote, multi-user MCP)
alter keys mint --app <app-id> --name mcp-hosted \
--scopes idp_users:read,idp_users:write,connect:initiate,grants:write --output json | jq -r '.plain_key'
cd packages/github-mcp
npx wrangler deploy
npx wrangler secret put ALTER_AGENT_API_KEY
npx wrangler secret put ALTER_SIGNIN_KEY
npx wrangler secret put ALLOWED_USERS
Connect clients to https://alter-github-mcp.<your-subdomain>.workers.dev/mcp.
Configuration
| Variable | Required | Meaning |
|---|---|---|
ALTER_AGENT_API_KEY |
yes | The agent's key from step 3 |
ALTER_ACCOUNT |
no | Which GitHub account to use when more than one is delegated |
ALTER_GRANT_ID |
no | Use this exact grant instead of resolving by provider (not with ALTER_ACCOUNT) |
FAQ
Can it merge a PR without approval? Not under the recommended policy: Alter holds pulls/merge server-side until a human approves it, and the AI client cannot route around it.
What about prompt injection in issue comments or PR bodies? Every read tool labels GitHub text as untrusted data, comments/PRs/merges require human approval, and deletes/admin operations are blocked.
Enterprise / Company IdP
This server works with any OIDC IdP (Okta, Microsoft Entra ID, Auth0, WorkOS, Clerk). For company-wide policy, audit to SIEM, and on-prem vault → Alter. Want help connecting your company IdP? Book a 20-minute architecture review or email founders@alterauth.com.
License
MIT