Repository navigation
feat(mcp-binding): a tool is a composable function - a preload function per tool, bound in code - #122
Merged
Merged
Conversation
…on per tool, bound in code
The twin of the Python pack's reshaping. The binding's first shape read a tools allowlist
under each server and conjured each tool's route at boot as an alias of a private mcp.tool
function. Now a tool is declared where every route is declared: bind(server, tool,
{ schemaSha256 }) returns the tool as an async function and an ordinary preload function
calls it (the extension's own mermaid.render, bound to the public Mermaid Chart MCP
endpoint named in the default server file). The server file keeps servers only; boot
connects every server a function binds a tool of and stops by name on an unconfigured
server, a missing tool or a changed digest; mcp.tool is no longer a route. A route names
the capability, never the transport. The shared vectors are version 2, byte-identical
with the Python twin. Design: the engines' draft-design-specs/agent-tool-use.md (Eric's
review, 2026-11-16). npm test 469 tests, 405 passed, 0 failed; booted live against the
Mermaid server and a diagram rendered through mermaid.render.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
acn-ericlaw
added a commit
that referenced
this pull request
Nov 16, 2026
…rded as landed Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
acn-ericlaw
added a commit
that referenced
this pull request
Nov 16, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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 twin of the Python pack's reshaping of the MCP binding, in lockstep. A tool of an MCP server is declared where every
route is declared, in the code:
const render = bind('mermaid', 'validate_and_render_mermaid_diagram', { schemaSha256: '5ae6…' })names the server, the remote tool and the digest of its input schema and returns the tool as an async function, and an
ordinary
preloadfunction calls it (the extension's ownmermaid.render, bound to the public Mermaid Chart MCP endpointnamed in the default server file, so the binding serves a tool out of the box with no credential). The server file keeps
what is environment-specific and refuses a leftover
toolsallowlist by name. Boot connects every server a function bindsa tool of, lists its tools and stops the application by name when a bound server is not configured, a tool is not offered
or its schema no longer hashes to the pinned digest; a configured server nobody binds is not connected.
mcp.toolis nolonger a route;
mcp.healthstays;describeprints each digest, thebindline to paste and a catalog row whose route isthe developer's.
createBindingno longer takes a registry, since the binding registers no route. The shared vector file isversion 2, byte for byte the Python pack's;
test/mcp-binding.test.mjshas 49 tests (46 before); the README, the defaultserver file and the unreleased CHANGELOG entry describe the final shape.
npm test: 469 tests, 405 passed, 0 failed, 64skipped; a live boot against the Mermaid server rendered a flowchart through
mermaid.render(200, the SVG) and refused anon-map body (400).
Why
The first shape, built on 2026-11-14, conjured each tool's route at boot from a YAML row as an alias of a private
mcp.toolfunction: a route no
preloaddeclared and a mechanism a developer could forget. Eric's review of 2026-11-16 (the engines'draft-design-specs/agent-tool-use.md) settled the principle: a tool is a composable function whatever stands behind it,the MCP client is fully encapsulated, and the route must not carry the transport, because a tool may start as an MCP tool
and later be implemented another way while the graph stays unchanged. One route per tool with the digest pinned is kept, so
ADR-0033 stands untouched. The Python twin is Accenture/mercury-python#55; the Playground example follows with
mermaid.render.🤖 Generated with Claude Code
Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com