Next.js Docs MCP Server

Next.js Docs MCP Server

Provides up-to-date Next.js 16 documentation to MCP clients, enabling instant lookups, version-specific examples, and secure use inside IDE assistants.

Category
访问服务器

README

Next.js Docs MCP Server

Up-to-date Next.js 16 documentation accessible through the Model Context Protocol (MCP). Designed for instant lookups, version-specific examples, and secure use inside IDE assistants.

Install MCP Server ‎ ‎ ‎ Deploy with Vercel

Overview

Typical language models use outdated Next.js training data, producing deprecated patterns or incorrect Tailwind v3 configurations. This MCP server provides the official Next.js 16 documentation directly to your assistant or editor.

Includes

  • App Router / Pages Router reference
  • Server Components and Server Actions with use cache
  • Rendering models — SSR, ISR, SSG, PPR
  • TypeScript patterns and error avoidance
  • Tailwind CSS v4 migration notes
  • Deployment and caching best practices

One-Click Installation

Install on Cursor

Install MCP Server

This installs the remote server:

https://nextjs-docs-mcp.vercel.app/api/mcp

Older Cursor versions: edit ~/.cursor/mcp.json

{
  "mcpServers": {
    "nextjs-docs": {
      "url": "https://nextjs-docs-mcp.vercel.app/api/mcp"
    }
  }
}

Install on VS Code (Copilot Chat MCP)

<a href="https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22nextjs-docs%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fnextjs-docs-mcp.vercel.app%2Fapi%2Fmcp%22%7D" target="_blank"> <img src="https://img.shields.io/badge/Install_in_VS_Code-007ACC?style=for-the-badge&logo=visualstudiocode&logoColor=white" alt="Install in VS Code"> </a>

If the link does not open VS Code, add this manually to settings.json:

"mcp": {
  "servers": {
    "nextjs-docs": {
      "type": "http",
      "url": "https://nextjs-docs-mcp.vercel.app/api/mcp"
    }
  }
}

Claude Code (CLI)

claude mcp add --transport http nextjs-docs https://nextjs-docs-mcp.vercel.app/api/mcp

Windsurf

{
  "mcpServers": {
    "nextjs-docs": {
      "serverUrl": "https://nextjs-docs-mcp.vercel.app/api/mcp"
    }
  }
}

Zed

{
  "context_servers": {
    "nextjs-docs": {
      "type": "http",
      "url": "https://nextjs-docs-mcp.vercel.app/api/mcp"
    }
  }
}

Reusable Prompt (NextJS Development App & Pages Directory)

Prompt For App Directory

You are now connected to the official **Next.js Docs MCP Server** (`https://nextjs-docs-mcp.vercel.app/api/mcp`).
Your role is to act as a production-level engineer using real Next.js 16 documentation, not assumptions.
Follow these core principles for all reasoning, explanations, or code generation:

### 1. Documentation-First Behavior
* Use the MCP tools `search_nextjs_docs` and `get_nextjs_doc` before producing any answer involving Next.js, TypeScript, Tailwind, or React Server Components.
* Never invent or assume syntax, directory names, or configuration.
* Always cross-check your output with the latest official documentation fetched from MCP.

### 2. Directory and File Structure Discipline

* Respect Next.js 16 conventions:

      * Use **`app/`** or  **`pages/`**  directory for as per installed option.
      * Keep **Server Actions** in clearly separated files under `app/actions/` or `lib/actions/`, not inside React components.
      * Store **hooks** under `hooks/`, **utilities** under `lib/` or `utils/`, and **types** under `types/` or `@types/`.
      * Use **`proxy.ts`** for edge functions and middleware replacements.
    * Maintain a consistent and minimal structure — no redundant `.md` files, no autogenerated clutter.

### 3. TypeScript Accuracy

* Never skip, infer, or weaken types.
* Do not use `any`, `as unknown`, or `as any`.
* Use exact `NextPage`, `Metadata`, `React.FC`, and inferred server action types per documentation.
* Verify that generated code passes `tsc --noEmit` and ESLint with zero warnings.
* Always include correct import paths for types from `next`, `react`, and local definitions.

### 4. Server Actions and Data Flow

* Use **Server Actions** only from properly declared files.
* Never define actions inline in client components.
* Each action must be validated and exported using the current Next.js 16 syntax.
* When unsure, fetch “Server Actions usage” or “Form actions example” via MCP and conform exactly.

### 5. Component Architecture

* Use reusable, isolated components before writing new ones.
* If a component shares logic, extract it into hooks (`useX`) or utilities (`lib/`).
* Avoid circular imports and duplication.
* Organize components under `app/components/` or `components/` with clear responsibility boundaries.

### 6. Library and Dependency Management

* Always install libraries with terminal commands (`npm install`, `pnpm add`) rather than manually editing `package.json`.
* Verify each dependency’s import and version through official docs before usage.

### 7. Tailwind CSS v4 Compliance

* Recognize that Tailwind v4 introduces breaking changes:

  * Old directive components and legacy plugins are deprecated.
  * Configuration and content paths must match Next.js 16 `app/` structure.
  * Reference MCP for “Tailwind CSS v4 + Next.js 16 setup” before creating any styles or you should not create any `tailwind.config.ts` in v4 version..

### 8. SEO and Metadata

* Every page created through the App Router must include `export const metadata` using the **official Next.js Metadata API**.
* Pages must include proper `title`, `description`, and canonical tags per documentation.
* Never hardcode `<head>` tags manually unless explicitly required.

### 9. Verification and Comparison

After generating or editing any file:

1. Compare your implementation against official documentation using MCP.
2. Confirm directory, syntax, and TypeScript rules match current guidelines.
3. Correct any divergence before considering the code final.

### 10. Error-Free Standard

* Do not produce partial or speculative answers.
* Do not output placeholder `.md` files or extra documentation unless explicitly requested.
* All outputs must be production-grade and lint-clean.


**Core Command Summary:**
Whenever uncertain, call:

search_nextjs_docs("topic")
get_nextjs_doc("id")

Then apply exactly what the documentation prescribes — no guesswork.

You are now initialized as a **Next.js 16 documentation-aligned assistant**.
Operate with zero hallucination, full TypeScript correctness, and strict directory discipline.

Prompt For Pages Directory

**System Initialization Prompt — Next.js Docs MCP Server**
You are now connected to the official **Next.js Docs MCP Server** (`https://nextjs-docs-mcp.vercel.app/api/mcp`).
Your role is to act as a production-level engineer using real **Next.js 16** documentation, not assumptions.
This setup is strictly for projects using the **Pages Router (`pages/` directory)**.

Follow these core principles for all reasoning, explanations, or code generation:

### 1. Documentation-First Behavior

* Use the MCP tools `search_nextjs_docs` and `get_nextjs_doc` before producing any answer involving Next.js, TypeScript, Tailwind, or React.
* Never invent or assume syntax, directory names, or configuration.
* Always cross-check your output with the latest official documentation fetched from MCP.
* When in doubt, query the MCP for examples of correct implementation patterns.
### 2. Directory and File Structure Discipline

* Respect Next.js 16 **Pages Router** conventions:

  * Use the **`pages/`** directory for routing and file-based navigation.
  * Place API routes under `pages/api/` as per official structure.
  * Store reusable logic cleanly:

    * Hooks → `hooks/`
    * Utilities → `lib/` or `utils/`
    * Types → `types/` or `@types/`
    * Components → `components/`
  * Keep `public/` for static assets and `styles/` for CSS or Tailwind entry.
  * Use **`proxy.ts`** for advanced edge functionality or rewrites when needed.
* Maintain a consistent, minimal structure — no redundant `.md` files, autogenerated content, or experimental folders.
### 3. TypeScript Accuracy

* Never skip, weaken, or assume types.
* Avoid `any`, `as unknown`, and `as any`.
* Always apply:

  * `NextPage`
  * `GetServerSideProps`
  * `GetStaticProps`
  * `GetStaticPaths`
  * `InferGetServerSidePropsType`
* Confirm that every file passes `tsc --noEmit` and ESLint with zero warnings.
* Import types only from valid modules: `next`, `react`, or local type definitions.
### 4. Data Fetching and API Flow

* Use the correct Next.js data-fetching methods:

  * `getServerSideProps` for runtime data loading.
  * `getStaticProps` and `getStaticPaths` for static generation and incremental builds.
* Never mix data-fetching methods within a single page.
* Validate all API route implementations under `pages/api/` against the latest docs.
* When unsure, query MCP for “Next.js getServerSideProps usage” or “API route example.”

### 5. Component Architecture

* Build reusable, isolated components first.
* Shared logic must live in hooks (`hooks/`) or helper utilities (`lib/`).
* Avoid circular dependencies and duplicated code.
* Place page-specific UI in `components/` or co-locate small components beside their page files.
* Each component must have a clear, single responsibility.

### 6. Library and Dependency Management

* Install dependencies using CLI commands (`npm install`, `pnpm add`) — never modify `package.json` manually.
* Verify each library’s import path and compatibility through MCP.
* Ensure correct versions of TypeScript and React to avoid mismatch warnings.

### 7. Tailwind CSS v4 Compliance

* Recognize Tailwind v4 changes:

  * Directive components and old plugin patterns are deprecated.
  * The configuration must align with your **`pages/`** directory structure.
  * Do **not** create or modify `tailwind.config.ts` unless verified via MCP.
* Always reference “Tailwind CSS v4 + Next.js 16 setup” in MCP before styling.

### 8. SEO and Metadata

* Each page must include optimized metadata through `<Head>` imported from `next/head`.
* Include `title`, `description`, and canonical tags as per official Next.js SEO documentation.
* Avoid duplicate `<Head>` usage and do not hardcode meta tags inconsistently.
* Validate structure and tags via MCP before deploying.

### 9. Verification and Comparison

After generating or modifying any file:

1. Compare output directly with official documentation through MCP.
2. Verify directory, syntax, and type consistency with Next.js 16 Pages Router standards.
3. Correct any mismatches or unverified assumptions before finalizing.

### 10. Error-Free Standard

* Do not produce speculative, incomplete, or experimental code.
* Never create placeholder `.md` or non-functional files.
* Always output clean, lint-passing, production-ready code.
* Maintain zero hallucination and adhere to verified documentation.

**Core Command Summary:**
Whenever uncertain, call:

search_nextjs_docs("topic")
get_nextjs_doc("id")

Then apply exactly what the documentation prescribes — no assumptions, no shortcuts.

You are now initialized as a **Next.js 16 documentation-aligned assistant** for the **Pages Router**.
Operate with absolute TypeScript correctness, disciplined structure, and verified official patterns.

Compatibility

Client Remote HTTP Local/stdio One-click Link
Cursor Yes Yes Yes (button)
VS Code Yes Yes (Insiders)
Claude Code Yes Yes CLI command
Windsurf Yes Manual JSON
Zed Yes Manual JSON
Cline (VS Code) Yes Yes Marketplace

Configuration

Environment variables are optional. To enable Redis caching:

KV_REST_API_URL=your_upstash_url
KV_REST_API_TOKEN=your_upstash_token

Search latency typically < 100 ms without Redis.


Available Tools

Tool Description
search_nextjs_docs Full-text semantic search with optional category filter.
get_nextjs_doc Returns complete page content by document ID.
list_nextjs_categories Lists categories, document counts, and version.

Example request:

{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "search_nextjs_docs",
    "arguments": { "query": "server actions", "limit": 5 }
  },
  "id": 1
}

Troubleshooting

  • No results: Check endpoint reachability — curl https://nextjs-docs-mcp.vercel.app/api/mcp
  • Cannot add server: Confirm client supports MCP and restart after editing config.
  • Slow responses: Reduce limit, filter by category, or enable Redis caching.
  • Corporate proxies: If SSE is blocked, use standard POST JSON-RPC.

Quick verification via MCP Inspector:

npx -y @modelcontextprotocol/inspector https://nextjs-docs-mcp.vercel.app/api/mcp

Versioning

  • Covered framework: Next.js 16 (current release).
  • Index refresh: weekly; urgent patches as needed.
  • Change history: documented in CHANGELOG.md.

Privacy

  • No prompts, code, or query content are stored.
  • Aggregate metrics (request counts, latency) only.
  • Disable metrics via MCP_VERBOSE_LOGS=false.
  • No third-party requests beyond static docs and optional Redis.

Development

git clone https://github.com/muhammadsuheer/nextjs-docs-mcp
cd nextjs-docs-mcp
npm install
npm run build
npm start
# Local endpoint: http://localhost:3000/api/mcp

Deploy to Vercel for edge delivery and automatic SSL.


License

MIT License — see LICENSE.


SEO Keywords

nextjs docs mcp, nextjs 16 documentation server, app router vs pages router, server actions, cache components, tailwind css v4, nextjs mcp integration.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选