Repository navigation
Releases
v0.3.0
BREAKING: MCP trust, result and error handling now match the PHP reference
Breaking changes
- A tool result whose
isErrorfield is present and not literallyFalse(includingNone) reports a guarded
tool failure. Only an absent field orFalsereports success. - An explicitly empty trust allow-list is refused before the server is contacted, with a message distinct from
missing trust. Trusting every tool on a server that offers none is still valid. - Non-text content parts are replaced by ordered omission markers instead of being dropped silently. Text is
forwarded only from parts labelledtype: "text". - A tool you named explicitly whose mirrored-parameter annotations are invalid now raises. Tools excluded under
wildcard trust stay inspectable throughexcluded().
Changes
- Trusted tools the server does not offer are reported through the optional sync or async
on_diagnostic
callback, or a nativeMcpDiagnosticWarningby default. Diagnostics carry only the tool names you configured. A
failing callback stops discovery and no tools are offered. - The default result limit rises from 65,536 to 262,144 UTF-8 bytes, matching PHP. Explicit and disabled limits keep
their meaning. - No HTTP transport, cache or mirrored-header encoding change.
v0.2.1
prism-ai-mcp 0.2.1 — security fix
No breaking changes.
SECURITY: in 0.2.0 an async def gate was silently treated as consent.
The gate's verdict was never awaited; a coroutine is truthy, so a gate
that returned False let the tools/call through. The tool ran and its
result came back, and the only sign was "RuntimeWarning: coroutine was
never awaited". If you wrote an async gate against 0.2.0, upgrade.
- The gate's verdict is now awaited before anything is sent. Sync gates
keep working unchanged. - A gate that resolves to a further awaitable (an async gate that
forgets an inner await) is refused with TypeError instead of being read
as consent. - A ResultGuard filter that returns anything but str (e.g. an async
filter) now raises TypeError instead of framing "<coroutine ...>" as
the tool's answer.
Tracked as G-83.
v0.2.0
Breaking changes
list_tools() and call_tool() are now coroutines and must be awaited, and the
transport callable must return an awaitable. An async def transport satisfies
the new contract.
tools = await docs.list_tools()
result = await docs.call_tool(tools[0], {"query": "rate limits"})A synchronous embedder must manage its own event loop. The package deliberately
ships ONE async path and no synchronous wrapper: a wrapper here would choose an
event loop on the embedder's behalf, and that is the embedder's decision, not
this package's. It is also why the change is a major-style break at 0.2.0 rather
than an additive async twin — two entry points into the same request would mean
two paths to keep honest, and only one of them exercised.
What is unchanged
Everything the trust boundary does. TrustPolicy, tool pinning, the gate, the
mirrored-parameter rules and the result guard behave exactly as in 0.1.0, and
the suite proves each of them still bites on the async path rather than assuming
the conversion preserved them — including a changed pin refused after awaiting
discovery, an oversized result refused after awaiting the call, and a
gate-refused call that sends no request at all.
Still zero runtime dependencies. The package opens no connections and now also
chooses no event loop, so it still names no HTTP library.
initialize remains absent (G-52): this client speaks a stateless protocol with
no handshake, and the removed method made failures read backwards.
v0.1.0
First release: MCP servers as Prism tools, in Python
prism-ai-mcp is the Python port of particle-academy/prism-mcp — consuming
Model Context Protocol servers across an explicit trust boundary.
pip install prism-ai-mcp
Zero runtime dependencies. Python 3.10+.
Client speaks MCP over a transport you supply. TrustPolicy decides which of
a server's tools may be called at all, and ToolDefinition / ToolResult are
what crosses the boundary.
A server is not trusted because it answered. TrustPolicy.allowing([...]) names
the tools, and a PIN binds a tool to the definition it had when you approved it:
TrustPolicy.allowing(["search"], pins={"search": "sha256:3f1c…"})
Swap a tool's description after approval and the pin fails. That matters because
a description is INSTRUCTIONS TO A MODEL -- a server that changes it after
approval has changed what the tool does without changing its name, and nothing
about the call site looks different.
ErrorCode is a closed set of strings a caller can branch on:
SERVER_NOT_TRUSTED for a server nobody declared, and a distinct code for a
definition that moved after it was pinned.
ResultGuard frames what a server returns. The framing is PER RESULT rather
than one fixed marker around everything, because a fixed marker is a string the
SERVER can also emit -- closing the frame early and continuing outside it, in
text the model reads as ours (G-60).
This ships the stateless 2026-07-28 revision -- is_stateless_protocol,
PROTOCOL_VERSIONS and KNOWN_PROTOCOL_VERSIONS are exported so a caller can
ask rather than assume. initialize is not part of that revision.
The mcp family has a prism-parity suite running one fixture through PHP,
TypeScript and Python; all 13 rows agree. Getting there invalidated every
existing digest pin (G-20): the reference and the ports disagreed on an empty
map versus an absent description, so a pin computed before that fix does not
match one computed after. Re-pin rather than carrying an old digest across.