Skip to content
Closed
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
4 changes: 2 additions & 2 deletions mcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 19 additions & 4 deletions mcp/src/technocore_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 11 additions & 2 deletions tests/test_mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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/<room>" 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/<room>" 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):
Expand Down