为 Windsurf IDE 安装
在 Windsurf(Codeium)IDE 中安装和配置 ContextForge MCP 的完整指南。
前提条件
- Node.js 18 或更高版本
从 nodejs.org 下载
- Windsurf IDE
从 codeium.com/windsurf 下载
- ContextForge 账户
第一步:安装 ContextForge MCP
打开终端并执行:
npm install -g contextforge-mcp
第二步:验证安装
# Check if contextforge-mcp is installed which contextforge-mcp # Should output the path to the executable
第三步:配置 Windsurf
1. 找到 MCP 配置文件
Windsurf 使用 JSON 配置文件管理 MCP 服务器:
# macOS ~/.codeium/windsurf/mcp_config.json # Windows %USERPROFILE%\.codeium\windsurf\mcp_config.json # Linux ~/.codeium/windsurf/mcp_config.json
2. 创建或编辑配置文件
添加以下配置:
{
"mcpServers": {
"contextforge": {
"command": "npx",
"args": ["-y", "contextforge-mcp"],
"env": {
"CONTEXTFORGE_API_KEY": "your-api-key-here"
}
}
}
}注意:将 your-api-key-here 替换为你从 仪表盘 获取的实际 API key
3. 重启 Windsurf
关闭并重新打开 Windsurf IDE 以使更改生效。
在 Windsurf 中使用 ContextForge
配置完成后,你可以在 Windsurf 的 Cascade AI 中使用 ContextForge 工具:
# 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"
更新 ContextForge MCP
有新版本时,可以通过以下命令更新:
npm install -g contextforge-mcp
更新后,请重启 Windsurf 以使更改生效。
故障排除
MCP 未在 Windsurf 中显示
确保配置文件位于正确位置且 JSON 有效:
# Validate JSON syntax cat ~/.codeium/windsurf/mcp_config.json | jq . # Check if contextforge-mcp is accessible which contextforge-mcp
command not found: contextforge-mcp
在配置中使用完整路径:
# Find the full path
npm config get prefix
# Use full path in mcp_config.json
{
"mcpServers": {
"contextforge": {
"command": "/usr/local/bin/contextforge-mcp",
"env": {
"CONTEXTFORGE_API_KEY": "your-api-key"
}
}
}
}身份验证错误
确认 API key 正确且未过期。你可以在 仪表盘 中生成新密钥。