Skip to content
Mocky/Docs v0.2
Self-hosting

Connecting an assistant (MCP)

30 min read

Mocky can be an MCP server: Claude, ChatGPT or another MCP client connects to it and acts in Mocky on behalf of one account. The person signs in to Mocky, says yes once, and from then on the assistant can work with their projects.

It is off by default, and off means absent: no endpoint, no discovery document, nothing a scanner could find. It is switched on by an administrator, for the accounts they choose, and only on an instance served over HTTPS.

An assistant configured by hand — an assistant like Claude, or a script — can use an assistant key instead: a fixed key the account makes for itself, read-only or read and write.

What an assistant can do#

ToolWhat it does
mocky_guideThe guide written for the assistant itself: the steps from a request to a design, which tool when, the screen types, the pictures, what never to do. It is told to read it before its first design; also served as the resource mocky://guide.
create_designGenerates a new screen from a description, always in a new project, and returns a picture of it and a link to it in Mocky.
add_screenThe same, into an existing project — where the screen follows that project's art direction. When the person refers to that project — by name, by link, or plainly ("my bakery site"), found with list_projects; the assistant asks which when two could be meant, never moves a new, unrelated design into a project because it looks related, and the answer says which project the screen went into.
update_projectChanges an existing project itself, with no model: its name, its own art direction (the DESIGN.md its next screens follow; "" goes back to the account's) and its rules. Screens already made keep their look. get_project with direction: true shows the current ones first.
rename_screen, duplicate_screen, delete_screenA screen renamed; copied beside itself (no links, no notes), to try a change on the copy; or removed, as Delete does on the canvas — only when the person asked, after the assistant has named the screen back to them.
edit_templateOpens one of the account's templates as a project linked to it — the same project again if it is already open — to change it with the tools above.
update_templateWrites that project back into its template: screens, direction, rules and settings; the name and section stay.
create_campaignOne brief made into several pieces — an A3 poster, an A4 flyer, Instagram post and story, LinkedIn and Facebook visuals (formats) — in a new project that is the campaign. The key facts are read from the brief first; the answer lists every piece with its link.
create_publicationA magazine or a book (publication): four pages — front cover, two inside pages, back cover — under one art direction of its own, in a new project. add_screen with screen_type magazine or book in that project then adds one inside page per call, before the back cover.
get_designWaits for a design that is still being made, then returns the same.
list_projectsThe account's projects, each with a link.
get_projectOne project's screens: name, device or page size, the request that made it, the fields to fill with their current value, a campaign piece's format, a link.
get_screenshotA picture of a screen that already exists.
export_screenA screen as a file, as the Download dialog makes it: png (to publish — a post at its exact pixels), pptx (texts editable over the design), pptx-edit (Canva / PowerPoint with every piece taken apart) or pdf (documents). Answers a download link that works for a day; changes nothing and calls no model.
list_templatesThe account's project templates: names, sections and screens, never their code.
search_free_imagesFree photos from the libraries this Mocky is connected to (Pexels, Pixabay), as thumbnails the assistant looks at.
add_imagePuts one picture in the account's library for a design: a free photo chosen above, a picture from the conversation (one ChatGPT generated, or one the person attached), or a public address.
edit_designChanges an existing screen as the person asks — "make the header dark" — keeping the rest. Returns a picture and the link.
polish_designMocky's quality pass on a screen: corrects what it finds and scores it out of 20. Says what it fixed and what is left.
audit_designThe SEO and accessibility report of a screen: two scores and the named findings. Changes nothing; deep adds the model-judged questions.
audit_projectThe audit of a whole project against a grid drawn from its goal: strengths, observed problems, priority improvements, expected elements found or not. Reuses the project's grid, so it compares with the last audit. Changes nothing.
fix_accessibilityThat report's own correction: fixes the markup, the screen looking the same.
translate_screenA translated copy of a screen in language (fr, en, es, de, it, pt, nl, pl, sv, da, ca), placed right of it; the original does not change and only the words do.
fill_fieldsNew values in a screen's fields to fill, by field name, in rows: one row is one filled copy beside the screen (into: "here" fills the screen itself, revertible), several rows a series, one copy each. No model is called; a picture field takes an image_id from add_image. A screen without fields is refused, with how to choose them.
write_publication_packFor a campaign project: the publication pack — a caption with hashtags for Instagram, Facebook and LinkedIn and a text alternative per piece, in one model call — kept in the campaign and handed back to the assistant.
check_documentThe pre-export check of a document: picture sharpness, margins and safe zones, bleed, cut text, QR codes, what Canva flattens. Changes nothing, calls no model.

And seven prompts (the "/" menu in Claude), each a starting message that already names the right tools in the right order (server/mcp/prompts.js): new-design (a short interview, then the design), social-post, printed-document (flyer, poster, menu, CV…), landing-page, add-to-project, change-screen and review-screen (the quality pass, or the accessibility audit). Every argument is optional — picked from a menu with nothing filled in, a prompt still starts a sensible conversation.

  • Questions first. The assistant is told to make sure it knows what the screen is, who it is for and the tone wanted, and to ask at most three short questions when the person has not said. If a request still arrives with almost nothing in it ("un site"), Mocky does not guess: it hands the assistant three questions, in the person's language, and generates once they are answered.

  • The screen type. The assistant chooses one of Mocky's types (the composer's "Type d'écran": dashboard, landing, flyer, CV, Instagram post…), which sets the format — a flyer is an A4 page, an Instagram post a 4:5 image. A size the request names ("en 1:1", "a story", "A3") goes in page_format, or is read from the words when the assistant does not pass it: a post asked for in 1:1 once came back as a square drawn inside a 4:5 page, with a white band under it. When it does not, Mocky reads the type, and the device, from the request's own words ("un flyer", "une appli mobile"); the answer says which type was used.

  • Pictures: the assistant chooses. Not Mocky's model: the assistant searches the free libraries and looks at the thumbnails itself, or brings a picture it has, adds it with add_image, and passes it to the design with what it is for ("hero: the storefront"). The page is told to use each one, by its address on Mocky, and to invent no other. A picture by address is the person's own upload, with the same responsibility for its rights; downloading it goes through the SSRF guard on every redirect, is capped at 15 MB, and keeps only a JPEG, PNG or WebP — never an SVG. Free photos follow the account's access to them (Admin → Providers). Claude does not generate pictures; ChatGPT can hand over one it made, through the file links of its Apps SDK.

  • When the assistant brings none. A post or a document still gets its picture, the way the composer's "Images" choice gives it one: picture_source auto (the default) takes a free photo when the account has them, a generated picture otherwise; free, generated or none say it outright. The answer always says which picture the screen ended up with. The assistant is asked to say what that picture should show (picture_subject, in English): a subject guessed from a request written as an instruction ("créer directement dans Mocky le visuel…") once found a war grave for a food festival. And in auto, a free photo is taken only when Mocky's model can look at the candidates; otherwise the picture is generated.

  • Muse. On by default in create_design: a new project's first screen sets the direction every later one follows, and left to the assistant, Muse almost never ran. Off in add_screen, where the project already has its direction; muse turns it on or off either way. The picture_subject reaches its dossier, which plans the picture. With pictures supplied, Muse looks at the first one before writing its dossier and uses them in its slots instead of making its own — so the palette is chosen with the photo, not beside it.

  • Parcours and folds. flows: true on create_design or add_screen is the composer's Parcours: a web screen becomes a working prototype and Mocky makes the (up to three) pages it leads to; a flyer or a menu gets a recto and a verso; a post becomes a carousel. fold makes a flyer or a menu a folded leaflet, page_format then naming the flat sheet. The answer lists every screen made, with its link.

  • Creative mode. creative: true on create_design (and the tools that make several screens) makes the NEW project in Creative mode — bolder layouts, see the composer's options; in an existing project, the project's own setting decides. With the "client" engine the assistant's model receives the Creative instruction but not the temperature: an MCP server cannot set another model's sampling.

  • Several screens, one job. A campaign, a publication or a screen with its flow is ONE job: it counts once in the daily quota, it is given the time of as many generations (jobBudgetFactor), and it is always written by Mocky's own model — the "client" engine hands one component at a time to the assistant, and twelve round trips for a magazine is not what anyone asked for.

  • One pass per tool. edit_design, polish_design and fix_accessibility each run ONE of Mocky's passes, with its own instruction — an edit does what it is told, a polish may restyle, an accessibility fix must leave the screen looking the same — so asking for one never runs another. Each keeps the screen's previous version: Revert to the previous version, in the screen's menu, undoes what the assistant did. A screen changed in a tab while the pass ran is left alone, and the answer says so. An audit changes nothing, works during maintenance, and is not counted in the daily quota.

  • The same Mocky. The design is made by the headless runner (below), with the same pipeline as the interface, and saved in the account — in a tab already open on that project, the new screen appears on its own.

  • Waiting. A generation takes from thirty seconds to a few minutes. A call waits about forty seconds; past that, the assistant gets a job id and asks get_design, which waits again.

  • The live view. In a host that shows MCP Apps (Claude, ChatGPT), the answer is also the design itself, alive in the conversation: it scrolls, its buttons and animations work, and Open in Mocky takes you to the project. It is a small page (ui://mocky/screen-v1.html) framing one address on Mocky, /mcp-view/…, signed and valid for a day like the picture link — and served sandboxed, exactly as the composer's preview is (X7). A host without MCP Apps shows the picture, as before. The view reads the result from the standard notification and from ChatGPT's own channel (window.openai), and declares its one framed domain in both vocabularies; when it receives nothing it says so in the frame rather than staying empty.

    Claude refuses the frame for now — it "restricts frameDomains pending security review", and the first test drew the browser's ERR_BLOCKED_BY_CSP page in its place. There the view shows the screen's picture instead, scrollable in the same box, with a line saying it is still and Open in Mocky beside it. It switches on the host's own refusal (the securitypolicyviolation event) and, to spare the error page, straight away for a host that names itself Claude (FRAMELESS_HOSTS in server/mcp/view.js); the picture's origin is declared in resourceDomains for that.

  • The picture is a JPEG of the top of the page (2,000 px at most): the whole page is in Mocky, behind the link. For an assistant whose interface does not show a tool's picture, the answer also carries a picture link — that JPEG alone, signed, valid for a day, and invalid after a restart.

  • The link opens the project in Mocky, centred on the new screen, for someone signed in to that account and nobody else.

  • The files. export_screen runs the Download dialog's own exporters (lib/docExport) in the runner's page — the same PNG, .pptx and PDF a person downloads, never a second exporter. The file is kept a day under mcp-exports/ (a hundred at most) behind a link signed over its hash and its extension, and an unchanged screen asked for twice in one format is not made twice. No model, no quota, and a read key may ask for it: the account does not change. check_document runs the Download dialog's check the same way, and answers its report in words instead of a file.

  • Rewrites without a new layout. translate_screen and fill_fields make COPIES beside the screen, as "Translate…" and "Fill…" do in Mocky: what the screen is travels, its notes, links, quality report and campaign place stay with the original. A fill calls no model and does not count against the daily quota; it needs the fields the person chose in Mocky, and never guesses one. Elements the person locked stay as they are through every tool that rewrites a screen, and the project's and brand's rules reach every one of them.

  • From a template. create_design with template_id starts the new project from one of the account's templates, as "New project from this template" does: its direction, settings and screens, with fresh ids. The template's screens come along on purpose: a post or a printed document made from it is a new INSTANCE of the closest one (follow_layout, on by default with a template) — same composition, typography, colours and ornaments, only the content changes. Without it a document inherits only the identity of an earlier screen (its name and its mark), and a post made from a template came back in its colours and nothing else of it. add_screen takes follow_layout: true to keep a project's posts alike. To make a post of the same FAMILY as several posts without copying one, inspiration_ids gives up to four templates as EXAMPLES instead of template_id: their documents travel as style references (identity, palette, typography, kinds of blocks), the new project takes the first one's direction and none of their screens. Muse is off unless asked, the project having its direction. The server reads the template from the account's own store; an id that is not the account's answers like one that does not exist.

  • One design at a time per account; maintenance refuses new designs (reads still work); the optional daily quota counts them.

  • In Admin → Live activity and Users, an account using Mocky through an assistant shows as connected, with an MCP mark — also while a design is being made for it.

For the administrator#

Everything is in Admin → Assistants (MCP).

Requirements#

The section is always visible and stays locked until two things hold. It lists them, with a tick or a cross:

  1. MOCKY_ORIGIN starts with https://. It becomes the OAuth issuer and the address the tokens are bound to (${MOCKY_ORIGIN}/mcp).
  2. This admin page reached you over HTTPS, on that host. That proves TLS and the reverse proxy work, not merely that the variable is spelled right. Behind a proxy, Mocky reads X-Forwarded-Proto and X-Forwarded-Host; set TRUST_PROXY as the deployment page says.

A third line is never ticked: reachable from the Internet cannot be checked from inside — a self-test against one's own public address fails behind most NATs and succeeds on some setups that are not reachable from outside. Claude and ChatGPT connect from their own servers, so the first connection from either is the only proof. A self-signed certificate passes both checks and is refused by both assistants.

The server applies the same rule on its own: switching on is refused (409) while a check fails, and if the origin stops being HTTPS — the variable changed, the proxy removed — the MCP server is absent after the next restart, settings and connections kept.

Switching it on#

  • Allow assistants to connect — the switch. Switching off suspends every connection without deleting it; they work again if it is switched back on.
  • Allow assistant keys — a second switch, off by default. On, each account on the list can make its own assistant keys; off, existing keys are suspended, not deleted.
  • Who may connect an assistant — every account, or a list. The list starts empty, and an administrator is not allowed by their role: add yourself if you want to use it, as with every other access list in Mocky.
  • Accepted clients — Claude, ChatGPT and clients on the person's own machine (the default), or any MCP client. Decided on the address a client sends the person back to after consent: claude.ai, claude.com, chatgpt.com, or a loopback address.
  • Token lifetimes — an access token lasts an hour by default; a connection that is not used for thirty days expires.
  • Who writes a design's code — Mocky's model only (the default), either, or the assistant's model only. See Who writes the code.
  • Generations per account per day — empty means unlimited, as in the interface. Whatever the setting, one MCP generation at a time per account (from the runner onwards).

The page shows the address to give the assistant — ${MOCKY_ORIGIN}/mcp — the list of active connections: account, assistant, since when, last used, and a button that cuts one — and the list of assistant keys: account, name, level, created, last used, expiry, and Revoke. Never a key's value: nobody can see one after its creation, and an administrator cannot make one for somebody else.

The headless runner#

A design asked for from an assistant has to run the same pipeline the composer runs — direction, Muse, planner, generation — and that pipeline lives in the browser. So the server drives a Chromium of its own: it opens Mocky's runner.html, which runs the pipeline, writes the new screen into the account's project, and shows its preview; the server then photographs that preview with Chromium itself. Nobody needs a tab open.

  • Requirements. A Chromium — the Docker image installs one; elsewhere set MOCKY_RUNNER_CHROMIUM — a built interface (npm run build), and an HTTPS MOCKY_ORIGIN. A generation provider configured by the administrator: the runner never uses a key kept in somebody's browser.
  • Check the runner (free): starts Chromium, loads the runner page, photographs a fixed screen. No model is called.
  • Full try (paid like any generation): a real generation in your own account, in a project called Essai MCP, with its picture and a link to it.
  • One generation at a time per account, and concurrency at once for the instance (one by default).
  • What its browser may reach. Requests to Mocky's own address are answered by the server itself, over loopback, carrying a token for that one job — which opens only the routes a generation needs (model, Muse, images, the account's projects) and dies with the job. Anything else the generated page asks for goes through Mocky's SSRF guard first: a font or a picture from the Internet is fine, an address inside your network is refused. WebSockets are refused.

What is recorded#

  • mcp-config.json — the settings above.
  • mcp-prefs.json — each person's default engine, nothing else.
  • mcp-jobs.json and mcp-shots/ — the runner's recent jobs and the pictures it took (the last 200, a week at most). Neither travels with a migration.
  • mcp-oauth.json — registered clients and connections, with tokens stored by hash (SHA-256): a copy of the file does not let anyone call /mcp. Mode 0600. It does not travel with a migration: like sessions, each assistant asks for consent again once on the new server.
  • mcp-keys.json — the assistant keys, stored by hash (SHA-256) with their name, level, account and dates: a copy of the file does not let anyone call /mcp. Mode 0600. It does not travel with a migration either: each person makes a new key on the new server.
  • The audit log gains a group, Assistants (MCP): a settings change (field names only), a connection, a disconnection, a reused token — two parties holding the same refresh token, which cuts that connection —, and the creation and revocation of an assistant key (its name and level, never the key).

Removing an account from the list cuts its connections and deletes its keys at once; deleting an account deletes both.

Who writes the code#

By default Mocky's own model writes a design, on the instance's provider. An administrator can also let the assistant's model write it — the model of the conversation, on the person's own subscription — or allow only that.

  • What Mocky still does. Everything that is not writing the code: the direction, Muse, the pictures, the plan. Then create_design (or add_screen) answers awaiting_code with the two turns Mocky's own model would have been sent, word for word — its rules and the request — and a job id. The assistant writes the component and sends it with submit_screen.
  • What Mocky checks. The code goes through the same extraction, sanitising and motion guard as a screen Mocky's model wrote, then it is rendered. A render error — that error alone — goes back to the assistant to fix, twice at most, like the composer's own repair; after that the screen is kept and the answer says it does not render. Then it is saved, photographed and linked like any design, and the answer offers polish_design.
  • Who pays what. The code's tokens are the person's subscription; Muse and the pictures stay on the instance. A weak model writes a weak screen: that is what the quality pass offered afterwards is for.
  • Who chooses. The administrator sets which engines exist (Who writes a design's code). When both do, each person picks a default in Settings → Connected assistants, and the assistant may ask for the other one for a single request (engine). An engine that is not allowed is refused by name, never swapped for the other.
  • The rules are handed over as Mocky's, with the dossier inside them marked as a brief written partly from web pages — material, not instructions to the assistant. Giving the rules away is not a licensing question: Mocky is AGPL and they are in its source.
  • While the assistant writes, the job holds a runner slot and the account's one job at a time; ten minutes without code and it stops.

Edits, polishing and audits always use Mocky's model.

For a person using it#

Settings → Connected assistants gives the connector's address and lists the assistants this account let in, each with Disconnect. When the administrator allows both engines, it also asks who writes your designs' code. If the section says the feature is off, or that the account is not allowed, that is an administrator's decision. An account that chose its own key in Settings cannot generate from an assistant: that key lives in its browser, and the runner on the server has none — the assistant is told so, and choosing The instance’s model again opens the door.

To connect — the page gives each assistant its own steps, the address to copy, and the one line where there is one:

AssistantHow
Claude (claude.ai, desktop, mobile)Open Claude's connectors (claude.ai/customize/connectors) → + → Add custom connector: name it "Mocky", paste the address. Added once, it is there in all three.
ChatGPTSettings → Apps → Advanced settings: turn on developer mode, then Create app: name it "Mocky", paste the address, authentication OAuth.
Claude CodeOne line, then /mcp in Claude Code to give your consent.
Terminal
claude mcp add --transport http --scope user mocky https://<your-mocky>/mcp

Claude Code is the only one that takes a connector in one line: claude.ai, Claude Desktop and ChatGPT have no install link and no file for a remote connector, by design — the person adds it in their own settings. (A Claude skill cannot do it either: a skill teaches Claude how to do something, it does not add a connector.) For Claude Desktop with a Mocky the assistants cannot reach, see A Mocky the assistants cannot reach.

The skill, optional and free. Under the address, Download the skill (.zip) gives a Claude skill built for this instance (server/mcp/skill.js): the connector's own guide and its prompts, in one mocky/SKILL.md. The connector works without it; what it adds is being in Claude before any tool is called — Claude reaches for Mocky when someone asks for a flyer without naming it, skips the call to mocky_guide on the first design, and, when the connector is missing, gives this instance's address instead of pretending to design. Import it in Claude under Customize → Skills, or unzip it into ~/.claude/skills/ for Claude Code. It is generated from the same guide the connector serves, so the two cannot teach different things; download it again after an update to get the newer one.

Then, in every case:

  1. Ask for a design. The first time, the assistant opens Mocky. Sign in if asked.
  2. Mocky shows which assistant is asking, which account it would act as, and where you will be sent back. Allow or Deny — a refusal is handed back to the assistant, which stops waiting.

Assistant keys#

Some assistants do not go through OAuth: an assistant configured by hand — an assistant like Claude —, a script, a scheduled job. For them, an account can make an assistant key: a fixed key that acts as that account on /mcp, and nowhere else. Everything else on this page still holds for it — the switch, the access list, the account's daily quota and its one job at a time, maintenance.

The two levels#

LevelWhat it reaches
Read-onlymocky_guide, list_projects, get_project, get_design, get_screenshot, export_screen, check_document, list_templates, audit_design, audit_project, search_free_images — the tools that change nothing in the account. Every other tool is neither listed nor callable, and no prompt is offered.
Read and writeEvery tool the account may use, as with an OAuth connection.

The read-only list is closed, in code (server/mcp/levels.js): a tool added to Mocky later counts as one that writes until it is declared there. On a read-only key, audit_design changes nothing — though with deep: true it makes one call to Mocky's model, paid by the instance, like any audit —, search_free_images uses the instance's photo libraries, and get_design can wait for work the same account started elsewhere.

A key's level cannot be changed: revoke it and make another.

Making one#

  1. The administrator switches on Allow assistant keys in Admin → Assistants (MCP), and puts the account on the list (or opens it to every account).
  2. Signed in as that account, Settings → Connected assistants → Assistant keys: a name, a level (read-only unless you choose otherwise), an expiry (never, 7, 30, 90 or 365 days), and the account's password again — a key lasts longer than a session. An account that signs in through SSO only has no password here, and its session is enough: for that account, a session left open is all it takes to make a key that outlives it. Put such an account on the list only if it needs an assistant, and check its keys after any doubt about one of its sessions.
  3. The key is shown once, with a button to copy it and the line for Claude Code. Mocky keeps only its fingerprint (SHA-256): nobody, the administrator included, can show it again. A lost key is revoked and replaced.

At most five keys per account, a thousand per instance.

For an assistant of its own, use an account of its own. An administrator creates it (Admin → Users) with a long random password, adds it to the list, signs in as it once to make the key, and gives the key to the assistant. The key then reaches that account's projects and nobody else's. The password is needed only to make keys; keep it long, because ten wrong passwords freeze the account — its keys included — for fifteen minutes.

An administrator never makes a key for another account. A key acts as the account that made it, from its own session — the same rule as a consent —, and the admin page can revoke a key but never show or create one (X8).

Using it#

The assistant sends the key in the Authorization header, on ${MOCKY_ORIGIN}/mcp:

HTTP
Authorization: Bearer mocky_ak_…

For Claude Code, in one line:

Terminal
claude mcp add --transport http --scope user mocky https://<your-mocky>/mcp --header "Authorization: Bearer <key>"

A key is never read from an address or a cookie, and it opens nothing but /mcp: it is not a session. Behind a reverse proxy, set TRUST_PROXY (see deployment): failed keys are counted per address, and without it every request seems to come from the proxy.

A key the assistant keeps sending after it expired or was revoked fails on every call, and Mocky cannot tell those failures from guesses — that is why every refusal looks the same. After ten, the address is frozen on the key path for fifteen minutes, and each one is a mocky auth failure line: with the jail in deploy/fail2ban/ (maxretry = 10 in ten minutes, bantime = 1h), fail2ban then bans the address from the whole of Mocky for an hour. If the assistant goes out through the same address as the owner's browser — the same machine, the same home or office connection —, the owner loses access too. So take a key out of the assistant's configuration when you revoke it, and replace a key before it expires. A key suspended by the switch is not counted: nothing is compared.

Revoking it#

  • The person: Settings → Connected assistants → Revoke. It stops working on the next call.
  • The administrator: the Assistant keys list in Admin → Assistants (MCP) → Revoke.
  • Removing the account from the list, or deleting the account, deletes its keys.
  • Switching the MCP server off, or Allow assistant keys off, suspends every key; they work again when it is switched back on.
  • An expired key is refused, and stays on the list, marked expired, for thirty days.
  • Resetting the account's password (Admin → Users) signs it out everywhere, but revokes neither its assistant keys nor its OAuth connections: neither is a session. When a reset is because the account may be compromised, revoke its keys and cut its connections by hand, in Admin → Assistants (MCP).

Each creation and revocation is in the audit log, with the key's name and level — never the key.

How it is secured#

  • The Mocky session decides who you are. The OAuth authorization page sends the browser to Mocky's own consent page; no password is ever typed for an assistant, and nothing is granted without the click.

  • OAuth 2.1 with PKCE (S256), dynamic client registration, and tokens bound to one resource (RFC 8707): a token minted for any other address is refused.

  • Refresh tokens rotate, and an old one presented again revokes its connection — that is what a stolen token looks like.

  • Access is read again on every call, not when the token was issued.

  • Nothing private leaves: a screen's notes never reach an assistant, nor a key, nor another account's data; a project that is not yours answers like one that does not exist.

  • No outbound request. The MCP server never fetches anything a client names, so it adds nothing to the SSRF guard's surface.

  • A screen served alone stays sandboxed. The live view's address serves model-written code from Mocky's own origin, so it answers with Content-Security-Policy: sandbox allow-scripts: an opaque origin, no cookie, no storage, whoever opens it.

  • An assistant key is kept like a token. 256 random bits behind the mocky_ak_ prefix, stored only as a fingerprint and compared in constant time. An unknown, wrong, expired, revoked or suspended key gets exactly the answer an invalid OAuth token gets; ten failures freeze the address, and the key, for fifteen minutes, and each one is a mocky auth failure line the fail2ban filter in deploy/fail2ban/ already matches. A read-only key reaches a closed list of tools.

The rules are written down as series X of the invariants, X5 and X6 for the runner, X7 for the live view, X8 and X9 for assistant keys.

A Mocky the assistants cannot reach#

Claude and ChatGPT connect from their own servers: a Mocky on a LAN, behind a VPN, or with a certificate only your machines trust is out of their reach. A client that runs on your machine — Claude Desktop, Claude Code — can start a local program instead, and bridge/mocky-mcp.js is that program: it speaks stdio to the client and HTTPS to Mocky's /mcp, and relays every message unchanged. Mocky stays the server: same switch, same list, same consent page.

  • Requirements. The MCP server switched on, which still needs an https:// origin — a certificate from your own CA is fine: give it to Node with NODE_EXTRA_CA_CERTS, never by switching checks off. Node 22.12+ on the machine, and the bridge's files (the bridge/ folder of this repository, with npm install run in it).

  • Claude Desktop — in claude_desktop_config.json:

    JSON
    {  "mcpServers": {    "mocky": {      "command": "node",      "args": ["/path/to/mocky/bridge/mocky-mcp.js", "--url", "https://mocky.lan"],      "env": { "NODE_EXTRA_CA_CERTS": "/path/to/your-ca.pem" }    }  }}
  • The first time, your browser opens on Mocky's consent page: sign in, Allow. The answer comes back to 127.0.0.1 only (port 33418, or --port), and the connection is kept in ~/.mocky-mcp/, readable by you alone. Mocky lists it as Mocky bridge in Settings → Connected assistants, where Disconnect cuts it; the next start then asks again.

  • On a machine with no browser, MOCKY_MCP_BROWSER=none prints the address to open instead; MOCKY_MCP_HOME moves ~/.mocky-mcp.

Development#

MOCKY_MCP_INSECURE_LOOPBACK=1 accepts an http://localhost or http://127.0.0.1 origin. Nothing outside the machine can reach a loopback address, so this only serves a client on the same machine — Claude Code, for instance — and the end-to-end tests (tests/mcp-oauth-e2e.test.js, tests/mcp-keys-e2e.test.js). Never on a server.

Was this page helpful?
Documentation powered by Lumy llms.txt