# Operator access and remote MCP One deployment serves one publication. A solo operator and a small editorial team use the same configuration. Any active operator can run every publication operation, including managing the allowlist. An operator can delegate fewer operations to an MCP client. Newsletter subscribers have a separate identity and lifecycle. ## Entry points | Endpoint | Caller and authentication | | --- | --- | | Operator web app and its command API | A human signs in through Cloudflare Access. On every request the Worker validates the signed Access application JWT and resolves an active operator. State-changing browser calls also require an allowed Origin and a CSRF token. | | `POST /mcp` | A remote client presents a newsman OAuth bearer token issued for the canonical HTTPS `/mcp` URL. Authentication failures return an HTTP challenge a client can read. | | OAuth authorization and consent page | The operator signs in with Access, sees the identified client, resource, requested scopes and duration, and submits a CSRF-protected consent decision. Bind the pending authorization transaction to that operator and browser. | | Discovery, token and revocation endpoints | Accessible to OAuth clients over HTTPS. Apply the provider's client, authorization code, PKCE and refresh checks at the relevant endpoints. Configure Access path policies around browser routes so protocol requests reach the Worker directly. | | Reader form, email-link endpoints and `POST /reader/mcp` | Open signup and resend take bounded anonymous requests. A reader presents a purpose-bound capability from their own email for confirmation or unsubscribe. The reader endpoint offers only public reader operations. | The canonical operator origin, OAuth issuer and MCP resource identifier are deployment settings. Preview has its own audiences, storage and issuer/resource pair. Scope Access policies to the actual browser routes on each hostname, including both methods of the consent endpoint. Verify the primary domain and any alternate Worker URL enforce the same identity checks. [Cloudflare Access application JWT verification](https://developers.cloudflare.com/cloudflare-one/access-controls/applications/http-apps/authorization-cookie/validating-json/) · [Cloudflare remote MCP authorization](https://developers.cloudflare.com/agents/model-context-protocol/protocol/authorization/) ## Allowlist and grants 1. Provision one or more explicit operator email addresses through a one-time deployment bootstrap. An empty list leaves the operator surfaces closed. Bootstrap runs once per new instance. A later deploy preserves additions and removals. An authorized infrastructure owner can recover access through an explicit audited membership repair against D1. 2. Configure Access with a trusted identity provider or verified email login. Read the assertion from `Cf-Access-Jwt-Assertion`. Verify its signature against the configured team's rotating keys, issuer, expected application audience and validity window. Accept an asserted human identity with an email and a stable subject. Service tokens and unsigned email headers cannot claim a seat. 3. Store allowlist entries in D1 under immutable operator IDs. Trim and case-fold email consistently, using exact addresses without domain wildcards, alias stripping or plus-address rewriting. On first login atomically bind the eligible address to the verified issuer and subject. Subsequent requests must match the bound identity and active entry. Changing identities requires an explicit membership change. 4. `operators_list`, `operators_add` and `operators_remove` have the same behavior in the web app and MCP. List whether an address is awaiting first login or bound. Prevent removing the last bound active operator in the same transaction as removal. An unclaimed invitation cannot serve as that operator. Removing someone disables their entry and revokes their grants. Re-adding an address creates a fresh membership generation. 5. Keep a D1 authorization ledger keyed by an opaque grant reference, operator ID, membership generation, client, scopes, status and timestamps. Store the reference and generation in server-controlled OAuth grant properties. `grants_list` shows who authorized which client and scopes. `grants_revoke` invalidates the ledger entry first, then revokes the corresponding provider grant. Retry provider cleanup if needed. These views show metadata only. 6. Check current membership in primary-consistent D1 on each web command, OAuth code/refresh exchange and MCP request. MCP also requires an active grant for the same generation and client. Evaluate membership/grant as a write precondition when accepting a mutation. After a committed removal or revocation, old cookies and outstanding tokens cannot admit another command, even during provider-cache propagation. An authorization-store outage returns a temporary failure. Already accepted sends follow their recorded job and cancellation semantics. [Cloudflare OAuth provider](https://github.com/cloudflare/workers-oauth-provider) · [D1 consistency](https://developers.cloudflare.com/d1/best-practices/read-replication/) ## Remote authorization Use the Cloudflare Workers OAuth Provider for the authorization server and protected-resource adapter. Allocate its private `OAUTH_KV` binding in each environment. Token validation can use a private Worker service binding when the issuer and resource server are deployed separately. Restrict the issuer to the configured newsman resource. The provider handles token material. The application owns its membership ledger, grant checks and consent screen. [Workers OAuth Provider](https://github.com/cloudflare/workers-oauth-provider) - An unauthenticated `/mcp` call receives HTTP 401 with `WWW-Authenticate: Bearer resource_metadata="https://news.example/.well-known/oauth-protected-resource/mcp"` using the installation's actual origin. Publish matching RFC 9728 resource metadata and RFC 8414 issuer metadata with authorization, token and revocation endpoints, supported scopes and S256. For a small deployment, support pre-registered clients with their exact permitted redirect URIs. Document the endpoint, client ID and callback the operator must register. - Use the authorization code flow with PKCE S256 and client-checked state. Bind each single-use code to the grant, client, redirect URI and exact resource. Require the same resource during code exchange. Issue short-lived access tokens, e.g. 15 minutes. Validate token audience, expiry, client, grant and scope on every call. Reject an Access login JWT, a reader link or a token issued by another instance as an MCP credential. - The application scopes are `read`, `write`, `send` and `admin`. The operation catalog specifies the scope for every tool. Each scope grants its listed actions independently. Approving all four gives an allowlisted operator's full web capabilities. Choose individual scopes for a reporting or publishing client. Missing scope returns HTTP 403 with an `insufficient_scope` Bearer challenge. An invalid or expired bearer returns 401. - With separately consented `offline_access`, an unattended client can store its refresh token privately, refresh within the granted resource and scopes, and renew credentials without a browser during the grant's lifetime. Rotate refresh tokens according to the provider's supported policy and reject reuse outside its documented retry window. Grant revocation or membership removal ends this access. Token or grant secrets stay out of logs and application exports. [MCP authorization](https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization) ## Streamable HTTP behavior Implement the published MCP `2025-11-25` baseline on both endpoints. Use UTF-8 JSON-RPC 2.0 over Streamable HTTP. Each client POST carries one message, `Content-Type: application/json` and an Accept header allowing JSON and event streams. For this stateless profile the server returns JSON for requests, 202 with an empty body for accepted notifications and 405 for an authenticated operator GET or a reader GET requesting a standalone stream. No MCP session ID or sticky Worker is needed. Reject a present, disallowed HTTP Origin with 403. Headless clients may omit Origin. Support `initialize`, `notifications/initialized`, `ping`, `tools/list` and `tools/call`. Advertise tools and only implemented capabilities. Return the baseline if offered or propose a supported revision when the client's proposed version differs. The client continues only when it supports the returned revision. Subsequent requests carry the negotiated `MCP-Protocol-Version`. Reject unsupported versions with 400. Pin and test the SDK against this baseline before advertising another revision. [MCP transport](https://modelcontextprotocol.io/specification/2025-11-25/basic/transports) · [MCP lifecycle](https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle) For authenticated operators, both adapters invoke the same command with the resolved actor, input schema, idempotency key, revision and audit context. Web preview/commit steps, such as scheduling a live issue, expose equivalent callable steps and return the same review data and receipt through MCP. Background work returns a job ID that either interface can inspect. Public reader tools share the form's validation, rate limits and generic responses. Use an explicit confirmed POST for action links. Email-link landing GETs are safe to preview. A single-use confirmation proof and an unsubscribe proof have distinct purposes. Keep unsubscribe usable from previously delivered mail. Discard reader proofs from logs and telemetry. ## Acceptance - Sign in with one bootstrap identity, add a second operator from MCP, bind that operator on the web and revoke their delegated grant from either interface. Verify subsequent calls and refresh fail. Exercise the same sequence in reverse, including re-addition and a stale old grant. Two concurrent removals leave a bound operator. - A fresh remote client discovers the issuer from the 401, obtains a token, initializes, lists tools, prepares and commits a send to a synthetic audience and reads its receipt over HTTP. The read-only grant can inspect permitted records and receives 403 when it tries to send. Repeat for a wrong resource, expired grant, wrong OAuth redirect and mismatched PKCE verifier. - Submit a reader signup through each adapter. For matching inputs, both return the same pending outcome and require the same consent proof. An anonymous reader cannot enumerate subscribers, discover operator tools at the reader endpoint, or invoke an operator command by guessing its name.