chore: import upstream snapshot with attribution
Deploy Docs / deploy-docs (push) Failing after 1s
Conformance Tests / client-conformance (push) Failing after 3s
Conformance Tests / server-conformance (push) Failing after 1s
GitHub Actions Security Analysis / zizmor (push) Failing after 1s
CI / checks (push) Failing after 59m20s
CI / all-green (push) Waiting to run

This commit is contained in:
wehub-resource-sync
2026-07-13 12:10:27 +08:00
commit 49b9bb6724
992 changed files with 161690 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
"""Prove the middleware wrapped both `tools/list` and the in-flight `tools/call`."""
from mcp.client import Client
from stories._harness import Target, run_client
async def main(target: Target, *, mode: str = "auto") -> None:
async with Client(target, mode=mode) as client:
listed = await client.list_tools()
assert [t.name for t in listed.tools] == ["audit_log"]
result = await client.call_tool("audit_log", {})
assert not result.is_error
assert result.structured_content is not None, result
# Era-neutral: legacy adds initialize + notifications/initialized; modern HTTP
# adds server/discover; modern in-memory adds nothing. Filter to the methods
# this client drove.
seen = [m for m in result.structured_content["result"] if m.startswith("tools/")]
# The tail ends at tools/call with no :done — the handler ran inside the
# middleware frame. Assert the tail (not the whole list) so a re-run against
# a long-lived server, whose log accumulates across clients, still passes.
assert seen[-3:] == ["tools/list", "tools/list:done", "tools/call"], seen
if __name__ == "__main__":
run_client(main)