# Web and HTTP MCP parity The release contract is a set equality. Every publication operation reachable from a web screen must exist in MCP for the same actor. Both interfaces call the same validator, permission check, command or query, and receipt store. A button opening a browser, returning an admin URL or asking someone to click “finish” in the console cannot complete an MCP action. A prompt or free-form SQL tool cannot substitute for a missing operation. ## Machine-readable inventory [operations.json](operations.json) declares each operation's stable name, surface, screen, scope, mode, description, input and output. Resolve schema references against the file's shared definitions. When emitting `tools/list`, expand a root reference into a root object and attach its transitively reachable `$defs` to each input and output schema. Use JSON Schema 2020-12. A single registry drives MCP tool descriptors, web command identifiers, server dispatch, input validation, structured results and the parity test. Every screen declares its read queries as well as its buttons. Tab selection, local sorting, text selection and OAuth login or consent are client or identity-protocol interactions. Domain-visible settings and grant revocation are shared operations. | Web workflow | Example tool sequence | | --- | --- | | Check who can operate the publication | `operators_list`, `operators_add`, `grants_list`, `grants_revoke`, `operators_remove` | | Start with an existing issue or an empty editor | `file_begin` → `file_write` → `file_finish` → `issue_import`, or `issue_create` → `issue_update` | | Review and send | `issue_render` → `send_test` → `send_prepare` → `send_commit` → `campaign_get`. Use `send_cancel` to stop pending work. | | Rehearse a migration | Stage source files → `import_prepare` → `import_commit` → `job_get` → `migration_status`. Subsequent deltas use `migration_reconcile`. | | Download private data | `export_create` → `job_get` → successive `file_read` calls. A client can reconstruct and verify all bytes. | | Manage a subscription | On the reader endpoint, `reader_subscribe`, `reader_resend`, `reader_confirm` and `reader_unsubscribe` use the same public contract as the HTML flow. | | Hand an edition to an existing site | `archive_bundle` → `job_get` → `file_read`; after the host publishes it, `archive_verify` records the observed result. | ## Requests and results MCP speaks JSON-RPC over HTTPS using Streamable HTTP at `/mcp` for operators and `/reader/mcp` for readers. Implement lifecycle and discovery before calling tools. After initialization, send the negotiated protocol version. For `tools/list`, clients follow pagination to exhaustion if the server paginates. Never infer that the first page is the complete inventory. The web adapter can use a same-origin command route with a cookie and CSRF protection. A browser authorization cookie is unnecessary for an MCP call with a valid grant. [Transport and identity details](access.md) A successful call returns the typed result in `structuredContent` and an equivalent JSON text content item for clients that use text. Use the same fields, ISO 8601 UTC instants, filter semantics and cursor ordering on the web. Pages sort by an explicit immutable key with ID as a tie-breaker. Bind each opaque cursor to its operation, filter and stable read cut. Reject modified or mismatched cursors. Long-running actions return durable jobs with progress and an optional result file. Polling is sufficient. Never put an email address, reader proof or OAuth credential into diagnostic context. Operator commands take a caller-generated `key`. Scope it to the instance, operator membership and operation; web and MCP can retry each other's calls. Authorize every replay. Persist the canonical input digest, result or job reference, and command receipt atomically at the mutation boundary. Same key and input returns the first result, even when a revision has advanced. A different payload under that key returns `idempotency_conflict`. An unrecognized key modifying stale state returns `revision_conflict` with the current revision when permitted. Reader actions use challenge and consent state to deduplicate. Enforce rate limits and the same generic responses on both reader entry points. Use protocol errors for malformed JSON-RPC and unknown methods. Authentication errors use the HTTP challenge defined in the access contract. Known tool execution failures return `isError: true` with a stable code, actionable message, retryability and permitted detail. Specify parity fixtures for `invalid_input`, `not_found`, `permission_denied`, `revision_conflict`, `idempotency_conflict`, `expired_plan`, `rate_limited`, `suppressed`, `dispatch_paused` and `outcome_unknown`. Public signup conceals individual suppression and membership states. Showing a file, job or audit record requires both the operation scope and authority for the underlying data. Metadata about sensitive jobs obeys the same rule as their result. ### A send from an MCP client After authentication and initialization, a client calls `send_prepare` for the issue revision and segment it reviewed. Omitting `due_at` requests immediate dispatch upon commit. A future instant schedules the same campaign. ```json {"jsonrpc":"2.0","id":7,"method":"tools/call","params":{"name":"send_prepare","arguments":{"key":"prepare-week-014","issue_id":"issue-014","issue_version":3,"audience":{"statuses":["active"]},"due_at":"2027-01-08T10:00:00Z"}}} ``` The result includes the plan ID, subject, sender, time, estimated cost and counts, the audience and issue digests, expiry, and a digest for the complete plan. The cost object specifies the currency, estimated message count and SES base charge. A client submits the exact server-returned ID and digest to `send_commit` with a fresh command key. Check for intervening content, settings or membership changes before commit. Make membership cuts reproducible via a materialized or versioned set. Require another prepare if the eligible audience changed before commit. After commit, suppressions still take immediate precedence over queued work. The same two operations power the web review and final send button. ```json {"jsonrpc":"2.0","id":9,"method":"tools/call","params":{"name":"campaign_get","arguments":{"id":"campaign-014"}}} ``` ### Files and issue bundles Receive uploads in ordered chunks of at most 49,152 decoded bytes. Verify chunk offsets/digests, total bytes and final SHA-256. Limit staged objects to 25 MiB for v1 and expire unfinished uploads after 24 hours. Read chunks under the caller’s grant and verify the full hash at EOF. Reject arbitrary URL fetches. For migration and export data also require `admin` on each transfer step. A grant for all four operator scopes can perform the complete workflow. Validate images by actual type, size and dimensions. Treat imported markup as untrusted, render only allowed email markup and produce a text part. Fetch archive checks only on the configured publication origin. The host remains in charge of its public deployment. An `issue_bundle` is UTF-8 JSON with format version 1, a `source` object conforming to the registry, and optional email overrides for subject, preheader and text. The client uploads a hero first and references its sealed asset ID. Hash the exact bundle bytes. A new external key creates one issue. A matching key and hash returns the existing revision. A different digest requires the expected current revision. Blank editor drafts and imported issues converge on the same renderer. A template uses a single issue-body slot, explicit text fallbacks and escaped fields. Reject unresolved tokens before approval. Derive per-recipient unsubscribe and optional link-tracking capabilities only at delivery. ## Contract test that blocks release 1. Render each web screen with all features enabled on a fresh single-publication installation. Collect every declared query and action ID, plus actions observed from actual browser interactions. Fail on handler calls that bypass the registry, unregistered forms, missing reports, missing uploads or a web action implemented only as a privileged route. 2. Initialize an external SDK client against the HTTP Worker. For an allowlisted operator with all scopes, compare the complete operator tool list with the operator web inventory and registry. Repeat independently for the reader surface. Compare input and output schema hashes after expanding references. Missing tools, orphan tools, unexpected scope drift and schema mismatches fail CI. 3. For every operation, run the same fixture against the web adapter and the remote client on independent copies of the initial database, with a fixed clock, stable ID factory, test mailbox and simulated SNS. Compare structured output, state changes, emitted jobs, audit actor, final sends and file contents. Normalize only transport-specific IDs/headers and the recorded channel. Exercise invalid and forbidden inputs as well as the success case. An opaque download, job or preview handle is complete only if the MCP test can retrieve the result. 4. Run cross-channel retries on the same database. Submit an approved send on web, replay through MCP as the same operator and observe one campaign and one mail capture per eligible recipient. Reverse the channels, then try a different payload with the same key. Test removal of an operator and grant revocation during an active client session. Add a dummy web-only action in a negative build fixture and assert the parity suite fails.