49b9bb6724
Deploy Docs / deploy-docs (push) Failing after 1s
Conformance Tests / client-conformance (push) Failing after 3s
Conformance Tests / server-conformance (push) Failing after 1s
GitHub Actions Security Analysis / zizmor (push) Failing after 1s
CI / checks (push) Failing after 59m20s
CI / all-green (push) Waiting to run
prompts
Expose prompt templates with @mcp.prompt() and let clients autocomplete their
arguments with @mcp.completion(). MCPServer derives each prompt's
arguments (name + required) from the function signature. The client lists
prompts, completes the language argument of code_review, then renders both
prompts.
Run it
# stdio (default — the client spawns the server as a subprocess)
uv run python -m stories.prompts.client
# HTTP — the client self-hosts the server on a free port, runs, then tears it down
uv run python -m stories.prompts.client --http
# same, against the lowlevel-API server variant
uv run python -m stories.prompts.client --http --server server_lowlevel
What to look at
client.pymain— the body opens withasync with Client(target, mode=mode) as client:;targetis anythingClient(...)accepts (an in-process server, aTransport, or an HTTP URL).server.pygreetvscode_review— return a barestr(wrapped as one user message) or alist[Message]for a multi-turn seed conversation.server.pycomplete()— one global handler dispatches onref+argument.name; returningNonebecomes an empty completion. There is no per-argumentcompleter=sugar yet.server_lowlevel.py— the samePrompt/PromptArgumentdescriptors andGetPromptResultbuilt by hand; this is whatMCPServergenerates for you.client.pycomplete(...)—argumentis a{"name": ..., "value": ...}dict, the onlyClientrequest method that takes a raw dict for a typed wire field.
Caveats
@mcp.prompt() and @mcp.completion() need the parentheses — @mcp.prompt
without () raises a confusing TypeError at registration time.
Spec
See also
tools/ (start here), resources/ (the other ref kind completion accepts),
pagination/ (list_prompts cursor loop).