为 ChatGPT Desktop 安装

在 ChatGPT 桌面应用中安装和配置 ContextForge MCP 的完整指南。

前提条件

第一步:安装 ContextForge MCP

打开终端并执行:

npm install -g contextforge-mcp

第二步:获取 API key

登录 ContextForge 仪表盘,前往 API Keys 生成密钥。复制以备下一步使用。

第三步:配置 ChatGPT Desktop

选项 A:通过设置界面

  1. 打开 ChatGPT Desktop
  2. 前往 设置(齿轮图标)
  3. 导航至 功能 > MCP 服务器
  4. 点击 添加服务器
  5. 输入服务器名称: contextforge
  6. 输入命令: contextforge-mcp
  7. 添加环境变量 CONTEXTFORGE_API_KEY,值为你的 API key

选项 B:通过 JSON 配置

直接编辑 ChatGPT MCP 配置文件:

# macOS
~/Library/Application Support/com.openai.chat/mcp.json

# Windows
%APPDATA%\com.openai.chat\mcp.json

添加以下配置:

{
  "mcpServers": {
    "contextforge": {
      "command": "npx",
      "args": ["-y", "contextforge-mcp"],
      "env": {
        "CONTEXTFORGE_API_KEY": "your-api-key-here"
      }
    }
  }
}

注意: your-api-key-here 替换为你从 仪表盘 获取的实际 API key

3. 重启 ChatGPT Desktop

关闭并重新打开 ChatGPT Desktop 以使更改生效。你应该能在对话中看到 ContextForge 工具可用。

在 ChatGPT 中使用 ContextForge

配置完成后,ContextForge 工具将在 ChatGPT 对话中自动可用:

# Save knowledge to memory
"Remember this API endpoint documentation..."

# Query your memory
"What do we know about the authentication flow?"

# Create tasks
"Create a task: Fix the login bug"

# List your tasks
"Show my pending tasks"

注意:ChatGPT 支持 MCP 工具,但不支持 MCP 资源和提示词。ContextForge 的所有功能均通过工具实现,因此你可以获得完整功能。

故障排除

command not found: contextforge-mcp

桌面应用有时不会继承 shell 的 PATH。使用完整路径:

# Find the full path
which contextforge-mcp

# Use it in your config
{
  "mcpServers": {
    "contextforge": {
      "command": "/usr/local/bin/contextforge-mcp",
      "env": {
        "CONTEXTFORGE_API_KEY": "your-api-key"
      }
    }
  }
}

工具未在对话中显示

确保你拥有 ChatGPT Plus、Team 或 Enterprise 计划。免费版不支持 MCP。同时在设置 > 功能 > MCP 服务器中确认服务器显示为已连接。

身份验证错误

确认 API key 正确且未过期。你可以在 仪表盘 中生成新密钥。

下一步