diff --git a/.gitignore b/.gitignore index 697de28f7..59855977d 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ dist .eslintcache .eve .workflow-data +.design # Local Netlify folder .netlify diff --git a/app/components/content/AgentsAside.vue b/app/components/content/AgentsAside.vue new file mode 100644 index 000000000..cf6889d35 --- /dev/null +++ b/app/components/content/AgentsAside.vue @@ -0,0 +1,36 @@ + + + diff --git a/app/components/content/AgentsCard.vue b/app/components/content/AgentsCard.vue new file mode 100644 index 000000000..b27a66962 --- /dev/null +++ b/app/components/content/AgentsCard.vue @@ -0,0 +1,85 @@ + + + diff --git a/app/components/content/AgentsCaveat.vue b/app/components/content/AgentsCaveat.vue new file mode 100644 index 000000000..773511451 --- /dev/null +++ b/app/components/content/AgentsCaveat.vue @@ -0,0 +1,26 @@ + + + diff --git a/app/components/content/AgentsChatPreview.vue b/app/components/content/AgentsChatPreview.vue new file mode 100644 index 000000000..211c3a82a --- /dev/null +++ b/app/components/content/AgentsChatPreview.vue @@ -0,0 +1,79 @@ + + + diff --git a/app/components/content/AgentsCodeFrameVisual.vue b/app/components/content/AgentsCodeFrameVisual.vue new file mode 100644 index 000000000..bd937b81f --- /dev/null +++ b/app/components/content/AgentsCodeFrameVisual.vue @@ -0,0 +1,35 @@ + + + diff --git a/app/components/content/AgentsCodeGroup.vue b/app/components/content/AgentsCodeGroup.vue new file mode 100644 index 000000000..e3216f307 --- /dev/null +++ b/app/components/content/AgentsCodeGroup.vue @@ -0,0 +1,26 @@ + + + diff --git a/app/components/content/AgentsConfigCheckVisual.vue b/app/components/content/AgentsConfigCheckVisual.vue new file mode 100644 index 000000000..8caabc52f --- /dev/null +++ b/app/components/content/AgentsConfigCheckVisual.vue @@ -0,0 +1,55 @@ + + + diff --git a/app/components/content/AgentsConnect.vue b/app/components/content/AgentsConnect.vue new file mode 100644 index 000000000..5bb370a8c --- /dev/null +++ b/app/components/content/AgentsConnect.vue @@ -0,0 +1,23 @@ + + + diff --git a/app/components/content/AgentsErrorCodeVisual.vue b/app/components/content/AgentsErrorCodeVisual.vue new file mode 100644 index 000000000..b8b904b05 --- /dev/null +++ b/app/components/content/AgentsErrorCodeVisual.vue @@ -0,0 +1,29 @@ + + + diff --git a/app/components/content/AgentsEvalSuites.vue b/app/components/content/AgentsEvalSuites.vue new file mode 100644 index 000000000..8905f0964 --- /dev/null +++ b/app/components/content/AgentsEvalSuites.vue @@ -0,0 +1,43 @@ + + + diff --git a/app/components/content/AgentsFileTree.vue b/app/components/content/AgentsFileTree.vue new file mode 100644 index 000000000..cdf4c313e --- /dev/null +++ b/app/components/content/AgentsFileTree.vue @@ -0,0 +1,66 @@ + + + diff --git a/app/components/content/AgentsHalfBar.vue b/app/components/content/AgentsHalfBar.vue new file mode 100644 index 000000000..dd4225d83 --- /dev/null +++ b/app/components/content/AgentsHalfBar.vue @@ -0,0 +1,88 @@ + + + diff --git a/app/components/content/AgentsHalfHeader.vue b/app/components/content/AgentsHalfHeader.vue new file mode 100644 index 000000000..3c08d3e7e --- /dev/null +++ b/app/components/content/AgentsHalfHeader.vue @@ -0,0 +1,49 @@ + + + diff --git a/app/components/content/AgentsHalfOverview.vue b/app/components/content/AgentsHalfOverview.vue new file mode 100644 index 000000000..31d158125 --- /dev/null +++ b/app/components/content/AgentsHalfOverview.vue @@ -0,0 +1,46 @@ + + + diff --git a/app/components/content/AgentsHeroSplit.vue b/app/components/content/AgentsHeroSplit.vue new file mode 100644 index 000000000..769a6f12f --- /dev/null +++ b/app/components/content/AgentsHeroSplit.vue @@ -0,0 +1,274 @@ + + + + + diff --git a/app/components/content/AgentsLinkList.vue b/app/components/content/AgentsLinkList.vue new file mode 100644 index 000000000..b2cbb540f --- /dev/null +++ b/app/components/content/AgentsLinkList.vue @@ -0,0 +1,13 @@ + diff --git a/app/components/content/AgentsLoopRing.vue b/app/components/content/AgentsLoopRing.vue new file mode 100644 index 000000000..3deaa24dd --- /dev/null +++ b/app/components/content/AgentsLoopRing.vue @@ -0,0 +1,132 @@ + + + + + diff --git a/app/components/content/AgentsMcpLink.vue b/app/components/content/AgentsMcpLink.vue new file mode 100644 index 000000000..e1065ad15 --- /dev/null +++ b/app/components/content/AgentsMcpLink.vue @@ -0,0 +1,53 @@ + + + diff --git a/app/components/content/AgentsMcpTools.vue b/app/components/content/AgentsMcpTools.vue new file mode 100644 index 000000000..93021e0fa --- /dev/null +++ b/app/components/content/AgentsMcpTools.vue @@ -0,0 +1,30 @@ + + + diff --git a/app/components/content/AgentsMcpTree.vue b/app/components/content/AgentsMcpTree.vue new file mode 100644 index 000000000..357cee28f --- /dev/null +++ b/app/components/content/AgentsMcpTree.vue @@ -0,0 +1,38 @@ + + + diff --git a/app/components/content/AgentsNuxiCard.vue b/app/components/content/AgentsNuxiCard.vue new file mode 100644 index 000000000..4710d73fc --- /dev/null +++ b/app/components/content/AgentsNuxiCard.vue @@ -0,0 +1,28 @@ + + + diff --git a/app/components/content/AgentsProblemsPanel.vue b/app/components/content/AgentsProblemsPanel.vue new file mode 100644 index 000000000..932950059 --- /dev/null +++ b/app/components/content/AgentsProblemsPanel.vue @@ -0,0 +1,75 @@ + + + diff --git a/app/components/content/AgentsProsePre.vue b/app/components/content/AgentsProsePre.vue new file mode 100644 index 000000000..6cb9fba8a --- /dev/null +++ b/app/components/content/AgentsProsePre.vue @@ -0,0 +1,85 @@ + + + + + diff --git a/app/components/content/AgentsRelease.vue b/app/components/content/AgentsRelease.vue new file mode 100644 index 000000000..e5a850129 --- /dev/null +++ b/app/components/content/AgentsRelease.vue @@ -0,0 +1,29 @@ + + + diff --git a/app/components/content/AgentsSection.vue b/app/components/content/AgentsSection.vue new file mode 100644 index 000000000..4aef86dff --- /dev/null +++ b/app/components/content/AgentsSection.vue @@ -0,0 +1,98 @@ + + + diff --git a/app/components/content/AgentsSizeBar.vue b/app/components/content/AgentsSizeBar.vue new file mode 100644 index 000000000..070a14164 --- /dev/null +++ b/app/components/content/AgentsSizeBar.vue @@ -0,0 +1,48 @@ + + + + + diff --git a/app/components/content/AgentsStat.vue b/app/components/content/AgentsStat.vue new file mode 100644 index 000000000..1a02417f9 --- /dev/null +++ b/app/components/content/AgentsStat.vue @@ -0,0 +1,143 @@ + + + + + diff --git a/app/components/content/AgentsStatBand.vue b/app/components/content/AgentsStatBand.vue new file mode 100644 index 000000000..803a3b064 --- /dev/null +++ b/app/components/content/AgentsStatBand.vue @@ -0,0 +1,54 @@ + + + diff --git a/app/components/content/AgentsTabs.vue b/app/components/content/AgentsTabs.vue new file mode 100644 index 000000000..0d5b69769 --- /dev/null +++ b/app/components/content/AgentsTabs.vue @@ -0,0 +1,56 @@ + + + diff --git a/app/components/content/AgentsTip.vue b/app/components/content/AgentsTip.vue new file mode 100644 index 000000000..228e3484f --- /dev/null +++ b/app/components/content/AgentsTip.vue @@ -0,0 +1,15 @@ + + + diff --git a/app/components/content/AgentsTokenRange.vue b/app/components/content/AgentsTokenRange.vue new file mode 100644 index 000000000..12d3bc7ab --- /dev/null +++ b/app/components/content/AgentsTokenRange.vue @@ -0,0 +1,53 @@ + + + diff --git a/app/components/content/AgentsTypedCommand.vue b/app/components/content/AgentsTypedCommand.vue new file mode 100644 index 000000000..4e5ec51ce --- /dev/null +++ b/app/components/content/AgentsTypedCommand.vue @@ -0,0 +1,55 @@ + + + diff --git a/app/components/content/AgentsWebMcpDemo.vue b/app/components/content/AgentsWebMcpDemo.vue new file mode 100644 index 000000000..c7be8a256 --- /dev/null +++ b/app/components/content/AgentsWebMcpDemo.vue @@ -0,0 +1,78 @@ + + + diff --git a/app/composables/useAgentsMotion.ts b/app/composables/useAgentsMotion.ts new file mode 100644 index 000000000..36faf6320 --- /dev/null +++ b/app/composables/useAgentsMotion.ts @@ -0,0 +1,12 @@ +/** + * Whether the `/agents` visuals may animate. + * + * `false` on the server and until mount, so the static final state is what renders first, + * then `true` once mounted unless the visitor asked for reduced motion. + */ +export function useAgentsMotion() { + const reducedMotion = usePreferredReducedMotion() + const mounted = useMounted() + + return computed(() => mounted.value && reducedMotion.value !== 'reduce') +} diff --git a/app/composables/useNavigation.ts b/app/composables/useNavigation.ts index 6db9354dd..566a9a301 100644 --- a/app/composables/useNavigation.ts +++ b/app/composables/useNavigation.ts @@ -95,8 +95,13 @@ function _useHeaderLinks() { label: 'More', icon: 'i-lucide-library', search: false, - active: ['/video-courses', '/enterprise', '/sponsors'].some(path => route.path.startsWith(path)), + active: route.path === '/agents' || ['/video-courses', '/enterprise', '/sponsors'].some(path => route.path.startsWith(path)), children: [{ + label: 'Build with AI', + description: 'Nuxt for coding agents and the apps they ship.', + icon: 'i-lucide-sparkles', + to: '/agents' + }, { label: 'Video Courses', description: 'Learn Nuxt by watching video courses.', icon: 'i-lucide-graduation-cap', @@ -146,6 +151,9 @@ const footerLinks = [{ }, { label: 'Showcase', to: '/showcase' + }, { + label: 'Build with AI', + to: '/agents' }, { label: 'AI Evals', to: '/evals' @@ -202,6 +210,10 @@ const _useNavigation = () => { label: 'Design Kit', icon: 'i-lucide-palette', to: '/design-kit' + }, { + label: 'Build with AI', + icon: 'i-lucide-sparkles', + to: '/agents' }, { label: 'AI Evals', icon: 'i-lucide-brain', diff --git a/app/pages/agents.vue b/app/pages/agents.vue new file mode 100644 index 000000000..d611337f1 --- /dev/null +++ b/app/pages/agents.vue @@ -0,0 +1,165 @@ + + + + + diff --git a/app/utils/agents.ts b/app/utils/agents.ts new file mode 100644 index 000000000..f7bdb9a18 --- /dev/null +++ b/app/utils/agents.ts @@ -0,0 +1,29 @@ +import type { InjectionKey, Ref } from 'vue' + +export interface AgentsSectionLink { + id: string + label: string +} + +/** One half of the `/agents` page, from the `halves` frontmatter of `content/agents.md`. */ +export interface AgentsHalf { + id: 'development' | 'production' + num: number + when: string + title: string + description: string + icon: string + sections: AgentsSectionLink[] +} + +export const AGENTS_HALVES_KEY: InjectionKey> = Symbol('agents-halves') + +/** The halves `app/pages/agents.vue` provides to the components rendered from its markdown. */ +export function useAgentsHalves(): Ref { + return inject(AGENTS_HALVES_KEY, ref([])) +} + +/** "01", "02"…, the numbering the overview, half headers and chips share. */ +export function agentsSectionNumber(index: number): string { + return String(index + 1).padStart(2, '0') +} diff --git a/content/agents.md b/content/agents.md new file mode 100644 index 000000000..8f0336b79 --- /dev/null +++ b/content/agents.md @@ -0,0 +1,495 @@ +--- +title: Built for the agentic era +highlight: agentic era +head: + title: Nuxt for AI Agents + description: Coding agents build Nuxt apps with fewer tokens and clear errors to fix, and the apps they ship work for the agents your users bring. +description: Coding agents build Nuxt apps with fewer tokens and clear errors to fix, and the apps they ship work for the agents your users bring. +navigation: + icon: i-lucide-sparkles +links: + - label: Connect your agent + to: '#connect-your-agent' + trailingIcon: i-lucide-arrow-down + size: xl + - label: Read the benchmark + to: 'https://nolanlawson.com/2026/10/28/the-ai-cost-of-javascript-frameworks/' + target: _blank + trailingIcon: i-lucide-arrow-up-right + color: neutral + variant: subtle + size: xl +halves: + - id: development + num: 1 + when: Before you ship + title: Development + description: How Nuxt works for the coding agent that builds your app. + icon: i-lucide-square-terminal + sections: + - id: conventions + label: Conventions mean fewer tokens + - id: feedback-loop + label: A fast feedback loop + - id: errors + label: Errors an agent can fix + - id: connect-your-agent + label: Connect your agent + - id: production + num: 2 + when: After you ship + title: Production + description: How Nuxt works for the agents that use the app you ship. + icon: i-lucide-app-window + sections: + - id: webmcp + label: WebMCP built in + - id: mcp-server + label: Your own MCP server + - id: markdown + label: Markdown for every page + - id: performance + label: Fast for people too +--- + +::agents-half-header{half="development"} +#title +Development + +#description +How Nuxt works for the coding agent that builds your app. +:: + +::agents-section{id="conventions" label="01 · Conventions" wide space="lg"} +#title +Conventions mean fewer tokens + +#description +File-based routing, auto-imports and a fixed directory structure leave the agent less to decide and less to write. + +#default +:agents-file-tree + +#below +:::agents-stat-band{value="3.85M" label="Tokens" detail="Fewest of 12" icon="i-lucide-type" place="1" of="12"} + ::::agents-token-range{low="3.16M" median="3.85M" high="8.18M" position="13.7"} + :::: + + ::::div{class="grid grid-cols-2 gap-4"} + :::::agents-stat{value="$2.82" label="Cost" detail="3rd of 12" icon="i-lucide-receipt" place="3" of="12"} + ::::: + + :::::agents-stat{value="1,415" label="Lines of code" detail="2nd of 12" icon="i-lucide-code" place="2" of="12"} + ::::: + :::: +::: + +:::agents-caveat +#title +About these numbers + +#default +[Nolan Lawson](https://nolanlawson.com/2026/10/28/the-ai-cost-of-javascript-frameworks/){target="_blank"} gave Claude Code with Opus 5.5 one spec (a Pokémon browser on the PokéAPI) and had it build the app five times in each of 12 frameworks, checked against a conformance suite. + +Medians of five runs with Nuxt 4.6.2, cost at API list prices. The Nuxt MCP server was installed but never called, so the result comes from the framework. It's one small, content-heavy app, and Nuxt's tokens ranged from 3.16M to 8.18M. + +:u-button{to="https://nolanlawson.com/2026/10/28/the-ai-cost-of-javascript-frameworks/" target="_blank" label="Source: Nolan Lawson's benchmark" variant="link" trailing-icon="i-lucide-arrow-up-right" class="self-start px-0 text-[15px]"} +::: + +:::agents-aside{id="evals" label="Evals"} +#title +Measured on Nuxt tasks + +#description +We run coding agents against Nuxt, Nuxt UI and Nuxt Content tasks and publish each model's success rate, time and cost. + +#default +:agents-eval-suites + +:u-button{to="/evals" label="See the evals" color="neutral" variant="subtle" size="xl" trailing-icon="i-lucide-arrow-right" class="w-full justify-center min-h-12 bg-elevated ring-accented hover:bg-accented/70"} +::: +:: + +::agents-section{id="feedback-loop" label="02 · Feedback loop" layout="stack"} +#title +A fast feedback loop + +#description +An agent works in a loop: change a file, read what the dev server reports, try again. + +#default +:::div{class="grid lg:grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)] items-center gap-12 lg:gap-x-[clamp(32px,5vw,80px)]"} + ::::agents-loop-ring{value="9.0 min" label="Time to build the app" detail="Median, 3rd of 12"} + Same benchmark as above. [Source: Nolan Lawson ↗](https://nolanlawson.com/2026/10/28/the-ai-cost-of-javascript-frameworks/){target="_blank"} + :::: + + ::::div{class="min-w-0 flex flex-col gap-4 [&>p]:my-0"} + Since Nuxt 4.7, the dev overlay collects type errors, Vite checkers such as ESLint, Vue compiler warnings and Nuxt's own warnings in one problems list. + + :agents-problems-panel + :::: +::: +:: + +::agents-section{id="errors" label="03 · Errors" layout="stack"} +#title +Errors an agent can fix + +#description +Three changes, each tied to a release. + +#default +:::u-page-grid{class="sm:grid-cols-1 lg:grid-cols-3 gap-4"} + ::::agents-release{version="Nuxt 4.5"} + :::::agents-card{to="/docs/errors/e1001" link="See NUXT_E1001" bleed} + #header + :agents-error-code-visual + + #title + Stable error codes + + #description + Codes like `NUXT_E1001`, with why it happened and a fix. + ::::: + :::: + + ::::agents-release{version="Nuxt 4.6"} + :::::agents-card{bleed} + #header + :agents-code-frame-visual + + #title + Source-mapped server errors + + #description + A code frame, printed in the terminal the agent reads and copyable as an agent prompt. + ::::: + :::: + + ::::agents-release{version="Nuxt 4.7" current} + :::::agents-card{bleed} + #header + :agents-config-check-visual + + #title + Validated runtime config + + #description + Use a Zod, Valibot or ArkType schema. A bad value stops the server with one error that lists everything wrong. + ::::: + :::: +::: +:: + +::agents-section{id="connect-your-agent" label="04 · Setup" layout="stack"} +#title +Connect your agent + +#description +The MCP server has 13 tools for docs, modules, deploy guides and release notes. + +#default +:::agents-connect +:agents-mcp-link + +::::div{class="flex flex-col gap-2"} +:::::div{class="text-[13px] font-medium text-muted"} +MCP server URL +::::: + +:u-input-copy{value="https://nuxt.com/mcp" label="https://nuxt.com/mcp" size="xl"} +:::: + +::::tabs + :::::tabs-item{label="Claude Code"} + ::::::agents-typed-command + ```bash [Terminal] + claude mcp add --transport http nuxt https://nuxt.com/mcp + ``` + :::::: + ::::: + + :::::tabs-item{label="Cursor"} + ::::::u-button + --- + to: "cursor://anysphere.cursor-deeplink/mcp/install?name=nuxt&config=eyJ0eXBlIjoiaHR0cCIsInVybCI6Imh0dHBzOi8vbnV4dC5jb20vbWNwIn0%3D" + label: Install in Cursor + color: neutral + icon: i-custom-cursor + size: lg + --- + :::::: + + Or add it to your project yourself: + + ```json [.cursor/mcp.json] line-numbers + { + "mcpServers": { + "nuxt": { + "type": "http", + "url": "https://nuxt.com/mcp" + } + } + } + ``` + ::::: + + :::::tabs-item{label="VS Code"} + ```json [.vscode/mcp.json] line-numbers + { + "servers": { + "nuxt": { + "type": "http", + "url": "https://nuxt.com/mcp" + } + } + } + ``` + ::::: +:::: + +#aside +:agents-mcp-tools + +::::div{class="flex flex-col gap-3 px-1"} + :::::agents-tip{icon="i-lucide-book-open"} + Another client? [See the MCP docs](/docs/guide/ai/mcp) for setup in other agents and editors. + ::::: + + :::::agents-tip{icon="i-lucide-info"} + Tip: send an `X-MCP-Tools` header that names only the tools you need. + ::::: + + :::::agents-tip{icon="i-lucide-plug"} + Using Nuxt UI? Add its server at `https://ui.nuxt.com/mcp` or its skill with `npx skills add nuxt/ui`. + ::::: +:::: + +#below +::::agents-card +#title +Markdown docs + +#description +Add `.md` to a docs URL or send `Accept: text/markdown`. + +:::::agents-link-list +- [`/llms.txt`](/llms.txt){external} +- [`/llms-full.txt`](/llms-full.txt){external} +- [`/sitemap.md`](/sitemap.md){external} +::::: +:::: +::: +:: + +::agents-half-header{half="production"} +#title +Production + +#description +How Nuxt works for the agents that use the app you ship. +:: + +::agents-section{id="webmcp" label="01 · WebMCP" badge="Experimental" layout="stack" space="lg"} +#title +WebMCP built in + +#description +A proposed browser API that lets a page offer tools to agents in the browser. + +#default +:::div{class="grid lg:grid-cols-[minmax(0,1fr)_minmax(0,1.36fr)] items-start gap-10 lg:gap-x-[clamp(32px,5vw,80px)]"} + ::::div{class="min-w-0 flex flex-col gap-4 [&>p]:my-0 [&>p]:text-[clamp(16px,1.3vw,18px)]/[1.7]"} + Since Nuxt 4.7, tag a function with `@tool` and an agent can call it wherever a user could click it. For other tools, use `defineAgentTool()`. + + :u-button{to="/docs/guide/ai/webmcp" label="WebMCP docs" variant="link" trailing-icon="i-lucide-arrow-right" class="self-start px-0 min-h-11 text-[15px]"} + + :agents-web-mcp-demo + :::: + + ::::div{class="min-w-0"} +:::::code-group{defaultValue="1"} +```ts [nuxt.config.ts] {3} line-numbers diff +export default defineNuxtConfig({ + experimental: { + webmcp: true, + }, +}) +``` + +```vue [app/pages/index.vue] {7} line-numbers + + + +``` + +```vue [app/pages/products.vue] line-numbers + +``` +::::: + :::: +::: +:: + +::agents-section{id="mcp-server" label="02 · MCP server" layout="stack"} +#title +Your own MCP server + +#description +`@nuxtjs/mcp-toolkit` turns files in `server/mcp/` into an MCP server. + +#default +:::div{class="grid lg:grid-cols-[minmax(0,1fr)_minmax(0,1.36fr)] items-start gap-10 lg:gap-x-[clamp(32px,5vw,80px)]"} + ::::div{class="min-w-0 flex flex-col gap-4 [&>p]:my-0 [&>p]:text-[clamp(16px,1.3vw,18px)]/[1.7]"} + The 13 tools at nuxt.com/mcp are built with it. + + :u-button{to="/modules/mcp" label="See the module" variant="link" trailing-icon="i-lucide-arrow-right" class="self-start px-0 min-h-11 text-[15px]"} + + :agents-mcp-tree + :::: + + ::::div{class="min-w-0"} +```ts [server/mcp/tools/get-changelog.ts] line-numbers +import { z } from 'zod' + +export default defineMcpTool({ + description: 'Retrieves the latest releases from Nuxt core and official modules.', + inputSchema: { + repo: z.string().optional().describe('Filter by repository, like "nuxt/ui"'), + }, + async handler({ repo }) { + return $fetch('/api/releases', { query: { repo } }) + }, +}) +``` + :::: +::: +:: + +::agents-section{id="markdown" label="03 · Markdown" layout="stack"} +#title +Markdown for every page + +#description +`nuxt-agent-discovery` serves each page as Markdown to agents that ask, plus discovery documents, `sitemap.md` and a `robots.txt` AI policy. + +#default +:::div{class="grid lg:grid-cols-[minmax(0,1fr)_minmax(0,1.36fr)] items-start gap-10 lg:gap-x-[clamp(32px,5vw,80px)]"} + ::::div{class="min-w-0 flex flex-col gap-4 [&>p]:my-0 [&>p]:text-[clamp(16px,1.3vw,18px)]/[1.7]"} + nuxt.com runs on it. + + :u-button{to="/modules/agent-discovery" label="See the module" variant="link" trailing-icon="i-lucide-arrow-right" class="self-start px-0 min-h-11 text-[15px]"} + :::: + + ::::div{class="min-w-0"} +```bash [Terminal] +curl -H 'Accept: text/markdown' \ + https://nuxt.com/docs/4.x/getting-started/data-fetching +``` + :::: +::: + +#below +:::div{class="flex flex-col gap-[clamp(28px,3vw,40px)] pt-[clamp(28px,3vw,40px)] border-t border-default"} + ::::agents-size-bar{value="824 KB" label="Data fetching page as HTML" bar="100"} + :::: + + ::::agents-size-bar{value="34 KB" label="The same page as Markdown" detail="24 times smaller" bar="4.13" highlight} + :::: + + ::::div{class="text-sm/normal text-muted"} + Uncompressed response sizes for nuxt.com/docs/4.x/getting-started/data-fetching, measured November 2026. + :::: +::: +:: + +::agents-section{id="performance" label="04 · Performance" layout="stack"} +#title +Fast for people too + +#description +[e18e framework benchmark](https://frameworks.e18e.dev/run-time/){target="_blank"} results for Nuxt 4.7, server-rendered and client-rendered. + +#default +:::div{class="agents-stats grid sm:grid-cols-3 border-y border-default max-sm:divide-y sm:divide-x divide-default"} + ::::agents-stat{value="89" unit="ms" label="First paint" detail="Server-rendered, 7th of 10" place="7" alt-value="99" alt-detail="Client-rendered, 2nd of 10" alt-place="2" of="10" size="lg" class="py-[clamp(24px,3vw,40px)] sm:pe-[clamp(16px,2.4vw,32px)]"} + :::: + + ::::agents-stat{value="10.05" unit="ms" label="Interaction latency" detail="Server-rendered, 2nd of 10" place="2" alt-value="10.29" alt-detail="Client-rendered, 2nd of 10" alt-place="2" of="10" size="lg" class="py-[clamp(24px,3vw,40px)] sm:px-[clamp(16px,2.4vw,32px)]"} + :::: + + ::::agents-stat{value="2.86" unit="ms" label="Interaction work to commit" detail="Server-rendered, 2nd of 10" place="2" alt-value="3.19" alt-detail="Client-rendered, 2nd of 10" alt-place="2" of="10" size="lg" class="py-[clamp(24px,3vw,40px)] sm:ps-[clamp(16px,2.4vw,32px)]"} + :::: +::: + +:::div{class="flex flex-wrap items-center justify-between gap-x-6 gap-y-2 text-sm/normal text-muted [&>p]:my-0"} +Source: e18e framework benchmark, Nuxt 4.7, measured November 2026. + +:u-button{to="https://frameworks.e18e.dev/run-time/" target="_blank" label="See the full results" variant="link" trailing-icon="i-lucide-arrow-up-right" class="px-0 min-h-11 text-[15px]"} +::: +:: + +::agents-section{id="build-ai" layout="stack" divider} +#title +Build AI features with Nuxt + +#default +:::u-page-grid{class="lg:grid-cols-3 gap-4"} + ::::agents-card{to="/templates/nuxt-ui-chat" link="See the template" icon="i-lucide-layout-template"} + #header + :agents-chat-preview{variant="template"} + + #title + AI Chatbot template + + #description + A chat app with auth and history, built with the AI SDK and Nuxt UI. + :::: + + ::::agents-card{to="https://ui.nuxt.com/docs/components/chat-messages" target="_blank" link="See the components" icon="i-lucide-messages-square"} + #header + :agents-chat-preview{variant="components"} + + #title + Nuxt UI chat components + + #description + Messages, prompts, reasoning and tool calls. + :::: + + ::::agents-nuxi-card + #title + Nuxi + + #description + The assistant on nuxt.com, built with Nuxt and the Nuxt UI chat components. + :::: +::: +:: diff --git a/modules/mcp-tools/index.ts b/modules/mcp-tools/index.ts new file mode 100644 index 000000000..b0dd92fb3 --- /dev/null +++ b/modules/mcp-tools/index.ts @@ -0,0 +1,37 @@ +import { addTemplate, addTypeTemplate, defineNuxtModule, updateTemplates } from '@nuxt/kit' +import { join } from 'pathe' +import { listMcpTools } from './list' + +const FILENAME = 'mcp-tools.mjs' + +/** + * Exposes the public MCP tool names and folders as `#build/mcp-tools.mjs`, + * so `/agents` lists what `/mcp` serves without shipping `server/` to the client. + */ +export default defineNuxtModule({ + meta: { name: 'mcp-tools' }, + setup(_options, nuxt) { + const serverDir = nuxt.options.serverDir + + addTemplate({ + filename: FILENAME, + getContents: () => `export default ${JSON.stringify(listMcpTools(serverDir))}` + }) + + addTypeTemplate({ + filename: 'types/mcp-tools.d.ts', + getContents: () => `declare module '#build/${FILENAME}' { + const list: import('${join(nuxt.options.rootDir, 'modules/mcp-tools/list')}').McpToolsList + export default list +} +export {} +` + }) + + nuxt.hook('builder:watch', async (_event, path) => { + if (path.includes('mcp/')) { + await updateTemplates({ filter: template => template.filename === FILENAME }) + } + }) + } +}) diff --git a/modules/mcp-tools/list.ts b/modules/mcp-tools/list.ts new file mode 100644 index 000000000..0421e45c7 --- /dev/null +++ b/modules/mcp-tools/list.ts @@ -0,0 +1,59 @@ +import { existsSync, readdirSync } from 'node:fs' +import { basename, extname, join } from 'pathe' + +export interface McpToolsList { + /** Tool names, as `@nuxtjs/mcp-toolkit` derives them from the file names. */ + tools: string[] + /** The folders of each kind, as the tree on `/agents` shows them. */ + dirs: Record<'tools' | 'resources' | 'prompts', string[]> +} + +/** `admin` is served by its own authenticated handler, not by the public `/mcp`. */ +const PRIVATE_DIRS = new Set(['admin']) + +/** The order the `/agents` page lists the public folders in. Unknown folders follow, alphabetically. */ +const DIR_ORDER = ['docs', 'modules', 'deploy', 'changelog', 'blog', 'nuxters'] + +function sortDirs(dirs: string[]): string[] { + const rank = (dir: string) => { + const index = DIR_ORDER.indexOf(dir) + return index === -1 ? DIR_ORDER.length : index + } + return [...dirs].sort((a, b) => rank(a) - rank(b) || a.localeCompare(b)) +} + +/** Within a folder: search tools first, then lists, then single lookups. */ +function verbRank(tool: string): number { + const index = ['search', 'list', 'get'].indexOf(tool.split('-')[0]!) + return index === -1 ? 3 : index +} + +function publicDirs(dir: string): string[] { + if (!existsSync(dir)) return [] + return sortDirs(readdirSync(dir, { withFileTypes: true }) + .filter(entry => entry.isDirectory() && !PRIVATE_DIRS.has(entry.name)) + .map(entry => entry.name)) +} + +/** + * The public MCP surface of `server/mcp/`, read from the file system. + */ +export function listMcpTools(serverDir: string): McpToolsList { + const root = join(serverDir, 'mcp') + const toolsDir = join(root, 'tools') + const toolDirs = publicDirs(toolsDir) + + const tools = toolDirs.flatMap(dir => readdirSync(join(toolsDir, dir)) + .filter(file => extname(file) === '.ts') + .map(file => basename(file, '.ts')) + .sort((a, b) => verbRank(a) - verbRank(b) || a.localeCompare(b))) + + return { + tools, + dirs: { + tools: toolDirs, + resources: publicDirs(join(root, 'resources')), + prompts: publicDirs(join(root, 'prompts')) + } + } +} diff --git a/nuxt.config.ts b/nuxt.config.ts index e10bb3207..30b802d5c 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -241,6 +241,7 @@ export default defineNuxtConfig({ // Purged by the translations push webhook. '/translations': { isr: CONTENT_ISR }, '/design-kit': { isr: CONTENT_ISR }, + '/agents': { isr: CONTENT_ISR }, '/video-courses': { isr: CONTENT_ISR }, '/newsletter': { isr: CONTENT_ISR }, // Stats change once a day (nuxt/nuxters CI); the import purges /nuxters itself. diff --git a/shared/utils/pull.ts b/shared/utils/pull.ts index b2086ccba..4e5a4187c 100644 --- a/shared/utils/pull.ts +++ b/shared/utils/pull.ts @@ -111,6 +111,7 @@ export function parsePullPath(url: string): { target: PullTarget, path: string } */ export const PULL_CONTENT_PAGES = [ '/', + '/agents', '/blog/**', '/deploy/**', '/design-kit', diff --git a/test/unit/agents-page.spec.ts b/test/unit/agents-page.spec.ts new file mode 100644 index 000000000..efe1f28f1 --- /dev/null +++ b/test/unit/agents-page.spec.ts @@ -0,0 +1,24 @@ +import { readFileSync } from 'node:fs' +import { fileURLToPath } from 'node:url' +import { describe, expect, it } from 'vitest' +import { listMcpTools } from '../../modules/mcp-tools/list' + +const root = fileURLToPath(new URL('../..', import.meta.url)) +const page = readFileSync(`${root}/content/agents.md`, 'utf8') + +describe('/agents', () => { + const { tools, dirs } = listMcpTools(`${root}/server`) + + it('lists the public MCP tools, without the admin ones', () => { + expect(tools).toContain('search-documentation') + expect(dirs.tools).not.toContain('admin') + expect(dirs.prompts).not.toContain('admin') + }) + + // The copy keeps the count as text so `/raw/agents.md` reads well: update it when a tool is added or removed. + it('states the number of tools the MCP server has', () => { + const counts = [...page.matchAll(/\b(\d+) tools\b/g)].map(match => Number(match[1])) + expect(counts.length).toBeGreaterThan(0) + expect(new Set(counts)).toEqual(new Set([tools.length])) + }) +})