Building Next.js for an agentic future
Key Points
- MCP exposes runtime and framework state to agents
- Vector prototype proved visibility + framework knowledge matters
- Run npx @next/codemod to generate agents.md
Summary
Next.js teams focused on making frameworks visible and useful to AI agents. They prototyped an in-browser agent (Vector), then shifted to surfacing runtime and framework state directly from Next.js via MCP and devtools so external agents can discover and act on live app context. Key practical outcomes: structured error/log visibility, an agents-oriented docs index, and tooling to make agent workflows repeatable.
Key Points
- Problem: general coding agents can’t see browser runtime state (runtime errors, client-side warnings, rendered segments), so prompts like “fix the error” lack necessary context.
- Prototype: built Vector (in-browser chat agent) to select elements, view source, and suggest fixes; useful but redundant with external coding agents, so it was sunset.
- MCP integration: next-devtools-mcp exposes internal Next.js state (errors, routes, rendered segments) and enables agent discovery and communication with running dev servers.
- Visibility and knowledge: added structured error forwarding (browser → terminal), Server Action invocation logging, and a compressed docs index (
agents.md) and Next.js skills to reduce agent hallucination. - Tooling and adoption:
npx @next/codemodcan generate a docs index for projects; an expanded eval suite will measure which Next.js 16 APIs help agents most. - Roadmap: integrate agent-aware context into
next devso agents receive the right runtime and docs context automatically.
Practical steps for engineers
- Generate a project docs index: run
npx @next/codemodto produceagents.md. - Enable or adopt next-devtools-mcp to expose runtime state to external agents and devtools.
- Forward browser logs and enable Server Action logging in your dev environment so agents can read runtime hints.
- Monitor the Next.js eval suite updates and plan to adopt integrated agent-context features when they land in
next dev.