@spacefast/mcp
v0.13.0
Published
MCP server for publishing and managing Spacefast spaces from AI agents.
Readme
Spacefast MCP
MCP server for publishing and managing Spacefast spaces from AI agents. It ships both as part of
the spacefast CLI (sf mcp) and as the standalone @spacefast/mcp package. Spacefast generates
the operation catalog from its public OpenAPI document and exposes each eligible operation as a
named tool. Source edits use CodeStorage-backed workspaces, so they need no local checkout.
Read-only views and execution approvals open as MCP Apps in capable clients.
publish accepts inline files everywhere; local paths need the native Linux sf build (npx,
macOS, and Windows publish inline files).
Spacefast has two MCP lanes:
- Cloud-hosted MCP at
https://mcp.spacefast.com: for cloud agents; no local file access. - On-Device MCP via
sf mcp: for agents running on the user's machine; publishes local paths on the native Linuxsfbuild (npx, macOS, and Windows publish inline files) while the host agent keeps its normal filesystem and shell tools.
Usage
Cloud-only clients can use the hosted Streamable HTTP server:
https://mcp.spacefast.comEvery connection gets the same catalog: each MCP-eligible API operation is a tool named by its
OpenAPI operationId, with its description, input schema, output schema, and safety annotations.
The catalog exclusions and permissions apply to every runtime. Local stdio, the authenticated
proxy, and direct hosted OAuth differ in transport and runtime. Each runtime adds a few host
tools, listed under Tools. The connector gateway is one of them, and only On-Device MCP
has it:
sf mcp
sf mcp proxy
sf mcp install --agent claude-code
sf setup agent --agent cursor --remote --oauthNarrowed connections
Only a preset on the one MCP address narrows a connection. Without one, every eligible operation is listed and step-up asks the person for any missing scope, whatever the grant holds, so a connection approved as Read-only can still ask before a write. With a preset, the connection lists only what it can use and never steps up past the preset:
?access=readlists only tools withreadOnlyHintwhose scopes it holds.?groups=...(the consent screen'sOAUTH_SCOPE_GROUPSthat MCP tokens carry:spaces,publishing,domains,teams,money) lists only the tools those groups' held scopes fit.
https://mcp.spacefast.com/?access=read
https://mcp.spacefast.com/?groups=spaces,domainsThe resource identifier stays the origin: a resource parameter carrying the preset is read as
the MCP origin, and nothing else is. The 401 challenge names only the preset's scopes, so the
client asks for exactly those and consent opens on Read-only access or those groups. On every
request the connection uses the grant's scopes within the preset, even with a broader token or a
CLI key through sf mcp proxy, and step-up stays within it. An invalid preset is a 400.
sf mcp --read-only
sf mcp proxy --groups spaces,domains
sf mcp install --agent claude-code --read-onlyToolsets
A toolset shortens the tool list to the API families one kind of work needs. It filters discovery
and nothing else: OAuth scopes, consent, step-up, and approvals stay as they are, so a toolset is
not an access limit. Use ?access=read or ?groups=... to limit access, alone or with toolsets.
| Toolset | Lists |
| --------------- | ------------------------------------------------------------------------- |
| core | Create, publish, share, and inspect Spaces: about 70 everyday tools |
| git | Source, builds, versions, runtime settings, and native apps |
| tags | Tag configuration, revisions, releases, and previews |
| dns | DNS records, nameservers, Domain Connect, certificates, and traffic rules |
| domains | Domain search, purchase, registration, and connection to a Space |
| database | A Space's database tables and rows, and its stored objects |
| team-admin | Teams, members, sharing, credentials, connectors, approvals, and billing |
| sell | Products, orders, and payouts for a Space that sells |
| observability | Logs, analytics, activity, comments, webhooks, and page screenshots |
| all | Every tool, the same as no toolset |
https://mcp.spacefast.com/?toolsets=core,git
https://mcp.spacefast.com/?access=read&toolsets=coresf mcp --toolsets core,git
sf mcp proxy --toolsets core --read-onlyToolsets add up. Each one also lists resume_execution, the sign-in tools, and the Claude Design
import tools, and App-only tools follow their Apps on every connection. A tool outside the selected
toolsets is not registered, so a call to it is refused. The server guide stays whole and names the
host tools the connection does not list. The rules live in MCP_TOOLSET_RULES
(packages/common/src/contracts/mcp-toolsets.ts); toolsets.test.ts fails when an operation
belongs to no toolset or a rule matches nothing.
Calls to an unlisted tool are refused. A narrowed connection has no connector gateway and no
retired search/execute stubs; a read-only one has no resume_execution or approval card, since
nothing pauses.
Hosted HTTP is stateless for both protocol eras. sf mcp proxy repeats the stdio client's
identity and capabilities with each request.
Opening the MCP endpoint in a browser shows client setup instructions. Protocol requests still use
the same endpoint and authentication. To test this branch locally, run bun run dev:mcp:http and
open http://127.0.0.1:6279/. Connect your MCP client to http://127.0.0.1:6279/mcp. The local
HTTP server uses the On-Device runtime.
The server collects its tool definitions from src/tools/. The generated API catalog
supplies operation contracts; product modules supply publishing, Apps, entrypoints, and
host integrations. An agent calls an operation tool with JSON arguments matching its advertised
schema. Every call goes through the same validation, authorization, work-mode, and approval path.
resume_execution continues the exact saved call; it cannot choose a new operation.
Tool descriptions stay short. The calling guide lives in the server instructions and in the
spacefast://skills/api resource: how to call and check the operation tools, and one section per
entry in API_CAPABILITIES. Capability guidance follows the registered operation tools. For
example, when Sell permits only existing purchase management, the guide keeps those operations
and omits new-seller setup. The server also serves a spacefast://skills/comments
resource and MCP prompts; On-Device MCP adds spacefast://skills/connectors. Their bodies
account for the client profile and the local or hosted runtime. The shared workflow facts live
in common docs, so instructions, prompts, skills, and App actions use one calling convention.
Hosted and On-Device MCP also serve the native Skills extension.
On MCP 2026-07-28, look for io.modelcontextprotocol/skills in server/discover.
Call skills/list to see the catalog, or skills/get with a URI such as
skill://spacefast/build-website/SKILL.md for one manifest. The manifest includes the
frontmatter, size in bytes, and SHA-256 digest for every file. Read files with
resources/read; resources/directory/read lists a directory's direct children.
Native skills are served through a per-request SkillSource (src/native-skills.ts). Built-in
workflow skills come from the same renderer as the root
skills directory in spacefast/plugins,
adapted for the hosted or local runtime, filtered to the connection's narrowed preset
(?access=read, ?groups=...), and stripped of plugin-only agents/openai.yaml, pre-connection
setup, and moderator-only moderate-show-and-tell entries. For authenticated callers who hold
spaces:read, the server also serves their teams' enabled Team Skills dynamically under
skill://spacefast/teams/<teamSlug>/<skillKey>/SKILL.md (with a bounded 2.5 s timeout and graceful
fallback so built-in skills never degrade). A release checks the packaged MCP server against the
plugin payload with bun packages/mcp/scripts/check-plugin-skills.ts /path/to/plugins/skills.
Hosted and On-Device MCP also advertise the Tasks extension
(io.modelcontextprotocol/tasks, SEP-2663) on MCP 2026-07-28. When a client declares
io.modelcontextprotocol/tasks: {} on a tools/call request and the call starts a background
Spacefast build or operation — via publish, import-claude-design-from-url, or any non-read-only
OpenAPI operation tool returning an unsettled operation or build — the server returns a
CreateTaskResult (resultType: "task") instead of requiring manual polling with
operation_status or get-design-import-job-status. Clients poll tasks/get until the task
reaches completed (carrying the final CallToolResult, including enriched live URLs for publish
operations) or cancelled, and can call tasks/cancel (canceling archive builds via
POST /v1/builds/{buildId}/cancel unless the connection is read-only, and cooperatively
acknowledging operations) or tasks/update. Tasks are backed directly by durable Spacefast builds
and operations, so hosted HTTP remains stateless across replicas and re-authorizes every tasks/*
request against the caller's current credential. Anonymous publishes keep their immediate
CallToolResult so the one-time claim handoff is delivered immediately, read-only status checks
(getOperation, getBuild) never turn into tasks, and clients without
io.modelcontextprotocol/tasks continue using operation_status and get-design-import-job-status.
Durable approval executions (sf_exec_<executionId>) also bridge into tasks/get (status: "input_required"
with URL elicitation), tasks/update (decline/cancel only for browser-owned pauses), and tasks/cancel.
When the API owns the approval, a writable task poll returns its approval page and continues the
saved operation after the person decides. tasks/cancel acknowledges the cancellation request.
The person can deny the pending API approval on its page. tasks/get reports its current state.
Hosted MCP also exposes GET /whoami (and GET /mcp/whoami) through the same OAuth, rate-limit, and
preset pipeline, returning non-secret connection diagnostics (Cache-Control: private, no-store), and
emits : keep-alive SSE comment frames during idle intervals on text/event-stream responses. Execution
results normalize base64url payloads on ToolFile and MCP media blocks to standard base64, keep vision
image blocks restricted to raster formats (image/png, image/jpeg, image/gif, image/webp),
render image/svg+xml as redacted text, and emit other binary images as embedded resources.
Hosted MCP requires an OAuth access token carrying the API scopes each tool needs:
teams:read, teams:create, spaces:read, spaces:write, versions:download, and/or
publish:write. There is no separate "use MCP" scope. MCP is transport over the same API, so a
token authenticates each request and every tool call is gated by the scope its underlying operation already
requires. Bearer and DPoP-bound tokens are supported. It exposes cloud-safe Spacefast operations,
source workspaces, and inline-file publishing, with no
filesystem access.
Each hosted tool advertises its required scopes in spacefast/requiredScopes. Operation tools
authorize each underlying operation independently, so no tool can bypass the scopes the operation
requires.
Signed out, a client that shows MCP Apps (Claude, ChatGPT) connects to a stateless sign-in shell
instead of getting a 401 on its handshake: the Space Library App, its protected read, and publish.
The first publish asks the user to sign in (lazy authentication). Claude starts sign-in only when the
HTTP request fails, so it gets the 401 challenge and its inline Connect card, then retries the call.
ChatGPT links from the tool result's _meta["mcp/www_authenticate"] and publish declares
securitySchemes, but a 2025-era signed-out call carries no client name, so only a 2026-07-28
ChatGPT request is told apart. Clients that cannot show the App, such as Claude Code and Cursor, keep
the 401 on the handshake, which is where they sign in. Hosted MCP never publishes anonymously.
When a valid OAuth token is too narrow, hosted MCP asks for more scope with the MCP spec's step-up
authorization: HTTP 403 and WWW-Authenticate: Bearer error="insufficient_scope". The challenge
names the scopes the grant holds plus the missing ones, because a consent replaces the grant's
scopes. The client asks the user, re-authorizes, and retries the same call. Approving more access
for the same teams updates the existing grant, so the MCP session and paused work stay attached.
- Profile tools are checked before they run.
- Operation tools are checked when the API refuses the operation. The streamed reply is held until
its first message, so the refusal can still become the
403. - ChatGPT and Codex step up from the tool result's
_meta["mcp/www_authenticate"], not from the403(scopeChallengeDeliveryinsrc/tool-mode.ts). They get the same challenge there. spaces:deleteis never challenged. Deletion keeps its per-Space temporary-access approval.
Some decisions belong to the API, not to MCP: confirmation_required, elevation_required
(temporary access, or approving a Space move), and a requestApproval for team access. The call
pauses with the API approval card (approvalOwner: "api"), which says what the person is deciding
and, for a plain confirmation, shows the action's own title and review facts. It links to the
reusable /approvals/<id> page when MCP knows the API's dashboard (configured, or a Spacefast
environment's API). Otherwise it keeps the API's one-use link. The person decides there while
signed in, so an agent can never grant it. In hosts that can open links, the card mints a fresh
one-use signed-in link on each click; elsewhere it shows the address to copy into a signed-in browser.
resume_execution polls resumeAction. Once approved, a confirmation replays its exact request
with the continuation token, temporary access and moves run the same call again, and a team access
request returns the decision so the call can continue in that team
(src/execution-confirmation.ts). The decision belongs to the connection's grant, so a token
refreshed during the pause keeps polling it.
In a trusted chat host the person decides it in the card itself. A connection counts when only the
host's MCP connector can hold its token: the OAuth client id is claude.ai's or chatgpt.com's
connector metadata document, or every registered redirect URI is one of their exact connector
callbacks (isCardHostClient in apps/control-plane/src/mcp/card-decisions.ts). Other paths on those
sites, such as a custom GPT's Action callback, do not count, because those clients see raw results. For a Space delete or move, a Share change, a
domain transfer out, a rollback or a team access request, the pause then carries cardDecides,
apiApprovalId, and a private token in _meta, which survives polling. Approve and Deny call
decide_execution_approval, and the API records the decision as the connection's person through
the same checks, events and audit as the page, with via: "agent_card" on the audit row. API keys,
budget changes, unblocking share links and temporary scopes stay on the page, where "Confirm it's
you" applies. Any other host keeps the page.
Nobody has to come back and say they approved. A card watches the approval's event record, the
same approval.requested and approval.resolved rows MCP Events deliver: read_execution_approval
takes waitMs (up to 25 seconds) and answers as soon as the person decides, in this card, another
card, or on the page. The card then calls resume_execution itself (the tool is visible to the
App), so the approved call runs and shows the result. The card tells the agent through
ui/update-model-context, or one chat message on a host without it. A
card without that authority checks resume_execution on the API's poll interval instead, and at
once when the chat regains focus. Without a card, one resume_execution
keeps checking for up to 45 seconds (BROWSER_APPROVAL_WAIT_TIMEOUT_MS) and returns as soon as the
person decides. On-Device MCP does the same for an API approval: the model calls
resume_execution({ executionId }) (or action: "wait"; a released client's action: "accept"
works the same), since only the person can approve it.
MCP leaves established approvals to the API. These include an Agent access grant deleting or moving a Space, minting an API key, changing a usage budget, domain transfer out, unblocking share links, and an agent connection creating a new Share entry. MCP also leaves locked asks to the API where older replicas enforce them on the same route.
MCP keeps its first prompt for newly covered asks because the policy read and the write can reach different API replicas. For example, a Space reference, a parent-authorized subteam write, a forward promotion, or a Share update can prompt again when the API also asks.
Protocol eras
Both stdio and hosted Streamable HTTP serve two protocol revisions from one set of registered tools, resources and prompts.
2025-11-25 and older ("legacy"). initialize negotiates the protocol and returns server
capabilities. Hosted HTTP does not issue an Mcp-Session-Id or retain a transport session.
Each request is authenticated independently. OAuth user grants can remember the client's name
and App support for requests that omit them, including on a fresh replica. Shared API keys and
device credentials require per-request hints; without App capabilities, approvals use browser
links. Explicit per-request capabilities override saved hints, and a different client identity
cannot borrow them. Saving presentation hints is best-effort. Hosted legacy requests use chat choices for forms because they have no callback channel.
On-Device stdio and the local HTTP debugger retain their sessions, including client callbacks
for elicitation and roots.
2026-07-28 ("modern"). There is no initialize and no session: server/discover reports the
capabilities, and every request carries its protocol version and client capabilities in a _meta
envelope. Streamable-HTTP POSTs must carry Mcp-Method (and Mcp-Name for a named call) — a POST
without them is refused. Every result carries a resultType, and tools/list, resources/list,
resources/read and server/discover also carry ttlMs/cacheScope.
There is no server→client request channel on the modern era. Where the server needs input it
returns an input_required result and the client retries the same call with the answers plus the
server's opaque requestState — so handlers are written to be re-enterable, deriving where
they are in a flow from ctx.mcpReq.inputResponses / ctx.mcpReq.requestState(). The same
handlers serve local 2025 clients through the SDK's legacy shim, which performs the round trip as a real
server→client request. Hosted 2025 calls use browser or chat continuation instead.
Our requestState is a plain structural reference, not a sealed blob:
everything it names is authorized on use through the caller's own credential-scoped approval store
(the durable Postgres store on hosted). The reference needs no shared signing key or
per-deployment configuration.
A paused operation call persists its approval. A URL-elicitation client without Apps receives an
input_required result with the approval URL and re-enters the same protocol call after the
browser decision. Other model-driven clients use resume_execution. In an App-capable client, the
first call returns the approval card. The card records the user's decision, calls
resume_execution itself, shows the receipt, and tells the agent through model context (or one
chat message on a host without it). The model reads the result once more with the same
executionId. If the card cannot resume (no server tool calls, or the call fails), it falls back to
the chat message and offers Try again. Several actions decided together go back to the agent,
which resumes each.
Approvals that wait on the same connection show together. When the card reads its approval, it
also gets the connection's other waiting plain confirmations (pendingApprovals, up to 20), each
with its review facts and the chat that asked. Each pause saves a hash of the host's conversation
id (openai/session or com.anthropic/session in the call's _meta, else the transport session).
Hosts send no chat title, so the card sections them under This chat, Another chat (or Other chat
N), and Chat not identified, this chat first and oldest first within each. This chat's ones start
checked; other chats' ones start unchecked. Approve or Decline then applies to this approval and
every checked one: decide_execution_approval takes them as alsoDecide, decides each only if it
still waits on this connection, and reports each outcome in alsoDecided. They get a plain yes or
no, never form values or an "always allow". The message the card sends names only this chat's
executions to resume; other chats' decided actions continue in their own chats. Agents are told to
make independent calls that ask first together, so one card covers them.
App reads and decisions also require a private token bound to that exact approval.
The server delivers it only through tool-result _meta; public receipt IDs and
App visibility metadata do not authorize a decision. Pending resumes preserve
the token. Model-visible content and activity transcripts exclude it.
The signed-in browser approval page uses its existing person-session authority.
Browser-only clients keep the first call open while the user decides. On-Device callers include
the executionId, explicit action, and requested form content in that call.
Hosted HTTP has no transport sessions, owner leases, or session-routing conflicts. Both protocol eras scope approvals and activity to the caller's credential. Browser-approval snapshots and decisions are encrypted in Postgres, so the signed-in approval page can land on any API replica. Operation calls, their results, immutable approval snapshots, private approval tokens, and API confirmation continuations are encrypted in Postgres. A paused hosted call holds nothing in process memory. The local HTTP debugger's App-only approvals use the same journal, kept in its process memory. Any replica can resume a paused call from its journal after a restart. Completed operations replay their saved results; they never dispatch again. A database lease fences concurrent resumes. An execution belongs to the connection's authorization (principal, grant, and OAuth client), which also partitions its storage. Approving more access for it, a team access or temporary-access approval, and a token refresh keep paused work resumable. Every live call uses the current access.
The journal is a small header plus one append-only row per outcome, so a checkpoint writes only
what is new. The hosted store compresses each value before sealing it, so a checkpoint writes about
a sixth of the bytes that sealed text would. A call that may change state is marked before it dispatches and its outcome is saved
before it returns. Reads (GET operations) commit with the next such write or pause: after a stop
they run again, and nothing that changes state ran after them. A finished execution keeps only its
answer. One execution may save 32 MiB of outcomes; past that it stops with
execution_journal_too_large.
If a process stops after dispatching an operation but before saving its result, resume reports an uncertain outcome. Inspect that operation before starting another execution; the server never blindly repeats a possibly committed mutation. Execution records and terminal receipts remain available for 24 hours; approval deadlines still apply. Deploy the additive database migration before the new server. Pauses created by the previous in-memory implementation cannot be recovered.
Preferred for checkout-aware work: let the agent config run the Spacefast CLI as On-Device MCP over stdio:
sf setup agent --agent auto --local -y
sf mcp install --agent codex --local{
"mcpServers": {
"spacefast": {
"command": "npx",
"args": ["-y", "spacefast", "mcp"]
}
}
}Advanced and administrative operations are tools too, except the dashboard-only operations listed under Tools.
For local protocol and tool debugging, launch the MCP Inspector with the checked-in
mcp-inspector.config.json. The command starts one Spacefast HTTP server at
http://127.0.0.1:6279/mcp, then opens Inspector with MCP Apps enabled. Local workspace and
publish paths stay bounded to this checkout:
bun run dev:mcp:debuggerTools
Hosted and On-Device MCP expose each eligible API operation as a tool named by its operationId,
with the operation's description, input and output schemas, and safety annotations. Writes can
pause for approval.
resume_execution— continue the exact paused operation call identified byexecutionId.
Capabilities live in the operation catalog. Work mode, comments, annotated page screenshots,
traffic rules, and content dashboard sign-in links are API operations. Their guidance is one
section each in the server instructions and the spacefast://skills/api resource, generated from
API_CAPABILITIES in @spacefast/common/docs/mcp-prose. To teach agents something new, add a
section to API_CAPABILITIES rather than a new tool.
Some operations stay out of the agent catalog. DASHBOARD_ONLY_OPERATIONS in
src/tools/operations.ts lists them: redeemPlanCode, requestSpaceContentRest,
runSpaceWpCliCommand, the domain chat's continueDomainConversation and
classifyDomainMessage, and the SSH domain search's card entry (getDomainPurchaseCardEntry,
createDomainPurchaseCard, getDomainPurchaseCardConfirmation,
returnFromDomainCardConfirmation). They are not tools, and no tool calls them. The dashboard, the
CLI, and the API keep them. The domain chat operations send a whole transcript to a model, so agents
find names with searchDomains, which starts from one naming brief. Card entry takes a card a
person types into the terminal; an agent never handles one. Domain purchases are operation
tools: with purchasing power (billing:purchase) an agent charges the team's saved payment method, and
without it the purchase returns a confirmUrl for its person.
Operations that accept only a browser session and client-protocol operations are also outside the
catalog. Connector administration is Spacefast API work, so it is tools: the team's sources,
accounts, tool rules and run history (/v1/connectors/...), a Space's connector roles, and the
team's site-serving requests. Calling a connected service is not: running a provider tool
(createConnectorRun, resumeConnectorRun) and listing a connector's or account's provider tools
go through search_connector_tools on On-Device MCP (see below), and the logo image and the
dashboard's OAuth callback (completeConnection) belong to the browser
(CONNECTOR_GATEWAY_OPERATIONS in src/tools/operations.ts). Hosted MCP lists only the operations
its OAuth resource can authorize: listSpaceConnectorBindings, requestSpaceConnectorServing,
getSpaceClient and listTeamExternalAccessTeamConnectors need no connector scope and are on both
runtimes; everything else needs one, so only On-Device MCP, on the CLI login, lists it. Binding a
role, unbinding it, revoking a visitor connection, approving or requesting site serving,
disconnecting or deleting an account, source or tool rule, creating or changing a tool rule, and
turning on an account's site serving ask the user first (spacefastOperationNeedsApproval in
src/approval-policy.ts), like making a team role public: a bound role lets every viewer of the
Space read through that account. An updateSpace that
changes config.connectors asks too, even under Vibe it.
A few focused tools sit beside the operation tools:
publish— publish a new inline artifact. On-Device MCP also accepts a local filesystem path and owns anonymous creation and claim handoff. It is not a replacement for source editing.operation_status— continue a pendingpublishoperation until it settles.- Space App launchers — open each read-only Space view through its own named tool.
show_domains— open the Domains App: search names, compare availability and prices, show public WHOIS details for taken names, and show the status of names the team holds. To buy, the App uses the person's saved owner details for the team or asks for them in a form, then callspurchaseDomain. With purchasing power the team's saved payment method pays at once. Otherwise the App opens the purchase'sconfirmUrl. A host without MCP Apps getscheckoutUrlonce the team is known: the agent appends the chosen names, and the person adds owner details and pays there.choose_space— choose an existing Space when the target is unclear. Uses a rich form, standard form, or chat choices according to host capabilities and transport. Hosted legacy connections, includingsf mcp proxy, return chat choices. The rich picker includes thumbnails, Space previews, and optional next-step suggestions. Selection does not approve or run a write.open_local_file— show a workspace file in ChatGPT through On-Device MCP.search_connector_tools— On-Device MCP only. Search the team's connected third-party services, call one discovered operation with JSON arguments, and resume a paused call after the user decides at its approval URL. It runs on the CLI login through the public Connectors API and needsconnectors:read, plusconnectors:executeto call or resume. A call that parks for a person returns the standarduser_approval_requiredpause (approvalOwner: "api", the run'scxr_id asexecutionId):resume_execution({ executionId })waits up to 45 seconds for the decision on the same saved run, and{ action: "resume", executionId, team }still checks it once. Neither approves it. Hosted MCP, andsf mcp proxythat relays it, have no connector gateway, and hosted OAuth grants no connector scopes.cli_login— sign in the localsfCLI with this session's access. Use it only when the user explicitly asks; itsloginUrlcan be shown on request.
Beside the operation tools, hosted MCP lists 20 model-visible tools, including the two Claude
Design tools. On-Device MCP drops those two and adds search_connector_tools, for 19; its ChatGPT
profile also gets open_local_file, for 20. App-only helpers such as read_space_app carry
ui.visibility: ["app"] and are not part of that count.
Hosted MCP also supports Claude Design's Send to integration:
import-claude-design-from-urlaccepts a requiredurland optionaltitle. It fetches the self-contained HTML once from an HTTPSclaudeusercontent.comsubdomain, publishes it asindex.htmlin a new Space, and returnsImported: <Space dashboard URL>. It requirespublish:writeand keeps the default Space access policy.get-design-import-job-statusaccepts the returnedjob_idif the import is still processing. It requiresspaces:readand returnsprocessing,donewithdesign_url, orfailed.
Import calls use the existing OAuth and Streamable HTTP transport. The source download rejects redirects and oversized files, and the import has a 290-second timeout. A Claude connector directory listing is required for discovery in Claude Design; adding the tools does not create that listing.
Fourteen Space Apps each have their own launcher tool with input fields
at the top level: show_space_preview, show_space_deployments, show_space_domains,
show_space_analytics, show_space_comments, show_space_source_files,
show_space_source_changes, show_space_source_history, compare_space_source_versions,
compare_space_deployment_versions, show_space_build_logs, show_space_database,
show_space_share, and show_space_apps.
For example, a deployment view uses show_space_deployments({ space: "spc_..." }).
The canonical mapping lives in @spacefast/common/docs/space-app-tools; prompts and App
actions use the same call shape.
AGENTS.md holds the rules for writing an App.
App documents are Preact TSX applications under src/ui/client/ paired with shared and per-app
stylesheets in src/ui/styles/ and rendered into self-contained HTML documents via
src/ui/render-document.ts. They import preact and preact/hooks directly, without
preact/compat, so handlers and attributes follow the DOM: onInput for text fields,
onFocusIn/onFocusOut for bubbling focus, and kebab-case SVG attributes. Icons are named
exports of components/Icons.tsx, so a bundle carries only the glyphs its App uses. Each App's
stylesheet is the shared sheet plus its own, trimmed by src/ui/trim-styles.ts to the rules
whose classes appear in that App's script. Write class names out in full, or with a fixed start
that ends in a hyphen (tok-${kind}); a name assembled any other way loses its styles. The
build precompiles each entry and minifies each stylesheet with esbuild, then embeds the
compressed results in dist/server.js, including when the CLI bundles
it again. Each Space App has a content-hashed resource URI
(ui://spacefast/space-<view>-<sha256>.html) and includes only its own bundle and stylesheet.
Related source views share SourceApp.tsx. An App action that calls the API calls its operation
tool by name ({ name: "stageSpaceSourceWorkspaceChanges", arguments }).
read_space_app is App-only and handles refresh, pagination, navigation, comparison, source
search, and database row pages. The Database view is read-only; the SQL console lives in the
dashboard and sf db console. Source workspace lifecycle, editing, staging, commit, sync,
recovery, conflict, and build operations are operation tools.
Custom domains belong to a Space. Use the generated API operations under
/v1/spaces/{spaceId}/domains to attach, inspect, check, select the primary domain,
or remove an attachment. Attach either the apex or www hostname once; Spacefast
manages its counterpart automatically. Configure DNS at the domain's DNS provider.
WP.Cloud owns verification and SSL provisioning. Apex/www redirects remain runtime
routing behavior. The domains App uses spaces:read and domains:read. It shows all attachments
without pagination.
App documents compose their UI from the shared design system in src/ui/styles/design-system.css
and src/ui/client/core/bridge.ts (tokens, app-* components, host-context application, and
shared CSP in src/app-design-system.ts): inline cards sit on the host's ground, and fullscreen
Apps become a Spacefast canvas page. Follow DESIGN.md and the host rules
documented beside the shared implementation.
Refreshes retain the last successful view while loading or recovering. Deployment and domain lists expose Load more; publish cards confirm completion only when the receipt does and offer a browser URL when the host cannot open links.
Hosted accepts inline files only. On-Device additionally accepts publish({ path }), bounded to
the configured local root on Linux. Neither runtime exposes general filesystem tools. Inline-file
publishing works on every supported Node.js platform.
For an inline Sell store, include sf.jsonc, the product JSON named by
sell.products, and every declared digital asset in files (binary assets use
encoding: "base64"). MCP validates the catalog, uploads paid bytes with commerce
protection, and attaches verified receipts to the publication. The product JSON
and paid files stay out of public content, including compiled output. Inactive
digital products still require their private assets. Sell requires a signed-in
connection, a team-owned Space, and the team's Sell feature. New stores create
that Space first with a retry-safe request ID; their connection also needs
spaces:write. Use sell.mode: "test" for previews. Supply the same requestId
and unchanged files when retrying after a timeout. If a later step fails after a new
Space was created, the error reports its spaceId and original requestId.
Resume with that spaceId after correcting the error instead of creating another
Space. On-Device saves the link immediately, so a corrected publish can also reuse
the workspace's linked Space. A read-only checkout or a link to another environment
does not block publishing; recovery uses the Space ID when the local link cannot
be saved.
Inline Functions files publish as source, and the platform builds the worker at
finalize, the same as for every other publish path. That build installs no npm
packages: a worker that imports them is bundled into one entry file named in
sf.jsonc's runtime.entry, or published from its project. On-Device
publish({ path }) compiles the project with its declared installed
dependencies. It keeps source bytes from the collected upload and excludes
dependency files and private project files from the published content.
Hosted requires authorization before every protocol method, including discovery, and never falls
back to anonymous publishing. On-Device may start an anonymous publish when access is omitted
and its account credential is missing or rejected. Explicit access settings and existing Space
publishes remain protected.
ChatGPT plugin extensions
These integrations follow OpenAI's ChatGPT UI guide, extension contracts, and MCP Events guide. Availability depends on the host platform and its advertised capabilities.
The plugin includes an onboarding skill and host entrypoints in addition to model-visible tools:
- Your Spaces opens the Space Library from the sidebar or a conversation tab. Its App-only
open_spacefastentrypoint accepts{}. Search and pagination useread_space_library./spaces/<id>deep links select a Space. Display controls follow the host's supported modes. - Composer mentions use
search_space_mentions, advertised as theopenai/mentionsserver capability. It finds Spaces and domains; a query that starts with a Space name (pricing v12,pricing hero) also finds that Space's versions and comment threads. Each result is aspacefast://resource link thatresources/readresolves to a short summary. Add to chat attaches the selected Space when the host supports model context. Removing an attachment leaves it removed. Mounted Library tools let the model read the view, search, and select without automatically attaching context. - Wide panes show Spaces as a grid of page previews; narrow ones keep the list. Preview URLs
travel only in
_meta["spacefast/library"], never in model-visible results. - An opened Space offers Next steps (review it, make a change, use a custom domain, share
it, and more) when the host supports
ui/messagetext. Each one sends a prompt for that Space to this chat; OpenAI hosts also get a titled Space item. Selecting a Space or sending a step does not attach the Space as model context. - Native plugin settings use
read_plugin_settingsandupdate_plugin_settings. Their results follow the host's raw settings format.pageSizeaccepts 10–50 (default 20);showStatusdefaults to true. Preferences belong to the authenticated user. Team and service subjects use defaults and cannot update a creator's personal preferences. - Desktop HTML Preview opens
.htmland.htmfiles throughopen_space_file. It reads the exact host resource URI. Explicit Save uses the host's write capability and ETag. Saving changes the opened file; publishing remains a separate action. Conflicts retain the draft.
On-Device MCP also exposes open_local_file to ChatGPT clients for a regular file inside its workspace root.
It rejects absolute inputs, paths outside the root, symlink components, and directories.
The server returns the verified absolute path without reading the file. A supporting ChatGPT host
shows an explicit Open in ChatGPT action; the App sends openai/files/open after that click.
Hosted MCP does not advertise this tool.
The Library and HTML viewer use hashed UI resource URIs. Host-specific presentation and context metadata are capability-gated. The onboarding skill checks account access before reporting that the connection works; installation does not create a Space or an event subscription.
Durable events
Hosted MCP exposes events/list, events/subscribe, and events/unsubscribe for OAuth connections
with a user grant. ChatGPT uses MCP 2026-07-28 for this flow. Space lifecycle subscriptions filter one
spaceId. Their names are build.succeeded, build.failed, version.ready,
version.failed, channel.promoted, domain.verified, domain.verification_failed, and
domain.control_lost. Discovery and delivery check the grant's current scopes and Space access.
approval.requested and approval.resolved watch approvals on the subscribing OAuth connection.
Use arguments: {} before calling operation tools to watch future approvals, or
arguments: { executionId } to watch one saved execution owned by that connection. A paused
call's receipt on such a connection carries subscription: { name: "approval.resolved",
arguments: { executionId } }, so the host can hear the decision instead of waiting for the person
to say they made it.
Both MCP approval cards and API-owned approvals produce events. Payloads contain executionId,
immutable approvalId, owner (mcp or api), status, expiresAt, and the authenticated
approval page url. Requested events have status pending; resolved events have status
approved, denied, or canceled. Expiry is communicated by expiresAt, without a separate
expiry event. Events contain no approval capabilities, continuation tokens, arguments, or reviews.
MCP approval links include the immutable approval ID; an old link cannot display a later request.
A resolved event means the decision was saved. Call resume_execution with its executionId
to continue the call and read its outcome. An approval.resolved subscription with
arguments: { executionId } also catches up when it is created or refreshed: if that execution's
latest approval was already decided, its approval.resolved event is delivered once to the
subscription, but not when a newer approval of the execution is still pending. Connection-wide
subscriptions never receive earlier transitions; use the saved execution's receipt to inspect its
current state. Delivery may be retried or arrive
out of order: deduplicate eventId and keep a recorded decision when an older requested event arrives.
domain.checkout_paid watches one domain purchase, so the agent can continue after a person
confirms and pays it. When purchaseDomain returns a purchase that still waits for a person or
their bank, its receipt carries subscription: { name, arguments: { teamId, purchaseId } }. Pass
it to events/subscribe with your delivery. Only the person who opened the purchase can watch it,
and only while their grant can read that team's domains. Other connections get no hint. The event
is sent once, when the purchase is marked paid: after the saved payment method is charged, or after Stripe
reports the invoice paid. Its payload has teamId, purchaseId, and domainIds, with no amount,
payment method, or owner details. Payment is not registration: read the domains' registration status next.
A failed, canceled, or expired purchase sends no event, so read getTeamPurchase for those.
This is the one event with catch-up. A subscription created after the payment still receives it.
Subscriptions persist across restarts. The default lifetime is one hour; requests can grant up
to 24 hours. A request with ttlMs: null still receives a finite lifetime. Refresh before the
returned refreshBefore. These events have no replay: responses use cursor: null, and a supplied
cursor returns truncated: true. Committed delivery jobs survive restarts and retry within the
subscription's lifetime. Apart from a paid domain purchase, transitions outside an active
subscription have no catch-up path.
The host supplies the HTTPS callback and signing secret. Verification and deliveries use Standard
Webhooks signatures, pinned public destination addresses, and no redirects. Deliveries have at
most eight attempts with exponential backoff; 410 and 413 stop retries. Expiration, unsubscribe,
or lost access stops delivery. The existing per-account webhook delivery budget also applies.
Apply the database migration and upgrade both API producers and workers before creating event
subscriptions. The separate mcp.event.deliver operation keeps older workers from sending the
legacy webhook format. Older API producers do not create these delivery intents.
Approval transitions and their delivery jobs commit together in Postgres and use
mcp.approval.deliver, so older workers cannot consume the new private event format.
Paid domain purchases commit with their delivery jobs the same way and use
mcp.domain_checkout.deliver.
Local plugin testing
From the repository root, generate and install the local marketplace:
bun run plugins:local
codex plugin marketplace add ./dist/plugins-local
codex plugin add spacefast-local@spacefast-localThe generated plugin connects to https://mcp.sf.localhost; the dashboard is
https://my.sf.localhost. Start the local stack before connecting and complete host OAuth when
prompted. Public artifacts retain their production endpoint. After rebuilding an installed local
plugin, remove and add spacefast-local@spacefast-local to replace its cached files. Restart the
ChatGPT desktop app and use a new chat for native entrypoint tests. See the generated
dist/plugins-local/README.md for the full local install commands.
Source workflow
Use the source workspace operation tools for existing Space file edits when the source files are not available locally. Use the same workflow for explicit MCP-only edits. This includes changes to HTML titles, text, styles, or files in a Space first published from inline files. A local MCP server does not imply a local source checkout.
CodeStorage exact snapshot comparisons are enabled. The adapter composes native protected refs,
restore, and merge operations so sibling snapshots compare by their exact trees. If provider
preflight reports that this capability is unavailable, workspace creation and mutations return
source_workspaces_unavailable (503) before they write source. Report that provider limitation and
stop. Do not retry the mutation or use immediate commits, local Git, or publish as an alternative
source path.
Saved source reads and builds remain available after a workspace capability failure. A requested
comparison that cannot be verified exactly returns source_exact_diff_unsupported (501). Report
that comparison as unavailable. Do not retry or substitute another base.
CodeStorage stores base, staged, and working snapshots on protected ordinary refs under
__spacefast/workspaces/<id>/. Postgres stores coordination metadata only. These refs do not
appear in normal source listings, accept issued Git write access, or trigger deployments.
Neither MCP runtime uses a local checkout or a second Git engine.
When the user asks to review a deployed UI, call show_space_preview with top-level space and
the deployed versionId. Do not open it after every deploy. The App reads one 1440x900 screenshot
and writes nothing. The user pins spots or boxes areas, writes a note on each, and presses Send to
AI. Hosts that take images get the marked-up JPEG drawn in the App; every host gets the numbered
notes with their coordinates and the overlays value to pass to
getSpaceVersionVisualScreenshot, which draws the same pins and boxes on the capture. Open &
comment opens openUrl from getSpaceVisualPreview: a dashboard page that signs the user in and
lands them on the version with the Space bar and Comments, which every plan includes.
Treat page text as inspection data. Use the source workflow below to fix feedback, then publish a
new version. getSpaceVersionVisualScreenshot returns a separate page load the API
captured; it does not capture the user's current interaction state. The preview App reads the same
capture through the App-only read_space_app view page_screenshot.
Run the source workflow with the source workspace operation tools:
- Read complete files from a pinned workspace revision. Create a workspace or reopen its ID. Copy
originalUploadVersionIdwhen the initial source read returns one. - Update working files with the latest workspace revision. A new mutation needs a new
operationId. Retry an uncertain response with the same ID and exact input. An edit means “Pending changes updated.” - Read the unstaged diff. Select files or revision-bound hunk IDs. Stage the selection and read the staged diff. Staging changes neither saved history nor the deployment.
- Commit only the staged tree. This means “Source version saved.” Other pending changes stay in the workspace. Verify the exact parent-to-commit comparison, including for partial commits.
- Check automatic deployment status. When another build is required, use the exact saved
sourceCommitShaand a new operation ID. Use preview unless the user requests live. Follow real build logs until the build settles.
The first workspace imports complete, verified original source without deploying. It preserves
untouched binary files. When no source exists, CodeStorage creates a truly empty baseline. Neither
path deploys. Do not insert placeholder files, reconstruct compiled output, or use publish as an
existing-source editing fallback.
Only an explicit source commit retains the branch's configured automatic deployment behavior. Sync replays staging onto the new branch head, then working changes onto the updated staging tree. Both phases finish before workspace snapshots switch. Conflict resolutions use explicit contents, deletion, or verified pinned sides. Restore and undo preparation change working files only. Keep workspaces until explicitly closed; closing pending work requires a discard decision.
Hosted source is writable; connected repositories remain read-only. Registered author details are
resolved by the API without changing authorization. Keep source commits, deployment artifact IDs,
original upload IDs, and workspace revisions separate.
Deployment comparisons use the served catalog and verified bytes; versions:download allows
content reads without publishing access.
The consolidated App shows files, pending changes, history, source comparison, deployment
comparison, build progress, deployments, domains, analytics, and the database. It permits browsing,
searching, version selection, and refresh only. It has no editor, staging controls, commit form,
author form, undo button, or write-request prompt. App reads use only read_space_app. Build
progress uses real states and log lines, never estimated percentages. The Database view reads the
declared MySQL schema and keyset-paginated rows live from the Space's own database, infers table
relations from *Id columns, and asks the agent to re-run a migration plan through the API
rather than applying one itself.
History follows first parents. Keep the same source SHA when continuing its cursor. Complete file reads have explicit size limits; do not replace files from truncated or secret-filtered previews.
The operation tools come from @spacefast/sdk/openapi.json. A write that needs consent pauses
before the request: every DELETE except a few that lose nothing and one call undoes (canceling an
upload or a pending transfer, an ephemeral branch, a tag preview session, a Space label, a pending
invitation), a named list of writes that lose data, cut off access, redirect visitors, or switch
off review (approval-policy.ts), and source or deployment writes under Manage the code. Closing a
source workspace asks only when it discards pending changes. Other writes run without a pause.
Hosted MCP returns a signed-in dashboard URL. Call resume_execution({ executionId }) right away:
it waits for the browser decision. On-Device MCP can call
resume_execution({ executionId, action: "accept", content: "{}" }) directly, or use decline or
cancel. For an approval the API owns, the model sends only executionId (or action: "wait"):
the call waits for the person's decision on the page. Browser approvals hold nothing in process memory: on resume the saved call replays from
its journal, so no completed call is sent twice.
Call publish directly for local files, a new inline artifact, or an anonymous claim flow. Use
operation_status only to continue that publish. After an API task, open the matching Space
App when the user asks to see the result.
For an unclaimed Space, use the publish receipt as verification. Do not open a Space App until the user claims the Space.
publish returns { ok, tool, summary, result?, error? } as structured content. An operation tool
returns { status, result?, error?, executionId? }, with the API response in result.data.
Failures set isError: true.
Configuration
SPACEFAST_AGENT_CONFIG— JSON config from the dashboard's agent account flow. The MCP server exchanges it for Better Auth OAuth access tokens withprivate_key_jwt.SPACEFAST_API_URL— API origin, defaults tohttps://api.spacefast.com.
Requests identify themselves with X-Spacefast-Client: spacefast-mcp/{version}. Attribution is never
required for a request to succeed and carries no user-identifying data.
Analytics
Against the production API, the server reports discovery, connections, tool and resource listings,
resource and directory reads, native Skills calls (skills/list, skills/get), Tasks calls
(tasks/get, tasks/update, tasks/cancel), Events calls (events/list, events/subscribe,
events/unsubscribe), and tool calls to PostHog. The explicit field allowlist
is registered tool name, duration, error outcome, client category, MCP version, and runtime. Client
categories are claude, openai, cursor, and other. Tool schemas are unchanged.
Tool arguments, results, error messages and codes, free-text intent, resource URIs, URLs,
raw client names and versions, and protocol identifiers are never sent. On-Device events use a
random connection identity and require the current CLI disclosure to have been shown, for example
by sf mcp install. MCP hosts may hide stderr, so starting MCP does not acknowledge disclosure.
The standalone spacefast-mcp entry point keeps reporting disabled.
Hosted reporting checks current account existence and analytics opt-out after the MCP reply,
immediately before sending the event. It keeps no identity cache. Eligible accounts use their
opaque analytics ID; team credentials remain anonymous and personless. At most two database
lookups run concurrently, with a 100 ms budget. A pool without immediate capacity, a failed lookup,
or an expired deadline drops the event without delaying dispatch. sf mcp proxy reports only at
the hosted endpoint, under that account policy. It starts no local collector.
Set DO_NOT_TRACK=1 or SPACEFAST_TELEMETRY_DISABLED=1 to turn On-Device reporting off.
Buffers and network requests are bounded. Stdio close, EOF, and termination signals drain the
collector; hosted shutdown drains it after requests close. Delivery is best-effort.
