MCP documentation

Rewrites Studio is a lasting writing workspace for memoirs, stories and professional writing. Chat assistants are good at producing a first draft or a downloadable file in the moment; Rewrites gives that writing a permanent home. Projects stay saved and organized, writers keep editing on the web or on a phone, turn drafts into narration to listen to on the go, export DOCX or PDF, and share or submit work when ready.

The Rewrites connector lets an account holder's chosen AI assistant work with that account's saved writing and hand them into the full app. Expanded actions are implemented subject to permissions and review. Verification status: real Muse OAuth and draft reading were confirmed earlier for the read-only connector. Expanded actions are locally verified, but have not yet been operator-tested end to end in live Muse. Local checks are separate from live validation and production security sign-off.

Platform integration teams and connector reviewers will find setup and review steps below.

What happens where

Existing read tools (previously confirmed in real Muse)

  • Find saved projects and read saved draft text: find_my_projects, read_my_draft.

Expanded implementation (live Muse validation pending)

  • Save chat writing as a new project that stays editable: save_chat_draft.
  • Change a saved draft after the account holder reviews the exact change in Rewrites, with a recoverable checkpoint: propose_draft_edit, apply_draft_edit.
  • Narration after the account holder confirms voice, source and credit cost: discover_narration_voices, estimate_narration, start_narration, narration_status, cancel_narration, list_narrations. Listening opens privately in the app.
  • DOCX or PDF export: export_draft. The download opens in the account holder's signed-in browser; an export is a copy, not the editable project.
  • Unlisted sharing after the account holder confirms content and access: prepare_unlisted_share, create_unlisted_share, list_unlisted_shares, revoke_unlisted_share.
  • Library eligibility and a handoff to the submission review: library_status.
  • Check this connection's proposal/result without authorizing it: action_status.

Editing an existing draft, starting narration and creating an unlisted share require opening the returned reviewUrl, signing in as the owner, and approving the exact proposal in Rewrites. Approval records permission only; return to the assistant to execute the corresponding tool with the returned id as actionId. A chat “yes,” draft instructions or model-supplied confirmed=true cannot authorize these actions. Saving supplied writing as a new project uses drafts:write consent without a separate review click. More permissions require fresh explicit consent; existing grants never expand silently.

Opens the full app

  • Rich editing, advanced narration preparation and voice selection, credit purchases, and private listening on web or mobile. Listening never creates a public share.
  • Library submission. Submitting is not publication: it still passes consent, rights checks and moderation.

The connector does not guarantee directory listing, promotion or discovery. No listing submission, approval, publishing, real narration charges or live public shares are claimed.

Writing suggested in chat stays there unless saved with save_chat_draft or added in the app. Connector writing is recorded as externally AI-generated, not a human edit. Project results contain the title, persisted revision and authenticated editor URL; the project lives in the normal workspace for continued web/mobile editing.

Private listening, unlisted sharing and Public Library distribution are separate. Anyone with an unlisted link can read and forward it without signing in. It exposes the live project, so later edits are visible. New connector links disable feedback/anonymous comments and search indexing. Revoking stops that link, not copies already saved or other links. Library eligibility is not acceptance; submission still requires rights consent and moderation and is not publication.

Example requests and boundaries

  • “Save this conversation as a draft”: save supplied title/text with save_chat_draft, then use Continue editing.
  • “Continue my memoir”: find/read the saved project, propose bounded edits, review in Rewrites, then apply.
  • “Narrate this chapter”: discover a voice and estimate/confirm cost. MCP simple narration covers the whole saved project; chapter-specific and advanced preparation remain in the app.
  • “Listen on the go”: list/check existing narrations and open a private listening handoff. Queued/rendering is not finished audio.
  • “Export my document”: request DOCX/PDF, then open the owner-authenticated browser download. Export is a copy, not the editable project.
  • “Share my work”: prepare/review an unlisted link, or inspect Library status and open its separate app submission review.

Connector URLs are authenticated web handoffs, not mobile deep-link schemes. Use the same account on mobile for saved writing and listening; do not assume bearer-only clients can use session-authenticated playback/download endpoints.

Overview

  • Endpoint: https://rewrites.studio/api/mcp
  • Transport: MCP Streamable HTTP with POST requests. The server does not keep sessions and returns JSON responses.
  • Authorization: OAuth 2.1 authorization code with PKCE (S256) and rotating refresh tokens, for public clients (token_endpoint_auth_method: none).
  • Scopes: drafts:read, drafts:write, narration:write, shares:write. Request only what is needed; omitted scope defaults to drafts:read.
  • Account: a Rewrites Studio account with a verified email address. The account holder approves each connection on a consent screen.
  • API keys: not supported. The older pilot keys have been retired.
  • Credits: voice discovery, reading, saving, estimates and export do not start paid narration. start_narration requests a credit-costed render using existing Rewrites accounting and failure/refund rules. Buy credits in the full app; there is no automatic purchase tool.

drafts:read permits find/read/export, voice discovery, existing narration and Library status. drafts:write permits project creation and reviewed edits. narration:write permits estimate/start and cancellation. shares:write permits reviewed unlisted creation, listing and revocation, not Library publication. Tools are advertised only for granted capabilities; annotations are not authorization.

Reviewer setup and checks

Account-holder browser flow

Connection starts in the approved MCP client with https://rewrites.studio/api/mcp. Existing customers sign into their verified account. New eligible customers use the normal Create Account browser flow, enter required signup details (including birth year and policy agreement), and follow the email-verification link. The flow preserves a safe connection return destination. Inspect the requesting app, callback origin and requested permissions, approve or deny consent, and return to the client. If verification opens another browser, sign into the same account there or return to the original connection tab. There is no demo-account requirement.

Passwords must not be shared with an assistant. Account creation happens in the browser; there is no create_account MCP tool. Connecting alone does not create or edit drafts. New accounts can save their first writing with save_chat_draft subject to normal account/plan/project limits. Anonymous work must be claimed before connector access.

Signup rollout is independent of OAuth client registration. The normal signup UI checks /api/waitlist/status; when the operator's gate is enabled it shows the waitlist, and the backend rejects direct registration too. Eligible customers follow that approved flow or contact support, not a bypass. This source audit does not assert the deployed gate's value or successful live email delivery. Verify normal signup, verification and return-to-consent during rollout, not only a seeded reviewer account.

Dedicated reviewer procedure

  1. Before dynamic registration, arrange approval of the client's actual callback origin with Rewrites support at support@rewrites.studio (see Client registration below). The platform team provides the actual callback URL or URLs used by its client. No platform callback is assumed, and the callback policy is not relaxed for review.
  2. Establish a dedicated test account through the browser flow above. Signup may be gated: if only Try it now or a waitlist is available, contact support@rewrites.studio for reviewer access.
  3. Create and save a small, non-sensitive sample draft with a distinctive title in the Rewrites Studio web app under the test account. Complete the client connection using that account and inspect the requesting app, callback origin and read-only consent.
  4. Execute find_my_projects with the sample's title. Expect the saved project, its title and an open link; an unmatched title should return an empty list.
  5. Execute read_my_draft with the returned project ID. Expect the saved sample text, not unsaved edits. Suggestions stay in the client and do not change the Rewrites draft.
  6. Test refresh rotation and reuse only on a dedicated test connection, never a live account-holder connection. Exchange its code for an access/refresh pair, then renew once with that refresh token. Expect a new access token and a different refresh token with the same drafts:read scope. Replay the consumed refresh token: expect HTTP 400 invalid_grant, revocation of that connection, HTTP 401 invalid_token when using its new access token, and HTTP 400 invalid_grant when using its new refresh token. Recovery requires fresh browser consent.
  7. Establish a fresh dedicated test connection. Exercise the account-holder revocation control described below for the test connection. Retry a read or search through the client: expect HTTP 401 invalid_token (the client may offer to reconnect), not draft content. Retry renewal: expect HTTP 400 invalid_grant. Do not approve a new connection during this revocation check.

These are expected results, not evidence that expanded live checks passed. Use synthetic writing and fresh consent for additional scopes, then check denied/expired proposals, stale revision/source, same-key retries and owner-authenticated export/listening. Real narration spending or live share effects require operator approval; no such effects are claimed here. Review requires no changes to secrets or callback policy.

Data access

Available: saved, non-archived projects owned by the authorized account. Tools return titles, update times, a link to open the project, and the saved text as plain text.

Not available: unsaved changes, chat history, memory files, projects where the account holder is only a collaborator, anonymous projects, and anything from another account. If a project ID is not available to the authorized account, the connector responds as if it does not exist.

Authorization

An MCP client SDK with OAuth support should discover the metadata, create its own PKCE verifier and state value, and handle the redirect. Example values below are not reusable credentials or PKCE values.

Discovery

  • Protected resource metadata: GET https://rewrites.studio/.well-known/oauth-protected-resource/api/mcp
  • Authorization server metadata: GET https://rewrites.studio/.well-known/oauth-authorization-server. The path /.well-known/oauth-authorization-server/api redirects here.

Authorization server metadata advertises both authorization_code and refresh_token in grant_types_supported.

A request to /api/mcp without a valid token returns HTTP 401 with this header:

WWW-Authenticate: Bearer resource_metadata="https://rewrites.studio/.well-known/oauth-protected-resource/api/mcp", scope="drafts:read"

Client registration

Approved Muse registration remains https://agent.meta.ai only. muse.ai is an onward redirect, not an approved registration origin. Additional origins require separate operator review; broad customer availability does not mean unrestricted client registration.

Dynamic client registration is available but restricted. Every callback URL must use an origin that Rewrites Studio has reviewed and approved. It must also use https, or http on 127.0.0.1 or [::1] for local loopback callbacks. Loopback is an HTTP scheme exception only: every loopback callback origin still requires approval, including its port. Callback URLs cannot contain a fragment or user credentials. Callback-origin review is arranged with support@rewrites.studio before registration, using the actual callback URLs supplied by the platform team. Rewrites Studio approves exact origins only, not wildcards or broad domains.

POST https://rewrites.studio/api/oauth/register
Content-Type: application/json

{
  "client_name": "Example Writing Assistant",
  "redirect_uris": ["https://assistant.example.com/oauth/callback"],
  "token_endpoint_auth_method": "none",
  "grant_types": ["authorization_code", "refresh_token"],
  "response_types": ["code"]
}

Registration accepts between one and five redirect_uris. Code-only registrations with grant_types: ["authorization_code"] remain accepted for compatibility. A successful request returns HTTP 201 with a client_id in the form rw_client_.... Invalid metadata, including any callback that has not been approved, returns HTTP 400 invalid_client_metadata.

Authorization request

GET https://rewrites.studio/api/oauth/authorize
  ?response_type=code
  &client_id=rw_client_EXAMPLE
  &redirect_uri=https://assistant.example.com/oauth/callback
  &scope=drafts:read
  &state=CLIENT_GENERATED_STATE
  &code_challenge=CLIENT_GENERATED_S256_CHALLENGE
  &code_challenge_method=S256
  &resource=https://rewrites.studio/api/mcp

redirect_uri must exactly match a registered URI. If it does not, the server shows an error and does not redirect. state is required, up to 512 characters. resource is optional, but if sent, it must be the endpoint above. The account holder signs in if needed, then sees which app is asking and the origin of its callback, and chooses to allow or deny access. Approval returns code and state to the callback. Denial returns error=access_denied. Authorization codes expire after five minutes and work only once.

Token request

POST https://rewrites.studio/api/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&client_id=rw_client_EXAMPLE
&redirect_uri=https://assistant.example.com/oauth/callback
&code=AUTHORIZATION_CODE&code_verifier=CLIENT_PKCE_VERIFIER

A successful response looks like this:

{ "access_token": "rw_oauth_...", "refresh_token": "OPAQUE_REFRESH_TOKEN",
  "token_type": "Bearer", "expires_in": 3600, "scope": "drafts:read" }

Access tokens last one hour. Each MCP request carries the access token as Authorization: Bearer <token>.

Refresh and connection lifetime

POST https://rewrites.studio/api/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=refresh_token&client_id=rw_client_EXAMPLE
&refresh_token=OPAQUE_REFRESH_TOKEN

A successful renewal returns a new pair:

{ "access_token": "rw_oauth_...", "refresh_token": "NEW_OPAQUE_REFRESH_TOKEN",
  "token_type": "Bearer", "expires_in": 3600, "scope": "drafts:read" }

Refresh tokens are opaque, bound to the original client and single-use; each successful renewal consumes the submitted token and rotates it. The approved scope set stays unchanged; token exchange and refresh never expand it. Old read-only grants remain drafts:read until fresh explicit browser consent for additional permissions. Renewal lasts at most 30 days from the original authorization-code exchange, an absolute deadline that rotation does not extend. Then reconnect through fresh consent. Token examples above illustrate read-only grants; expanded responses list the approved space-separated set. Expanded authorization requests URL-encode that desired space-separated set in scope.

Clients must serialize renewals for each connection and atomically replace the stored refresh token with the new one before another renewal. A lost successful response requires fresh browser consent: retrying a consumed refresh token returns HTTP 400 invalid_grant and revokes the entire connection, including its access and refresh tokens. Clients must not retry a consumed token or run concurrent renewals.

Access tokens issued before the refresh upgrade continue working until their normal expiry unless revoked. Those connections need one browser reconnection to obtain an access/refresh pair.

Tools

Tools use MCP JSON-RPC tools/call. Successful results include a text block containing JSON, parsed with JSON.parse(result.content[0].text). Expanded tools also return structuredContent; legacy find_my_projects and read_my_draft return JSON text only. Identifiers, revisions/status and contextual URLs are structured data in these results. Existing read tool names and pagination are unchanged. Example IDs/content below are fictional.

Expanded inputs, review and retries

  • save_chat_draft: title (1–200 characters), text (1–100,000) and idempotencyKey.
  • propose_draft_edit: projectId, expectedRevision, 1–20 replacements with find/replace (maximum 10,000 characters each), idempotencyKey. Each find must uniquely match one ordinary text run. Single-line non-overlapping replacements preserve structure; formatting-boundary, entity, multiline and collaborative/Yjs edits require the app. Apply creates a recoverable checkpoint and rejects stale drafts instead of overwriting newer work.
  • estimate_narration: projectId, voiceId, idempotencyKey. Its immutable payload includes title/source text for human review, saved source hash/revision, voice and credit cost. Even same-length changed source invalidates approval.
  • prepare_unlisted_share: projectId, expectedRevision, idempotencyKey; binds content and access policy.
  • Preparations return id, kind, status, immutable payload, expiresAt and reviewUrl. Records bind account, OAuth grant/client and exact terms and expire after ten minutes. Apply/start/create take actionId after in-app approval; action_status inspects only this connection's record and never authorizes it.
  • Use stable idempotencyKey (1–128 characters) per logical request. Reuse only for identical retries, including uncertain outcomes. Changed content requires a new key; expired proposals need new preparation/review. Execution retries reuse the same actionId; durable domain keys recover original results rather than duplicate projects, render/charges or shares. Do not blindly create a second action after a timeout.
  • Project-scoped tools take projectId; status/cancel also take audiobookId, revoke takes shareId, export takes format: "docx" | "pdf". Use returned identifiers.
  • Export returns revision, handoffUrl and downloadUrl. Downloads require the owner's browser session, not the MCP bearer token; changed content requires fresh export. Narration results include job status/progress/cost and private listenUrl/openUrl. Cancellation uses existing credit rules and may race completion.

find_my_projects

Finds the authorized account's saved, non-archived projects by title, most recently updated first.

Input:

  • query (string, optional, maximum 100 characters, default ""): matches anywhere in the title, ignoring case
  • limit (integer 1-20, default 10)

Request:

{ "jsonrpc": "2.0", "id": 1, "method": "tools/call",
  "params": { "name": "find_my_projects", "arguments": { "query": "grandmother", "limit": 5 } } }

Response:

{ "jsonrpc": "2.0", "id": 1, "result": { "content": [ { "type": "text",
  "text": "{\"projects\":[{\"projectId\":\"00000000-0000-4000-8000-000000000001\", ...}]}" } ] } }

Parsed text:

{ "projects": [ {
  "projectId": "00000000-0000-4000-8000-000000000001",
  "title": "Example: Summers at Grandmother's House",
  "updatedAt": "2026-01-15T10:30:00.000Z",
  "openUrl": "https://rewrites.studio/editor/00000000-0000-4000-8000-000000000001"
} ] }

read_my_draft

Reads a saved draft as plain text, in pages.

Input:

  • projectId (UUID, required): a project ID returned by find_my_projects
  • page (integer 0-499, default 0)
  • expectedRevision (64 lowercase hexadecimal characters): required for every page after page 0, using the revision value returned with page 0.

Request for a later page:

{ "jsonrpc": "2.0", "id": 2, "method": "tools/call",
  "params": { "name": "read_my_draft", "arguments": {
    "projectId": "00000000-0000-4000-8000-000000000001", "page": 1,
    "expectedRevision": "0000000000000000000000000000000000000000000000000000000000000000" } } }

Example parsed result for page 0. The text value is abbreviated here; actual pages contain up to 20,000 UTF-16 code units, without splitting a surrogate pair.

{
  "projectId": "00000000-0000-4000-8000-000000000001",
  "title": "Example: Summers at Grandmother's House",
  "text": "Example text. The kitchen always smelled of... [abbreviated excerpt]",
  "page": 0,
  "nextPage": 1,
  "truncated": true,
  "revision": "0000000000000000000000000000000000000000000000000000000000000000",
  "updatedAt": "2026-01-15T10:30:00.000Z",
  "openUrl": "https://rewrites.studio/editor/00000000-0000-4000-8000-000000000001"
}

Pagination

Each page holds up to 20,000 UTF-16 code units. A page never splits a surrogate pair. Reading a long draft starts at page 0, then continues by requesting nextPage with the same expectedRevision until nextPage is null. Only pages 0-499 can be read. If a draft is longer than that, truncated stays true on page 499. If the draft changes during reading, the tool returns an error and reading must restart at page 0.

Errors and limits

  • Tool errors are returned as a normal JSON-RPC result with isError: true and one of these messages: Draft not found or not accessible., Draft revision changed. Restart at page 0., or expectedRevision is required for pages after page 0. Read page 0 first. Invalid inputs fail schema validation.
  • Expanded errors use isError: true and JSON {error, message} (for example review_required, confirmation_expired, idempotency_conflict, stale_quote, insufficient_credits, or generic action_failed). Inspect isError before treating HTTP 200 as success or parsing a plain-text read error as JSON.
  • HTTP 401 invalid_token: the token is missing, expired or revoked, the account is deleted, or the email address is not verified. A valid authorized connection is required.
  • HTTP 405: any method other than POST, including opening the endpoint in a browser. This is expected.
  • HTTP 429: rate limit reached. Retries must wait for the time given in the Retry-After and RateLimit headers.
  • Rate limits per IP address: 120 requests per minute to /api/mcp, and 30 requests per minute shared across the OAuth registration, authorization and token endpoints.
  • OAuth errors: invalid_request (sent to the callback), invalid_grant (invalid, expired, consumed or revoked credentials, or mismatched client or scope at the token endpoint), unsupported_grant_type (unsupported token grant), access_denied (the account holder declined). A token-endpoint HTTP 500 server_error is a server failure, not a successful renewal.

Revoking access

Account holders can inspect permissions and revoke a grant from Account → MCP connections. Revocation immediately invalidates access/refresh tokens and prevents further action execution. Account deletion or verification loss also blocks requests/renewal. It cannot recall client-retained content, cancel an already queued narration or revoke existing shares; use corresponding tool/app controls.

Integration review context

The review target is the expanded custom connector at https://rewrites.studio/api/mcp. The 27 isolated database/API/SDK checks and four actual Chromium OAuth chains passed locally, including consent with production CSP and an onward callback. This is separate from the earlier real-Muse read-only confirmation. Expanded live Muse actions, deployed signup/email delivery, signed-in live UI/handoffs and operator-approved paid/share effects remain release checks. UI component checks passed, but signed-in live UI was not real-browser verified. Local checks use disposable PostgreSQL, synthetic users/content and mocked providers, never the ambient customer database. Independent security review and deployment verification remain gates before any directory submission. No submission, publishing or terms acceptance has been performed by this documentation.

Support and policies