Skip to content
prod 352bb92
Browse

Library MCP

Topic · Library MCP

ZajLibrary exposes a remote MCP server at /api/mcp (Streamable HTTP). The corpus index is built at deploy time; this route is the only on-demand function on an otherwise static site.

ItemValue
Production URLhttps://library.zajapps.com/api/mcp
Local devhttp://localhost:4321/api/mcp (npm run dev from app/ — port 4321 only)
Local index refreshcd app && npm run build:index then restart dev (index loads at server start)
Smoke testcd app && npm run test:mcp
TransportStreamable HTTP (JSON-RPC tools)
Server namezajlibrary (from tenant.config.mjs)
ToolAccessPurpose
list_contentsPublicTaxonomy counts, top tags, index metadata (commitShaShort, indexBuiltAt)
search_libraryPublicKeyword, semantic, or hybrid search — ranked title, URL, topic crumb, snippet
get_documentPublic*Full Markdown body by id, slug path, or library URL
submit_feedbackPublicFile structured feedback to the same DB queue as the UI form
list_feedbackAdminTriage queue (emails redacted)
review_feedbackAdminUpdate review decision, implementation state, and notes on one row

*Private documents require read-private scope (admin token or signed-in session).

CallerScopes
AnonymousPublic read + submit_feedback
Authorization: Bearer <MCP_ADMIN_TOKEN>Public + private read + feedback submit + list/review
Signed-in Better Auth sessionPublic + private read + feedback submit; allowlisted admin email also gets list/review

Every search and list response carries index provenance (commitShaShort, builtAt) so an agent can confirm the MCP index matches the live deploy without guessing.

flowchart LR
Agent["MCP client"] --> Endpoint["/api/mcp"]
Endpoint --> Read["list_contents · search_library · get_document"]
Endpoint --> Write["submit_feedback"]
Endpoint --> Admin["list_feedback · review_feedback"]
Read --> Index[("Build-time index")]