import Link from "next/link"; import { listDocuments, listSections } from "@mcpedia/core"; export const dynamic = "force-dynamic"; export default async function DashboardPage() { const [all, sections] = await Promise.all([listDocuments(), listSections()]); const totalTags = new Set(all.flatMap((d) => d.tags)).size; const recentDocs = [...all].sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()).slice(0, 8); // Tag aggregation server-side for SSR snapshot (client TagCloud will hydrate live via SWR) const tagCounts = new Map(); for (const d of all) for (const t of d.tags) tagCounts.set(t, (tagCounts.get(t) ?? 0) + 1); const topTags = [...tagCounts.entries()].sort((a, b) => b[1] - a[1]).slice(0, 12); return (

Dashboard

Live overview of the MCPedia knowledge base. Data via PostgreSQL Core + BullMQ queue.

+ New Doc
{/* Metric strip — SSR snapshot */}
DB Documents
{all.length}
{totalTags} unique tags
Active Sections
{sections.length}
{sections.map((s) => s.id).join(" · ")}
Search
RRF
FTS + Cosine Vectors
MCP Tools
13
HTTP :4021
{/* Queue strip — client component polls live */} {/* Section breakdown */}

Section Breakdown

{sections.map((s) => { const pct = all.length ? Math.round((s.docCount / all.length) * 100) : 0; return ( {s.icon} {s.label}
{s.docCount} docs · {pct}% ); })}
{/* Top tags */} {topTags.length > 0 && (

Top Tags

{topTags.map(([tag, count]) => ( #{tag} {count} ))}
)} {/* Recent */} {recentDocs.length > 0 && (

Recently Updated

{recentDocs.map((d) => (
{d.section} · {new Date(d.updatedAt).toLocaleDateString()}
{d.title}
{d.tags.length > 0 &&
{d.tags.slice(0, 3).map((t) => #{t})}
} ))}
)}
); } // Client islands — isolated so the page stays RSC import DashboardQueueStrip from "./QueueStrip"; import TagCloudClient from "./TagCloudClient";