# MCPedia β€” Phase Status Legend: βœ… built Β· 🟑 partial Β· ⬜ deferred ## Phase 1 β€” MVP (βœ… DONE) | Capability | Status | Notes | | --------------------- | ------ | ----- | | Monorepo (bun + Turbo)| βœ… | apps/{web,mcp}, packages/{types,config,db,parser,search,core}, scripts | | Content as Markdown | βœ… | `content/{docs,writeups,research,notes}/`, Git-tracked | | Frontmatter parsing | βœ… | `@mcpedia/parser` (gray-matter) | | Postgres metadata | βœ… | `@mcpedia/db` Drizzle, `documents` table | | Postgres FTS | βœ… | weighted `tsvector` (title A / body B), GIN index, `ts_rank`+`ts_headline` | | Core services | βœ… | Document / Content / Search β€” single business-logic layer | | Indexer | βœ… | `scripts/indexer.ts` walks content/ β†’ upserts | | Web UI (Next 16) | βœ… | home (list), doc view (SSG), search (dynamic). react-markdown render | | MCP server (stdio) | βœ… | 4 tools; in-memory smoke test passing | | Hybrid/semantic search| ⬜ | Phase 2 | ## Phase 2 β€” Semantic + API - [x] `packages/embeddings` β€” `EmbeddingProvider` interface + OpenRouter provider (via 9router `/v1`, `encoding_format:"float"`); `chunkText` + `embedChunks` batcher. `EMBED_DIM=2048` discovered live. - [x] Schema `document_chunks` (id, document_idβ†’documents.id cascade, slug, chunk_index, content, `embedding real[]`). Stored as `real[]` because pgvector **is not installed** on the shared imrnes Postgres (installing needs host-level apt β€” deferred). Cosine computed in-app; instant for a KB-sized corpus. - [x] `scripts/indexer.ts` β€” chunks + embeds + upserts (per-doc replace). - [x] `@mcpedia/search` β€” `semanticSearch` (cosine) + `hybridSearch` (FTS + cosine, RRF fusion). `keywordSearch` unchanged. - [x] `apps/api` β€” Hono + tRPC v11 (`@trpc/server` fetch adapter, `@hono/node-server` on :4020): `search`, `semanticSearch`, `hybridSearch`, `getDocument`, `listDocuments`, `related`. - [x] MCP server β€” added `semantic_search` + `hybrid_search` tools (6 total). - [x] Web search β€” keyword/hybrid toggle (`?mode=hybrid`), hybrid reaches semantically-related docs keyword misses. ## Phase 3 β€” Async + Scale - [ ] Redis + BullMQ background indexing / embedding workers - [ ] Git synchronization hook (auto-reindex on push) - [ ] Document revision system (`document_revisions`) - [ ] MCP Resources (`mcpedia://docs/...`) in addition to tools ## Phase 4 β€” Scale-out (only if needed) - [ ] Dedicated search engine (OpenSearch/Elasticsearch) β€” YAGNI until FTS is insufficient - [ ] Object storage for assets - [ ] Advanced ranking, distributed workers, observability, multi-tenant ## Decisions locked (from initial planning) - **Tooling:** bun workspaces + Turborepo (repo already used bun; pnpm rejected to minimize churn). - **DB:** imrnes Postgres `100.121.180.82:6432/mcpedia` for both dev and deploy; driver `prepare:false` (PgBouncer). Docker Compose reserved for future prod. - **Phase 1 scope:** Core + Web + MCP only. tRPC/Hono API, pgvector, auth, BullMQ deferred (YAGNI).