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
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@
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.
`tests/vectors/mcp-recipes.json`, shared byte for byte with the Node.js pack, pins the input-schema digests of all
seven servers (95 tools, read 2026-11-18 through both packs' `describe`, identical; GitHub's hosted server with a
maintainer's token - 39 tools of its three default toolsets, 22 of them under the read-only header), 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 (GitHub's when `GITHUB_MCP_TOKEN` is set, in both modes), so
a recipe that rots fails by name.

### Fixed

Expand Down
7 changes: 4 additions & 3 deletions extensions/mcp-binding/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ servers Git, Time, Fetch and Filesystem (started with `uvx` and `npx`, versions
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 page carries the digests of all seven servers, read on 2026-11-18 from the pinned versions (GitHub's with a
maintainer's token), 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, GitHub's `GITHUB_MCP_TOKEN`): a recipe that rots fails at the
digest, as the boot would.

## The function contract

Expand Down
7 changes: 4 additions & 3 deletions extensions/mcp-binding/resources/mcp-recipes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ servers:
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.
# header selects the tool families (the default lists 39 tools), the read-only header hides the
# seventeen that write. The listing needs the credential: the page's digests were read with a
# maintainer's token, and the gated test checks them when GITHUB_MCP_TOKEN is set. A self-hosted
# alternative is the vendor's container image over stdio.
github:
transport: http
url: 'https://api.githubcopilot.com/mcp/'
Expand Down
4 changes: 3 additions & 1 deletion memory/open-threads/thread-bp-agent-tools-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
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, merge `8db480a`, MERGED
2026-11-18); 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
2026-11-18); the page is the engine's `docs/guides/tools-from-mcp-servers.md`. GitHub's digests pinned the same day with Eric's
token (39 tools, 22 under the read-only header; two live tests gated on `GITHUB_MCP_TOKEN`; PR #67). 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 Down
15 changes: 15 additions & 0 deletions memory/sessions/2026-11-18-090840.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@

Opened as PR #66; **MERGED 2026-11-18** (merge `8db480a`).

## Later the same day - GitHub's digests pinned

- Eric merged #66, #132 and #648, generated a fine-grained token and set `GITHUB_MCP_TOKEN` in the shell; he ran
`describe github` himself too and it worked. The hosted server listed 22 tools under the recipe's default
`X-MCP-Readonly: true` and 39 with the header off (`repos,issues,pull_requests`), identical digests from both
bindings; every output file was checked for the token's value before it was read (none).
- `tests/vectors/mcp-recipes.json` gains `github` with the 39 digests and the `read_only_tools` list (95 tools in all,
new pin in both packs); `tests/test_mcp_recipes.py` gains two live tests gated on the token: the read-only listing
is exactly the pinned reads, and the full listing carries every pinned digest. Both passed live; the plain suite is
green. The recipe's comment, the README and the CHANGELOG item no longer say GitHub's digests are unpinned.
- Seventeen of the server's tools write (`issue_write`, `create_pull_request`, `push_files`, `merge_pull_request`,
...) and the read-only header hides exactly those; several of its descriptions instruct a chat assistant, which the
page now cites as a second case for rewriting the row. The token is only needed for the live run; CI skips it.
- Opened as PR #67.

## Memory References

- Referenced: bp-agent-tools-python (edited: step 5's pack half), mcp-binding-function-per-tool (the bind shape the
Expand Down
42 changes: 39 additions & 3 deletions tests/test_mcp_recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
_RECIPES = _BINDING.parent / "resources" / "mcp-recipes.yml"
_DIGESTS = _TESTS / "vectors" / "mcp-recipes.json"
# the Node.js twin pins the same digest: change the file in both packs or in neither
_DIGESTS_SHA256 = "10c70fe179d315cb0932d56cf0bc1e11290eb7c922ff439e5b9e7944df437d53"
_DIGESTS_SHA256 = "844e729bc41e667892ecd5a6e864568b2c10d4785f0624864c91834074b47aac"

# the module name tests/test_mcp_binding.py loads the binding under: one process executes the
# module once, because a second execution would register mermaid.render again with a second function
Expand Down Expand Up @@ -55,7 +55,7 @@ def _load_binding() -> Any:
DIGESTS: dict[str, Any] = json.loads(_DIGESTS.read_text(encoding="utf-8"))
LIVE = bool(os.environ.get("MCP_RECIPES_LIVE"))
RECIPE_SERVERS = ["fetch", "filesystem", "git", "github", "neo4j", "playwright", "time"]
# the servers that list their tools without a credential - the ones the page pins
# the servers that list their tools without a credential; GitHub's hosted server lists with a token
CREDENTIAL_FREE = ["git", "time", "fetch", "filesystem", "playwright"]
# a credential the file references but these tests never send gets a placeholder, so the file
# loads; a real value already in the environment (the Neo4j run) is kept
Expand Down Expand Up @@ -114,7 +114,8 @@ def test_the_references_resolve_from_the_environment(recipes: dict[str, Any]) ->

def test_every_pinned_server_has_a_recipe_and_tools(recipes: dict[str, Any]) -> None:
pinned = DIGESTS["servers"]
assert sorted(pinned) == sorted(CREDENTIAL_FREE + ["neo4j"])
assert sorted(pinned) == RECIPE_SERVERS
assert set(pinned["github"]["read_only_tools"]) <= set(pinned["github"]["tools"])
assert set(pinned) <= set(recipes)
for name, server in pinned.items():
assert server["tools"], name
Expand Down Expand Up @@ -163,3 +164,38 @@ async def test_live_neo4j_recipe_digests(recipes: dict[str, Any]) -> None:
assert not missing and not changed, (
f"the neo4j recipe rotted - missing {missing}, changed {changed}"
)


# --- GitHub's hosted server, live with a token (gated) -----------------------------------------

GITHUB_LIVE = LIVE and bool(os.environ.get("GITHUB_MCP_TOKEN"))
GITHUB_REASON = (
"set MCP_RECIPES_LIVE=1 and GITHUB_MCP_TOKEN (a fine-grained, read-only token) to list "
"GitHub's hosted server"
)


@pytest.mark.skipif(not GITHUB_LIVE, reason=GITHUB_REASON)
@pytest.mark.asyncio
async def test_live_github_read_only_header_hides_every_write(recipes: dict[str, Any]) -> None:
# the recipe's default, X-MCP-Readonly true: exactly the pinned read tools, with their digests
actual = await offered_digests(recipes["github"])
pinned = DIGESTS["servers"]["github"]
expected = {name: pinned["tools"][name] for name in pinned["read_only_tools"]}
assert actual == expected, "the read-only listing differs from the pinned read tools"


@pytest.mark.skipif(not GITHUB_LIVE, reason=GITHUB_REASON)
@pytest.mark.asyncio
async def test_live_github_recipe_digests(
monkeypatch: pytest.MonkeyPatch, recipes: dict[str, Any]
) -> None:
# with the writes listed: every pinned tool offered, with its digest
assert "github" in recipes
monkeypatch.setenv("GITHUB_MCP_READONLY", "false")
github = {spec.name: spec for spec in binding.load_servers(str(_RECIPES))}["github"]
actual = await offered_digests(github)
missing, changed = rot(actual, DIGESTS["servers"]["github"]["tools"])
assert not missing and not changed, (
f"the github recipe rotted - missing {missing}, changed {changed}"
)
68 changes: 68 additions & 0 deletions tests/vectors/mcp-recipes.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,74 @@
"browser_type": "ed892740ebc14bb2a49467c08b8bb02717d50f1f3ef8ed06d51abf5ebb3249da",
"browser_wait_for": "cee58694f677034e21fc68446200888eb28469696b4ca9259047e15084fb22ff"
}
},
"github": {
"started_with": "https://api.githubcopilot.com/mcp/ with X-MCP-Toolsets: repos,issues,pull_requests (X-MCP-Readonly: false for the whole list; read_only_tools is the list under X-MCP-Readonly: true)",
"read_only_tools": [
"get_commit",
"get_file_contents",
"get_label",
"get_latest_release",
"get_release_by_tag",
"get_tag",
"issue_read",
"list_branches",
"list_commits",
"list_issue_fields",
"list_issue_types",
"list_issues",
"list_pull_requests",
"list_releases",
"list_repository_collaborators",
"list_tags",
"pull_request_read",
"search_code",
"search_commits",
"search_issues",
"search_pull_requests",
"search_repositories"
],
"tools": {
"add_comment_to_pending_review": "4db72d6ccc6cbf6c5a5a60db2269bdb78076bf2150838c932c4756fa16bc4667",
"add_issue_comment": "d93b8edaabd74e3c655651f4fcd84fcb30d30bbd9b648cf3194c410faed2f282",
"add_reply_to_pull_request_comment": "b3e21f358fb25d6e1e9b60c6b4133d50823f3401cb28a742b461b7f37bdc7951",
"create_branch": "e65b73ec25a45f23ce7371d5a18b7d2bb749388c330c01f592f1c288016fc385",
"create_or_update_file": "4bbfd9f8df3736e4897c2a0466b2131764d414c3075e3691711282eae7dc209e",
"create_pull_request": "e249ccd5a1f2364cbfc0a5d9e11bebdc298626351cc7e43fd59b851c3d520238",
"create_repository": "eb38a6e274e4b762d210740cdec57eacc9ebf0b5b87c013e32ee80406036f76b",
"delete_file": "af29cf413864c65dee4ac821b10d15f9bb0673e2977d2298918b1317d160d4ba",
"fork_repository": "ac52a51d95996c5af97cac680c7bc1b7dcc423061174a84c727dfd4a1d06b210",
"get_commit": "f084d5addb427982ea2cb3064e8c7faf23ef2117009b17707ca1f3dca2e08945",
"get_file_contents": "3e8fd49a5ed6d35c07b9b3d712312ffe317391a11f7fdd185fe7c86ed8a241bd",
"get_label": "cf89e3a5ff5d176d7be8375ae68fdde2bb90a85a524cb39037d0bf2d272fa474",
"get_latest_release": "6bd7211e72d2921f609892e467a7b293cc3ed176557cc391f736361ea718e021",
"get_release_by_tag": "9012396d62f53b04de455a466203e7c9ee6c56fa9f61063f28e08c147cb881f9",
"get_tag": "8b13651d5e7162c741afd862aa15fa2a1419c539ebcba092bfd07ef1ee88a82a",
"issue_read": "4129cf817f37afefbc65885a75ba37817ae95f46ab9658b0b9de8c37d6b26c2e",
"issue_write": "083aa952baecd960494979902818962438474a84f1985252f3024597e9442f5f",
"list_branches": "cc4d347261dd31b2df9f0a36d7bd49a5acb4dba8043c857f70a5dfb74c6b7804",
"list_commits": "591090af37df44793d29ce44be3afe0ec122e3ac2db6edc4e5db62d330b0a35c",
"list_issue_fields": "ae44b8d0eadc50902f62a7907ab1c45dfbf95a71ec87ec4aa836fece8477c002",
"list_issue_types": "fa18815229ec77ba88b9a249313ed41dd9e62382729cb72bc472587f1c06fb37",
"list_issues": "ae3a1945a49d3648618475385a0d3647f107f57e40720f1889e2360b40a98d37",
"list_pull_requests": "e1e093b013497fae6ca27152cc7d2ffed822ab389a5983e68773466bf83dc38b",
"list_releases": "4118d959bb3b13749813d74442a4d143f9a2a0fad7ac5e23880fc5d1f1aace03",
"list_repository_collaborators": "ee69edd2a4af5094260553c303fbc28db0a701ef28a9e93016aed005d6bc89a9",
"list_tags": "cc4d347261dd31b2df9f0a36d7bd49a5acb4dba8043c857f70a5dfb74c6b7804",
"merge_pull_request": "d6b25b3006b7124dc4a1d775458febd3e802fe1dd9ff61347fc9bdb5e0176a02",
"pull_request_read": "380c0d04d38cb7ae46ac5862485e29277e353f7f7d868b558125e27be06017c1",
"pull_request_review_write": "250438d8197b381022f562f96943dfab18a397fafaada3fdca3d3f18696fdf0b",
"push_files": "63d80fecd0ff8d6b927f02faa499f858e13f79a008a6dfedaf04d8783194d51e",
"search_code": "4ad473c9570e3a825e6d60c9869b87324e0a5d371cf293ffb70fd2b840358cf7",
"search_commits": "e477f9b9a99ce91db99e3380c7272485b0ee66cf06d9415674918bc6e8c159f7",
"search_issues": "a055d2bd8d73374c84787996a5dae3934ef1570fda9c0aa1ad7061038bc0e12e",
"search_pull_requests": "1d885a55314d8a1aff83ac5536600429ac3ae089d0f760335fa8ed559e99a9a1",
"search_repositories": "7b4cad1aba3867b93477594b3054d4e6a3b2fb2fa09ba9b7e11cb42b034a7902",
"sub_issue_write": "8b4d8c72ba5b500c5fed41a86b4720f0bbb58eac1f58abf576fbc00d9a90a88b",
"update_issue_comment": "a4a9d37cda657866581bd1a8ca5eb7d6c1af6626d050361b1a3e4d1f63950441",
"update_pull_request": "f9ef3dae6c8d529fa50f1ebd23b6fe351c0def794deb20787d4b55a9503fb9e1",
"update_pull_request_branch": "48c3c0aa12992defea00c3727690442719367b1210187d5da589234bde3b62b6"
}
}
}
}
Loading