Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@
`dev/graph-up.sh` and `graph-down.sh` run Neo4j Community on Colima for development; the live test runs against it
when `TOOLS_GRAPH_TEST_URI` is set. The five new catalog rows join the `catalog/` folder and `describe`.

4. **Recipes for tools from existing MCP servers (RFC-0013 in mercury-composable, step 5).**
`extensions/mcp-binding/resources/mcp-recipes.yml` holds one ready server-file entry for each server of the engines'
page *Tools from MCP Servers* - the reference servers Git, Time, Fetch and Filesystem (`uvx` and `npx`, versions
pinned), Neo4j's Cypher server, GitHub's hosted server and Playwright's browser - with every environment-specific
value a `${NAME:default}` reference and every credential a reference without a default. The binding does not load
the file; an entry is copied into `mcp-servers.yml` and its tools declared with `bind` as before.
`tests/vectors/mcp-recipes.json`, shared byte for byte with the Node.js pack, pins the input-schema digests of the
six servers that list their tools without a credential (56 tools, read 2026-11-18 through both packs' `describe`,
identical), and `tests/test_mcp_recipes.py` loads the recipes file on every run and, with `MCP_RECIPES_LIVE=1`,
starts each server through the binding's own probe and compares the digests, so a recipe that rots fails by name.

### Fixed

1. **A direct `python extensions/mcp-binding/mcp_binding.py` now connects its servers.** The binding attached its boot
Expand Down
13 changes: 13 additions & 0 deletions extensions/mcp-binding/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ catalog row (name your function's route; review the description before the graph

A tool the server offers but no function binds is shown as `not bound` and is never served.

## Recipes

`resources/mcp-recipes.yml` holds one ready entry for each server of the engines' page
[Tools from MCP Servers](https://accenture.github.io/mercury-composable/guides/tools-from-mcp-servers/): the reference
servers Git, Time, Fetch and Filesystem (started with `uvx` and `npx`, versions pinned), Neo4j's Cypher server, GitHub's
hosted server and Playwright's browser. Every environment-specific value is a `${NAME:default}` reference and every
credential a reference without a default. The binding does not read the file: copy an entry into `mcp-servers.yml`,
set the references it names, run `describe` on it and declare the tools you want with `bind` and a function, as above.
The page carries the digests of the six servers that list their tools without a credential, read on 2026-11-18 from
the pinned versions, and `tests/test_mcp_recipes.py` re-reads them live when `MCP_RECIPES_LIVE=1` is set (the Neo4j
server also wants `NEO4J_PASSWORD` and a database): a recipe that rots fails at the digest, as the boot would.

## The function contract

| | |
Expand Down Expand Up @@ -182,6 +194,7 @@ server's `tools/call` is inside that `exec_time`, not a span of its own. Driven
```bash
pip install -e '.[dev]'
pytest tests/test_mcp_binding.py
MCP_RECIPES_LIVE=1 pytest tests/test_mcp_recipes.py # starts the recipe servers with uvx and npx
```

The shared vector file pins the pure half (the digest, the verification of declared bindings, the result mapping) in
Expand Down
85 changes: 85 additions & 0 deletions extensions/mcp-binding/resources/mcp-recipes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Recipes - the MCP servers of the engines' page "Tools from MCP servers" (RFC-0013, step 5), one
# entry per server, ready to copy into mcp-servers.yml. The binding does not read this file by
# default, and nothing here is served until a function binds a tool of it: a bind line in
# mcp_binding.py (or in an application that imports it), a preload function on a route of your own,
# a catalog row on the graph and an Event-over-HTTP entry on the engine.
#
# Everything environment-specific is a ${NAME:default} reference, resolved from this process's
# environment at boot. A credential has no default, so a missing one stops the boot by name, and a
# resolved value is never logged. The package versions are the ones the page's digests were read
# from (2026-11-18): bump one, run describe, review the schema and re-pin the digest next to the
# function that binds the tool.
#
# The gated test tests/test_mcp_recipes.py loads this file on every run and, with MCP_RECIPES_LIVE=1,
# starts each server with uvx or npx through the binding's own probe and checks the digests pinned
# in tests/vectors/mcp-recipes.json (the Neo4j server also wants NEO4J_PASSWORD and a database, for
# example the one extensions/agent-tools/dev/graph-up.sh starts).
servers:
# Git (reference server, Python). The history and state of one repository; --repository confines
# every tool to it, and the function that binds a tool adds repo_path from configuration, so no
# graph names a path. The reads are git_status, git_diff_unstaged, git_diff_staged, git_diff,
# git_log, git_show, git_branch and git_remote; git_add, git_commit, git_reset, git_create_branch,
# git_checkout and git_merge are write: true on the graph.
git:
transport: stdio
command: uvx
args: ['mcp-server-git==2026.11.11', '--repository', '${MCP_GIT_REPOSITORY:/srv/repository}']
# Time (reference server, Python). The alternative to the built-in time.now when a use case
# converts between zones or reasons about relative times; --local-timezone fixes the server's
# default zone. All three tools read.
time:
transport: stdio
command: uvx
args: ['mcp-server-time==2026.11.11', '--local-timezone', '${MCP_TIME_ZONE:UTC}']
# Fetch (reference server, Python). The alternative to the built-in web.fetch: one tool, Markdown
# out, robots.txt honoured, private addresses refused by default, and --allowed-hosts as the
# allowlist (repeat the option for more hosts). The built-in web.crawl has no counterpart here.
fetch:
transport: stdio
command: uvx
args: ['mcp-server-fetch==2026.11.11', '--allowed-hosts', '${MCP_FETCH_ALLOWED_HOST:docs.example.com}']
# Filesystem (reference server, Node.js). The alternative to the built-in file.* tools, started in
# read-only mode: the ten tools that read and list. Without --read-only the server also offers
# write_file, edit_file, create_directory, move_file and copy_file, each write: true on the graph.
# The directories named are the sandbox; a path outside them is refused by the server.
filesystem:
transport: stdio
command: npx
args: ['-y', '@modelcontextprotocol/server-filesystem@2.3.0', '--read-only', '${MCP_FILESYSTEM_ROOT:/srv/documents}']
# Neo4j's Cypher server (vendor server, Python). The alternative to graph.schema, graph.query and
# graph.write over the vendor's own server: get_neo4j_schema (needs the APOC plugin in the
# database), read_neo4j_cypher and write_neo4j_cypher (write: true on the graph; add --read-only to
# leave it out of the listing). graph.ingest has no counterpart - the model would write the MERGE
# statements itself.
neo4j:
transport: stdio
command: uvx
args: ['mcp-neo4j-cypher==0.6.0']
env:
NEO4J_URI: '${NEO4J_URI:bolt://127.0.0.1:7687}'
NEO4J_USERNAME: '${NEO4J_USERNAME:neo4j}'
NEO4J_PASSWORD: '${NEO4J_PASSWORD}'
NEO4J_DATABASE: '${NEO4J_DATABASE:neo4j}'
# GitHub's server (vendor server). The hosted endpoint over streamable HTTP with a fine-grained
# personal access token of least privilege (or the deployment's GitHub App token); the toolsets
# header selects the tool families, the read-only header hides every write. The listing needs the
# credential, so its digests are not pinned on the page: run describe with the token and pin what it
# prints. A self-hosted alternative is the vendor's container image over stdio.
github:
transport: http
url: 'https://api.githubcopilot.com/mcp/'
headers:
Authorization: 'Bearer ${GITHUB_MCP_TOKEN}'
X-MCP-Toolsets: '${GITHUB_MCP_TOOLSETS:repos,issues,pull_requests}'
X-MCP-Readonly: '${GITHUB_MCP_READONLY:true}'
timeout_ms: 30000
# Playwright's server (vendor server, Node.js). A headless browser with an in-memory profile;
# --allowed-origins is the allowlist of sites the browser may request. The reads are the snapshot,
# the screenshot, find, the console and network listings and navigation; the actions (click, type,
# fill_form, select_option, press_key, drag, file_upload, handle_dialog) are write: true on the
# graph; browser_evaluate and browser_run_code_unsafe are never bound.
playwright:
transport: stdio
command: npx
args: ['-y', '@playwright/mcp@0.0.85', '--headless', '--isolated', '--allowed-origins', '${MCP_PLAYWRIGHT_ORIGINS:https://docs.example.com}']
timeout_ms: 60000
10 changes: 7 additions & 3 deletions memory/open-threads/thread-bp-agent-tools-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
`graph-down.sh`, 161 tests and a live round trip on the development Neo4j; eight defaults set without a ruling in
the session log. The Node twin landed as mercury-nodejs #130; the Playground's three graphs as
mercury-composable #647 (step 4), driven live through both packs 2026-11-17 - the drive taught a relative `include`
(PR #65, merge `30cbb0d`, MERGED 2026-11-17, with the README's Event-over-HTTP snippet corrected to one route per entry). Next: nothing
here until the recipes page (step 5, the engine's). The plan as settled - step 1: `extensions/agent-tools/agent_tools.py` (the layout of `extensions/mcp-binding`: a module docstring, a
(PR #65, merge `30cbb0d`, MERGED 2026-11-17, with the README's Event-over-HTTP snippet corrected to one route per entry). **Step 5, the pack's half, BUILT 2026-11-18:** `extensions/mcp-binding/resources/mcp-recipes.yml` (seven server
entries - git, time, fetch, filesystem, neo4j, github, playwright - with `${NAME:default}` references and pinned
versions, not loaded by default), the shared digest vector `tests/vectors/mcp-recipes.json` (56 tools of the six
servers that list without a credential, read through `describe`, identical from both packs) and
`tests/test_mcp_recipes.py` (five tests on every run, six gated live on `MCP_RECIPES_LIVE=1`; 11 passed live; PR #66); the
page is the engine's `docs/guides/tools-from-mcp-servers.md`. Next: nothing until Eric rules on RFC-0013's promotion. The plan as settled - step 1: `extensions/agent-tools/agent_tools.py` (the layout of `extensions/mcp-binding`: a module docstring, a
`README.md`, `resources/application.yml`, a `describe` command printing every catalog row, `platform.on_startup` for the
gated registration) with the file tools inside `tools.file.root` (`file.read`, `file.write` marked `write: true` with
`create` the default, `file.list`, `file.search`; paths resolved with symlinks followed and refused outside the root;
Expand All @@ -34,4 +38,4 @@
plus its skill inventory `files.list`), the Node twin (step 3), the Playground graphs and the recipes (steps 4-5, in the
engine repo). RFC-0012 is done and promoted (ADR-0035, mercury-composable #643).
→ serves: vision-mercury-python
<!-- id: bp-agent-tools-python | created: 2026-11-17 | last_used: 2026-11-17 | uses: 1 | tier: working | origin: 2026-11-17-094509 -->
<!-- id: bp-agent-tools-python | created: 2026-11-17 | last_used: 2026-11-18 | uses: 1 | tier: working | origin: 2026-11-17-094509 -->
45 changes: 45 additions & 0 deletions memory/sessions/2026-11-18-090840.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Session (2026-11-18T09:08:40.000Z)

**Agent:** Claude Code
**Title:** RFC-0013 step 5, the pack's half - the MCP recipes file, the shared digest vector and the gated live test
**User:** Eric - "both npx and uvx are available in this dev machine. please continue with step 5."

## What We Did

- **`extensions/mcp-binding/resources/mcp-recipes.yml`:** one ready server-file entry per recipe of the engines' page
"Tools from MCP Servers" - the reference servers Git, Time, Fetch (`uvx`, 2026.11.11) and Filesystem (`npx`, 2.3.0,
`--read-only`), Neo4j's Cypher server (`uvx`, 0.6.0, the connection from `NEO4J_*` variables), GitHub's hosted server
(streamable HTTP, a token reference, the toolsets and read-only headers) and Playwright's browser (`npx`, 0.0.85,
`--headless --isolated --allowed-origins`). Every environment-specific value is a `${NAME:default}` reference, every
credential a reference without a default; the binding does not load the file.
- **`tests/vectors/mcp-recipes.json`:** the input-schema digests of 56 tools of the six servers that list their tools
without a credential, read on 2026-11-18 through `describe` from the pinned versions; the Node.js binding printed the
same digests line for line. Shared byte for byte with the Node pack, pinned by SHA in both tests.
- **`tests/test_mcp_recipes.py`:** on every run the vector pin, the seven servers with their transports and commands,
the references resolved from the environment, every pinned server with a recipe and tools, the rot helper; gated on
`MCP_RECIPES_LIVE=1`, each credential-free server started through the binding's own probe and its digests compared
(the Neo4j one also wants `NEO4J_PASSWORD`): 11 passed live in about twenty seconds against the development Neo4j.
- README (a Recipes section, the live command), CHANGELOG Unreleased/Added 4.
- **What the build taught:** `args` are resolved through `${}` like `env` and `headers`, so a path placeholder works in
an argument list; the Neo4j server reads `NEO4J_URI`, `NEO4J_USERNAME`, `NEO4J_PASSWORD` and `NEO4J_DATABASE` from
its environment and `--read-only` lists two tools of three; the Filesystem server's `--read-only` lists ten of
fifteen; the Fetch server's own description addresses a chat assistant, which is why the graph's row is rewritten;
the engine's loop refuses `$schema` and `anyOf`, so a row is never a copy of `describe`'s output; a credential
reference without a default fails `load_servers` for the whole file, so the test sets placeholders for the
credentials it never sends.
- Gates: ruff OK, basedpyright OK, pytest 603 passed and one failed - first read as the public Mermaid endpoint, and
wrong: the new test module loaded `mcp_binding.py` a second time under its own module name, so its `@preload`
registered `mermaid.render` again with a second function object and the binding test's identity check failed
whenever both files ran in one process (CI on #66 failed the same way). The recipes test now reuses the module
`test_mcp_binding.py` loads, by its name in `sys.modules`, and executes the file only when it is first; the full
suite is green. **Lesson:** a file-loaded module with `@preload` registrations is loaded once per process -
share the module name across test files, never load it twice. Diff scanned for [[conv-compartment-downstream-secrets]]: fictional hosts only.

Opened as PR #66.

## Memory References

- Referenced: bp-agent-tools-python (edited: step 5's pack half), mcp-binding-function-per-tool (the bind shape the
recipes apply), conv-compartment-downstream-secrets (the diff scanned)
- Created: (none)
- Superseded: (none)
Loading
Loading