内容
# Cherry Studio 知识库 MCP 服务器
**一行配置,即刻使用。** 让 Claude、Cursor 等 AI 助手直接读取你的 Cherry Studio 知识库。
## 客户端兼容性
| 客户端 | 状态 | 备注 |
|:---:|:---:|:---|
| ✅ Codex | **已验证可用** | — |
| ✅ WorkBuddy | **已验证可用** | — |
| ⚠️ LobeHub | **可能无法使用** | 已知兼容性问题 |
> 你的客户端不在这个列表?欢迎提交 Issue 反馈使用体验!
## 使用方法
### 方式一:npx 直接运行(推荐,无需安装)
打开你的 AI 客户端配置(Claude Desktop / Cursor 等),粘贴以下 JSON:
```json
{
"mcpServers": {
"cherrystudio-knowledgebase": {
"command": "npx",
"args": ["-y", "cherrystudio-knowledgebase-mcp"],
"env": {
"CHERRYSTUDIO_API_BASE_URL": "http://127.0.0.1:23333",
"CHERRYSTUDIO_API_KEY": "cs-sk-your-api-key-here"
}
}
}
}
```
**只需替换 `cs-sk-your-api-key-here` 为你的真实 API Key**,保存后重启客户端即可。
> 获取 API Key:在 Cherry Studio 中打开设置,找到 API 密钥并复制。
### 方式二:本地克隆运行
```bash
git clone https://github.com/Prism-Future/cherrystudio-knowledgebase-mcp.git
cd cherrystudio-knowledgebase-mcp
npm install
npm run build
```
然后使用本地路径配置:
```json
{
"mcpServers": {
"cherrystudio-knowledgebase": {
"command": "node",
"args": ["path/to/cherrystudio-knowledgebase-mcp/dist/index.js"],
"env": {
"CHERRYSTUDIO_API_BASE_URL": "http://127.0.0.1:23333",
"CHERRYSTUDIO_API_KEY": "cs-sk-your-api-key-here"
}
}
}
}
```
### 方式三:JSON 配置文件
如果你不想把 API Key 写在客户端配置里,可以创建一个独立的 JSON 配置文件:
```bash
# 创建配置文件
echo '{"cherryStudioApiKey":"cs-sk-your-api-key-here"}' > config.json
```
然后客户端配置里不需要写 `env`:
```json
{
"mcpServers": {
"cherrystudio-knowledgebase": {
"command": "npx",
"args": ["-y", "cherrystudio-knowledgebase-mcp"]
}
}
}
```
配置文件支持放在以下位置(优先级由高到低):
1. `config.json` in project root
2. `~/.config/cherrystudio-kb-mcp/config.json`
完整配置示例见 `config.example.json`。
## 前置要求
- Node.js 18+
- Cherry Studio(已启动并运行)
- Cherry Studio API 已启用且知道 API Key
## 功能
| 工具 | 功能 |
|---|---|
| `listKnowledgeBases` | 列出所有知识库 |
| `searchKnowledgeBases` | 搜索知识库内容 |
| `getKnowledgeBase` | 获取知识库详情 |
| `getMcpServers` | 列出已配置的 MCP 服务器 |
## 常见问题
**Q: API Key 在哪里获取?**
A: 在 Cherry Studio 设置中找到 API 密钥并复制。
**Q: Cherry Studio API 地址是什么?**
A: 默认是 `http://127.0.0.1:23333`,请确保 Cherry Studio 正在运行。
**Q: 支持哪些客户端?**
A: 任何支持 MCP 协议的客户端,如 Claude Desktop、Cursor、Codex 等。
## 开发
```bash
npm install # 安装依赖
npm run dev # 开发模式
npm run build # 构建
npm run test # 测试
```
## 项目信息
- **作者**: [Prism-Future](https://github.com/Prism-Future)
- **许可证**: MIT
- **技术栈**: TypeScript, Node.js, MCP SDK, Zod, Axios
## 相关链接
- [Cherry Studio 官网](https://docs.cherryai.com.cn/)
- [MCP 协议文档](https://modelcontextprotocol.io/)
- [Claude Desktop](https://claude.ai/)
- [问题反馈](https://github.com/Prism-Future/cherrystudio-knowledgebase-mcp/issues)