Claude Code 设置

最后更新:2026年6月22日

Claude Code 是一个在终端中运行的编码 agent。把 WEEGLOO MCP 服务器连接到它之后,Claude Code 就能直接创建、读取和修改 Content TypeContentMedia 等资源。连接方式与其他环境相同。先用安装工具一次性完成设置,然后在 Claude Code 中完成认证即可。

关于 MCP 本身、服务器分组以及文件上传服务器的说明,请参阅 MCP。本页只讲连接到 Claude Code 的步骤。

准备工作

  • Node.js 18 及以上:运行安装工具和文件传输服务器(weegloo-upload)时需要。
  • Personal Access Token:用于认证。签发方法请参阅 签发 Personal Access Token
  • Claude Code:在终端中可以通过 claude 命令运行的状态。

用安装工具进行连接

先进入要连接的项目文件夹,然后在该文件夹中运行安装工具。MCP 设置是按文件夹保存的,因此运行的位置就是设置将要生效的项目。

npx weegloo@latest

运行后会依次提问。每一项按如下方式选择。

  1. Select plugin version (branch):Skills 和 Rules 的版本。选择 latest
  2. Select your IDE:选择 Claude Code
  3. What would you like to install?:可以分别安装 MCP 服务器和 Skills / Rules。如果是首次安装,请全部安装。
  4. Enter your Weegloo Personal Access Token:粘贴事先签发好的 Personal Access Token。
  5. Select the MCP server group:通常选择 default。各服务器分组之间的差异请参阅 MCP 服务器分组
  6. Where would you like to install ... configuration:如果只想应用于当前项目,请选择 Project。根据 Claude Code 的版本,如果不支持 Project 安装,则以 Global 方式安装。

安装完成后,项目文件夹中会生成 .mcp.json.claude/ 目录,并注册 weeglooweegloo-upload 两个 MCP 服务器。

√ Select plugin version (branch): latest  (recommended)
√ Select your IDE: Claude Code
√ What would you like to install? Install MCP server, Install Skills and Rules
√ Enter your Weegloo Personal Access Token: ********
√ Select the MCP server group: default
√ Where would you like to install Claude Code configuration? Project
 
√   MCP servers configured   → ./.mcp.json
√   Skills installed         → ./.claude/skills
√   Rules installed          → ./.claude/rules
 
  ✔  Installation complete!

直接查看配置文件

安装工具生成的 .mcp.json 大致如下所示。weegloo 服务器以 HTTP 方式连接到 https://ai.weegloo.com/mcp,处理文件的 weegloo-upload 服务器通过 npx 运行,并使用 Personal Access Token 进行认证。

{
  "mcpServers": {
    "weegloo": {
      "type": "http",
      "url": "https://ai.weegloo.com/mcp"
    },
    "weegloo-upload": {
      "command": "npx",
      "args": ["-y", "weegloo-upload"],
      "env": {
        "UPLOAD_API_URL": "https://upload.weegloo.com/v1",
        "AUTH_BEARER_TOKEN": "<Personal Access Token>"
      }
    }
  }
}

要更换服务器分组,请在 weegloo 服务器的 url 末尾附加 group 值。例如,要使用所有工具,就写成 https://ai.weegloo.com/mcp?group=all。各分组的工具构成请参阅 MCP 服务器分组

在 Claude Code 中启用服务器

在存放配置文件的项目文件夹中运行 Claude Code。

claude

首次运行时,会询问是否要启用 .mcp.json 中新增的服务器。选中这两个服务器并按 Enter 启用。

  2 new MCP servers found in .mcp.json
  Select any you wish to enable.
 
  > [√] weegloo
    [√] weegloo-upload

weegloo-upload 服务器会用配置文件中填入的 Personal Access Token 直接完成认证,进入 connected 状态。weegloo 服务器由于是 HTTP 连接,需要单独认证,因此显示为 needs authentication 状态。

认证 weegloo 服务器

要认证 weegloo 服务器,请进入 MCP 服务器管理界面。在已注册的服务器列表中选择 weegloo

  Manage MCP servers
 
  > weegloo · ∆ needs authentication
    weegloo-upload · √ connected · 1 tool

选择 weegloo 后会显示状态界面。确认连接地址为 https://ai.weegloo.com/mcp 无误后,选择 Authenticate

   Weegloo MCP Server
 
  Status:  ∆ needs authentication
  URL:     https://ai.weegloo.com/mcp
 
  > 1. Authenticate
    2. Disable

选择 Authenticate 后,浏览器中会打开登录页面。如果浏览器没有自动打开,请把 Claude Code 中显示的地址直接输入到浏览器地址栏。输入事先签发好的 Personal Access Token,认证即告完成。

认证完成后,weegloo 服务器的状态会变为 connected。此后,在 Claude Code 中用自然语言提出请求,就能直接操作 WEEGLOO 资源。

下一步

  • MCP:介绍服务器分组、文件上传服务器等作为连接基础的内容。
  • Skills 与 Rules:介绍安装工具一并安装的 Skills 和 Rules 是什么。
  • 用 AI 迁移静态页面:跟随流程,用已连接的 MCP 把实际页面迁移为基于内容的服务。