|
| 1 | +# MCP Access Management |
| 2 | + |
| 3 | +Infrastructure as Code for managing access to MCP community resources using Pulumi. |
| 4 | + |
| 5 | +- Define groups in [`src/config/groups.ts`](src/config/groups.ts) |
| 6 | +- Add users to groups in [`src/config/users.ts`](src/config/users.ts) |
| 7 | +- Changes are applied via GitHub Actions when merged to the main branch |
| 8 | + |
| 9 | +## What This Manages |
| 10 | + |
| 11 | +- **GitHub Teams**: Automatically syncs team memberships in the MCP GitHub organization |
| 12 | +- **Google Workspace Groups**: Automatically syncs group memberships for @modelcontextprotocol.io email accounts |
| 13 | + |
| 14 | +## Deployment |
| 15 | + |
| 16 | +### Production Deployment (Automated) |
| 17 | + |
| 18 | +**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). |
| 19 | + |
| 20 | +### Manual Deployment |
| 21 | + |
| 22 | +Pre-requisites: |
| 23 | +- [Pulumi CLI installed](https://www.pulumi.com/docs/iac/download-install/) |
| 24 | +- [Google Cloud SDK installed](https://cloud.google.com/sdk/docs/install) |
| 25 | +- Access to GCP project and GCS bucket |
| 26 | +- Required credentials and secrets |
| 27 | + |
| 28 | +1. Authenticate with GCP: `gcloud auth application-default login` |
| 29 | +2. Get the passphrase file `passphrase.prod.txt` from the maintainers |
| 30 | +3. Preview changes: `make preview` |
| 31 | +4. Deploy changes: `make up` |
| 32 | + |
| 33 | +## Key Management |
| 34 | + |
| 35 | +### Required GitHub Secrets (for CI/CD) |
| 36 | + |
| 37 | +The following secrets must be configured in GitHub Actions for automated deployments: |
| 38 | + |
| 39 | +- **`GCP_PROD_SERVICE_ACCOUNT_KEY`**: GCP service account key |
| 40 | + - Used to authenticate with Google Cloud Storage for Pulumi state (`gs://mcp-access-prod-pulumi-state`) |
| 41 | + - Should be a JSON key file for a service account with Storage Admin permissions |
| 42 | + - See "Setting Up GCS Backend" below for setup instructions |
| 43 | + |
| 44 | +- **`PULUMI_PROD_PASSPHRASE`**: Passphrase for encrypting Pulumi state |
| 45 | + - Used to decrypt encrypted values in Pulumi stack configuration |
| 46 | + - Keep this secure - if lost, you cannot decrypt your Pulumi state |
| 47 | + |
| 48 | +## Initial Setup |
| 49 | + |
| 50 | +If setting up this infrastructure for the first time: |
| 51 | + |
| 52 | +### 1. Set Up Service Account |
| 53 | + |
| 54 | +```bash |
| 55 | +# Create project and enable APIs |
| 56 | +gcloud projects create mcp-access-prod |
| 57 | +gcloud config set project mcp-access-prod |
| 58 | +gcloud services enable storage.googleapis.com |
| 59 | +gcloud services enable admin.googleapis.com |
| 60 | +gcloud services enable groupssettings.googleapis.com |
| 61 | + |
| 62 | +# Create service account |
| 63 | +gcloud iam service-accounts create pulumi-svc \ |
| 64 | + --display-name="MCP Access Management Service Account" \ |
| 65 | + --description="Service account for Pulumi state and Google Workspace management" |
| 66 | + |
| 67 | +# Grant storage admin permissions (for Pulumi state) |
| 68 | +gcloud projects add-iam-policy-binding mcp-access-prod \ |
| 69 | + --member= "serviceAccount:[email protected]" \ |
| 70 | + --role="roles/storage.admin" |
| 71 | + |
| 72 | +# Create key |
| 73 | +gcloud iam service-accounts keys create sa-key.json \ |
| 74 | + |
| 75 | + |
| 76 | +# Create GCS bucket for Pulumi state |
| 77 | +gsutil mb gs://mcp-access-prod-pulumi-state |
| 78 | +``` |
| 79 | + |
| 80 | +Then: |
| 81 | +1. In Google Workspace Admin Console, go to **Account** → **Admin roles** |
| 82 | +2. Select **Groups Admin** role (or create a custom role with these privileges): |
| 83 | + - Read, create, update, and delete groups |
| 84 | + - Read and update group members |
| 85 | +3. Click **Assign service accounts** |
| 86 | +4. Add your service account email: `[email protected]` |
| 87 | + |
| 88 | +### 2. Initialize Pulumi Stack |
| 89 | + |
| 90 | +```bash |
| 91 | +# Login to Pulumi backend (GCS) |
| 92 | +pulumi login gs://mcp-access-prod-pulumi-state |
| 93 | + |
| 94 | +# Create production stack |
| 95 | +export PULUMI_CONFIG_PASSPHRASE_FILE=passphrase.prod.txt |
| 96 | +pulumi stack init prod |
| 97 | + |
| 98 | +# Configure application secrets in Pulumi |
| 99 | +pulumi config set --secret googleworkspace:credentials "$(cat sa-key.json)" |
| 100 | +pulumi config set --secret github:token "ghp_your_github_token_here" |
| 101 | +``` |
| 102 | + |
| 103 | +### 3. Configure GitHub Actions Secrets |
| 104 | + |
| 105 | +Add the CI/CD secrets to GitHub Actions (repository settings → Secrets and variables → Actions): |
| 106 | +- `GCP_PROD_SERVICE_ACCOUNT_KEY`: Content of `sa-key.json` |
| 107 | +- `PULUMI_PROD_PASSPHRASE`: The passphrase you set above |
0 commit comments