Prompt Engine MCP server
prompt-engine-mcp brings Prompt Engine to MCP clients. Prompt Engine turns a rough prompt into a detailed, LLM-ready prompt. It finds what's missing, asks you a few multiple-choice questions with a recommended answer for each, then writes the prompt and explains every addition.
The model you already use does the writing. This server supplies the method, the domain checklists, a way to ask you questions and a deterministic lint. It never calls a model or any other service, needs no API key and doesn't log prompts.
Install
Claude Desktop. Download prompt-engine.mcpb from the latest release (not yet tested in Claude Desktop) and open it with Claude Desktop. The bundle carries its own server file, so nothing else gets installed. That file includes third-party code under the MIT, Apache-2.0 and BSD-3-Clause licenses, whose texts are in server/THIRD_PARTY_NOTICES.txt inside the bundle. To check a download, put it next to SHA256SUMS from the same release and run shasum -a 256 -c --ignore-missing SHA256SUMS (or, on Linux, sha256sum -c --ignore-missing SHA256SUMS). A good download prints the line prompt-engine.mcpb: OK; other release files in the folder get lines of their own. If there's no such line, or the bundle's line says FAILED, the file doesn't match or isn't in that folder under that name: a browser may rename a second download.
Claude Code.
Add --scope user to use it in every project. If you also installed the Prompt Engine plugin, you don't need this server in Claude Code: the plugin's skill does the same job.
Cursor (~/.cursor/mcp.json, or .cursor/mcp.json in a project), Windsurf, Claude Desktop without the bundle and most other clients:
VS Code (.vscode/mcp.json):
The server is supported on Node.js 22.19 or later. On Windows, some clients need "command": "cmd", "args": ["/c", "npx", "-y", "prompt-engine-mcp"]. To run it from a clone instead, build it (see Development and testing) and start it with node /path/to/prompt-engine/mcp/dist/cli.js; in JSON configs, that's "command": "node", "args": ["/path/to/prompt-engine/mcp/dist/cli.js"].
Use it
Ask for it in plain words: "improve this prompt: write a blog post about remote work", "quick: a Midjourney prompt for a cozy cabin at night", or "use prompt-engine on this agent prompt: …". Start with quick: to skip the questions, or with deep: for extra rounds.
What happens:
- The model calls
enhance_prompt and gets the method brief, then get_checklist for the prompt's domain.
- In standard and deep modes it calls
ask_user with its questions. Where your client supports MCP form elicitation, they appear as one form, with the recommended answers as defaults and a notes field. Otherwise, or if you close the form without answering, the model shows them as a numbered list; reply ok to accept every ★, or answer like 2b 4: your own text.
- It writes the enhanced prompt in a fixed format: the full prompt, a short version, what it added and why, assumptions, a score, and a "What next?" menu.
The enhance prompt gives the same start from a client's prompt menu. In Claude Code, write your rough prompt first, then run /mcp__prompt-engine__enhance, optionally followed by quick, standard or deep. Claude Code passes one word per argument, so the mode is the prompt's only argument.
Reference
Tools
Every tool is annotated read-only, non-destructive, idempotent and closed-world.
How ask_user asks:
The form has a single-choice field per question, preselected on the recommended answer, and an optional notes field of up to 1,000 characters; longer notes are cut. The only text the server adds to a form is the ★ marker and, unless the model passes intro, notes_label and notes_hint in your language, an English opening line and notes label and hint. Questions asked in the chat open with their own English line, which explains the ★, never with the form's intro or its default message; next asks the model to translate it. When a question round opens with a line of its own (the biggest gaps for a request to critique a prompt or find what's missing, that the prompt is already strong, that a pasted secret was removed, or that another person's private detail was removed), the brief has the model pass that line as intro, in 200 characters or fewer, and, when it asks in the chat, put that line before the questions' own opening line.
ask_user adds the ★ itself: it takes a ★ that stands alone at the start or end of the recommended label off, and rejects a label with any other ★, such as a star rating. A rating with one ★ on the recommended option alone, such as "4.5 ★", looks the same as that marker and loses its ★ too; the ★ that ask_user adds stands next to it. It also rejects a question, a why or a label with no visible character, and two labels in one question that differ only in whitespace, invisible characters or Unicode normalization. Joiners, variation selectors and tag characters count as differences except at the start of a label or after an ASCII character, since elsewhere they change how emoji and some scripts are drawn: the flags of England and Scotland are two labels. Labels that look alike because of letters from another script, full-width letters or ligatures are not caught. Control characters in the model's text and the user's notes become spaces (notes keep their line breaks), and unpaired surrogates become U+FFFD.
check_prompt is a heuristic. For each scored area (Clear goal, Context, Constraints, Output format, Edge cases) it reports whether the draft explicitly mentions it, with short evidence, plus lint findings from data/lint-rules.json: capitalized pressure words, requests to expose reasoning, prefill instructions, template leftovers, open [[placeholders]] and similar. It gives no score; the model scores with the shared rubric. The rule for requests to expose reasoning takes think step by step and reason step by step, with spaces or hyphens, and the phrase next to your reasoning, your thinking, by reasoning or by thinking. It can't tell such a request from a sentence where the words only meet, such as "I think step-by-step instructions would help", or where the reasoning is someone else's, such as "Help the student think step by step", and it misses other wordings, such as "think it through step by step".
The area checks, and every lint rule except the {{template}} and [[placeholder]] checks, match English text only. When a draft looks mostly non-English, an area without a match is reported as unknown rather than not found. Language is judged on the prose, without code blocks, inline code and URLs; text in bare fences, and in fences marked as text, Markdown or a prompt, counts only when the prose outside them is too short to judge. Letters of another script mark a draft as non-English once they are a fifth of its letters, so tool names don't make a Chinese draft English. An English draft that quotes a longer passage in another script, such as a sentence to translate, is read as non-English too, and its areas come back unknown. It recognizes drafts in non-Latin scripts; in German, French, Spanish, Portuguese, Italian, Dutch, Polish, Swedish, Turkish, Indonesian, Tagalog, Swahili or Romanized Hindi; and with many accented letters. Drafts in other languages, and short or terse drafts in any script, may be reported as not found.
Output format counts a format word (JSON, YAML, CSV, XML, Markdown, HTML) only in phrases such as "respond in JSON", "the output must be valid JSON", "return JSON only", or "JSON only" and "Output: JSON" at the start of a line, list item or sentence, so "build a JSON parser" doesn't count. Other wordings, such as "It must be valid JSON" or "Give me JSON only", can be reported as not found. Phrases about the task that use the same words, such as "an endpoint that returns JSON" or "stored in JSON", still count.
Lines are matched one at a time, after each control character becomes a space and each run of whitespace one space, so a lint rule about tabs or double spaces never fires here. A rule whose pattern could run slowly or miss matches is skipped and named in the summary; CONTRIBUTING.md lists the limits. The time grows linearly with the draft's length, and the tests time hostile 100,000-character drafts.
Prompt
Resources
All text comes from the same sources as the skill and the copy-paste prompt (skills/prompt-engine/ and universal/), generated into src/generated/content.ts by node scripts/build.mjs at the repository root. The method brief is the copy-paste prompt's text with this server's steps added, so it shares that prompt's limits: for example, it has no rule for other people's private details, which the skill replaces with placeholders (Known limits).
Self-hosting over HTTP
This serves Streamable HTTP at http://127.0.0.1:8787/mcp. Options:
Requests with any other Host header, or one that doesn't parse, get 403, which protects a local server from DNS rebinding. A request with an Origin header gets 403 unless the origin's hostname is allowed too; requests without one, which is what non-browser clients send, are accepted. Browser clients aren't supported: the server sends no CORS headers, so a browser's preflight OPTIONS request fails, with 403 from an origin that isn't allowed and 405 otherwise.
The allowlist, here and in the Worker's ALLOWED_HOSTS, is a comma-separated list of exact hostnames:
- A pasted URL counts as its hostname. A port is ignored, with a warning.
- Entries are compared in the URL parser's form, so
MCP.Example.com, 0:0:0:0:0:0:0:1 and bücher.example match mcp.example.com, [::1] and xn--bcher-kva.example.
- Entries that name no hostname, such as
:8080, a b or user@host, are ignored, with a warning, and so are hostnames with *, http://* and https://*, which would never match. If no entry is left, the CLI falls back to the localhost defaults.
- A
<scheme>://* entry for any scheme other than http and https, such as chrome-extension://* or moz-extension://*, is kept without a warning: it accepts an Origin header with that scheme. It matches no Host header, so a list made only of such entries refuses every request with 403, in the CLI and in the Worker.
To serve on a network, bind the interface and name the hostname clients use:
Connect a client with, for example, claude mcp add --transport http prompt-engine http://127.0.0.1:8787/mcp. The server has no authentication of its own, so put it behind your own proxy or access control before exposing it. Each request gets a fresh, stateless server. Clients on the 2026-07-28 protocol get question forms; 2025-era clients over HTTP get the questions as text.
The HTTP server's own limits:
- A body over 1,500,000 bytes gets
413. The largest valid single call, a check_prompt draft of 100,000 characters each written as an escaped surrogate pair, is about 1.2 MB.
- The MCP SDK takes JSON-RPC batches of up to 100 messages, from 2025-era clients: a longer batch, or a batch that holds a 2026-07-28 request, gets
400. A batch is one body, so a batch over 1,500,000 bytes gets 413 even when each call in it is valid.
- A
notifications/cancelled is ignored, as the protocol allows: each request gets a server of its own, so it can only name a request in the same batch, and every request is answered at once. The MCP SDK sends no answer for a request it has cancelled, and ends a batch's answer only once each request in the batch has one, so that answer would never end, and would hold its request slot for as long as the client kept the connection.
- The MCP SDK answers a 2025-era
resources/read whose URI is over 1,000,000 characters with 500, without the request's id, and the server logs the error.
- The headers must arrive within 10 seconds and the whole request within 30, or the server answers
408 and closes the connection. It checks every 5 seconds, so a stalled request can run up to 5 seconds past its limit.
- At most 128 requests are handled at once, and only while the bodies they declare add up to 8,000,000 bytes or less, room for five of the largest; a body sent without a
Content-Length counts as 1,500,000 bytes, and so does one that declares more, which gets 413. Past either limit, a request gets 503 with Retry-After: 1 before its body is read, and its connection is closed.
- The MCP SDK can keep a request's parsed body in memory until its answer has been sent, as it does for a batch, and parsed JSON can take far more memory than its text: a 1.5 MB body of deeply nested arrays held about 40 MiB (measured with Node 24). The 8,000,000-byte limit keeps that to about 210 MiB. The tests start a server with a 512 MB heap (
NODE_OPTIONS=--max-old-space-size=512), have 32 clients each offer such a body at once, and check that it takes five and stays up while their bodies arrive together.
- A connection whose answer the client stops reading is closed once the answer has waited 15 seconds for it, which ends every request on that connection. The server checks every 5 seconds, so this can take up to 20 seconds. The server sees the answer go only as the operating system takes it, in bursts as the client's reads free its buffers, which can hold hundreds of kilobytes, so a client reading a large answer slowly can be closed too: on macOS, a client reading a 2.2 MB batch answer at 30 KB/s got all of it, and one reading at 25 KB/s was closed.
- At most 1,024 connections are open at once; more are closed straight away.
- A request refused for its
Host or its Origin, or for a method other than POST, GET, DELETE and OPTIONS, is answered before its body is read, and its connection is closed. The MCP SDK answers GET, DELETE and OPTIONS with 405 itself and keeps the connection open. It reads a DELETE or OPTIONS body first, so one whose body stalls gets 408 at the timeout instead.
- After an answer that closes the connection, such as a
403, 413 or 503, the server closes its side and reads and discards what the client still sends, so a client still sending its body reads the answer rather than a reset connection. It closes the connection once the client closes its side or has sent nothing for 2 seconds, and 30 seconds after the answer at the latest, even if the client is still sending. A request sent after such an answer isn't served, and closes the connection at once. Requests sent on the same connection behind the one that got such an answer can't be answered either: if the server had already taken any of them on, it closes the connection as soon as the answer has been written, which frees their slots. A chunked body over 1,500,000 bytes isn't read past the cap, so its connection is closed 2 seconds after the 413.
One client can still hold all 128 request slots, or all 8,000,000 bytes, with slow uploads or answers it doesn't read, until the timeouts close them, or with large answers it reads slowly, for as long as it reads them. It can hold all 1,024 connections for as long as it goes on: a connection kept open after an answer stays open between requests while its client sends bytes that start no request, such as an empty line every few seconds, since Node's keep-alive timer counts any byte and no other timeout starts. On a network, a proxy in front of the server should still limit body size, connections per client, slow clients and request rate.
Cloudflare Workers
src/worker.ts serves the same server statelessly on Cloudflare Workers, with the SDK's Workers JSON Schema validator. From this folder:
-
Set ALLOWED_HOSTS in wrangler.jsonc (or in the dashboard) to the hostname clients will use, such as prompt-engine-mcp.<your-subdomain>.workers.dev. It is read like --allowed-hosts above. Requests for any other host get 403. If the variable is unset, empty or blank, every request to /mcp gets 500 with a message that says it isn't set; if it names no usable hostname, the 500 message says that instead. Write the list as one string: vars also take JSON values, and a value that isn't a string, such as a JSON list, gets 500 with a message that says so. Other paths get 404. Request bodies are capped at 1,500,000 bytes, and JSON-RPC batches and notifications/cancelled follow the same rules, as in the CLI.
The Worker prints its warnings about entries when an isolate handles its first /mcp request. wrangler dev shows them in its terminal (checked with Wrangler 4.155.0). wrangler.jsonc turns stored Workers Logs off ("observability": { "enabled": false }), so on a deployed Worker, look for them in a live npx wrangler tail or the dashboard's real-time logs, open when the isolate starts. Where else a deployed Worker's warnings can be seen hasn't been checked.
-
Deploy with npx [email protected] deploy (Wrangler needs Node.js 22 or later).
-
Connect clients to https://<your hostname>/mcp.
npm run test:worker checks the Worker without deploying: a wrangler deploy --dry-run, then a local wrangler dev that must answer tools/list and enhance_prompt, reject a foreign Host, and return ask_user form answers to a 2026-07-28 client.
Privacy
- No prompt logging. Over stdio, stdout carries only protocol messages. On stderr the server writes its start-up line (
--http only), warnings about its own settings, and one line per error. It logs nothing for requests that succeed, and nothing for most refused ones: a foreign or unparseable Host, a foreign Origin, an unsupported method, a body that is too large or isn't JSON, a busy server, or headers that never arrive. Some refusals by the MCP SDK are logged as a fixed phrase with its reason code, such as rejected a request (method-header-missing) or, over HTTP, rejected a request (batch-too-large), and so are stdio messages that are JSON but not JSON-RPC, such as ignored a message that is not valid JSON-RPC (invalid-message), and, over HTTP, responses and progress notifications for requests the server doesn't know, such as ignored a response (unknown-request-id). Stdio lines that aren't JSON are dropped without a reply or a log line. No line quotes a request. Any other error, such as a socket failing, an upload cut off (Error: aborted) or a resources/read URI over the MCP SDK's 1,000,000-character limit, is logged as its type and message, with quoted text removed, control characters replaced by spaces, and cut to 200 characters. The Worker's own code logs only its two warnings about ALLOWED_HOSTS entries.
- No API key and no outbound calls. It never calls a model or any other service.
- What the server receives.
enhance_prompt never receives your prompt. Only check_prompt sees a draft, and only when the model calls it. ask_user receives the questions and, when your app shows a form, returns your answers and notes. On a server someone else hosts, those calls pass through their server.
- Self-hosted and Workers deployments keep nothing between requests.
Development and testing
From a clone, in this folder (Node.js 22.19 or later):
npm test covers:
- the
check_prompt heuristics, language detection and lint rules, with timing tests on hostile 100,000-character drafts, the question validation, text format and form schema, and the rule that decides when the HTTP server closes a connection whose answer isn't read;
- every tool, the prompt and the resources through a real SDK client, in both the 2025-era and the 2026-07-28 protocol, including form answers, declines, closed forms and the text fallback;
- the built
dist/cli.js over stdio, and over real HTTP with Host and Origin checks, --allowed-hosts and PROMPT_ENGINE_ALLOWED_HOSTS, the body cap, the request, body and connection caps, a 512 MB heap under dense bodies, the header and request timeouts, the closing of a connection whose answers aren't read (while a client reading a 2.2 MB answer at 50 KB/s gets all of it), of one whose client is still sending after a refusal and of one with requests waiting behind a refusal, and what gets logged for refused and unreadable requests;
- budgets: instructions under 3,500 characters; tool descriptions of at most 1,024 characters, since some clients and model APIs are reported to reject or cut longer ones; and every tool result under 24,000 characters, counting its text and structured content as JSON, for the largest inputs the schemas allow. Those inputs are filled with quotes, which double when escaped, or with control characters or unpaired surrogates, which the tools return as spaces and U+FFFD rather than as 6-character escapes. A target of 100 characters outside the BMP, which the schema allows, is kept whole rather than cut inside a surrogate pair. The longest list of
ask_user errors is under the budget too. Errors the MCP SDK writes itself, such as the one for a client that answers a form with an invalid result, aren't covered and can be longer;
- version and schema checks for
package.json, manifest.json (MCPB) and server.json (MCP Registry).
The lint patterns in data/lint-rules.json are also timed on adversarial input by node --test scripts/test/*.test.mjs at the repository root.
To try the server by hand, run the Inspector: npx @modelcontextprotocol/[email protected] --cli node dist/cli.js --method tools/list.
Edit the method in skills/prompt-engine/, universal/ or data/, never in src/generated/, then run node scripts/build.mjs from the repository root. One version number covers every part of Prompt Engine; set it with node scripts/version.mjs <version> from the root, which updates package.json, package-lock.json, manifest.json and server.json here too.