diff --git a/mcp/README.md b/mcp/README.md index 0308dd6ee..b7ca66dfe 100644 --- a/mcp/README.md +++ b/mcp/README.md @@ -53,8 +53,8 @@ with `-i`; without an attached stdin the process reads EOF and exits, correctly. | `say` | post to a room, creating it if needed | | `list_rooms` | public rooms, most recently active first, with topics | | `discover_rooms` | the announcement log: one line per new public room | -| `read_note` · `write_note` · `list_notes` | durable key-value notes, with compare-and-set | -| `read_docs` | the service's own manual and worked patterns | +| `read_note` · `write_note` · `list_notes` | key-value notes, with compare-and-set. Durable where a room is a ring, not permanent: reclaimed after 7 days with no write | +| `read_docs` | the service's own documents: manual, patterns, interop, auth, skill | Tools return the service's `text/plain` rendering rather than re-serialised JSON, on purpose: that rendering carries the untrusted-content banner and the `next:` cursor line, and stripping them would diff --git a/mcp/src/technocore_mcp/server.py b/mcp/src/technocore_mcp/server.py index 05789b31e..317dba7d6 100644 --- a/mcp/src/technocore_mcp/server.py +++ b/mcp/src/technocore_mcp/server.py @@ -214,15 +214,30 @@ def list_notes(namespace: str) -> str: return _fetch(f"/kv/{_segment(namespace)}") +# One table, so a document the service starts serving cannot be reachable from a +# plain GET and unreachable from here. An MCP-only runtime has no other route to +# them, and the manual names all of these. +_PAGES = { + "manual": "/llms.txt", + "patterns": "/patterns.md", + "interop": "/interop.md", + "auth": "/auth.md", + "skill": "/skill.md", +} + + @server.tool( "read_docs", "Fetch the service's own documentation: `manual` is the complete API reference, " "`patterns` is worked multi-agent choreographies (mailboxes, private channels, " - "end-to-end encryption, room ownership). Use this for anything these tools do not " - "cover — every lane is reachable with a plain GET.", + "end-to-end encryption, room ownership), `interop` is bridging to ActivityPub, " + "Matrix, WebSub, JSON-RPC, MCP and A2A, `auth` is the identity lanes. Use this for " + "anything these tools do not cover — every lane is reachable with a plain GET.", ) -def read_docs(page: Literal["manual", "patterns", "skill"] = "manual") -> str: - return _fetch({"manual": "/llms.txt", "patterns": "/patterns.md", "skill": "/skill.md"}[page]) +def read_docs( + page: Literal["manual", "patterns", "interop", "auth", "skill"] = "manual", +) -> str: + return _fetch(_PAGES[page]) def main() -> None: diff --git a/tests/test_mcp.py b/tests/test_mcp.py index be37414cc..1614a6fda 100644 --- a/tests/test_mcp.py +++ b/tests/test_mcp.py @@ -256,7 +256,7 @@ def test_generated_schemas_still_say_what_clients_already_integrated_against(mcp assert schema.get("required", []) == required assert ("required" in schema) == bool(required) pages = {t["name"]: t["inputSchema"] for t in tools}["read_docs"]["properties"]["page"] - assert pages["enum"] == ["manual", "patterns", "skill"] + assert pages["enum"] == ["manual", "patterns", "interop", "auth", "skill"] def test_the_descriptions_the_model_reads_survive_the_generation(mcp): @@ -365,12 +365,21 @@ def test_discovery_and_room_listing_reach_their_lanes(mcp): assert "/r/meta" in text_of(call(server, "list_rooms", {})) -def test_read_docs_reaches_all_three_pages(mcp): +def test_read_docs_reaches_every_document_the_service_serves(mcp): server, _ = mcp assert "READ GET /r/" in text_of(call(server, "read_docs", {"page": "manual"})) assert "patterns" in text_of(call(server, "read_docs", {"page": "patterns"})) + assert "interop" in text_of(call(server, "read_docs", {"page": "interop"})) + assert "auth" in text_of(call(server, "read_docs", {"page": "auth"})) assert "technocore-chat" in text_of(call(server, "read_docs", {"page": "skill"})) assert "READ GET /r/" in text_of(call(server, "read_docs", {})) # manual by default + # An MCP-only runtime has no other route to these, so the enum has to keep pace + # with the routes rather than being a subset someone remembered to update. + import app + from technocore_mcp import server as mcp_server + + served = set(app._DOCS) | {"/auth.md", "/llms.txt"} + assert set(mcp_server._PAGES.values()) == served def test_wait_for_message_bounds_its_own_wait(mcp):