Expose bundled prompts as static MCP resources (resources/list + resources/read)
Summary
Expose OpenHuman's bundled prompt assets — the three core identity files (IDENTITY.md, SOUL.md, USER.md) plus each built-in subagent's static prompt.md — as MCP resources so external MCP clients (Claude Desktop, Cursor, Zed, …) can attach them as conversation context.
Problem
The MCP server today only implements initialize, ping, tools/list, and tools/call; every other spec method returns -32601 Method not found. External MCP clients connecting to openhuman-core therefore see a tools-only surface and have no way to pull OpenHuman's own prompt scaffolds into their own conversations — even though those scaffolds are already bundled into the binary at compile time and contain no per-user data.
Concretely, a Claude Desktop user who connects OpenHuman as an MCP server cannot today:
- Attach
IDENTITY.md,SOUL.md, orUSER.mdas context to a Claude conversation. - Discover or attach any subagent prompt (
orchestrator,planner,researcher, etc.) without reading the OpenHuman source tree.
This is the smallest user-visible spec gap on the server-side MCP surface and lands without backend coordination.
Solution (optional)
Add a static MCP resources catalog backed by include_str!-bundled prompt files, plus the two spec handlers:
resources/list— returns the full catalog in one page; advertises 21 URIs (3 core + 18 subagents).cursoraccepted for spec-compliance but ignored.resources/read— looks up byuriand returns the markdown body undercontents[0].text. Missing-uri→-32602 Invalid params. Unknown URI →-32002 Resource not foundper MCP error-code convention.
initialize advertises "resources": { "subscribe": false, "listChanged": false } because the catalog cannot change without rebuilding the binary, so the server intentionally does not implement subscriptions or notifications/resources/list_changed.
URI scheme:
| URI | Source path |
|---|---|
openhuman://core/identity |
src/openhuman/agent/prompts/IDENTITY.md |
openhuman://core/soul |
src/openhuman/agent/prompts/SOUL.md |
openhuman://core/user |
src/openhuman/agent/prompts/USER.md |
openhuman://agents/<id>/prompt |
src/openhuman/agent/agents/<id>/prompt.md (one entry per BUILTINS row) |
Scope (core only, no app/UI change):
src/openhuman/mcp_server/resources.rs— new module holding the catalog + the two builders.src/openhuman/mcp_server/mod.rs— register the module.src/openhuman/mcp_server/protocol.rs— wire the two match arms + advertise the capability + extend the existinginitializetest.gitbooks/developing/mcp-server.md— Resources section + extended smoke-test snippet.docs/TEST-COVERAGE-MATRIX.md— new row 11.1.7.
Out of scope (deliberately, to keep the PR end-to-end shippable):
- Dynamic memory-as-resources (
openhuman://memory/recent,openhuman://memory/search?q=…) — needs per-user context plumbing and SecurityPolicy gating; tracked as a follow-up. resources/subscribe/resources/unsubscribe/notifications/resources/list_changed— the static catalog cannot change at runtime, so subscriptions would be no-ops.resources/templates/list— no templated URIs in the MVP catalog.
Acceptance criteria
- [ ]
resources/listreturns the full static catalog — one entry per core identity file plus one perBUILTINSrow, each withuri,name,title,description, andmimeTypepopulated. - [ ]
resources/readreturns the markdown body for a known URI undercontents[0].textwithmimeType: "text/markdown". - [ ] Unknown-URI lookups surface as
-32002 Resource not foundwith adatafield that names the offending URI. - [ ] Missing-
urifield surfaces as-32602 Invalid paramsso clients can distinguish a typo from a malformed request. - [ ]
initializeadvertises theresourcescapability withsubscribe: falseandlistChanged: false. - [ ] Catalog parity is locked in — a unit test mirrors the
BUILTINSlist so adding a new subagent without a matching catalog entry fails CI. - [ ] Smoke test docs cover the new flow —
gitbooks/developing/mcp-server.mdlists the URIs and the smoke-test snippet exercisesresources/list+resources/read. - [ ] Diff coverage ≥ 80% — the implementing PR meets the changed-lines coverage gate (Vitest + cargo-llvm-cov, enforced by
.github/workflows/coverage.yml).
Related
- MCP spec, server-side resources surface: https://modelcontextprotocol.io/specification/2025-06-18/server/resources
- Prior MCP-server PRs (context): #1845 (HTTP/SSE transport), #2559 (split + boot-spawn), #2306 / #2316 (memory write tools), #2570 (Skills-page coming-soon placeholder).
Picking this one up. PR up next.