Skip to content
modelcontextprotocolPublic

About

Infrastructure as Code for MCP access management

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

53 stars

Watchers

3 watching

Forks

Repository files navigation

MCP access

This repository decides who has access to what in the MCP project: GitHub, Google Workspace, Discord and Cloudflare. Access is described in TypeScript, reviewed in pull requests, and applied with Pulumi when a change merges to main.

Where things are

To change Edit
Who is in which group src/config/users.ts
Which groups exist src/config/roles.ts
Who can access a repository src/config/repoAccess.ts
Organization-wide GitHub roles src/config/orgRoles.ts
GitHub organization settings src/config/orgSettings.ts
Discord channels src/config/channels.ts
Who can sign in to the security room src/config/accessPolicies.ts
Who publishes to npm and PyPI src/config/packageAccess.ts

npm and PyPI are the exception to automatic deploys. Their expected access is recorded here, but a person applies it. See Package publishing.

Make a change

  1. Edit the config and run npm run check.
  2. Open a pull request. A core maintainer has to approve it.
  3. Merge it. The Deploy workflow applies it, usually within 10 to 20 minutes.

Manual changes to anything managed here are usually undone by the next deploy.

Common tasks

Add someone to a group

Add the group's role to their memberOf in users.ts. If they aren't listed yet, add an entry in alphabetical order:

{
  github: 'their-username',
  discord: '123456789012345678', // optional, their Discord user ID
  memberOf: [ROLE_IDS.TYPESCRIPT_SDK],
},

Someone new to the organization gets an invitation by email and has no access until they accept it.

Add or remove a registry admin

Add ROLE_IDS.REGISTRY_ADMINS to their memberOf, or remove it. The registry checks the registry-admins team each time an admin signs in, and admin tokens that were already issued last up to 5 minutes.

Get an @modelcontextprotocol.io account

Maintainers, SDK maintainers and working group members can have one, and sign in to it with GitHub. Add these fields to your entry in users.ts, and add the sign-in role to your memberOf:

githubUserId: 12345678, // the "id" at https://github.com/proxy/api.github.com/users/your-username
firstName: 'Your',
lastName: 'Name',
googleEmailPrefix: 'yourname', // yourname@modelcontextprotocol.io
memberOf: [/* your roles, */ ROLE_IDS.WORKSPACE_SSO],

After the deploy, enter your new address on the Google sign-in page and it sends you to GitHub. If you already have an account, add githubUserId and ROLE_IDS.WORKSPACE_SSO to use GitHub sign-in. Workspace admins keep their passwords. See GitHub sign-in for Google Workspace.

Create a repository

Organization members can't create repositories directly. Add an entry with settings to repoAccess.ts:

{
  repository: 'ext-example',
  settings: {
    description: 'MCP Extension for Example. Maintained by the Example Working Group.',
  },
  teams: [
    { team: 'core-maintainers', permission: 'admin' },
    { team: 'moderators', permission: 'maintain' },
    { team: 'example-wg', permission: 'admin' },
  ],
},
  • Use lowercase names with hyphens. Extensions start with ext-, or experimental-ext- while they're experimental.
  • At least one team or person needs admin.
  • Removing the entry archives the repository. Only an organization owner can delete it.
  • An entry without settings manages only who has access. Before adding settings to an existing repository, run pulumi import, or the deploy fails.
  • Don't rename an entry in place, because that archives the old repository and creates a new one. repoAccess.ts has the steps.
  • A repository that was archived by hand stays archived.

How GitHub access works

People get access through teams. These rules explain most of what you'll see:

  • Core and lead maintainers are admins of every repository, through an organization role.
  • A child team gets everything its parent has. SDK teams are under sdk-maintainers, which is under steering-committee, so they get its triage on modelcontextprotocol, .github, inspector and quickstart-resources, pull on maintainer-docs, and push on docs.
  • Working and interest groups inherit nothing from steering-committee. A group has its own grants and those of its group parent.
  • Some teams must not have a parent, so that they can't inherit access. Comments in roles.ts mark them.
  • On servers, grant teams one by one. Don't give it to steering-committee, because that would reach every SDK team.
  • Grants to one person (users in repoAccess.ts) are exceptions. Prefer a team.

npm run validate rejects a grant that is lower than what the team already has, a pull or triage grant that repeats it, and a team listed twice. Repeating push or higher is allowed, because CODEOWNERS only accepts teams with their own write access.

Contributor ladder

The contributor ladder defines project roles. Access here comes from teams, so a rank on the ladder doesn't grant anything by itself.

Ladder role Access here
Contributor None.
Member members team: push on modelcontextprotocol, triage on docs, .github, inspector, quickstart-resources and servers.
Maintainer Their own team, such as an SDK team or docs-maintainers. The general maintainers team has push on modelcontextprotocol.
Core maintainer Admin of every repository.
Lead maintainer Admin of every repository.
Community moderator moderators team: maintain on most community repositories. Discord moderator role.
WG lead or IG facilitator wg-ig-facilitators on Discord. Some working groups also have a *-wg-leads team with admin on the group's repository.

Members need push on modelcontextprotocol because it only accepts pull requests from people with write access. Their triage is granted per repository, because the organization-wide triage role would also cover private ones.

Some teams are outside the ladder: security-managers, security-team, workspace-sso, the *-auth and conformance-auth code owner teams, the *-collaborators teams, auth-contributors, access-maintainers, registry-admins and csharp-sdk-admin.

Discord

The deploy gives people the Discord roles of their groups, if their entry in users.ts has a Discord ID. It also manages the channels listed in channels.ts.

A refresh corrects Discord roles too, so don't run make refresh or pulumi preview --refresh only to look.

Channels

An entry with an id adopts an existing channel. An entry without one creates a channel.

// Adopt a channel and enforce only its slow mode
{ id: '1234567890123456789', type: 'text', rateLimitPerUser: 5 },

// Create a forum channel
{
  name: 'sdk-help',
  type: 'forum',
  requireTag: true,
  availableTags: [{ name: 'typescript' }, { name: 'python' }, { name: 'answered', moderated: true }],
  defaultSortOrder: 'latest_activity',
},
  • Only the settings you declare are managed. name is required for a new channel and optional for an adopted one.
  • Changes made by hand to a declared setting are reverted by the next deploy.
  • Channels are never deleted. Removing an entry, or changing its id or type, leaves the old channel on Discord.
  • position is used only when the channel is created. Reorder channels in Discord.
  • npm run check rejects invalid settings. It warns about channel names with uppercase letters or spaces, and about requireTag on an adopted channel with no availableTags. The deploy fails if that channel has no tags on Discord.
  • Changes appear in Discord's audit log as modelcontextprotocol/access deploy.

Thread-only channels

forum and media channels are always thread-only. Discord can't convert a text channel into one, so declaring type: 'forum' on a text channel's id fails the deploy.

To make a text channel thread-only, adopt it and set permissionOverwrites:

  • For DISCORD_EVERYONE_ROLE, deny SEND_MESSAGES and allow CREATE_PUBLIC_THREADS and SEND_MESSAGES_IN_THREADS.
  • For each role that may still post in the channel itself, allow SEND_MESSAGES. #general does this for moderators and community managers.

Permission overwrites

Each entry names a role from roles.ts or DISCORD_EVERYONE_ROLE, and the permissions to allow and deny. Only permissions listed in discordPermissions.ts can be used.

Only the listed permissions are managed. Other permissions, and overwrites for other roles or members, stay as they are. Removing a permission clears it on the next deploy. Administrators bypass overwrites.

What the bot needs

  • Manage Channels in the server, and View Channel on private channels you adopt.
  • Manage Roles to write overwrites. It can only allow or deny permissions that it has itself.
  • The Community feature on the server, to create forum and media channels.

Security room sign-in

securityroom.modelcontextprotocol.io is behind Cloudflare Access, which signs people in with GitHub. accessPolicies.ts lists the roles that may sign in. Only that policy is managed here. The application's domain, identity providers and session settings are set in Cloudflare.

Give someone access

Add ROLE_IDS.SECURITY_TEAM to their memberOf in users.ts. That role grants no repository access.

To let in another team, add its role to the policy in accessPolicies.ts.

Cloudflare only counts direct members of a team. Someone in python-sdk doesn't match a rule for its parent, sdk-maintainers. That's why the security leads of the SDKs are added to security-team directly.

If Cloudflare turned someone away before they had access, they need to revoke Cloudflare Access in their GitHub settings (Applications, then Authorized OAuth Apps) and sign in again. Until then, Cloudflare uses the team list from their earlier sign-in.

Replace the Cloudflare token

In the MCP Domain Account on Cloudflare, create a token with only Account > Access: Apps and Policies > Edit. Save it as CLOUDFLARE_ROLE_MANAGEMENT_TOKEN in the production environment, and use it for nothing else. The deploy stops if it's missing.

GitHub sign-in for Google Workspace

People sign in to their @modelcontextprotocol.io account with GitHub. Cloudflare Access is the SAML identity provider.

Enable someone

In a reviewed pull request, change their entry in users.ts:

  1. Confirm their numeric GitHub ID with them and set githubUserId. CI checks that it matches their login.
  2. Add ROLE_IDS.WORKSPACE_SSO to their memberOf. They also need a role that gives them a Workspace account.

The deploy moves their account into the /Model Context Protocol/GitHub SSO organizational unit, including accounts marked existingGWSUser. If an admin moves it out by hand, the next deploy moves it back. A refresh does too. Removing the role returns the account to the unit it came from.

Caution

Keep Workspace admin accounts out of this unit.

Configure Google

Use a modern SAML profile and keep legacy SSO off.

  1. Create the profile with the Cloudflare Access SSO URL, entity ID and signing certificate.
  2. Set cloudflare:googleSamlEntityId and cloudflare:googleSamlAcsUrl together, with the values from that profile. If neither is set, the application uses placeholders that can't sign anyone in.
  3. Have a Workspace admin assign the profile to the GitHub SSO unit. To roll back, remove the assignment.
  4. Check that post-SSO verification applies to the unit, 2-Step Verification is enforced, and every user is enrolled.

The Cloudflare token that edits Access applications can change which Workspace identity Cloudflare signs, so treat it as sensitive.

Remove someone

  1. Suspend the Workspace account, reset its sign-in cookies, and revoke OAuth grants and app passwords where they apply.
  2. Revoke their Cloudflare Access sessions.
  3. Remove the Workspace SSO role in users.ts and deploy.

The Access application and policy sessions last one hour. Cloudflare can reuse stored GitHub membership until the global session ends, so check that setting. Google manages its own sessions.

Package publishing

packageAccess.ts records who should be able to publish to npm and PyPI. A maintainer applies the changes by hand, because neither registry lets automation do it: npm asks for an interactive 2FA challenge for every access change, and PyPI has no API for it.

npm can still be read automatically. The drift workflow compares it with the config every week and on demand. It needs NPM_READ_TOKEN, a read-only npm token with organization read access, and skips the check without it. Keep that token read-only, because npm tokens that can write expire after 90 days at most.

npm organization members come from the npm field in users.ts.

Change npm access

  1. Merge the change to packageAccess.ts or users.ts.
  2. Run NPM_TOKEN=<read-only token> npm run check-package-drift. It prints the npm commands that would fix the differences.
  3. Read them, especially the removals.
  4. As an npm organization owner, log in with npm login and run the commands in one session. At the first 2FA prompt, choose Don't ask again for 5 minutes. With sleep 2 between commands, about 80 fit in that time.
  5. Run the check again. It should find no differences.

Change PyPI access

  • Add a maintainer: under Manage project > Collaborators, invite them by PyPI username. They have no access until they accept the email. Then record them in packageAccess.ts and in the pypi field of users.ts.
  • Add a trusted publisher: under Manage project > Publishing, add the GitHub repository and workflow. Prefer this to API tokens.

Deployment, secrets and keys

Every merge to main runs the Deploy workflow. You can also start it by hand on main.

Deploy from your machine

You need the Pulumi CLI, the Google Cloud SDK, and access to the GCP project and its bucket.

  1. Run gcloud auth application-default login.
  2. Get passphrase.prod.txt from the maintainers.
  3. Set GITHUB_TOKEN to a token with the permissions of the deploy App. The organization rejects classic personal access tokens.
  4. Set the discord:*, githubBillingEmail and cloudflare:roleManagementToken config values the way deploy.yml does. Without the Discord and Cloudflare values, make up deletes what they manage.
  5. Run make preview, then make up.

A refresh isn't read-only. make refresh and pulumi preview --refresh can change Discord roles and move Google Workspace accounts.

Environments and secrets

Secrets belong to a GitHub environment (Settings > Environments). Don't store them at repository level, where every branch can read them.

Environment Used by Branches
production deploy.yml main only
preview preview.yml on pull requests No restriction

Pull requests run on refs/pull/<number>/merge, so preview can't be limited to main. Anyone who can push a branch can use what's in it.

Name What it is
DEPLOY_APP_CLIENT_ID (variable) Client ID of the environment's GitHub App
DEPLOY_APP_PRIVATE_KEY Private key of that App
GCP_PROD_SERVICE_ACCOUNT_KEY Service account key for the Pulumi state in Google Cloud Storage
PULUMI_PROD_PASSPHRASE Passphrase that decrypts the Pulumi secrets. It can't be recovered.
ORG_BILLING_EMAIL Billing email of the GitHub organization
DISCORD_BOT_TOKEN Token of the Discord bot
DISCORD_GUILD_ID ID of the Discord server
CLOUDFLARE_ROLE_MANAGEMENT_TOKEN Cloudflare Access token

All of them are set in production. The deploy stops before changing anything if a secret is missing.

preview has only its own App's two values, so the Pulumi preview is skipped on pull requests. To turn it on, first add required reviewers to preview, then the other secrets. It fails if only some of them are there.

Deploy App

The deploy signs in to GitHub as the mcp-access-deploy App, which is installed on all repositories. Each run gets a token that expires after an hour and is revoked when the job ends.

Scope Permission Access
Repository Administration Read and write
Repository Metadata Read
Repository Pages Read
Organization Administration Read and write
Organization Members Read and write
Organization Custom organization roles Read

The App has no access to repository contents on purpose. Because of that, repositories with settings may show the same merge settings as changed on every deploy, and creating a repository from a template doesn't work.

Its private key is as powerful as an organization admin. Keep it in production and nowhere else. preview uses a separate App with only Metadata: read and Custom organization roles: read.

To replace the key, generate a new one in the App settings and run this. Then delete the old key and the local file.

gh secret set DEPLOY_APP_PRIVATE_KEY --env production -R modelcontextprotocol/access < key.pem

About

Infrastructure as Code for MCP access management

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

53 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages