mcp-server
Minimal MCP server helpers (EXPERIMENTAL x/ tier, #6 Y1; stream 18) — the server counterpart to cx-x/mcp, at the 2025-06-18 protocol revision (one target). Pure request readers (method-of, id-of, tool-name-of, tool-args-of) + response builders (initialize-result, tools-list-result, tool-result, tool-error, protocol-error) composed from cx-stdlib/jsonrpc + json. tools/list derives from module source at list time via cx-x/tools (tool-json-of maps one descriptor to the MCP entry with outputSchema, annotation hints, and _meta carrying the Tier-1/Tier-2 addresses, schema ids, and cap: requirements; tools-for maps a whole module — a projection failure propagates, never a silent empty list). The tools/call boundary is PROPOSE-ONLY: propose-call / propose-result construct the cx:propose proposal and reply with its canonical text + Tier-1 address (what an out-of-band approval binds) — the command body never runs on this path. The differentiator (ties #7's PEP): a tool handler is ordinary CX, so its effects are gated by CX capabilities at the effect point — a denied effect (CXER0271) maps to an isError tool result. The transport is the real cx-stdlib/http server: a [?def] handler reads the request, dispatches on the method, and returns a [response].
Experimental x/ tier — imported as cx-x/mcp-server. Bundled and gated in-tree like any other module, but EXEMPT from the frozen-surface stability promise (std-lib README, decision D3): a semver-breaking change is allowed here while the surface settles, and the frozen-surface canary never counts it. Pin behaviour you depend on with your own fixtures.
mcp-server:method-of
[$mcp-server:method-of] -> string — The JSON-RPC method of a parsed request.
mcp-server:id-of
[$mcp-server:id-of] -> any — The request id, to echo into the response.
mcp-server:tool-name-of
[$mcp-server:tool-name-of] -> string — The tools/call target name (params.name).
mcp-server:tool-args-of
[$mcp-server:tool-args-of] -> any — The tools/call arguments object (params.arguments).
mcp-server:initialize-result
[$mcp-server:initialize-result] -> map — Build the MCP initialize success reply (protocolVersion + capabilities + serverInfo).
mcp-server:tools-list-result
[$mcp-server:tools-list-result] -> map — Build a tools/list success reply wrapping a tools array.
mcp-server:tool-json-of
[$mcp-server:tool-json-of] ($d::element) -> map — Map ONE cx-x/tools descriptor to the 2025-06-18 MCP tool entry (name/description/inputSchema/outputSchema + annotation hints + _meta with Tier-1 source, Tier-2 code, schema ids, cap: requirements).
mcp-server:tools-for
[$mcp-server:tools-for] ($source::string) -> any — Module source text → the tools/list array, derived at list time via cx-x/tools (no materialized manifest). A projection failure propagates its [err] — never a silent empty list.
mcp-server:propose-result
[$mcp-server:propose-result] ($id::any $proposal::element) -> map — Shape the propose-only tools/call reply: canonical proposal text as the content block + structuredContent.address = the proposal's Tier-1 address (what an out-of-band approval binds).
mcp-server:propose-call
[$mcp-server:propose-call] ($id::any $command::function $args::map) -> map — The propose-only tools/call boundary in one step: cx:propose the command with the name-keyed args record (never executes the body) and shape the reply. A refused proposal raises CXER411x for the handler to map to tool-error.
mcp-server:tool-result
[$mcp-server:tool-result] -> map — Build a tools/call success reply with one text content block (isError:false).
mcp-server:tool-error
[$mcp-server:tool-error] -> map — Build a tools/call reply reporting a tool failure (isError:true) — e.g. a denied capability.
mcp-server:protocol-error
[$mcp-server:protocol-error] -> map — Build a JSON-RPC error response for a standard kind (e.g. method-not-found).