From e8260fd802c1baa4fd132a44cfd1708113823df8 Mon Sep 17 00:00:00 2001 From: Den <53200638+localden@users.noreply.github.com> Date: Tue, 1 Dec 2026 20:02:51 +0000 Subject: [PATCH 1/7] Stop groups from inheriting steering-committee access Remove the parent from working-groups and interest-groups, and lower steering-committee to pull on maintainer-docs. --- README.md | 4 ++-- scripts/test-config.ts | 4 ++++ src/config/repoAccess.ts | 4 ++-- src/config/roles.ts | 6 ++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 61dba332..bed907e0 100644 --- a/README.md +++ b/README.md @@ -79,10 +79,10 @@ The [contributor ladder](https://modelcontextprotocol.io/community/contributor-l Things to know when reading the config against the ladder: -- **GitHub child teams inherit their parent's repository access.** WG, IG, and SDK teams nest under `steering-committee` (via `working-groups`, `interest-groups`, and `sdk-maintainers`). Their members therefore get `steering-committee`'s grants, which include `triage` on `modelcontextprotocol`, `.github`, `inspector`, and `quickstart-resources`, and `push` on the archived `docs` repository. `steering-committee` deliberately has no grant on `servers`, so the teams listed there have their own `triage` grants, which their child teams inherit in turn. Write access on `inspector`, `servers`, and `quickstart-resources` comes from the team that owns each one: `inspector-maintainers` on `inspector`, `reference-servers-maintainers` on `servers`, and `docs-maintainers` on `quickstart-resources`. This is independent of ladder rank. Roles that must not inherit these grants (`members`, `maintainers`, `access-maintainers`, `security-team`, `registry-collaborators`, `typescript-sdk-collaborators`) have no parent. `npm run validate` fails when a team's grant is lower than what it inherits or has from its organization role, and when a `pull` or `triage` grant repeats what it inherits. Repeating `push` or higher is allowed, because CODEOWNERS only accepts teams with their own write access. +- **GitHub child teams inherit their parent's repository access.** SDK teams nest under `steering-committee` via `sdk-maintainers`, next to the core, lead, docs, inspector and MCPB maintainers and the moderators. Their members therefore get `steering-committee`'s grants, which include `triage` on `modelcontextprotocol`, `.github`, `inspector`, and `quickstart-resources`, `pull` on `maintainer-docs`, and `push` on the archived `docs` repository. WG and IG teams nest under `working-groups` and `interest-groups`, which have no parent, so a group has its own grants plus those of its group parent teams, and nothing from `steering-committee`. `steering-committee` deliberately has no grant on `servers`, so the teams listed there have their own `triage` grants, which their child teams inherit in turn. Write access on `inspector`, `servers`, and `quickstart-resources` comes from the team that owns each one: `inspector-maintainers` on `inspector`, `reference-servers-maintainers` on `servers`, and `docs-maintainers` on `quickstart-resources`. This is independent of ladder rank. Roles that must not inherit these grants (`working-groups`, `interest-groups`, `members`, `maintainers`, `access-maintainers`, `security-team`, `registry-collaborators`, `typescript-sdk-collaborators`) have no parent. `npm run validate` fails when a team's grant is lower than what it inherits or has from its organization role, and when a `pull` or `triage` grant repeats what it inherits. Repeating `push` or higher is allowed, because CODEOWNERS only accepts teams with their own write access. - **Some roles have no ladder counterpart.** These are functional or operational roles: `security-managers`, `security-team`, CODEOWNERS teams (`*-auth`, `conformance-auth`), collaborator teams (`registry-collaborators`, `typescript-sdk-collaborators`), `auth-contributors` (`push` on `ext-auth` only, no parent team), `access-maintainers` (`push` on `access` only, no parent team), `csharp-sdk-admin`, Discord-only `administrators` and `community-managers`, and Google email groups. - **Per-user grants** in `repoAccess.ts` (the `users` lists) are not tied to any ladder role. -- **`security-ig` has no repository grants of its own** apart from an older `admin` on `docs`, which is archived. Like the other interest groups, it has what it inherits from its parent teams. +- **`security-ig` has no repository grants of its own** apart from an older `admin` on `docs`, which is archived. ## Discord channels diff --git a/scripts/test-config.ts b/scripts/test-config.ts index 4710ab6f..3fbe97ef 100644 --- a/scripts/test-config.ts +++ b/scripts/test-config.ts @@ -201,6 +201,10 @@ test('A team may not be listed twice on a repository', () => { team: 'top', permission: 'push' }, { team: 'top', permission: 'pull' }, ]).length === 1); +test('Group teams do not inherit from teams outside the groups', () => + [ROLE_IDS.WORKING_GROUPS, ROLE_IDS.INTEREST_GROUPS].every( + (id) => roleLookup.get(id)?.github?.parent === undefined + )); test('Collaborator teams have no parent team', () => [ROLE_IDS.REGISTRY_COLLABORATORS, ROLE_IDS.TYPESCRIPT_SDK_COLLABORATORS].every( (id) => roleLookup.get(id)?.github?.parent === undefined diff --git a/src/config/repoAccess.ts b/src/config/repoAccess.ts index 5209ab02..28e3007e 100644 --- a/src/config/repoAccess.ts +++ b/src/config/repoAccess.ts @@ -162,7 +162,7 @@ export const REPOSITORY_ACCESS: RepositoryAccess[] = [ { repository: 'servers', // No steering-committee grant: child teams would inherit it, so it would reach - // every WG and IG member. Write access comes from the owning team. + // every SDK team. Write access comes from the owning team. teams: [ { team: 'reference-servers-maintainers', permission: 'admin' }, { team: 'auth-maintainers', permission: 'triage' }, @@ -426,7 +426,7 @@ export const REPOSITORY_ACCESS: RepositoryAccess[] = [ teams: [ { team: 'lead-maintainers', permission: 'admin' }, { team: 'core-maintainers', permission: 'admin' }, - { team: 'steering-committee', permission: 'maintain' }, + { team: 'steering-committee', permission: 'pull' }, { team: 'maintainers', permission: 'pull' }, ], }, diff --git a/src/config/roles.ts b/src/config/roles.ts index de00c729..b70ff2a3 100644 --- a/src/config/roles.ts +++ b/src/config/roles.ts @@ -356,7 +356,8 @@ export const ROLES: readonly Role[] = [ { id: ROLE_IDS.WORKING_GROUPS, description: 'MCP Working Groups', - github: { team: 'working-groups', parent: ROLE_IDS.STEERING_COMMITTEE }, + // No parent team: groups must not inherit steering-committee repo permissions + github: { team: 'working-groups' }, // No discord - organizational container // Covers all working groups via github.parent (e.g. transport-wg, tasks-events-wg) provisionUser: true, @@ -488,7 +489,8 @@ export const ROLES: readonly Role[] = [ { id: ROLE_IDS.INTEREST_GROUPS, description: 'Interest Groups', - github: { team: 'interest-groups', parent: ROLE_IDS.STEERING_COMMITTEE }, + // No parent team: groups must not inherit steering-committee repo permissions + github: { team: 'interest-groups' }, // No discord - organizational container }, { From 58b7b02015e79d14d0368edf466e95fdb4b115f4 Mon Sep 17 00:00:00 2001 From: Den <53200638+localden@users.noreply.github.com> Date: Tue, 1 Dec 2026 20:06:05 +0000 Subject: [PATCH 2/7] Rewrite the README and move the guides to docs --- .github/workflows/preview.yml | 4 +- Pulumi.prod.yaml | 4 +- README.md | 353 ++++++++------------------------- docs/cloudflare-access.md | 24 +++ docs/deployment.md | 64 ++++++ docs/discord.md | 51 +++++ docs/packages.md | 22 ++ docs/setup.md | 48 +++++ docs/workspace-sso.md | 33 +++ scripts/check-package-drift.ts | 6 +- src/cloudflare.ts | 2 +- src/config/accessPolicies.ts | 4 +- src/config/packageAccess.ts | 2 +- src/config/repoAccess.ts | 2 +- src/config/workspaceSso.ts | 2 +- src/google.ts | 2 +- 16 files changed, 336 insertions(+), 287 deletions(-) create mode 100644 docs/cloudflare-access.md create mode 100644 docs/deployment.md create mode 100644 docs/discord.md create mode 100644 docs/packages.md create mode 100644 docs/setup.md create mode 100644 docs/workspace-sso.md diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 832f1156..4d94de83 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -19,8 +19,8 @@ jobs: # Skip preview for fork PRs and Dependabot - they don't have access to Actions secrets if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' # `production` only deploys from main, so it rejects pull request refs. - # `preview` accepts them and holds its own credentials. See README.md - # "Required GitHub Secrets (for CI/CD)". + # `preview` accepts them and holds its own credentials. See + # docs/deployment.md. environment: preview steps: - name: Checkout code diff --git a/Pulumi.prod.yaml b/Pulumi.prod.yaml index 21abc88f..2a7ee6ba 100644 --- a/Pulumi.prod.yaml +++ b/Pulumi.prod.yaml @@ -4,14 +4,14 @@ config: googleworkspace:credentials: secure: v1:Ntr2su0kgwp0oAh3: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 github:owner: modelcontextprotocol - # Cloudflare Access (see README "Cloudflare Access (security-room)"). + # Cloudflare Access (see docs/cloudflare-access.md). # cloudflare:roleManagementToken is set by the deploy workflow from the CLOUDFLARE_ROLE_MANAGEMENT_TOKEN secret. cloudflare:accountId: c39d6379ccfdb20a3627eeddffa80ec9 cloudflare:githubIdentityProviderId: 1e53bc11-a504-4572-92d1-4c8d56fc198b # The dashboard-created policy was adopted by the first deploy of #195 and is now # managed from config. Leave this "false" so deploys apply the declared rules. cloudflare:importExistingPolicies: "false" - # GitHub sign-in for Google Workspace (see README): SP values from the modern + # GitHub sign-in for Google Workspace (see docs/workspace-sso.md): SP values from the modern # Google SAML profile. Legacy SSO stays disabled. cloudflare:googleSamlEntityId: https://accounts.google.com/samlrp/035ezb1t4kdf8xs cloudflare:googleSamlAcsUrl: https://accounts.google.com/samlrp/035ezb1t4kdf8xs/acs diff --git a/README.md b/README.md index bed907e0..0dc51ea8 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,67 @@ -# MCP Access Management +# MCP access -Infrastructure as Code for managing access to MCP community resources using Pulumi. +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](https://www.pulumi.com/) when a change merges to `main`. -- Define groups in [`src/config/roles.ts`](src/config/roles.ts) -- Add users to groups in [`src/config/users.ts`](src/config/users.ts) -- Changes are applied via GitHub Actions when merged to the main branch +## Where things are -## What This Manages +| To change | Edit | +| ------------------------------------ | -------------------------------------------------------------- | +| Who is in which group | [`src/config/users.ts`](src/config/users.ts) | +| Which groups exist | [`src/config/roles.ts`](src/config/roles.ts) | +| Who can access a repository | [`src/config/repoAccess.ts`](src/config/repoAccess.ts) | +| Organization-wide GitHub roles | [`src/config/orgRoles.ts`](src/config/orgRoles.ts) | +| GitHub organization settings | [`src/config/orgSettings.ts`](src/config/orgSettings.ts) | +| Discord channels | [`src/config/channels.ts`](src/config/channels.ts) | +| Who can sign in to the security room | [`src/config/accessPolicies.ts`](src/config/accessPolicies.ts) | +| Who publishes to npm and PyPI | [`src/config/packageAccess.ts`](src/config/packageAccess.ts) | -- **GitHub Teams**: Automatically syncs team memberships in the MCP GitHub organization -- **GitHub Repositories**: Creates and owns repositories declared with `settings` in [`src/config/repoAccess.ts`](src/config/repoAccess.ts), and syncs team and user access for every listed repository. See [Creating a new repository](#creating-a-new-repository-working-group-leads) below. -- **Google Workspace Groups**: Automatically syncs group memberships for @modelcontextprotocol.io email accounts - - **Email Groups**: Groups with `isEmailGroup: true` accept emails from anyone (including external users) and notify all members. External posts are moderated for security. -- **Google Workspace User Accounts**: Provisions @modelcontextprotocol.io accounts for members of roles with `provisionUser: true` (directly, or via a role nested under one through `github.parent` — e.g. SDK teams under `sdk-maintainers`, working groups under `working-groups`) -- **GitHub sign-in for Google Workspace**: Cloudflare Access is the SAML identity provider for Google Workspace, so allowlisted maintainers sign in to their `@modelcontextprotocol.io` account with GitHub. The allowlist and account mapping come from [`src/config/workspaceSso.ts`](src/config/workspaceSso.ts) and `users.ts`. See [GitHub sign-in for Google Workspace](#github-sign-in-for-google-workspace) below. -- **Discord**: Syncs the Discord roles declared in [`src/config/roles.ts`](src/config/roles.ts) to the members' Discord IDs in `users.ts`, and manages the settings of the channels declared in [`src/config/channels.ts`](src/config/channels.ts), including thread-only forum/media channels. See [Discord channels](#discord-channels) below. -- **Cloudflare Access (security-room)**: Syncs the Cloudflare Zero Trust Access policy that decides who can sign in to `securityroom.modelcontextprotocol.io` from the roles declared in [`src/config/accessPolicies.ts`](src/config/accessPolicies.ts). See [Cloudflare Access (security-room)](#cloudflare-access-security-room) below. -- **npm & PyPI Package Publishing Access** (declared, not applied): Expected registry access is declared in [`src/config/packageAccess.ts`](src/config/packageAccess.ts) and drift against the live npm registry is detected by CI — but changes are applied manually by a maintainer. See [npm & PyPI Package Publishing Access](#npm--pypi-package-publishing-access) below for why and how. +npm and PyPI are the exception to automatic deploys. Their expected access is recorded here, but a person applies it. See [Package publishing](docs/packages.md). -### Opting in to a Google Workspace account (maintainers) +## Make a change -If you're a maintainer — explicitly or implicitly (SDK maintainers, working group members, etc.) — and want an `@modelcontextprotocol.io` account, open a PR adding the following fields to your entry in [`src/config/users.ts`](src/config/users.ts): +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](.github/workflows/deploy.yml) 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`](src/config/users.ts). If they aren't listed yet, add an entry in alphabetical order: ```ts { - github: 'your-github-username', - // ... - firstName: 'Your', - lastName: 'Name', - googleEmailPrefix: 'yourname', // -> yourname@modelcontextprotocol.io - memberOf: [ROLE_IDS.MAINTAINERS /* , ... */], + github: 'their-username', + discord: '123456789012345678', // optional, their Discord user ID + memberOf: [ROLE_IDS.TYPESCRIPT_SDK], }, ``` -Once merged, Pulumi provisions the account. An admin will share your initial password (retrievable via `pulumi stack output --show-secrets newGWSUserPasswords`). +Someone new to the organization gets an invitation by email and has no access until they accept it. -### Creating a new repository (working group leads) +### Get an @modelcontextprotocol.io account -Org members cannot create repositories directly. Instead, open a PR adding an entry to [`src/config/repoAccess.ts`](src/config/repoAccess.ts) with a `settings` block plus the usual `teams`: +Maintainers, SDK maintainers and working group members can have one. Add these fields to your entry in [`users.ts`](src/config/users.ts): + +```ts +firstName: 'Your', +lastName: 'Name', +googleEmailPrefix: 'yourname', // yourname@modelcontextprotocol.io +``` + +After the deploy, ask an admin for your first password. Admins find it with `pulumi stack output --show-secrets newGWSUserPasswords`. + +### Create a repository + +Organization members can't create repositories directly. Add an entry with `settings` to [`repoAccess.ts`](src/config/repoAccess.ts): ```ts { repository: 'ext-example', settings: { description: 'MCP Extension for Example. Maintained by the Example Working Group.', - // visibility: 'public' (default), homepage, topics, template are optional }, teams: [ { team: 'core-maintainers', permission: 'admin' }, @@ -54,260 +71,50 @@ Org members cannot create repositories directly. Instead, open a PR adding an en }, ``` -The PR's `pulumi preview` comment shows the repository create, when [previews are on](#required-github-secrets-for-cicd). Once merged, the deploy creates the repository (with the baseline in `REPOSITORY_DEFAULTS`) and then grants the listed access, in one apply. Notes: - -- Repository names are lowercase kebab-case (`ext-*` for extensions, `experimental-ext-*` while experimental). -- At least one team or user must have `admin` permission (validated), so a managed repository is never ownerless. -- Removing the entry **archives** the repository rather than deleting it; deletion stays a manual org-owner action. -- Entries without `settings` are access-only: the repository pre-dates this config and Pulumi manages only its collaborators. Adding `settings` to such an entry does not adopt the repository. The deploy fails with a name-already-exists error. Adopt it with `pulumi import` first; that is out of scope for the PR flow above. -- The `repository` key of a managed entry is also the Pulumi resource name. Renaming it in place archives the old repository and creates a new one. To rename, do three things in order: rename the repository on GitHub, rename the resources in state with `pulumi state rename` (`repository-` to `repository-`, and `repo-` to `repo-`), then change the key. -- A repository archived by hand in GitHub stays archived (`archived` is ignored on refresh); un-archiving is a manual org-owner action. - -## Contributor ladder mapping - -The [contributor ladder](https://modelcontextprotocol.io/community/contributor-ladder) ([SEP-2148](https://modelcontextprotocol.io/seps/2148-contributor-ladder)) defines project roles and their privileges. This repo grants access by **team** (roles in [`src/config/roles.ts`](src/config/roles.ts)), not by ladder rank. The table shows how each ladder role corresponds to what is configured here. - -| Ladder role | Ladder privilege | Configured here | -| ------------------------ | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| Contributor | None | None. `defaultRepositoryPermission` is `none` ([`orgSettings.ts`](src/config/orgSettings.ts)). | -| Member | Org membership with triage rights | `members` team and `members (synced)` Discord role. The team has `push` on `modelcontextprotocol`, so Members can open pull requests there (the repository accepts them from collaborators only, which GitHub defines as write or higher), and `triage` on `docs`, `.github`, `inspector`, `quickstart-resources`, and `servers`. Grants are per repository rather than through the `all_repo_triage` org role, which would also cover private repositories. Add someone by putting `ROLE_IDS.MEMBERS` in their `memberOf` once the ladder's sponsorship requirements are met. | -| Maintainer | Merge privileges for owned areas | An "owned area" is a team: SDK teams (under `sdk-maintainers`), `docs-maintainers`, `inspector-maintainers`, `registry-wg`, `reference-servers-maintainers`, and others, each with `push`/`maintain`/`admin` on its repos ([`repoAccess.ts`](src/config/repoAccess.ts)). The general `maintainers` team has `push` on `modelcontextprotocol`. | -| Core Maintainer | Administrative rights to all MCP repositories | `core-maintainers` holds the `all_repo_admin` org role ([`orgRoles.ts`](src/config/orgRoles.ts)). | -| Lead Maintainer | All Core Maintainer privileges | `lead-maintainers` holds the `all_repo_admin` org role. Veto and appointment authority are governance, not access. | -| Community Moderator | Moderation rights on Discord and GitHub Discussions | `moderators` team and Discord role. The team has `maintain` on most community-facing repos. | -| WG Lead / IG Facilitator | Facilitation and SEP triage; no merge authority by default | `wg-ig-facilitators` Discord role (calendar access). Some WGs have a `*-wg-leads` team with `admin` on the WG's extension repo; most WGs do not. | - -Things to know when reading the config against the ladder: - -- **GitHub child teams inherit their parent's repository access.** SDK teams nest under `steering-committee` via `sdk-maintainers`, next to the core, lead, docs, inspector and MCPB maintainers and the moderators. Their members therefore get `steering-committee`'s grants, which include `triage` on `modelcontextprotocol`, `.github`, `inspector`, and `quickstart-resources`, `pull` on `maintainer-docs`, and `push` on the archived `docs` repository. WG and IG teams nest under `working-groups` and `interest-groups`, which have no parent, so a group has its own grants plus those of its group parent teams, and nothing from `steering-committee`. `steering-committee` deliberately has no grant on `servers`, so the teams listed there have their own `triage` grants, which their child teams inherit in turn. Write access on `inspector`, `servers`, and `quickstart-resources` comes from the team that owns each one: `inspector-maintainers` on `inspector`, `reference-servers-maintainers` on `servers`, and `docs-maintainers` on `quickstart-resources`. This is independent of ladder rank. Roles that must not inherit these grants (`working-groups`, `interest-groups`, `members`, `maintainers`, `access-maintainers`, `security-team`, `registry-collaborators`, `typescript-sdk-collaborators`) have no parent. `npm run validate` fails when a team's grant is lower than what it inherits or has from its organization role, and when a `pull` or `triage` grant repeats what it inherits. Repeating `push` or higher is allowed, because CODEOWNERS only accepts teams with their own write access. -- **Some roles have no ladder counterpart.** These are functional or operational roles: `security-managers`, `security-team`, CODEOWNERS teams (`*-auth`, `conformance-auth`), collaborator teams (`registry-collaborators`, `typescript-sdk-collaborators`), `auth-contributors` (`push` on `ext-auth` only, no parent team), `access-maintainers` (`push` on `access` only, no parent team), `csharp-sdk-admin`, Discord-only `administrators` and `community-managers`, and Google email groups. -- **Per-user grants** in `repoAccess.ts` (the `users` lists) are not tied to any ladder role. -- **`security-ig` has no repository grants of its own** apart from an older `admin` on `docs`, which is archived. - -## Discord channels - -Channels listed in [`src/config/channels.ts`](src/config/channels.ts) are managed by the `DiscordChannel` resource in [`src/discord.ts`](src/discord.ts), using the same `discord:botToken`/`discord:guildId` stack config as the role sync (the bot needs the **Manage Channels** permission in the guild, plus **View Channel** on any private channel you adopt; creating `forum`/`media` channels requires the guild's Community feature). Each entry is either an **existing channel adopted by its ID** or a **new channel created on deploy**: - -```ts -// Adopt an existing channel by ID: the declared settings are enforced in place, -// anything not declared (here, the name) is left as it is on Discord -{ id: '1234567890123456789', type: 'text', rateLimitPerUser: 5 }, - -// Create a thread-only forum channel -{ - name: 'sdk-help', - type: 'forum', - requireTag: true, - availableTags: [{ name: 'typescript' }, { name: 'python' }, { name: 'answered', moderated: true }], - defaultSortOrder: 'latest_activity', -}, -``` - -- **Thread-only channels are a channel type or a permission policy, not a setting.** Discord has no "require threads" switch. `forum` and `media` channels are thread-only by type, but the API cannot convert a text channel into one: declaring `type: 'forum'` on the `id` of a text channel fails the deploy with an error saying so. To make an existing text channel thread-only in place, keeping its ID and history, adopt it by `id` and declare `permissionOverwrites` that deny `SEND_MESSAGES` to `DISCORD_EVERYONE_ROLE` and allow `CREATE_PUBLIC_THREADS` and `SEND_MESSAGES_IN_THREADS`; members can then only start threads and reply in them. Add an overwrite allowing `SEND_MESSAGES` for any role that should still post at the top level (`#general` does this for moderators and community managers). -- **Permission overwrites are managed per permission.** Each `permissionOverwrites` entry names a role from `roles.ts` (or `DISCORD_EVERYONE_ROLE`) and the permissions to `allow` and `deny`, limited to the allowlist in [`discordPermissions.ts`](src/config/discordPermissions.ts). Pulumi owns only the listed permissions: other permissions on the same overwrite, and overwrites for other roles or members, stay as they are on Discord. Removing a permission or an entry clears just those bits on the next deploy. The bot needs **Manage Roles** to write overwrites, and Discord only lets it allow or deny permissions it holds itself. Administrators bypass overwrites. -- **Channels are never deleted.** Removing an entry only drops the resource from Pulumi state; the channel and its history stay on Discord. Changing an entry's `id` or `type` likewise adopts/creates the new channel and leaves the old one alone. -- Only declared settings are managed. `name` is required when creating a channel and optional when adopting one by `id`; declare it only if you want it enforced. Validation (`npm run check`) rejects a missing name on a new channel, names outside 1-100 characters, topics over Discord's limit (1024 for text, 4096 for forum/media), malformed snowflakes, duplicate entries, more than 20 tags, `requireTag` with no tags to pick from, and forum/media settings on text channels (`defaultForumLayout` is forum-only). It prints a `WARNING:` without failing for names with uppercase letters or spaces (Discord normalizes those, so the declared name would never match) and for `requireTag` on an adopted channel that declares no `availableTags` (it relies on the tags already on Discord; the deploy fails if there are none). -- `position` is applied on creation only. Discord renumbers positions whenever channels move, so it is not checked or re-applied afterwards; reorder channels in Discord. -- Settings changed by hand in Discord show up as drift on refresh and are reverted by the next deploy (`make up` runs `pulumi up --refresh`). Channel creates and updates carry `X-Audit-Log-Reason: modelcontextprotocol/access deploy`, so the guild's audit log shows where a change came from. - -## Cloudflare Access (security-room) - -[securityroom.modelcontextprotocol.io](https://securityroom.modelcontextprotocol.io) is protected by Cloudflare Zero Trust Access with GitHub as the identity provider. The reusable Access policy `Maintainers` that grants sign-in is managed from this repo by [`src/cloudflare.ts`](src/cloudflare.ts), driven by [`src/config/accessPolicies.ts`](src/config/accessPolicies.ts): - -- Each entry in `ACCESS_POLICIES` lists the roles (from `roles.ts`) whose GitHub team may sign in. Pulumi renders one `github-organization` include rule per team on the policy. Nothing else about the Access application (domain, identity providers, session settings) is managed here. -- **Cloudflare matches direct team membership only.** A member of `python-sdk` does not satisfy a rule for its parent team `sdk-maintainers`. That is why the policy allows the `security-team` team (the `SECURITY_TEAM` role: the MCP Security Team of SDK security leads, which has no parent team and grants no repository permissions) alongside `core-maintainers`, `lead-maintainers` and `security-managers`. -- **To add someone to the MCP Security Team** (and grant sign-in): add `ROLE_IDS.SECURITY_TEAM` to their `memberOf` in [`src/config/users.ts`](src/config/users.ts). **To allow another team**: add its role to the policy's `roles` in `accessPolicies.ts` (validation checks the role exists and has a GitHub team). -- After access is granted, a user who was previously denied must revoke the "Cloudflare Access" OAuth app under their GitHub settings (Applications → Authorized OAuth Apps) and sign in again, otherwise Cloudflare keeps using the cached team list from their earlier login. - -### One-time setup - -1. In the Cloudflare dashboard for the **MCP Domain Account**, create a token dedicated to Access policy role management. Give it a descriptive name so it does not read as a generic API token, e.g. `mcp-access: Access policy role management`, and scope it to only **Account → Access: Apps and Policies → Edit** on the MCP Domain Account. Do not reuse this token for anything else. -2. Add it as the GitHub Actions secret `CLOUDFLARE_ROLE_MANAGEMENT_TOKEN` in the `production` environment (repository settings → Environments). The deploy workflow passes it to Pulumi as `cloudflare:roleManagementToken`. Deploy stops if it is missing, because Pulumi would delete the policies it manages. -3. The account ID and GitHub identity-provider ID are non-secret and live in [`Pulumi.prod.yaml`](Pulumi.prod.yaml). -4. **Adopting the existing policy.** Pulumi's `import` resource option only succeeds when the program's inputs match the live resource, so adoption is two deploys: - - With `cloudflare:importExistingPolicies: "true"` in `Pulumi.prod.yaml`, the first deploy imports the existing `Maintainers` policy (by its `cloudflarePolicyId`) as-is, ignoring its rule lists. - - Then set the flag to `"false"` in a follow-up PR; its preview shows exactly the include-rule changes that the next deploy applies. Leave the flag off from then on. - -## GitHub sign-in for Google Workspace - -Cloudflare Access acts as the SAML identity provider for Google Workspace. The `workspace-sso` GitHub team's direct membership and the numeric GitHub ID → Workspace email mapping both come from `users.ts`. To enable someone, confirm their `githubUserId` and add `ROLE_IDS.WORKSPACE_SSO` in a reviewed PR. They also need a current Google provisioning role. CI verifies each enabled ID against the configured GitHub login. - -Use a modern Google Workspace SAML profile and keep legacy SSO disabled. Configure the profile with the Cloudflare Access SSO URL, entity ID and signing certificate. Set `cloudflare:googleSamlEntityId` and `cloudflare:googleSamlAcsUrl` together using the values from that profile. With both values unset, the app uses placeholders under the reserved `.invalid` domain. The Access edit token can change which Workspace identity Cloudflare signs. - -Pulumi creates the `/Model Context Protocol/GitHub SSO` organizational unit and moves every member with the Workspace SSO role into it, including `existingGWSUser` accounts. Removing the role moves the account back to the OU it came from. If an admin moves a member's account out of the OU by hand, the next deploy moves it back in. A Workspace admin assigns the SAML profile to that OU in the Admin console. Removing the assignment is the rollback. - -For accounts in that OU, confirm that post-SSO verification applies, 2-Step Verification is enforced, and each user is enrolled. Keep Workspace admin accounts out of the OU. - -**Offboarding:** suspend the Workspace account, reset its sign-in cookies and revoke OAuth grants and app passwords as applicable. Revoke the user's Cloudflare Access sessions, remove the Workspace SSO role in `users.ts`, and deploy. The Access app and policy each use one hour. Cloudflare can reuse stored GitHub membership until the global session expires (check the tenant setting), and Google manages its own sessions. - -## npm & PyPI Package Publishing Access - -Publishing access to the `modelcontextprotocol` npm organization and to the MCP PyPI projects is **config-as-code with human-applied changes** — deliberately outside the Pulumi resource graph: - -- **npm** has an official management API ([api-docs.npmjs.com](https://api-docs.npmjs.com/)), but since August 2026 every governance mutation (org/team membership, maintainer add/remove, trusted-publisher config, token management) requires an **interactive 2FA challenge** — tokens, even with "bypass 2FA", get `403`. Reads still work headless with a granular access token, so drift is detected automatically and remediated manually. -- **PyPI** has **no management API at all**: collaborators, trusted publishers, and organizations are web-UI only, and maintainer invites must be accepted by email. The PyPI section of the config is declared state for audit purposes plus the manual procedures below. - -What lives where: - -- [`src/config/packageAccess.ts`](src/config/packageAccess.ts) — expected npm org membership (derived from members' `npm` field in `users.ts`), per-package maintainers and trusted publishers for the key packages, a default policy for the rest of the org's packages, and declared PyPI project rosters. -- [`scripts/check-package-drift.ts`](scripts/check-package-drift.ts) — read-only npm drift check: `NPM_TOKEN= npm run check-package-drift`. Prints a drift report and a remediation plan of `npm` CLI commands; exits nonzero on drift, and skips gracefully when `NPM_TOKEN` is unset. -- [`.github/workflows/package-drift.yml`](.github/workflows/package-drift.yml) — runs the check weekly and on demand, using the optional `NPM_READ_TOKEN` secret (a read-only npm granular access token with organization read access; note write-capable npm tokens expire after at most 90 days, so keep this one read-only). +- 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. +- Entries without `settings` are for repositories that already existed, and only their access is managed. To manage one fully, run `pulumi import` before you add `settings`, or the deploy fails. +- Don't rename an entry in place, because that archives the old repository and creates a new one. [`repoAccess.ts`](src/config/repoAccess.ts) has the steps. +- A repository that was archived by hand stays archived. -### Applying npm changes (runbook) +## How GitHub access works -1. Edit `src/config/packageAccess.ts` / `users.ts` to the desired state and merge the PR. -2. Run the drift check locally with a read-only token: `NPM_TOKEN= npm run check-package-drift`. -3. Review the printed remediation plan — especially any removal commands. -4. As an npm org owner, execute the plan in **one interactive session**: log in with `npm login`, trigger a 2FA prompt (e.g. run the first command), and choose **"Don't ask again for 5 minutes"** on the npmjs.com challenge. npm's own bulk guidance is to script the commands with a `sleep 2` between calls — roughly 80 operations fit in one approval window. -5. Re-run the drift check to confirm it exits clean. +People get access through teams. These rules explain most of what you'll see: -### PyPI procedures (manual, web UI only) +- **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 the archived `docs`. +- **Working and interest groups inherit nothing from `steering-committee`.** A group has its own grants and those of its group parent. `working-groups` and `interest-groups` have `push` on the archived `docs`. +- **Some teams must not have a parent**, so that they can't inherit access. Comments in [`roles.ts`](src/config/roles.ts) mark them. +- **`servers` lists its teams one by one.** It has no `steering-committee` grant, because that would reach every SDK team. +- **`security-ig` has an old `admin` grant on `docs`.** No other repository grants it access. +- **Grants to one person** (`users` in `repoAccess.ts`) are exceptions. Prefer a team. -- **Add a maintainer**: Manage project → Collaborators → invite by PyPI username with the Maintainer (upload only) or Owner role. The invitee must accept the invitation email before the role takes effect. Afterwards, record the account in `packageAccess.ts` and on the member's `pypi` field. -- **Trusted publisher**: Manage project → Publishing → add the GitHub repository + workflow (multiple publishers per project are allowed). Prefer trusted publishing over project-scoped API tokens. -- **Recommended follow-up**: apply for a free [PyPI community organization](https://docs.pypi.org/organization-accounts/) so projects are org-owned and access is managed via teams rather than per-project role edits. -- **Naming constraint**: the PyPI project name `modelcontextprotocol` is registered by an unrelated third party, so MCP's Python packages live under `mcp*` names. Any future consolidation under that name would require a [PEP 541](https://peps.python.org/pep-0541/) name-transfer request or simply keeping the `mcp*` naming. +`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. -## Deployment +### Contributor ladder -### Production Deployment (Automated) +The [contributor ladder](https://modelcontextprotocol.io/community/contributor-ladder) defines project roles. Access here comes from teams, so a rank on the ladder doesn't grant anything by itself. -**Note:** Production deployment is automatically handled by GitHub Actions. All merges to the `main` branch trigger an automatic deployment via [the configured GitHub Actions workflow](.github/workflows/deploy.yml). +| 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. | -### Manual Deployment - -Pre-requisites: - -- [Pulumi CLI installed](https://www.pulumi.com/docs/iac/download-install/) -- [Google Cloud SDK installed](https://cloud.google.com/sdk/docs/install) -- Access to GCP project and GCS bucket -- Required credentials and secrets - -1. Authenticate with GCP: `gcloud auth application-default login` -2. Get the passphrase file `passphrase.prod.txt` from the maintainers -3. Export `GITHUB_TOKEN` with a token that has the permissions of the [deploy GitHub App](#deploy-github-app). The organization rejects classic personal access tokens. - Also set the `discord:*`, `githubBillingEmail` and `cloudflare:roleManagementToken` config values as [`deploy.yml`](.github/workflows/deploy.yml) does. **Without the Discord and Cloudflare values, `make up` deletes the resources they manage.** -4. Preview changes: `make preview` -5. Deploy changes: `make up` - -## Key Management - -### Deploy GitHub App - -CI authenticates to GitHub as the `mcp-access-deploy` GitHub App, owned by the organization and installed on **all repositories**. Each workflow run mints an installation token that expires after one hour and is revoked when the job ends. Deploy uses the full permissions below; Preview requests a token that can only read organization roles. - -| Scope | Permission | Access | -| ------------ | ------------------------- | ---------- | -| Repository | Administration | Read/write | -| Repository | Metadata | Read | -| Repository | Pages | Read | -| Organization | Administration | Read/write | -| Organization | Members | Read/write | -| Organization | Custom organization roles | Read | - -The App deliberately has no `Contents` permission. GitHub hides merge-related repository settings from tokens without it, so repositories with a `settings` block may show repeated changes to those settings. Creating a repository from a `template` also needs `Contents` read, so it does not work with the current permissions. - -The private key is equivalent to organization admin. Store it as an environment secret, never as a variable. To rotate: generate a new key in the App settings, run the command below, then delete the old key and the local file. - -```bash -gh secret set DEPLOY_APP_PRIVATE_KEY --env production -R modelcontextprotocol/access < key.pem -``` - -Preview runs in the `preview` environment and reads `DEPLOY_APP_CLIENT_ID` and `DEPLOY_APP_PRIVATE_KEY` from there. That environment accepts pull request branches, so give it the credentials of a separate App that has only **Metadata: read** and **Custom organization roles: read**, not the deploy App's. The token Preview requests is limited to those two permissions, but the private key behind it is not. - -Do not use a refresh (`make refresh`, `pulumi preview --refresh`) as a read-only check: the Discord member sync corrects role drift during `read()`, so any refresh can change live Discord roles. - -### Required GitHub Secrets (for CI/CD) - -The workflows run in two GitHub environments (repository settings → Environments): - -| Environment | Used by | Deployment branches | -| ------------ | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -| `production` | [`deploy.yml`](.github/workflows/deploy.yml) on `main` | `main` only | -| `preview` | [`preview.yml`](.github/workflows/preview.yml) on pull requests | No restriction. Pull request runs use `refs/pull//merge`, which a `main`-only rule rejects. | - -A secret or variable stored in an environment is visible only to jobs that declare that environment. One stored at repository level is visible to both. Anyone who can push a branch to this repository can run a workflow in `preview`, so keep the deploy App's private key out of it. - -The following secrets must be configured as secrets of the `production` environment, not at repository level, for automated deployments. Deploy stops before changing anything if one is missing. Preview reads the same names from the `preview` environment: it skips the Pulumi preview when none of them are there and fails when only some are. Add required reviewers to `preview` before adding any of these values to it. The App credentials are the exception: each environment holds those of its own App. - -- **`DEPLOY_APP_PRIVATE_KEY`** (secret, set in each environment): private key of the deploy GitHub App in `production`, and of the read-only preview App in `preview` - -- **`DEPLOY_APP_CLIENT_ID`** (a **variable**, not a secret, set in each environment): client ID of the App whose private key that environment holds - -- **`ORG_BILLING_EMAIL`**, **`DISCORD_BOT_TOKEN`**, **`DISCORD_GUILD_ID`**: passed to Pulumi config by the workflows - -- **`GCP_PROD_SERVICE_ACCOUNT_KEY`**: GCP service account key - - Used to authenticate with Google Cloud Storage for Pulumi state (`gs://mcp-access-prod-pulumi-state`) - - Should be a JSON key file for a service account with Storage Admin permissions - - See "Setting Up GCS Backend" below for setup instructions - -- **`PULUMI_PROD_PASSPHRASE`**: Passphrase for encrypting Pulumi state - - Used to decrypt encrypted values in Pulumi stack configuration - - Keep this secure - if lost, you cannot decrypt your Pulumi state - -- **`CLOUDFLARE_ROLE_MANAGEMENT_TOKEN`** (`production` environment): Cloudflare token dedicated to Access policy role management, scoped only to **Account → Access: Apps and Policies → Edit** on the MCP Domain Account (not a general-purpose API token) - - Used to manage the Cloudflare Access policy for `securityroom.modelcontextprotocol.io` (see [Cloudflare Access (security-room)](#cloudflare-access-security-room)) and the Google Workspace sign-in application (see [GitHub sign-in for Google Workspace](#github-sign-in-for-google-workspace)) - -## Initial Setup - -If setting up this infrastructure for the first time: - -### 1. Set Up Service Account - -```bash -# Create project and enable APIs -gcloud projects create mcp-access-prod -gcloud config set project mcp-access-prod -gcloud services enable storage.googleapis.com -gcloud services enable admin.googleapis.com -gcloud services enable groupssettings.googleapis.com - -# Create service account -gcloud iam service-accounts create pulumi-svc \ - --display-name="MCP Access Management Service Account" \ - --description="Service account for Pulumi state and Google Workspace management" - -# Grant storage admin permissions (for Pulumi state) -gcloud projects add-iam-policy-binding mcp-access-prod \ - --member="serviceAccount:pulumi-svc@mcp-access-prod.iam.gserviceaccount.com" \ - --role="roles/storage.admin" - -# Create key -gcloud iam service-accounts keys create sa-key.json \ - --iam-account=pulumi-svc@mcp-access-prod.iam.gserviceaccount.com - -# Create GCS bucket for Pulumi state -gsutil mb gs://mcp-access-prod-pulumi-state -``` - -Then: - -1. In Google Workspace Admin Console, go to **Account** → **Admin roles** -2. Select **Groups Admin** role (or create a custom role with these privileges): - - Read, create, update, and delete groups - - Read and update group members -3. Click **Assign service accounts** -4. Add your service account email: `pulumi-svc@mcp-access-prod.iam.gserviceaccount.com` - -### 2. Initialize Pulumi Stack - -```bash -# Login to Pulumi backend (GCS) -pulumi login gs://mcp-access-prod-pulumi-state - -# Create production stack -export PULUMI_CONFIG_PASSPHRASE_FILE=passphrase.prod.txt -pulumi stack init prod - -# Configure application secrets in Pulumi -pulumi config set --secret googleworkspace:credentials "$(cat sa-key.json)" -``` +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. -### 3. Configure GitHub Actions Secrets +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` and `csharp-sdk-admin`. -Add the CI/CD secrets to the `production` environment (repository settings → Environments): +## Guides -- `GCP_PROD_SERVICE_ACCOUNT_KEY`: Content of `sa-key.json` -- `PULUMI_PROD_PASSPHRASE`: The passphrase you set above -- `ORG_BILLING_EMAIL`, `DISCORD_BOT_TOKEN`, `DISCORD_GUILD_ID` and `CLOUDFLARE_ROLE_MANAGEMENT_TOKEN`: see [Required GitHub Secrets](#required-github-secrets-for-cicd) -- `DEPLOY_APP_CLIENT_ID` and `DEPLOY_APP_PRIVATE_KEY` (in the `production` and `preview` environments, not at repository level): see [Deploy GitHub App](#deploy-github-app) +- [Discord channels](docs/discord.md) +- [Security room sign-in (Cloudflare Access)](docs/cloudflare-access.md) +- [GitHub sign-in for Google Workspace](docs/workspace-sso.md) +- [Package publishing (npm and PyPI)](docs/packages.md) +- [Deployment, secrets and keys](docs/deployment.md) +- [First-time setup](docs/setup.md) diff --git a/docs/cloudflare-access.md b/docs/cloudflare-access.md new file mode 100644 index 00000000..45698dcc --- /dev/null +++ b/docs/cloudflare-access.md @@ -0,0 +1,24 @@ +# Security room sign-in + +[securityroom.modelcontextprotocol.io](https://securityroom.modelcontextprotocol.io) is behind Cloudflare Access, which signs people in with GitHub. [`accessPolicies.ts`](../src/config/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`](../src/config/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. + +## One-time setup + +1. In the **MCP Domain Account** on Cloudflare, create a token with only **Account > Access: Apps and Policies > Edit**. Name it for this purpose, such as `mcp-access: Access policy role management`, and don't use it for anything else. +2. Save it as `CLOUDFLARE_ROLE_MANAGEMENT_TOKEN` in the `production` environment. The deploy stops if it's missing, because Pulumi would otherwise delete the policies. +3. The account ID and identity provider ID aren't secret. They're in [`Pulumi.prod.yaml`](../Pulumi.prod.yaml). + +Adopting a policy that already exists takes two deploys: + +1. Deploy with `cloudflare:importExistingPolicies: "true"` in `Pulumi.prod.yaml`. This imports the policy as it is, using its `cloudflarePolicyId`. +2. Set the value back to `"false"` in a second pull request. That deploy applies the rules in the config. Leave it off afterwards. diff --git a/docs/deployment.md b/docs/deployment.md new file mode 100644 index 00000000..d1c63e28 --- /dev/null +++ b/docs/deployment.md @@ -0,0 +1,64 @@ +# Deployment, secrets and keys + +Every merge to `main` runs the [Deploy workflow](../.github/workflows/deploy.yml). You can also start it by hand on `main`. + +## Deploy from your machine + +You need the [Pulumi CLI](https://www.pulumi.com/docs/iac/download-install/), the [Google Cloud SDK](https://cloud.google.com/sdk/docs/install), 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](#deploy-app). The organization rejects classic personal access tokens. +4. Set the `discord:*`, `githubBillingEmail` and `cloudflare:roleManagementToken` config values the way [`deploy.yml`](../.github/workflows/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`](../.github/workflows/deploy.yml) | `main` only | +| `preview` | [`preview.yml`](../.github/workflows/preview.yml) on pull requests | No restriction | + +Pull requests run on `refs/pull//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](cloudflare-access.md#one-time-setup) | + +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. + +```bash +gh secret set DEPLOY_APP_PRIVATE_KEY --env production -R modelcontextprotocol/access < key.pem +``` diff --git a/docs/discord.md b/docs/discord.md new file mode 100644 index 00000000..81c2b33e --- /dev/null +++ b/docs/discord.md @@ -0,0 +1,51 @@ +# Discord + +The deploy gives people the Discord roles of their groups, if their entry in [`users.ts`](../src/config/users.ts) has a Discord ID. It also manages the channels listed in [`channels.ts`](../src/config/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. + +```ts +// 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`](../src/config/roles.ts) or `DISCORD_EVERYONE_ROLE`, and the permissions to allow and deny. Only permissions listed in [`discordPermissions.ts`](../src/config/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. diff --git a/docs/packages.md b/docs/packages.md new file mode 100644 index 00000000..9419c64b --- /dev/null +++ b/docs/packages.md @@ -0,0 +1,22 @@ +# Package publishing + +[`packageAccess.ts`](../src/config/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](../.github/workflows/package-drift.yml) 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`](../src/config/users.ts). + +## Change npm access + +1. Merge the change to `packageAccess.ts` or `users.ts`. +2. Run `NPM_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. + +The PyPI name `modelcontextprotocol` belongs to someone unrelated to the project, so MCP packages use names that start with `mcp`. Taking over the name would need a [PEP 541](https://peps.python.org/pep-0541/) request. Moving the projects to a free [PyPI community organization](https://docs.pypi.org/organization-accounts/) would let teams manage access to them. diff --git a/docs/setup.md b/docs/setup.md new file mode 100644 index 00000000..ca3eca27 --- /dev/null +++ b/docs/setup.md @@ -0,0 +1,48 @@ +# First-time setup + +These steps were done once, when the project was set up. + +## 1. Service account + +```bash +# Create the project and enable the APIs +gcloud projects create mcp-access-prod +gcloud config set project mcp-access-prod +gcloud services enable storage.googleapis.com +gcloud services enable admin.googleapis.com +gcloud services enable groupssettings.googleapis.com + +# Create the service account +gcloud iam service-accounts create pulumi-svc \ + --display-name="MCP Access Management Service Account" \ + --description="Service account for Pulumi state and Google Workspace management" + +# Let it manage the Pulumi state +gcloud projects add-iam-policy-binding mcp-access-prod \ + --member="serviceAccount:pulumi-svc@mcp-access-prod.iam.gserviceaccount.com" \ + --role="roles/storage.admin" + +# Create a key +gcloud iam service-accounts keys create sa-key.json \ + --iam-account=pulumi-svc@mcp-access-prod.iam.gserviceaccount.com + +# Create the bucket for the Pulumi state +gsutil mb gs://mcp-access-prod-pulumi-state +``` + +In the Google Workspace Admin console, open **Account > Admin roles**. Choose **Groups Admin**, or a custom role that can read, create, update and delete groups and read and update their members. Click **Assign service accounts** and add `pulumi-svc@mcp-access-prod.iam.gserviceaccount.com`. + +## 2. Pulumi stack + +```bash +pulumi login gs://mcp-access-prod-pulumi-state + +export PULUMI_CONFIG_PASSPHRASE_FILE=passphrase.prod.txt +pulumi stack init prod + +pulumi config set --secret googleworkspace:credentials "$(cat sa-key.json)" +``` + +## 3. GitHub secrets + +Add the values listed in [Environments and secrets](deployment.md#environments-and-secrets) to the `production` environment. `GCP_PROD_SERVICE_ACCOUNT_KEY` is the content of `sa-key.json`, and `PULUMI_PROD_PASSPHRASE` is the passphrase from step 2. Delete `sa-key.json` afterwards. diff --git a/docs/workspace-sso.md b/docs/workspace-sso.md new file mode 100644 index 00000000..44435981 --- /dev/null +++ b/docs/workspace-sso.md @@ -0,0 +1,33 @@ +# GitHub sign-in for Google Workspace + +Some 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`](../src/config/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. + +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. diff --git a/scripts/check-package-drift.ts b/scripts/check-package-drift.ts index ddead76a..20da9959 100644 --- a/scripts/check-package-drift.ts +++ b/scripts/check-package-drift.ts @@ -4,8 +4,8 @@ * Compares live npm registry state against the expected state declared in * src/config/packageAccess.ts and prints a drift report plus a remediation * plan of npm CLI commands for a maintainer to run in a single interactive - * 2FA-authenticated session (see "npm & PyPI Package Publishing Access" in - * the README). + * 2FA-authenticated session (see + * docs/packages.md). * * Read-only: this script never mutates anything. All npm write operations * require an interactive 2FA challenge (since August 2026), which is why the @@ -299,7 +299,7 @@ async function main(): Promise { console.log('# Review, then run in ONE interactive npm session (logged in as an org owner).'); console.log('# Approve a 2FA challenge on npmjs.com and choose "Don\'t ask again for 5 minutes"'); console.log('# to batch these; add `sleep 2` between commands in longer batches.'); - console.log('# See "npm & PyPI Package Publishing Access" in the README.\n'); + console.log('# See docs/packages.md.\n'); for (const drift of drifts) { for (const command of drift.commands) console.log(command); } diff --git a/src/cloudflare.ts b/src/cloudflare.ts index 57771ee1..5f1f2876 100644 --- a/src/cloudflare.ts +++ b/src/cloudflare.ts @@ -32,7 +32,7 @@ if (CLOUDFLARE_ENABLED) { // resource, so adopting an existing policy is a two-step process: // 1. importExistingPolicies=true: adopt the policy as-is (rule fields ignored) // 2. importExistingPolicies=false (or unset): manage the rules from config - // See README "Cloudflare Access (security-room)". + // See docs/cloudflare-access.md. const importExisting = config.getBoolean('importExistingPolicies') ?? false; const provider = new cloudflare.Provider('cloudflare', { diff --git a/src/config/accessPolicies.ts b/src/config/accessPolicies.ts index 0585a311..983feea1 100644 --- a/src/config/accessPolicies.ts +++ b/src/config/accessPolicies.ts @@ -24,8 +24,8 @@ export interface AccessPolicy { /** * ID of the reusable policy that already exists in Cloudflare. When set, and the * `cloudflare:importExistingPolicies` stack config is true, Pulumi adopts this - * policy instead of creating a new one. See the README section - * "Cloudflare Access (security-room)". + * policy instead of creating a new one. See + * docs/cloudflare-access.md. */ cloudflarePolicyId?: string; /** Roles whose GitHub team may sign in. Order is preserved in the include rules. */ diff --git a/src/config/packageAccess.ts b/src/config/packageAccess.ts index 3912d3fc..a0c3a7af 100644 --- a/src/config/packageAccess.ts +++ b/src/config/packageAccess.ts @@ -10,7 +10,7 @@ // Read endpoints still work with a granular access token, so drift is // *detected* by scripts/check-package-drift.ts (run weekly by // .github/workflows/package-drift.yml) and *applied* by a human following -// the runbook in the README ("npm & PyPI Package Publishing Access"). +// docs/packages.md. // - PyPI: there is no management API at all (collaborators, trusted // publishers and organizations are web-UI only), so the PyPI section below // is declared state for audit plus a manual runbook — nothing is automated. diff --git a/src/config/repoAccess.ts b/src/config/repoAccess.ts index 28e3007e..959e1c38 100644 --- a/src/config/repoAccess.ts +++ b/src/config/repoAccess.ts @@ -9,7 +9,7 @@ // collaborators — so a new repository and its access land in one deploy. // // To create a new repository (e.g. for a working group), add a managed entry. -// See README.md "Creating a new repository". +// See README.md "Create a repository". export type RepositoryPermission = 'pull' | 'triage' | 'push' | 'maintain' | 'admin'; diff --git a/src/config/workspaceSso.ts b/src/config/workspaceSso.ts index 8a202cb5..81e1ff93 100644 --- a/src/config/workspaceSso.ts +++ b/src/config/workspaceSso.ts @@ -1,5 +1,5 @@ // GitHub sign-in for Google Workspace via a Cloudflare Access SAML app (src/cloudflare.ts). -// See README "GitHub sign-in for Google Workspace". +// See docs/workspace-sso.md. import { GITHUB_ORG } from './accessPolicies'; import { ROLE_IDS } from './roleIds'; import { buildRoleLookup } from './roles'; diff --git a/src/google.ts b/src/google.ts index da00dfda..a15a9a59 100644 --- a/src/google.ts +++ b/src/google.ts @@ -81,7 +81,7 @@ const mcpOrgUnit = new gworkspace.OrgUnit( // Workspace SSO members are moved here by WorkspaceUserOrgUnit below. A Workspace admin // assigns the Google SAML profile to this OU in the Admin console (not managed here); // removing that assignment is the rollback. -// See README "GitHub sign-in for Google Workspace". +// See docs/workspace-sso.md. const workspaceSsoOrgUnit = new gworkspace.OrgUnit( 'workspace-sso-org-unit', { From 4f17c23c7c4fe5a82f99a49118826617499377cc Mon Sep 17 00:00:00 2001 From: Den <53200638+localden@users.noreply.github.com> Date: Tue, 1 Dec 2026 20:06:59 +0000 Subject: [PATCH 3/7] Describe signing in to Workspace with GitHub --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0dc51ea8..857cc8ac 100644 --- a/README.md +++ b/README.md @@ -43,15 +43,17 @@ Someone new to the organization gets an invitation by email and has no access un ### Get an @modelcontextprotocol.io account -Maintainers, SDK maintainers and working group members can have one. Add these fields to your entry in [`users.ts`](src/config/users.ts): +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`](src/config/users.ts), and add the sign-in role to your `memberOf`: ```ts +githubUserId: 12345678, // the "id" at https://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, ask an admin for your first password. Admins find it with `pulumi stack output --show-secrets newGWSUserPasswords`. +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 with a password, add `githubUserId` and `ROLE_IDS.WORKSPACE_SSO` to switch. Workspace admins keep their passwords. See [GitHub sign-in for Google Workspace](docs/workspace-sso.md). ### Create a repository From d4181609a6116c9d99f2d0ccb2a22d29e6b939ce Mon Sep 17 00:00:00 2001 From: Den <53200638+localden@users.noreply.github.com> Date: Tue, 1 Dec 2026 20:10:50 +0000 Subject: [PATCH 4/7] Describe the move to GitHub sign-in --- docs/workspace-sso.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/workspace-sso.md b/docs/workspace-sso.md index 44435981..c7b4c454 100644 --- a/docs/workspace-sso.md +++ b/docs/workspace-sso.md @@ -1,6 +1,6 @@ # GitHub sign-in for Google Workspace -Some people sign in to their `@modelcontextprotocol.io` account with GitHub. Cloudflare Access is the SAML identity provider. +`@modelcontextprotocol.io` accounts are moving to GitHub sign-in, with Cloudflare Access as the SAML identity provider. New accounts should use it from the start. Accounts that haven't moved yet still use a password. ## Enable someone From c676b46cb851304b55d3e42b029e0fb3a9b715b4 Mon Sep 17 00:00:00 2001 From: Den <53200638+localden@users.noreply.github.com> Date: Tue, 1 Dec 2026 20:11:08 +0000 Subject: [PATCH 5/7] Show the admin account rule as a warning --- docs/workspace-sso.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/workspace-sso.md b/docs/workspace-sso.md index c7b4c454..37687b05 100644 --- a/docs/workspace-sso.md +++ b/docs/workspace-sso.md @@ -11,7 +11,8 @@ In a reviewed pull request, change their entry in [`users.ts`](../src/config/use 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. -Keep Workspace admin accounts out of this unit. +> [!CAUTION] +> Keep Workspace admin accounts out of this unit. ## Configure Google From 4ea1ace2e412e3bb700402b7dffef5583e13dd5e Mon Sep 17 00:00:00 2001 From: Den <53200638+localden@users.noreply.github.com> Date: Tue, 1 Dec 2026 20:11:41 +0000 Subject: [PATCH 6/7] Fold the guides into the README --- .github/workflows/preview.yml | 2 +- Pulumi.prod.yaml | 4 +- README.md | 269 +++++++++++++++++++++++++++++++-- docs/cloudflare-access.md | 24 --- docs/deployment.md | 64 -------- docs/discord.md | 51 ------- docs/packages.md | 22 --- docs/setup.md | 48 ------ docs/workspace-sso.md | 34 ----- scripts/check-package-drift.ts | 5 +- src/cloudflare.ts | 2 +- src/config/accessPolicies.ts | 2 +- src/config/packageAccess.ts | 2 +- src/config/workspaceSso.ts | 2 +- src/google.ts | 2 +- 15 files changed, 270 insertions(+), 263 deletions(-) delete mode 100644 docs/cloudflare-access.md delete mode 100644 docs/deployment.md delete mode 100644 docs/discord.md delete mode 100644 docs/packages.md delete mode 100644 docs/setup.md delete mode 100644 docs/workspace-sso.md diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 4d94de83..8109fc8d 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -20,7 +20,7 @@ jobs: if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' # `production` only deploys from main, so it rejects pull request refs. # `preview` accepts them and holds its own credentials. See - # docs/deployment.md. + # README.md "Deployment, secrets and keys". environment: preview steps: - name: Checkout code diff --git a/Pulumi.prod.yaml b/Pulumi.prod.yaml index 2a7ee6ba..3c3db6ec 100644 --- a/Pulumi.prod.yaml +++ b/Pulumi.prod.yaml @@ -4,14 +4,14 @@ config: googleworkspace:credentials: secure: v1:Ntr2su0kgwp0oAh3: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 github:owner: modelcontextprotocol - # Cloudflare Access (see docs/cloudflare-access.md). + # Cloudflare Access (see README.md "Security room sign-in"). # cloudflare:roleManagementToken is set by the deploy workflow from the CLOUDFLARE_ROLE_MANAGEMENT_TOKEN secret. cloudflare:accountId: c39d6379ccfdb20a3627eeddffa80ec9 cloudflare:githubIdentityProviderId: 1e53bc11-a504-4572-92d1-4c8d56fc198b # The dashboard-created policy was adopted by the first deploy of #195 and is now # managed from config. Leave this "false" so deploys apply the declared rules. cloudflare:importExistingPolicies: "false" - # GitHub sign-in for Google Workspace (see docs/workspace-sso.md): SP values from the modern + # GitHub sign-in for Google Workspace (see README.md "GitHub sign-in for Google Workspace"): SP values from the modern # Google SAML profile. Legacy SSO stays disabled. cloudflare:googleSamlEntityId: https://accounts.google.com/samlrp/035ezb1t4kdf8xs cloudflare:googleSamlAcsUrl: https://accounts.google.com/samlrp/035ezb1t4kdf8xs/acs diff --git a/README.md b/README.md index 857cc8ac..41212664 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,17 @@ 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](https://www.pulumi.com/) when a change merges to `main`. +- [Where things are](#where-things-are) +- [Make a change](#make-a-change) +- [Common tasks](#common-tasks) +- [How GitHub access works](#how-github-access-works) +- [Discord](#discord) +- [Security room sign-in](#security-room-sign-in) +- [GitHub sign-in for Google Workspace](#github-sign-in-for-google-workspace) +- [Package publishing](#package-publishing) +- [Deployment, secrets and keys](#deployment-secrets-and-keys) +- [First-time setup](#first-time-setup) + ## Where things are | To change | Edit | @@ -15,7 +26,7 @@ This repository decides who has access to what in the MCP project: GitHub, Googl | Who can sign in to the security room | [`src/config/accessPolicies.ts`](src/config/accessPolicies.ts) | | Who publishes to npm and PyPI | [`src/config/packageAccess.ts`](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](docs/packages.md). +npm and PyPI are the exception to automatic deploys. Their expected access is recorded here, but a person applies it. See [Package publishing](#package-publishing). ## Make a change @@ -53,7 +64,7 @@ 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 with a password, add `githubUserId` and `ROLE_IDS.WORKSPACE_SSO` to switch. Workspace admins keep their passwords. See [GitHub sign-in for Google Workspace](docs/workspace-sso.md). +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 with a password, add `githubUserId` and `ROLE_IDS.WORKSPACE_SSO` to switch. Workspace admins keep their passwords. See [GitHub sign-in for Google Workspace](#github-sign-in-for-google-workspace). ### Create a repository @@ -112,11 +123,251 @@ Members need `push` on `modelcontextprotocol` because it only accepts pull reque 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` and `csharp-sdk-admin`. -## Guides +## Discord + +The deploy gives people the Discord roles of their groups, if their entry in [`users.ts`](src/config/users.ts) has a Discord ID. It also manages the channels listed in [`channels.ts`](src/config/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. + +```ts +// 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`](src/config/roles.ts) or `DISCORD_EVERYONE_ROLE`, and the permissions to allow and deny. Only permissions listed in [`discordPermissions.ts`](src/config/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](https://securityroom.modelcontextprotocol.io) is behind Cloudflare Access, which signs people in with GitHub. [`accessPolicies.ts`](src/config/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`](src/config/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. + +### One-time setup + +1. In the **MCP Domain Account** on Cloudflare, create a token with only **Account > Access: Apps and Policies > Edit**. Name it for this purpose, such as `mcp-access: Access policy role management`, and don't use it for anything else. +2. Save it as `CLOUDFLARE_ROLE_MANAGEMENT_TOKEN` in the `production` environment. The deploy stops if it's missing, because Pulumi would otherwise delete the policies. +3. The account ID and identity provider ID aren't secret. They're in [`Pulumi.prod.yaml`](Pulumi.prod.yaml). + +Adopting a policy that already exists takes two deploys: + +1. Deploy with `cloudflare:importExistingPolicies: "true"` in `Pulumi.prod.yaml`. This imports the policy as it is, using its `cloudflarePolicyId`. +2. Set the value back to `"false"` in a second pull request. That deploy applies the rules in the config. Leave it off afterwards. + +## GitHub sign-in for Google Workspace + +`@modelcontextprotocol.io` accounts are moving to GitHub sign-in, with Cloudflare Access as the SAML identity provider. New accounts should use it from the start. Accounts that haven't moved yet still use a password. + +### Enable someone + +In a reviewed pull request, change their entry in [`users.ts`](src/config/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`](src/config/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](.github/workflows/package-drift.yml) 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`](src/config/users.ts). + +### Change npm access + +1. Merge the change to `packageAccess.ts` or `users.ts`. +2. Run `NPM_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. + +The PyPI name `modelcontextprotocol` belongs to someone unrelated to the project, so MCP packages use names that start with `mcp`. Taking over the name would need a [PEP 541](https://peps.python.org/pep-0541/) request. Moving the projects to a free [PyPI community organization](https://docs.pypi.org/organization-accounts/) would let teams manage access to them. + +## Deployment, secrets and keys + +Every merge to `main` runs the [Deploy workflow](.github/workflows/deploy.yml). You can also start it by hand on `main`. + +### Deploy from your machine + +You need the [Pulumi CLI](https://www.pulumi.com/docs/iac/download-install/), the [Google Cloud SDK](https://cloud.google.com/sdk/docs/install), 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](#deploy-app). The organization rejects classic personal access tokens. +4. Set the `discord:*`, `githubBillingEmail` and `cloudflare:roleManagementToken` config values the way [`deploy.yml`](.github/workflows/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`](.github/workflows/deploy.yml) | `main` only | +| `preview` | [`preview.yml`](.github/workflows/preview.yml) on pull requests | No restriction | + +Pull requests run on `refs/pull//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](#one-time-setup) | + +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. + +```bash +gh secret set DEPLOY_APP_PRIVATE_KEY --env production -R modelcontextprotocol/access < key.pem +``` + +## First-time setup + +These steps were done once, when the project was set up. + +### 1. Service account + +```bash +# Create the project and enable the APIs +gcloud projects create mcp-access-prod +gcloud config set project mcp-access-prod +gcloud services enable storage.googleapis.com +gcloud services enable admin.googleapis.com +gcloud services enable groupssettings.googleapis.com + +# Create the service account +gcloud iam service-accounts create pulumi-svc \ + --display-name="MCP Access Management Service Account" \ + --description="Service account for Pulumi state and Google Workspace management" + +# Let it manage the Pulumi state +gcloud projects add-iam-policy-binding mcp-access-prod \ + --member="serviceAccount:pulumi-svc@mcp-access-prod.iam.gserviceaccount.com" \ + --role="roles/storage.admin" + +# Create a key +gcloud iam service-accounts keys create sa-key.json \ + --iam-account=pulumi-svc@mcp-access-prod.iam.gserviceaccount.com + +# Create the bucket for the Pulumi state +gsutil mb gs://mcp-access-prod-pulumi-state +``` + +In the Google Workspace Admin console, open **Account > Admin roles**. Choose **Groups Admin**, or a custom role that can read, create, update and delete groups and read and update their members. Click **Assign service accounts** and add `pulumi-svc@mcp-access-prod.iam.gserviceaccount.com`. + +### 2. Pulumi stack + +```bash +pulumi login gs://mcp-access-prod-pulumi-state + +export PULUMI_CONFIG_PASSPHRASE_FILE=passphrase.prod.txt +pulumi stack init prod + +pulumi config set --secret googleworkspace:credentials "$(cat sa-key.json)" +``` + +### 3. GitHub secrets -- [Discord channels](docs/discord.md) -- [Security room sign-in (Cloudflare Access)](docs/cloudflare-access.md) -- [GitHub sign-in for Google Workspace](docs/workspace-sso.md) -- [Package publishing (npm and PyPI)](docs/packages.md) -- [Deployment, secrets and keys](docs/deployment.md) -- [First-time setup](docs/setup.md) +Add the values listed in [Environments and secrets](#environments-and-secrets) to the `production` environment. `GCP_PROD_SERVICE_ACCOUNT_KEY` is the content of `sa-key.json`, and `PULUMI_PROD_PASSPHRASE` is the passphrase from step 2. Delete `sa-key.json` afterwards. diff --git a/docs/cloudflare-access.md b/docs/cloudflare-access.md deleted file mode 100644 index 45698dcc..00000000 --- a/docs/cloudflare-access.md +++ /dev/null @@ -1,24 +0,0 @@ -# Security room sign-in - -[securityroom.modelcontextprotocol.io](https://securityroom.modelcontextprotocol.io) is behind Cloudflare Access, which signs people in with GitHub. [`accessPolicies.ts`](../src/config/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`](../src/config/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. - -## One-time setup - -1. In the **MCP Domain Account** on Cloudflare, create a token with only **Account > Access: Apps and Policies > Edit**. Name it for this purpose, such as `mcp-access: Access policy role management`, and don't use it for anything else. -2. Save it as `CLOUDFLARE_ROLE_MANAGEMENT_TOKEN` in the `production` environment. The deploy stops if it's missing, because Pulumi would otherwise delete the policies. -3. The account ID and identity provider ID aren't secret. They're in [`Pulumi.prod.yaml`](../Pulumi.prod.yaml). - -Adopting a policy that already exists takes two deploys: - -1. Deploy with `cloudflare:importExistingPolicies: "true"` in `Pulumi.prod.yaml`. This imports the policy as it is, using its `cloudflarePolicyId`. -2. Set the value back to `"false"` in a second pull request. That deploy applies the rules in the config. Leave it off afterwards. diff --git a/docs/deployment.md b/docs/deployment.md deleted file mode 100644 index d1c63e28..00000000 --- a/docs/deployment.md +++ /dev/null @@ -1,64 +0,0 @@ -# Deployment, secrets and keys - -Every merge to `main` runs the [Deploy workflow](../.github/workflows/deploy.yml). You can also start it by hand on `main`. - -## Deploy from your machine - -You need the [Pulumi CLI](https://www.pulumi.com/docs/iac/download-install/), the [Google Cloud SDK](https://cloud.google.com/sdk/docs/install), 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](#deploy-app). The organization rejects classic personal access tokens. -4. Set the `discord:*`, `githubBillingEmail` and `cloudflare:roleManagementToken` config values the way [`deploy.yml`](../.github/workflows/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`](../.github/workflows/deploy.yml) | `main` only | -| `preview` | [`preview.yml`](../.github/workflows/preview.yml) on pull requests | No restriction | - -Pull requests run on `refs/pull//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](cloudflare-access.md#one-time-setup) | - -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. - -```bash -gh secret set DEPLOY_APP_PRIVATE_KEY --env production -R modelcontextprotocol/access < key.pem -``` diff --git a/docs/discord.md b/docs/discord.md deleted file mode 100644 index 81c2b33e..00000000 --- a/docs/discord.md +++ /dev/null @@ -1,51 +0,0 @@ -# Discord - -The deploy gives people the Discord roles of their groups, if their entry in [`users.ts`](../src/config/users.ts) has a Discord ID. It also manages the channels listed in [`channels.ts`](../src/config/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. - -```ts -// 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`](../src/config/roles.ts) or `DISCORD_EVERYONE_ROLE`, and the permissions to allow and deny. Only permissions listed in [`discordPermissions.ts`](../src/config/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. diff --git a/docs/packages.md b/docs/packages.md deleted file mode 100644 index 9419c64b..00000000 --- a/docs/packages.md +++ /dev/null @@ -1,22 +0,0 @@ -# Package publishing - -[`packageAccess.ts`](../src/config/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](../.github/workflows/package-drift.yml) 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`](../src/config/users.ts). - -## Change npm access - -1. Merge the change to `packageAccess.ts` or `users.ts`. -2. Run `NPM_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. - -The PyPI name `modelcontextprotocol` belongs to someone unrelated to the project, so MCP packages use names that start with `mcp`. Taking over the name would need a [PEP 541](https://peps.python.org/pep-0541/) request. Moving the projects to a free [PyPI community organization](https://docs.pypi.org/organization-accounts/) would let teams manage access to them. diff --git a/docs/setup.md b/docs/setup.md deleted file mode 100644 index ca3eca27..00000000 --- a/docs/setup.md +++ /dev/null @@ -1,48 +0,0 @@ -# First-time setup - -These steps were done once, when the project was set up. - -## 1. Service account - -```bash -# Create the project and enable the APIs -gcloud projects create mcp-access-prod -gcloud config set project mcp-access-prod -gcloud services enable storage.googleapis.com -gcloud services enable admin.googleapis.com -gcloud services enable groupssettings.googleapis.com - -# Create the service account -gcloud iam service-accounts create pulumi-svc \ - --display-name="MCP Access Management Service Account" \ - --description="Service account for Pulumi state and Google Workspace management" - -# Let it manage the Pulumi state -gcloud projects add-iam-policy-binding mcp-access-prod \ - --member="serviceAccount:pulumi-svc@mcp-access-prod.iam.gserviceaccount.com" \ - --role="roles/storage.admin" - -# Create a key -gcloud iam service-accounts keys create sa-key.json \ - --iam-account=pulumi-svc@mcp-access-prod.iam.gserviceaccount.com - -# Create the bucket for the Pulumi state -gsutil mb gs://mcp-access-prod-pulumi-state -``` - -In the Google Workspace Admin console, open **Account > Admin roles**. Choose **Groups Admin**, or a custom role that can read, create, update and delete groups and read and update their members. Click **Assign service accounts** and add `pulumi-svc@mcp-access-prod.iam.gserviceaccount.com`. - -## 2. Pulumi stack - -```bash -pulumi login gs://mcp-access-prod-pulumi-state - -export PULUMI_CONFIG_PASSPHRASE_FILE=passphrase.prod.txt -pulumi stack init prod - -pulumi config set --secret googleworkspace:credentials "$(cat sa-key.json)" -``` - -## 3. GitHub secrets - -Add the values listed in [Environments and secrets](deployment.md#environments-and-secrets) to the `production` environment. `GCP_PROD_SERVICE_ACCOUNT_KEY` is the content of `sa-key.json`, and `PULUMI_PROD_PASSPHRASE` is the passphrase from step 2. Delete `sa-key.json` afterwards. diff --git a/docs/workspace-sso.md b/docs/workspace-sso.md deleted file mode 100644 index 37687b05..00000000 --- a/docs/workspace-sso.md +++ /dev/null @@ -1,34 +0,0 @@ -# GitHub sign-in for Google Workspace - -`@modelcontextprotocol.io` accounts are moving to GitHub sign-in, with Cloudflare Access as the SAML identity provider. New accounts should use it from the start. Accounts that haven't moved yet still use a password. - -## Enable someone - -In a reviewed pull request, change their entry in [`users.ts`](../src/config/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. diff --git a/scripts/check-package-drift.ts b/scripts/check-package-drift.ts index 20da9959..ae3885b6 100644 --- a/scripts/check-package-drift.ts +++ b/scripts/check-package-drift.ts @@ -4,8 +4,7 @@ * Compares live npm registry state against the expected state declared in * src/config/packageAccess.ts and prints a drift report plus a remediation * plan of npm CLI commands for a maintainer to run in a single interactive - * 2FA-authenticated session (see - * docs/packages.md). + * 2FA-authenticated session (see README.md "Package publishing"). * * Read-only: this script never mutates anything. All npm write operations * require an interactive 2FA challenge (since August 2026), which is why the @@ -299,7 +298,7 @@ async function main(): Promise { console.log('# Review, then run in ONE interactive npm session (logged in as an org owner).'); console.log('# Approve a 2FA challenge on npmjs.com and choose "Don\'t ask again for 5 minutes"'); console.log('# to batch these; add `sleep 2` between commands in longer batches.'); - console.log('# See docs/packages.md.\n'); + console.log('# See README.md "Package publishing".\n'); for (const drift of drifts) { for (const command of drift.commands) console.log(command); } diff --git a/src/cloudflare.ts b/src/cloudflare.ts index 5f1f2876..906b8479 100644 --- a/src/cloudflare.ts +++ b/src/cloudflare.ts @@ -32,7 +32,7 @@ if (CLOUDFLARE_ENABLED) { // resource, so adopting an existing policy is a two-step process: // 1. importExistingPolicies=true: adopt the policy as-is (rule fields ignored) // 2. importExistingPolicies=false (or unset): manage the rules from config - // See docs/cloudflare-access.md. + // See README.md "Security room sign-in". const importExisting = config.getBoolean('importExistingPolicies') ?? false; const provider = new cloudflare.Provider('cloudflare', { diff --git a/src/config/accessPolicies.ts b/src/config/accessPolicies.ts index 983feea1..d045ea79 100644 --- a/src/config/accessPolicies.ts +++ b/src/config/accessPolicies.ts @@ -25,7 +25,7 @@ export interface AccessPolicy { * ID of the reusable policy that already exists in Cloudflare. When set, and the * `cloudflare:importExistingPolicies` stack config is true, Pulumi adopts this * policy instead of creating a new one. See - * docs/cloudflare-access.md. + * README.md "Security room sign-in". */ cloudflarePolicyId?: string; /** Roles whose GitHub team may sign in. Order is preserved in the include rules. */ diff --git a/src/config/packageAccess.ts b/src/config/packageAccess.ts index a0c3a7af..007ec038 100644 --- a/src/config/packageAccess.ts +++ b/src/config/packageAccess.ts @@ -10,7 +10,7 @@ // Read endpoints still work with a granular access token, so drift is // *detected* by scripts/check-package-drift.ts (run weekly by // .github/workflows/package-drift.yml) and *applied* by a human following -// docs/packages.md. +// README.md "Package publishing". // - PyPI: there is no management API at all (collaborators, trusted // publishers and organizations are web-UI only), so the PyPI section below // is declared state for audit plus a manual runbook — nothing is automated. diff --git a/src/config/workspaceSso.ts b/src/config/workspaceSso.ts index 81e1ff93..8e09ae84 100644 --- a/src/config/workspaceSso.ts +++ b/src/config/workspaceSso.ts @@ -1,5 +1,5 @@ // GitHub sign-in for Google Workspace via a Cloudflare Access SAML app (src/cloudflare.ts). -// See docs/workspace-sso.md. +// See README.md "GitHub sign-in for Google Workspace". import { GITHUB_ORG } from './accessPolicies'; import { ROLE_IDS } from './roleIds'; import { buildRoleLookup } from './roles'; diff --git a/src/google.ts b/src/google.ts index a15a9a59..e5d20d94 100644 --- a/src/google.ts +++ b/src/google.ts @@ -81,7 +81,7 @@ const mcpOrgUnit = new gworkspace.OrgUnit( // Workspace SSO members are moved here by WorkspaceUserOrgUnit below. A Workspace admin // assigns the Google SAML profile to this OU in the Admin console (not managed here); // removing that assignment is the rollback. -// See docs/workspace-sso.md. +// See README.md "GitHub sign-in for Google Workspace". const workspaceSsoOrgUnit = new gworkspace.OrgUnit( 'workspace-sso-org-unit', { From 9b62e509ce695295206443146bc081cfa9cc08a4 Mon Sep 17 00:00:00 2001 From: Den <53200638+localden@users.noreply.github.com> Date: Tue, 1 Dec 2026 20:12:32 +0000 Subject: [PATCH 7/7] Keep only administrator guidance in the README --- README.md | 78 +++++------------------------------- src/cloudflare.ts | 1 - src/config/accessPolicies.ts | 3 +- 3 files changed, 10 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index 41212664..8e9dd4bb 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ This repository decides who has access to what in the MCP project: GitHub, Googl - [GitHub sign-in for Google Workspace](#github-sign-in-for-google-workspace) - [Package publishing](#package-publishing) - [Deployment, secrets and keys](#deployment-secrets-and-keys) -- [First-time setup](#first-time-setup) ## Where things are @@ -64,7 +63,7 @@ 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 with a password, add `githubUserId` and `ROLE_IDS.WORKSPACE_SSO` to switch. Workspace admins keep their passwords. See [GitHub sign-in for Google Workspace](#github-sign-in-for-google-workspace). +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](#github-sign-in-for-google-workspace). ### Create a repository @@ -87,7 +86,7 @@ Organization members can't create repositories directly. Add an entry with `sett - 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. -- Entries without `settings` are for repositories that already existed, and only their access is managed. To manage one fully, run `pulumi import` before you add `settings`, or the deploy fails. +- 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`](src/config/repoAccess.ts) has the steps. - A repository that was archived by hand stays archived. @@ -96,11 +95,10 @@ Organization members can't create repositories directly. Add an entry with `sett 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 the archived `docs`. -- **Working and interest groups inherit nothing from `steering-committee`.** A group has its own grants and those of its group parent. `working-groups` and `interest-groups` have `push` on the archived `docs`. +- **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`](src/config/roles.ts) mark them. -- **`servers` lists its teams one by one.** It has no `steering-committee` grant, because that would reach every SDK team. -- **`security-ig` has an old `admin` grant on `docs`.** No other repository grants it access. +- **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. @@ -189,20 +187,13 @@ Cloudflare only counts direct members of a team. Someone in `python-sdk` doesn't 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. -### One-time setup +### Replace the Cloudflare token -1. In the **MCP Domain Account** on Cloudflare, create a token with only **Account > Access: Apps and Policies > Edit**. Name it for this purpose, such as `mcp-access: Access policy role management`, and don't use it for anything else. -2. Save it as `CLOUDFLARE_ROLE_MANAGEMENT_TOKEN` in the `production` environment. The deploy stops if it's missing, because Pulumi would otherwise delete the policies. -3. The account ID and identity provider ID aren't secret. They're in [`Pulumi.prod.yaml`](Pulumi.prod.yaml). - -Adopting a policy that already exists takes two deploys: - -1. Deploy with `cloudflare:importExistingPolicies: "true"` in `Pulumi.prod.yaml`. This imports the policy as it is, using its `cloudflarePolicyId`. -2. Set the value back to `"false"` in a second pull request. That deploy applies the rules in the config. Leave it off afterwards. +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 -`@modelcontextprotocol.io` accounts are moving to GitHub sign-in, with Cloudflare Access as the SAML identity provider. New accounts should use it from the start. Accounts that haven't moved yet still use a password. +People sign in to their `@modelcontextprotocol.io` account with GitHub. Cloudflare Access is the SAML identity provider. ### Enable someone @@ -256,8 +247,6 @@ npm organization members come from the `npm` field in [`users.ts`](src/config/us - **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. -The PyPI name `modelcontextprotocol` belongs to someone unrelated to the project, so MCP packages use names that start with `mcp`. Taking over the name would need a [PEP 541](https://peps.python.org/pep-0541/) request. Moving the projects to a free [PyPI community organization](https://docs.pypi.org/organization-accounts/) would let teams manage access to them. - ## Deployment, secrets and keys Every merge to `main` runs the [Deploy workflow](.github/workflows/deploy.yml). You can also start it by hand on `main`. @@ -294,7 +283,7 @@ Pull requests run on `refs/pull//merge`, so `preview` can't be limited t | `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](#one-time-setup) | +| `CLOUDFLARE_ROLE_MANAGEMENT_TOKEN` | [Cloudflare Access token](#replace-the-cloudflare-token) | All of them are set in `production`. The deploy stops before changing anything if a secret is missing. @@ -322,52 +311,3 @@ To replace the key, generate a new one in the App settings and run this. Then de ```bash gh secret set DEPLOY_APP_PRIVATE_KEY --env production -R modelcontextprotocol/access < key.pem ``` - -## First-time setup - -These steps were done once, when the project was set up. - -### 1. Service account - -```bash -# Create the project and enable the APIs -gcloud projects create mcp-access-prod -gcloud config set project mcp-access-prod -gcloud services enable storage.googleapis.com -gcloud services enable admin.googleapis.com -gcloud services enable groupssettings.googleapis.com - -# Create the service account -gcloud iam service-accounts create pulumi-svc \ - --display-name="MCP Access Management Service Account" \ - --description="Service account for Pulumi state and Google Workspace management" - -# Let it manage the Pulumi state -gcloud projects add-iam-policy-binding mcp-access-prod \ - --member="serviceAccount:pulumi-svc@mcp-access-prod.iam.gserviceaccount.com" \ - --role="roles/storage.admin" - -# Create a key -gcloud iam service-accounts keys create sa-key.json \ - --iam-account=pulumi-svc@mcp-access-prod.iam.gserviceaccount.com - -# Create the bucket for the Pulumi state -gsutil mb gs://mcp-access-prod-pulumi-state -``` - -In the Google Workspace Admin console, open **Account > Admin roles**. Choose **Groups Admin**, or a custom role that can read, create, update and delete groups and read and update their members. Click **Assign service accounts** and add `pulumi-svc@mcp-access-prod.iam.gserviceaccount.com`. - -### 2. Pulumi stack - -```bash -pulumi login gs://mcp-access-prod-pulumi-state - -export PULUMI_CONFIG_PASSPHRASE_FILE=passphrase.prod.txt -pulumi stack init prod - -pulumi config set --secret googleworkspace:credentials "$(cat sa-key.json)" -``` - -### 3. GitHub secrets - -Add the values listed in [Environments and secrets](#environments-and-secrets) to the `production` environment. `GCP_PROD_SERVICE_ACCOUNT_KEY` is the content of `sa-key.json`, and `PULUMI_PROD_PASSPHRASE` is the passphrase from step 2. Delete `sa-key.json` afterwards. diff --git a/src/cloudflare.ts b/src/cloudflare.ts index 906b8479..0a3b00e2 100644 --- a/src/cloudflare.ts +++ b/src/cloudflare.ts @@ -32,7 +32,6 @@ if (CLOUDFLARE_ENABLED) { // resource, so adopting an existing policy is a two-step process: // 1. importExistingPolicies=true: adopt the policy as-is (rule fields ignored) // 2. importExistingPolicies=false (or unset): manage the rules from config - // See README.md "Security room sign-in". const importExisting = config.getBoolean('importExistingPolicies') ?? false; const provider = new cloudflare.Provider('cloudflare', { diff --git a/src/config/accessPolicies.ts b/src/config/accessPolicies.ts index d045ea79..1ce32ee1 100644 --- a/src/config/accessPolicies.ts +++ b/src/config/accessPolicies.ts @@ -24,8 +24,7 @@ export interface AccessPolicy { /** * ID of the reusable policy that already exists in Cloudflare. When set, and the * `cloudflare:importExistingPolicies` stack config is true, Pulumi adopts this - * policy instead of creating a new one. See - * README.md "Security room sign-in". + * policy instead of creating a new one. See src/cloudflare.ts. */ cloudflarePolicyId?: string; /** Roles whose GitHub team may sign in. Order is preserved in the include rules. */