Design: the Witchspace MCP server

Design, 24 October 2026. Stage 1 built and live at https://space.witchspace.org.uk/mcp; the rest proposed.

Why

Witchspace is built to work with AI assistants: every content type has a strict schema, and AGENTS.md tells any assistant how to contribute well. The Get involved page has promised "a Witchspace MCP server so assistants can validate, preview and balance-check content directly". This is that.

MCP (the Model Context Protocol) lets an assistant use tools a service provides. With a Witchspace server added, someone can say "design a pirate gunship for Witchspace" and their assistant can check its own work against the real rules, draw it, compare it with the class it belongs to, and know which tasks are wanted, without the person needing GitHub, code or our repo on their machine. That's "no wall" from the community platform.

Principles

The Build connector (Mark, 27 October 2026)

Mark's point: the Build side of Witchspace feels out of reach if you don't code, because every road ends on GitHub, and we haven't fully embraced AI tools. Most people who'd design a ship or write a saloon regular already have an AI assistant. So the connector should be the whole workshop, not just a checker: you talk to your assistant, it does the files, the rules and the checks, and you do the imagining, the judging and the play-testing.

The loop, all in one conversation:

  1. Pick something. "What does Witchspace need that I could do?" The assistant reads help wanted, suggests tasks that fit, and claims one for you, so two people don't build the same prison module.
  2. Make it. A guided workshop (an MCP prompt: they show up as ready-made starters in Claude and others) walks you through it: the brief, the rules, two or three real examples, then drafts with you.
  3. See it. A preview after every change: the ship beside a Cobra, the module coupled into a Titanoboa line-up, the regular in a saloon scene. Where the client can show interactive views inside the chat (MCP Apps), it's the game's own wireframe renderer, turning, so you can drag it round.
  4. Try it. A link that opens the game with your draft in it, in a quiet test system: fly your ship, dock at a yard fitted with your module. Drafts are private, expire after a week, and never reach shared space.
  5. Hand it in. Sign in once (the same email code as the game), and submit. It's credited to your callsign, marked AI-assisted, and you can follow it, answer review notes and revise, all from the conversation.
  6. Get it in. A maintainer reviews the queue. Accepting it opens the pull request for you, credited, and you get a notification. When it's in the game you get the in-game reward (the Contributor rung; a Wexley-Yorozu commission for a module), and your name is on it.

Nobody needs GitHub, the repo or a terminal. People who code still can, and the same checks run in CI.

What's new, beyond stage 1

Area Tools and prompts
Workshops (prompts) first_ship, design_module, write_regular, write_news_event, critique (an honest second opinion against the design principles)
Content types validate_* and preview_* for each format as it gets a schema: modules first (schemas/module.schema.json exists), then characters, news events, trails, company files
Context preview_lineup (a module in a Titanoboa), compare_fleet (beside every ship in its class), lore_check (names, tone, no real companies, every story has people)
Try it playtest_link: stores a checked draft for a week and returns a /play/ link that loads it in a test system
Hand it in sign_in (OAuth, the client's own sign-in screen), submit, my_submissions, revise, withdraw
Community claim_task / release_task, ideas (search), post_idea and vote (signed in), my_credits (accepted work, commissions, rank)
Maintainers (admin only) review_queue, review (accept, or send back with notes), which opens the pull request from a GitHub App

Rules that keep it safe and fair

How it's built

On the Worker that already serves it. Sign-in is OAuth 2.1 (what MCP clients expect for remote servers), with our email code as the login step, so the account is the game's account. Submissions, claims and drafts are tables in the Accounts Durable Object beside the saves. Previews are SVG today; the in-chat viewer is a small HTML resource running the game's renderer, served where the client supports it. The pull request is opened by a GitHub App with access to this repo only.

The web form and the ship workshop page on the site use the same submission API, so a person without an AI assistant gets the same path (the community platform, stage 3).

The plan (27 October 2026, agreed with Mark)

Hand it in comes first. The Build adverts on /jobs/ now offer real in-game fees, and today the only way to hand anything in is a GitHub pull request. An assistant can already make and check a ship with stage 1; what's missing is somewhere to send it. Building the submission system first also gives the site's form and ship editor their back end, so people without an AI assistant aren't left out.

What the clients can do (checked 27 October 2026):

The stages, in order:

# Stage Where What
1 Submissions Server The submission system on the Worker, one API for every way in. The maintainers' review queue. Accepting opens the pull request.
2a Submit from the connector Server OAuth sign-in through the client's own screen; submit, my_submissions, revise, withdraw; review_queue and review for maintainers.
2b Submit from the site Site A submit form (paste or upload a file, or fill in the fields) and My submissions; then the ship editor, stage 3. Both use stage 1's API.
3 Workshops Server The prompts (first_ship, design_module, write_regular, write_news_event, critique) and validate_module, preview_module, preview_lineup.
4 Try it Server The in-chat viewer (MCP Apps), then playtest_link.
5 The rest Server Other content types as they get schemas; claims, ideas and credits.

Stage 1, the submission system:

What Mark does (the exact steps will be written out when we get there):

Still to decide while building: whether sign-in uses Cloudflare's OAuth provider library (which keeps its grants in a KV namespace: one new, free binding Mark would create) or our own tables in Accounts. Either way the login step is the game's email code, so the account is the game's account.

Signing in from an assistant (stage 2a, building)

Handing work in needs an account, so the connector gets a second address that signs you in. Reading and checking stay open to everyone at the first.

Address Sign-in Tools
https://space.witchspace.org.uk/mcp none the stage 1 tools: read, check, draw
https://space.witchspace.org.uk/mcp/build your Witchspace account the same, plus submit, my_submissions, submission, revise, withdraw

How signing in works. MCP clients sign in to remote servers with OAuth 2.1, so the Worker is a small OAuth server whose login step is the game's own sign-in:

  1. Adding /mcp/build, the client is told to sign in (a 401 pointing at /.well-known/oauth-protected-resource/mcp/build) and finds our authorisation server (/.well-known/oauth-authorization-server).
  2. It registers itself (dynamic client registration, POST /oauth/register, or a client metadata document, where the client's id is a URL) and opens /oauth/authorize with PKCE.
  3. The Worker checks the request and sends the browser to https://witchspace.org.uk/connect/?request=<id>, a page on the site. That page uses the game's sign-in (the email code), so someone already signed in to the game in that browser just clicks Allow. A callsign is needed first, since work is credited to it.
  4. Allowing sends the browser back to the client with a code, which the client trades at POST /oauth/token for an access token (an hour) and a refresh token (30 days, replaced at each use).
  5. The connector's tools act as that account. Submissions from it are marked via: connector and AI-assisted.

Only the hashes of codes and tokens are kept. Signing out of the game doesn't revoke a connector; deleting your account does, and so does Disconnect in your list of connected assistants (GET /me/connections → {connections: [{client, name, uri, until}]}, and DELETE /me/connections?client=<id>, which signs that assistant out at once).

As built (27 October 2026)

The live viewer (built, 27 October 2026; Mark: "the wow moment")

view_ship (on both addresses: it only reads) shows a ship turning in 3D inside the chat, where the client shows MCP Apps (claude.ai, Claude Desktop, ChatGPT). Pass a ship file or a fleet ship's id.

The connect page: the contract with the site

The page lives on the site, so it shares the game's sign-in. It calls two endpoints (CORS for our sites, like /me):

What the page says: who is asking (client.name, which the client chose, so say "says it is"), what it may do ("hand in ships and modules as CMDR X, and see and change the ones it handed in"), and that nothing goes public until a maintainer accepts it.

1. Contributors (built)

Tools:

Tool What it does
validate_ship Checks a ship file against schemas/ship.schema.json and the geometry rules in validate.ts (closed, convex parts, face winding, size), and the written rules: a class, a maker, a reason to exist (ships, classes and makers), and the homage rule (evoke, never copy an on-screen design). Returns every problem, with how to fix it.
preview_ship Draws the ship as wireframe pictures (three-quarter, front, side, top) with a Cobra Mk III beside it for scale, returned as an image.
balance_check Compares the ship's stats with its class in the class table: "fast for a bulk trader, and its hold is a third of a Python's".
list_ships, get_ship The fleet, and any ship's file, so an assistant can learn from real ones.
designs, get_design The roadmap and every design document: status, stages, summary, and the text.
help_wanted Every open task, by skill (ships, writing, art, playtest, design, code), with the design it belongs to.
galaxy_system Any system by name or number: government, economy, tech level, population, position, neighbours within 7 light years, and its description, so stories and missions land somewhere real.
worldbuilding The tone guide, the companies and the people, for writing that sounds like Witchspace.

Resources: the ship schema, AGENTS.md, CONTRIBUTING.md, the worldbuilding guide and the lore, so an assistant can read them before it starts.

How it's built. A route on the existing Worker (server/src) speaking MCP's streamable HTTP transport. The JSON Schema check is compiled at build time (Ajv's standalone output), since Workers can't compile code at run time; the geometry checks, the galaxy generator and the doc headers are plain TypeScript the Worker can import. Previews are drawn as SVG on the server (the same projection the game uses, without WebGL), so no browser is needed. A small stdio wrapper (npx tsx tools/mcp.ts) serves the same tools locally.

Limits. Rate-limited per address; inputs capped in size; no accounts needed for stage 1, since nothing is written.

2. Submissions

Superseded by The Build connector above, kept for the history. submit_ship sends a design that has passed validate_ship to the submission queue planned in the community platform (stage 3, the ship editor), with the person's name or callsign and a note, and returns a link to watch it. A maintainer turns good ones into pull requests, credited. This needs the queue to exist first, and an account (a sign-in link, as the game already uses) so submissions have an author and can be limited.

3. Players

The live galaxy, from the same seed and clock every commander shares, public information only:

Tool What it does
news_at The news as it reaches a system now, as its station's News tab shows it.
yards Where Wexley-Yorozu's Titanoboa is building, and what stage it's at.
firsts Who first surveyed a world: the names on the chart.
rules How something in the game works, from the design documents ("how does insurance work?").

Not included, on purpose: prices, routes, the best trade, where a pirate or a Legend is. A commander's own save stays private; if commanders later want their assistant to see their own commander (cargo, contracts, standing), that's an opt-in with a sign-in, and still no answers the game should make them earn.

4. New content types

As characters, events, trails and missions become data files with schemas, each gets its validate_* tool and examples, and the worldbuilding checks (every story has people, with their glad, sad, mad and bad moments; no real company names).

Open questions

Think something here should change? Say so on the ideas board, where others can vote it up, or email hello@witchspace.org.uk. If you code: this page is docs/design/mcp-server.md on GitHub, open to pull requests.