import Link from "next/link"; import { listDocuments } from "@mcpedia/core"; import type { DocSection } from "@mcpedia/core"; export const dynamic = "force-dynamic"; const SECTIONS: { id: DocSection; label: string }[] = [ { id: "docs", label: "Documentation" }, { id: "writeups", label: "Writeups" }, { id: "research", label: "Research" }, { id: "notes", label: "Notes" }, ]; const SECTION_ICONS: Record = { docs: "📄", writeups: "📝", research: "🔬", notes: "📌", }; export default async function DocsIndexPage() { const all = await listDocuments(); // Group by section, sort by updatedAt desc for recency const bySection = SECTIONS.map((section) => ({ section, docs: all .filter((d) => d.section === section.id) .sort( (a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime(), ), })); // Flatten + sort all docs by updatedAt for the hero "recent" strip const recent = [...all] .sort( (a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime(), ) .slice(0, 6); return ( <> {/* Hero */}

MCPedia Knowledge Base

A content-first knowledge base for humans and AI agents. Documents covering MCP protocol, TypeScript, infrastructure, and security.

{/* Search bar */}
Search documents, tags, authors...
{/* Recent strip */} {recent.length > 0 && (
{recent.map((d) => (
{SECTION_ICONS[d.section] || "📄"}

{d.title}

{d.tags.slice(0, 3).map((t) => ( #{t} ))}
))}
)}
{/* Sections */} {bySection.map(({ section, docs }) => { if (docs.length === 0) return null; return (

{section.label}

View all ({docs.length})
{docs.map((d) => (
{SECTION_ICONS[section.id] || "📄"}

{d.title}

{d.tags.slice(0, 4).map((t) => ( #{t} ))}
))}
); })} ); }