跳到主要内容

Nuxt MCP Server

借助 Model Context Protocol 支持,在你的 AI 助手中使用 Nuxt 文档。

什么是 MCP?

MCP(Model Context Protocol,模型上下文协议)是一种标准化协议,让 AI 助手能够访问外部数据源和工具。Nuxt 提供了一个 MCP 服务器,允许 Claude Code、Cursor、Windsurf 等 AI 助手直接访问文档、博客文章和部署指南。

该 MCP 服务器以结构化的方式提供 Nuxt 文档,让 AI 工具更容易理解并协助进行 Nuxt 开发。

资源(Resources)

Nuxt MCP 服务器提供以下用于发现的资源:

  • resource://nuxt-com/documentation-pages:浏览所有可用的文档页面(默认 v4.x)
  • resource://nuxt-com/blog-posts:浏览所有 Nuxt 博客文章,包括发布与教程
  • resource://nuxt-com/deploy-providers:浏览所有部署服务商和托管平台

你可以使用 Claude Code 等工具通过 @ 来访问这些资源。

工具(Tools)

Nuxt MCP 服务器提供以下按类别组织的工具:

文档

  • list_documentation_pages:列出所有可用的 Nuxt 文档页面及其分类和基本信息。支持版本过滤(3.x、4.x 或全部)
  • get_documentation_page:通过路径获取文档页面内容与详情
  • get_getting_started_guide:获取某个 Nuxt 版本的入门指南

博客

  • list_blog_posts:列出所有 Nuxt 博客文章及其元数据,包括日期、分类和标签
  • get_blog_post:通过路径获取博客文章内容及详情

部署

  • list_deploy_providers:列出 Nuxt 应用的所有部署服务商和托管平台
  • get_deploy_provider:通过路径获取部署服务商的详情与说明

提示(Prompts)

Nuxt MCP 服务器为常见工作流提供引导式提示:

  • find_documentation_for_topic:为某个特定主题或特性查找最合适的 Nuxt 文档
  • deployment_guide:获取某个特定托管服务商的部署说明
  • migration_help:获取在 Nuxt 版本间迁移的帮助

你可以使用 Claude Code 等工具通过 / 来访问这些资源。

配置

Nuxt MCP 服务器使用 HTTP 传输,可以安装在不同的 AI 助手中。

ChatGPT

基于 MCP 的自定义连接器在 ChatGPT 网页端面向 Pro 和 Plus 账户可用。

在 ChatGPT 中将 Nuxt 设置为连接器的步骤如下:

  1. 启用开发者模式:
    • 进入 Settings → Connectors → Advanced settings → Developer mode
  2. 打开 ChatGPT 设置
  3. 在 Connectors 标签页,创建一个新的连接器:
    • 名称:Nuxt
    • MCP server URL:https://nuxt.com/mcp
    • Authentication:None
  4. 点击 Create

该 Nuxt 连接器稍后会在对话中 composer 的 "Developer mode" 工具中出现。

Claude Code

请确保已安装 Claude Code - 参见 Anthropic 的文档 了解安装说明。

使用 CLI 命令添加服务器:

claude mcp add --transport http nuxt-remote https://nuxt.com/mcp

Claude Desktop

配置说明

  1. 打开 Claude Desktop,进入 "Settings" > "Developer"。
  2. 点击 "Edit Config"。这会打开本地 Claude 目录。
  3. 用你的自定义 MCP 服务器配置修改 claude_desktop_config.json 文件。
    claude_desktop_config.json
    {
      "mcpServers": {
        "nuxt": {
          "command": "npx",
          "args": [
            "mcp-remote",
            "https://nuxt.com/mcp"
          ]
        }
      }
    }
    
  4. 重启 Claude Desktop 应用。Nuxt MCP 服务器现在应该已注册。

Cursor

点击下面的按钮可直接在 Cursor 中安装 Nuxt MCP 服务器:

Install MCP Server

如需手动配置,请按照以下步骤:

  1. 打开 Cursor,进入 "Settings" > "Tools & MCP"
  2. 添加 Nuxt MCP 服务器配置

或者在你的项目根目录手动创建/更新 .cursor/mcp.json

.cursor/mcp.json
{
  "mcpServers": {
    "nuxt": {
      "type": "http",
      "url": "https://nuxt.com/mcp"
    }
  }
}

Le Chat Mistral

  1. 进入 "Intelligence" > "Connectors"
  2. 点击 "Add Connector" 按钮,然后选择 "Custom MCP Connector"
  3. 创建你的 Custom MCP Connector:
    • Connector Name : Nuxt
    • Connector Server : https://nuxt.com/mcp

Visual Studio Code

安装所需扩展 - 确保你已安装 GitHub CopilotGitHub Copilot Chat 扩展。
  1. 打开 VS Code,访问命令面板(Ctrl/Cmd + Shift + P)
  2. 输入 "Preferences: Open Workspace Settings (JSON)" 并选择它
  3. 进入你项目的 .vscode 文件夹,如果不存在则创建
  4. 用以下配置创建或编辑 mcp.json 文件:
.vscode/mcp.json
{
  "servers": {
    "nuxt": {
      "type": "http",
      "url": "https://nuxt.com/mcp"
    }
  }
}

GitHub Copilot Agent

需要仓库管理员权限 才能为 GitHub Copilot coding agent 配置 MCP 服务器。

如果你已经在 VS Code 中配置过 MCP 服务器(将 servers 键替换为 mcpServers 用于 GitHub Copilot Agent),你可以为 GitHub Copilot coding agent 复用类似的配置。你需要添加一个 tools 键来指定 Copilot 可用的工具。

  1. 进入你的 GitHub 仓库
  2. 进入 Settings > Code & automation > Copilot > Coding agent
  3. MCP configuration 部分,添加以下配置:
    {
      "mcpServers": {
        "nuxt": {
          "type": "http",
          "url": "https://nuxt.com/mcp",
          "tools": ["*"]
        }
      }
    }
    
  4. 点击 Save

验证配置

要验证 MCP 服务器配置正确:

  1. 在你的仓库中创建一个 issue 并将其分配给 Copilot
  2. 等待 Copilot 创建一个 pull request
  3. 在 pull request 中,点击 "Copilot started work" 时间线事件里的 View session
  4. 点击右上角的省略号按钮(...),然后在侧边栏点击 Copilot
  5. 展开 Start MCP Servers 步骤,查看已配置的 Nuxt 工具

关于在 GitHub Copilot coding agent 中使用 MCP 的更多信息,请参阅 用 MCP 扩展 coding agent

Windsurf

  1. 打开 Windsurf,进入 "Settings" > "Windsurf Settings" > "Cascade"
  2. 点击 "Manage MCPs" 按钮,然后选择 "View raw config" 选项
  3. 在你的 MCP 设置中添加以下配置:
.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "nuxt": {
      "type": "http",
      "url": "https://nuxt.com/mcp"
    }
  }
}

Zed

  1. 打开 Zed,进入 "Settings" > "Open Settings"
  2. 进入 JSON 设置文件
  3. 在你的设置中添加以下 context server 配置:
.config/zed/settings.json
{
  "context_servers": {
    "nuxt": {
      "source": "custom",
      "command": "npx",
      "args": ["mcp-remote", "https://nuxt.com/mcp"],
      "env": {}
    }
  }
}

Opencode

  1. 在你的项目根目录创建 opencode.json
  2. 添加以下配置:
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "nuxt": {
      "type": "remote",
      "url": "https://nuxt.com/mcp",
      "enabled": true
    }
  }
}

提示示例

配置完成后,你可以向你的 AI 助手提问,例如:

  • "列出所有可用的 Nuxt 文档页面"
  • "获取入门介绍文档"
  • "v3 和 v4 有什么区别?"
  • "如何部署到 Vercel?"
  • "给我看看最新的博客文章"
  • "帮我从 Nuxt 3 迁移到 Nuxt 4"
  • "搜索关于组合式函数的文档"
  • "查找 Cloudflare 的部署指南"

AI 助手会使用该 MCP 服务器来获取结构化的 JSON 数据,并为 Nuxt 开发提供引导式协助。