Skip to content

Commit 8db480a

Browse files
authored
Merge pull request #66 from Accenture/feat/mcp-recipes
feat(mcp-binding): recipes for tools from existing MCP servers (RFC-0013 step 5)
2 parents 3defc46 + 978a338 commit 8db480a

7 files changed

Lines changed: 419 additions & 3 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@
7070
`dev/graph-up.sh` and `graph-down.sh` run Neo4j Community on Colima for development; the live test runs against it
7171
when `TOOLS_GRAPH_TEST_URI` is set. The five new catalog rows join the `catalog/` folder and `describe`.
7272

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

7586
1. **A direct `python extensions/mcp-binding/mcp_binding.py` now connects its servers.** The binding attached its boot

‎extensions/mcp-binding/README.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ catalog row (name your function's route; review the description before the graph
122122

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

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

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

187200
The shared vector file pins the pure half (the digest, the verification of declared bindings, the result mapping) in
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Recipes - the MCP servers of the engines' page "Tools from MCP servers" (RFC-0013, step 5), one
2+
# entry per server, ready to copy into mcp-servers.yml. The binding does not read this file by
3+
# default, and nothing here is served until a function binds a tool of it: a bind line in
4+
# mcp_binding.py (or in an application that imports it), a preload function on a route of your own,
5+
# a catalog row on the graph and an Event-over-HTTP entry on the engine.
6+
#
7+
# Everything environment-specific is a ${NAME:default} reference, resolved from this process's
8+
# environment at boot. A credential has no default, so a missing one stops the boot by name, and a
9+
# resolved value is never logged. The package versions are the ones the page's digests were read
10+
# from (2026-11-18): bump one, run describe, review the schema and re-pin the digest next to the
11+
# function that binds the tool.
12+
#
13+
# The gated test tests/test_mcp_recipes.py loads this file on every run and, with MCP_RECIPES_LIVE=1,
14+
# starts each server with uvx or npx through the binding's own probe and checks the digests pinned
15+
# in tests/vectors/mcp-recipes.json (the Neo4j server also wants NEO4J_PASSWORD and a database, for
16+
# example the one extensions/agent-tools/dev/graph-up.sh starts).
17+
servers:
18+
# Git (reference server, Python). The history and state of one repository; --repository confines
19+
# every tool to it, and the function that binds a tool adds repo_path from configuration, so no
20+
# graph names a path. The reads are git_status, git_diff_unstaged, git_diff_staged, git_diff,
21+
# git_log, git_show, git_branch and git_remote; git_add, git_commit, git_reset, git_create_branch,
22+
# git_checkout and git_merge are write: true on the graph.
23+
git:
24+
transport: stdio
25+
command: uvx
26+
args: ['mcp-server-git==2026.11.11', '--repository', '${MCP_GIT_REPOSITORY:/srv/repository}']
27+
# Time (reference server, Python). The alternative to the built-in time.now when a use case
28+
# converts between zones or reasons about relative times; --local-timezone fixes the server's
29+
# default zone. All three tools read.
30+
time:
31+
transport: stdio
32+
command: uvx
33+
args: ['mcp-server-time==2026.11.11', '--local-timezone', '${MCP_TIME_ZONE:UTC}']
34+
# Fetch (reference server, Python). The alternative to the built-in web.fetch: one tool, Markdown
35+
# out, robots.txt honoured, private addresses refused by default, and --allowed-hosts as the
36+
# allowlist (repeat the option for more hosts). The built-in web.crawl has no counterpart here.
37+
fetch:
38+
transport: stdio
39+
command: uvx
40+
args: ['mcp-server-fetch==2026.11.11', '--allowed-hosts', '${MCP_FETCH_ALLOWED_HOST:docs.example.com}']
41+
# Filesystem (reference server, Node.js). The alternative to the built-in file.* tools, started in
42+
# read-only mode: the ten tools that read and list. Without --read-only the server also offers
43+
# write_file, edit_file, create_directory, move_file and copy_file, each write: true on the graph.
44+
# The directories named are the sandbox; a path outside them is refused by the server.
45+
filesystem:
46+
transport: stdio
47+
command: npx
48+
args: ['-y', '@modelcontextprotocol/server-filesystem@2.3.0', '--read-only', '${MCP_FILESYSTEM_ROOT:/srv/documents}']
49+
# Neo4j's Cypher server (vendor server, Python). The alternative to graph.schema, graph.query and
50+
# graph.write over the vendor's own server: get_neo4j_schema (needs the APOC plugin in the
51+
# database), read_neo4j_cypher and write_neo4j_cypher (write: true on the graph; add --read-only to
52+
# leave it out of the listing). graph.ingest has no counterpart - the model would write the MERGE
53+
# statements itself.
54+
neo4j:
55+
transport: stdio
56+
command: uvx
57+
args: ['mcp-neo4j-cypher==0.6.0']
58+
env:
59+
NEO4J_URI: '${NEO4J_URI:bolt://127.0.0.1:7687}'
60+
NEO4J_USERNAME: '${NEO4J_USERNAME:neo4j}'
61+
NEO4J_PASSWORD: '${NEO4J_PASSWORD}'
62+
NEO4J_DATABASE: '${NEO4J_DATABASE:neo4j}'
63+
# GitHub's server (vendor server). The hosted endpoint over streamable HTTP with a fine-grained
64+
# personal access token of least privilege (or the deployment's GitHub App token); the toolsets
65+
# header selects the tool families, the read-only header hides every write. The listing needs the
66+
# credential, so its digests are not pinned on the page: run describe with the token and pin what it
67+
# prints. A self-hosted alternative is the vendor's container image over stdio.
68+
github:
69+
transport: http
70+
url: 'https://api.githubcopilot.com/mcp/'
71+
headers:
72+
Authorization: 'Bearer ${GITHUB_MCP_TOKEN}'
73+
X-MCP-Toolsets: '${GITHUB_MCP_TOOLSETS:repos,issues,pull_requests}'
74+
X-MCP-Readonly: '${GITHUB_MCP_READONLY:true}'
75+
timeout_ms: 30000
76+
# Playwright's server (vendor server, Node.js). A headless browser with an in-memory profile;
77+
# --allowed-origins is the allowlist of sites the browser may request. The reads are the snapshot,
78+
# the screenshot, find, the console and network listings and navigation; the actions (click, type,
79+
# fill_form, select_option, press_key, drag, file_upload, handle_dialog) are write: true on the
80+
# graph; browser_evaluate and browser_run_code_unsafe are never bound.
81+
playwright:
82+
transport: stdio
83+
command: npx
84+
args: ['-y', '@playwright/mcp@0.0.85', '--headless', '--isolated', '--allowed-origins', '${MCP_PLAYWRIGHT_ORIGINS:https://docs.example.com}']
85+
timeout_ms: 60000

‎memory/open-threads/thread-bp-agent-tools-python.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@
1313
`graph-down.sh`, 161 tests and a live round trip on the development Neo4j; eight defaults set without a ruling in
1414
the session log. The Node twin landed as mercury-nodejs #130; the Playground's three graphs as
1515
mercury-composable #647 (step 4), driven live through both packs 2026-11-17 - the drive taught a relative `include`
16-
(PR #65, merge `30cbb0d`, MERGED 2026-11-17, with the README's Event-over-HTTP snippet corrected to one route per entry). Next: nothing
17-
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
16+
(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
17+
entries - git, time, fetch, filesystem, neo4j, github, playwright - with `${NAME:default}` references and pinned
18+
versions, not loaded by default), the shared digest vector `tests/vectors/mcp-recipes.json` (56 tools of the six
19+
servers that list without a credential, read through `describe`, identical from both packs) and
20+
`tests/test_mcp_recipes.py` (five tests on every run, six gated live on `MCP_RECIPES_LIVE=1`; 11 passed live; PR #66); the
21+
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
1822
`README.md`, `resources/application.yml`, a `describe` command printing every catalog row, `platform.on_startup` for the
1923
gated registration) with the file tools inside `tools.file.root` (`file.read`, `file.write` marked `write: true` with
2024
`create` the default, `file.list`, `file.search`; paths resolved with symlinks followed and refused outside the root;
@@ -34,4 +38,4 @@
3438
plus its skill inventory `files.list`), the Node twin (step 3), the Playground graphs and the recipes (steps 4-5, in the
3539
engine repo). RFC-0012 is done and promoted (ADR-0035, mercury-composable #643).
3640
→ serves: vision-mercury-python
37-
<!-- id: bp-agent-tools-python | created: 2026-11-17 | last_used: 2026-11-17 | uses: 1 | tier: working | origin: 2026-11-17-094509 -->
41+
<!-- id: bp-agent-tools-python | created: 2026-11-17 | last_used: 2026-11-18 | uses: 1 | tier: working | origin: 2026-11-17-094509 -->
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Session (2026-11-18T09:08:40.000Z)
2+
3+
**Agent:** Claude Code
4+
**Title:** RFC-0013 step 5, the pack's half - the MCP recipes file, the shared digest vector and the gated live test
5+
**User:** Eric - "both npx and uvx are available in this dev machine. please continue with step 5."
6+
7+
## What We Did
8+
9+
- **`extensions/mcp-binding/resources/mcp-recipes.yml`:** one ready server-file entry per recipe of the engines' page
10+
"Tools from MCP Servers" - the reference servers Git, Time, Fetch (`uvx`, 2026.11.11) and Filesystem (`npx`, 2.3.0,
11+
`--read-only`), Neo4j's Cypher server (`uvx`, 0.6.0, the connection from `NEO4J_*` variables), GitHub's hosted server
12+
(streamable HTTP, a token reference, the toolsets and read-only headers) and Playwright's browser (`npx`, 0.0.85,
13+
`--headless --isolated --allowed-origins`). Every environment-specific value is a `${NAME:default}` reference, every
14+
credential a reference without a default; the binding does not load the file.
15+
- **`tests/vectors/mcp-recipes.json`:** the input-schema digests of 56 tools of the six servers that list their tools
16+
without a credential, read on 2026-11-18 through `describe` from the pinned versions; the Node.js binding printed the
17+
same digests line for line. Shared byte for byte with the Node pack, pinned by SHA in both tests.
18+
- **`tests/test_mcp_recipes.py`:** on every run the vector pin, the seven servers with their transports and commands,
19+
the references resolved from the environment, every pinned server with a recipe and tools, the rot helper; gated on
20+
`MCP_RECIPES_LIVE=1`, each credential-free server started through the binding's own probe and its digests compared
21+
(the Neo4j one also wants `NEO4J_PASSWORD`): 11 passed live in about twenty seconds against the development Neo4j.
22+
- README (a Recipes section, the live command), CHANGELOG Unreleased/Added 4.
23+
- **What the build taught:** `args` are resolved through `${}` like `env` and `headers`, so a path placeholder works in
24+
an argument list; the Neo4j server reads `NEO4J_URI`, `NEO4J_USERNAME`, `NEO4J_PASSWORD` and `NEO4J_DATABASE` from
25+
its environment and `--read-only` lists two tools of three; the Filesystem server's `--read-only` lists ten of
26+
fifteen; the Fetch server's own description addresses a chat assistant, which is why the graph's row is rewritten;
27+
the engine's loop refuses `$schema` and `anyOf`, so a row is never a copy of `describe`'s output; a credential
28+
reference without a default fails `load_servers` for the whole file, so the test sets placeholders for the
29+
credentials it never sends.
30+
- Gates: ruff OK, basedpyright OK, pytest 603 passed and one failed - first read as the public Mermaid endpoint, and
31+
wrong: the new test module loaded `mcp_binding.py` a second time under its own module name, so its `@preload`
32+
registered `mermaid.render` again with a second function object and the binding test's identity check failed
33+
whenever both files ran in one process (CI on #66 failed the same way). The recipes test now reuses the module
34+
`test_mcp_binding.py` loads, by its name in `sys.modules`, and executes the file only when it is first; the full
35+
suite is green. **Lesson:** a file-loaded module with `@preload` registrations is loaded once per process -
36+
share the module name across test files, never load it twice. Diff scanned for [[conv-compartment-downstream-secrets]]: fictional hosts only.
37+
38+
Opened as PR #66.
39+
40+
## Memory References
41+
42+
- Referenced: bp-agent-tools-python (edited: step 5's pack half), mcp-binding-function-per-tool (the bind shape the
43+
recipes apply), conv-compartment-downstream-secrets (the diff scanned)
44+
- Created: (none)
45+
- Superseded: (none)

0 commit comments

Comments
 (0)