Skip to content

Reduce to a thin Next.js dev server connector#145

Open
gaojude wants to merge 3 commits into
mainfrom
jude/thin-wrapper-deprecate-docs-prompts
Open

Reduce to a thin Next.js dev server connector#145
gaojude wants to merge 3 commits into
mainfrom
jude/thin-wrapper-deprecate-docs-prompts

Conversation

@gaojude

@gaojude gaojude commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Reduces the server to a thin connector to the Next.js dev server, since Next.js now ships its own docs.

nextjs_docs is kept but no longer fetches anything. It is now a version-aware gateway: it detects the project's installed Next.js version and, on 16+, points the agent at the docs bundled in node_modules/next/dist/docs/ (which match the installed version and are surfaced through AGENTS.md); on older projects it recommends npx @next/codemod@latest upgrade latest. This keeps the docs entry point agents already know while letting them read version-accurate docs themselves. The nextjs-docs://llms-index resource is removed.

browser_eval is also now a gateway. Instead of spawning and proxying @playwright/mcp, it detects whether the agent-browser CLI is installed and returns install/usage guidance (npm install -g agent-browser / agent-browser skills get core --full), so the agent drives the native CLI directly. The orphaned browser-eval manager and external MCP client are removed.

Removed: the init tool (it only enforced the old docs-fetch workflow), the upgrade_nextjs_16 and enable_cache_components tools and their prompts (thin wrappers over prompts; the workflows move to distributable agent skills), and all cache-components:// / nextjs16:// / nextjs-fundamentals:// resources. The server now declares only the tools capability — no prompt or resource handlers — and the build no longer copies markdown (scripts/copy-resources.js removed).

What remains: nextjs_docs (gateway), nextjs_index (discover dev servers), nextjs_call (proxy /_next/mcp), browser_eval (gateway). README and CLAUDE.md are rewritten with a Migrating from 0.3.x section; version bumped to 0.4.0.

This is a breaking change: callers of the removed tools (including agent configs wired to call init first) will get Tool not found.

Validation

Typecheck, build, 25 unit tests, and 8 e2e tests pass. The e2e registration test asserts the surface is exactly the four tools with no prompts or resources.

The gateway design was also validated end-to-end with a real headless Claude Code session (claude -p with --mcp-config) against a throwaway project containing a real next@16.2.9 install (422 bundled doc files):

  • nextjs_docs: the agent called the tool, received {status: use_bundled_docs, nextVersion: 16.2.9, docsAvailable: true}, then followed the guidance — ran the suggested grep over node_modules/next/dist/docs, read the real bundled caching guide, and answered version-accurately (Cache Components, use cache, cacheLife/cacheTag) rather than from training data.
  • browser_eval: both branches confirmed in the agent loop — with agent-browser on PATH it returned use_agent_browser plus the CLI steps; with agent-browser masked from PATH it returned install_required plus the npm install -g agent-browser / agent-browser install steps.

This confirms the gateway indirection (tool points → agent self-serves) produces correct behavior in a real agent loop. Spawned MCP servers inherit the session's project directory as cwd, so the gateway's version/CLI detection resolves against the right project.

The matching Next.js docs update (#94859) lands with the 0.4.0 release.

gaojude added 2 commits June 15, 2026 11:32
Remove the docs-search tool, the init tool, the upgrade/Cache Components
tools and their prompts, and all knowledge-base resources. Documentation now
ships with Next.js itself (node_modules/next/dist/docs/) and workflows are
distributed as agent skills, so the server is now tools-only: nextjs_index,
nextjs_call, and browser_eval.
Instead of fetching docs over the network, nextjs_docs now detects the
project's installed Next.js version and points the agent at the docs bundled
in node_modules/next/dist/docs/ (Next.js 16+), or recommends the upgrade
codemod for older projects. It enables agents to read version-accurate docs
themselves rather than doing the search.
Instead of spawning and proxying @playwright/mcp, browser_eval now detects
whether the agent-browser CLI is installed and returns install/usage guidance
(npm install -g agent-browser / agent-browser skills get core --full), so the
agent drives the native CLI directly. Removes the now-unused browser-eval
manager and external MCP client.
@gaojude gaojude marked this pull request as ready for review June 16, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant