脑mcp起动器
用于将Claude Code(或任何MCP客户端)连接到WeenHive Brain MCP服务器的最小启动模板。
克隆此回购,添加您的API密钥,Claude Code将立即访问所有Brain工具。
______________________________________________________________________
这给了你什么
配置后,Claude Code在每个会话中都会获得这些工具:
| 工具 | 它做什么 |
|---|---|
recall(query) | 跨所有记忆的语义搜索 |
remember(content) | 保存带有类型和标签的内存 |
list_tasks() | 查看任务板 |
create_task() | 创建新任务 |
update_task() | 更改任务状态 |
complete_task() | 标记任务已完成 |
post_note() | 在公告板上贴一张便条 |
list_notes() | 列出最近的笔记 |
alert() | 发送紧急警报 |
report() | 生成每日摘要 |
______________________________________________________________________
先决条件
- 克劳德代码 安装
- WeenHive Brain API密钥(从您的WeenHive帐户设置中获取一个)
______________________________________________________________________
设置(2分钟)
步骤1:复制MCP配置
复制 .claude/settings.local.json.example 到 .claude/settings.local.json:
cp .claude/settings.local.json.example .claude/settings.local.json步骤2:添加您的API密钥
编辑 .claude/settings.local.json 并替换 YOUR_WEENHIVE_API_KEY_HERE 使用您的真实密钥:
{
"mcpServers": {
"weenhive": {
"type": "http",
"url": "https://weenhive.thisaan.cloud/mcp",
"headers": {
"x-api-key": "wh_your_actual_key_here"
}
}
}
}步骤3:在Claude Code中打开项目
claude .克劳德代码将检测 .claude/settings.local.json 并自动连接到大脑。你会看到 weenhive 出现在MCP工具列表中。
步骤4:验证连接
在克劳德代码中,问:
“使用召回工具搜索有关WeenHive的任何信息”
如果大脑连接,你会得到结果。
______________________________________________________________________
备选方案:全局设置(所有项目)
要在计算机上的每个项目中都使用Brain工具,请将配置添加到全局Claude Code设置中:
macOS/Linux:
mkdir -p ~/.claude
cat >> ~/.claude/settings.json 注:如果 `~/.claude/settings.json` 已存在,请合并 `mcpServers` 手动阻止——不要覆盖文件。
______________________________________________________________________
## 项目结构
brain-mcp-starter/ ├── README.md — This file ├── CLAUDE.md — Instructions for Claude in this project ├── .claude/ │ ├── settings.local.json.example — MCP config template (copy and fill in key) │ └── settings.local.json — Your real config (gitignored) └── examples/ ├── 01-recall.md — How to use recall() ├── 02-remember.md — How to use remember() ├── 03-tasks.md — How to use task tools ├── 04-notes.md — How to use post_note() and list_notes() └── 05-session-workflow.md — Full session workflow example
______________________________________________________________________
## 安全说明
- `.claude/settings.local.json` 是gitignored-您的API密钥保持本地
- 永远不要将API密钥提交给git
- 示例文件使用占位符——提交是安全的
- API密钥可以在您的WeenHive帐户设置中旋转
______________________________________________________________________
## 故障排除
**“找不到MCP服务器”或工具未出现:**
- 确认 `settings.local.json` 存在于 `.claude/` (不仅仅是示例文件)
- 确认API密钥正确(无额外空格,前缀正确)
- 更改配置后重新启动Claude代码
**“401未经授权”错误:**
- 您的API密钥错误或已过期
- 从WeenHive帐户设置中获取新密钥
**“连接被拒绝”或网络错误:**
- 检查一下 `weenhive.thisaan.cloud` 可访问: `curl https://weenhive.thisaan.cloud/health`
- 如果无法访问,服务可能会暂时关闭——等待并重试
**工具出现但返回空结果:**
- 你的大脑可能是空的——从使用开始 `remember()` 添加一些记忆
- 尝试 `recall("test")` 添加至少一个内存后
______________________________________________________________________
## MCP协议说明
WeenHive大脑使用 **可流式HTTP传输** (MCP规范2025-03-26+)。
- 端点: `POST https://weenhive.thisaan.cloud/mcp`
- 认证: `x-api-key` 标头(非承载令牌)
- 会话管理:服务器返回 `Mcp-Session-Id` 在init上;客户端在后续请求中包含它
- 当您使用时,Claude Code会自动处理所有这些 `"type": "http"` 在配置中
传统的SSE运输(`/mcp/sse`)从MCP规范2025-03-26开始,已弃用。使用流式HTTP。
______________________________________________________________________
## 相关资源
- [WeenHive大脑——登录页面](https://newsix.github.io/weenhive-brain-landing/)
- [MCP规范](https://modelcontextprotocol.io/specification)
- [克劳德代码MCP文档](https://docs.anthropic.com/en/docs/claude-code/mcp)
- [WeenHive](https://weenhive.thisaan.cloud)