feat(mcpedia): Phase 3 — async indexing (BullMQ), git-sync webhook, revisions, MCP Resources
- packages/queue: ioredis singleton + BullMQ Queue/Worker (prefix mcpedia:
on shared imrnes Redis :6379); apps/worker runs startWorker()
- @mcpedia/core: indexContentFile/runFullIndex (single indexing entry point
shared by script/worker/hook) + revision.service (list/get/restore)
- document_revisions table (migration 0002) — snapshots only on body change
- apps/api: POST /hooks/reindex + /hooks/index webhooks; tRPC revisions,
getRevision, restoreRevision, jobStatus, queueStatus
- apps/mcp: register MCP Resources mcpedia://docs{/,+slug/chunks/revisions}
({+slug} RFC6570 reserved expansion for slugs containing /)
- apps/mcp zod pinned to ^4 to match MCP SDK 1.30 compiled types
(resolves registerTool TS2589/ShapeOutput skew)
- scripts/enqueue.ts one-shot job enqueue helper; indexer refactored to runFullIndex
- PHASES.md/README/.env.example/docs updated
This commit is contained in:
1 parent
9397303f01
commit
8f2229d447
30 files changed
+1233
-78
No files matched your search
@@ -92,6 +92,35 @@ async function main() {
|
||||
}
|
||||
console.log(`hybrid_search => ${hybHits.length} docs, top: ${hybHits[0].doc.slug}`);
|
||||
|
||||
// 8) resources: list
|
||||
const resList = await client.listResources();
|
||||
const resNames = resList.resources.map((r: any) => r.name).sort();
|
||||
console.log("resources:", resNames.join(", "));
|
||||
if (!resNames.includes("mcpedia-docs-list")) {
|
||||
throw new Error("expected mcpedia-docs-list resource");
|
||||
}
|
||||
|
||||
// 9) resource: read the docs list (must not throw, returns JSON content)
|
||||
const readList = await client.readResource({ uri: "mcpedia://docs" });
|
||||
const listText = (readList.contents as any)[0].text;
|
||||
if (!listText.includes("docs/websocket/contract")) {
|
||||
throw new Error("mcpedia://docs did not list the websocket contract doc");
|
||||
}
|
||||
console.log("readResource(mcpedia://docs) => ok");
|
||||
|
||||
// 10) resource: read a single doc body + revisions
|
||||
const readDoc = await client.readResource({ uri: "mcpedia://docs/docs/websocket/contract" });
|
||||
const docText = (readDoc.contents as any)[0].text;
|
||||
if (!docText.includes("WebSocket Contract")) {
|
||||
throw new Error("mcpedia://docs/{slug} returned unexpected body");
|
||||
}
|
||||
console.log("readResource(mcpedia://docs/docs/websocket/contract) => ok");
|
||||
|
||||
const readRev = await client.readResource({
|
||||
uri: "mcpedia://docs/docs/websocket/contract/revisions",
|
||||
});
|
||||
console.log("readResource(.../revisions) => ok");
|
||||
|
||||
await client.close();
|
||||
await server.close();
|
||||
console.log("\nSMOKE OK");
|
||||
|
||||
Reference in new issue
Block a user