Repository navigation
refactor(mcp-binding): every bound route is an alias of one @preload function, mcp.tool - #52
Merged
Merged
Conversation
…function, mcp.tool The function serving the binding's routes was a closure made by a factory and registered per tool. It is now mcp_tool, declared with @preload like any composable function, private and bound to no tool; the boot registers each allowlisted tool's route as an alias of it with the server's instances, and a call reads the route it was addressed to from its execution context (get_trace().route, the pack's counterpart of the engines' my_route). The tests call the routes through PostOffice local RPC, the path behind the HTTP host; the shape was also driven live through the public Mermaid Chart MCP server. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
acn-ericlaw
added a commit
that referenced
this pull request
Nov 14, 2026
…e as landed Co-Authored-By: Claude Fable 5.1 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The MCP binding's routes were served by a closure that a factory (
_handler) made per allowlisted tool and registered atboot. They are now aliases of one function,
mcp_tool, declared with@preload(route="mcp.tool", instances=10, private=True)like any composable function:
mcp.toolitself is private and bound to no tool (a call to it is a 404), and the bootregisters each allowlisted tool's route as an alias of it with the server's
instances-default_registry.register(route, mcp_tool, ...), the pack's counterpart of the engines'Platform.register. A call learns the route it was addressed tofrom its execution context,
get_trace().route, the pack's counterpart of the engines' read-onlymy_routeheader, andthat route names the server and the remote tool. The route contract, the servers file and the shared vector file are
unchanged. The tests now call the routes through
PostOfficelocal RPC, the path behind the HTTP host, and pin the shape(every bound route's handler is
mcp_tool, public, with the server's instances;mcp.toolprivate). README and CHANGELOGdescribe it.
ruffclean,basedpyright0 errors, 46 binding tests and the suite's 397 passed; driven live through thepublic Mermaid Chart MCP server: the bound route 200 with the server's structured content,
mcp.tool403 on the wire, anon-map body 400, an unknown route 404.
Why
Eric asked which function serves
diagram.render.mcpand found a closure where the composable style has a declaredfunction; this aligns the binding with
llm.chatandmcp.healthwithout changing ADR-0033's shape (one route perallowlisted remote tool, certified on the graph's catalog). A generic client with one route addressed by server and tool
was considered and set aside: the ADR rejects it as alternative (c), and its certifiable form would need a
headersmap onthe catalog row in both engines.
🤖 Generated with Claude Code
Co-Authored-By: Claude Fable 5.1 [email protected]