Bear-MCP服务器
一种模型上下文协议服务器,允许像 Claude 这样的人工智能助手以安全的只读模式读取来自 Bear 笔记应用的笔记。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"bear": {
"args": [
"github:bart6114/my-bear-mcp-server"
],
"autoApprove": [],
"command": "npx",
"disabled": false,
"env": {}
}
}
}
该服务需要配置环境变量:DB_PATH
服务介绍
Bear MCP 服务器
一个模型上下文协议(MCP)服务器,允许像 Claude 这样的 AI 助手从 Bear 笔记应用中读取笔记。此实现以只读模式直接连接到 Bear 的 SQLite 数据库,确保您的笔记安全且不被修改。
快速开始
选项 1:从 GitHub 安装(推荐)
npx github:bart6114/my-bear-mcp-server
就这样!服务器将开始运行并连接到您的 Bear 数据库。
选项 2:克隆并在本地运行
# Clone the repository
git clone https://github.com/bart6114/my-bear-mcp-server.git
cd my-bear-mcp-server
# Install dependencies
npm install
# Build and run
npm run build
npm start
前提条件
- 安装了 Bear 应用的 macOS
- Node.js 18 或更高版本
配置
对于 Claude 桌面应用程序
在 ~/Library/Application Support/Claude/claude_desktop_config.json 中添加以下配置:
{
"mcpServers": {
"bear": {
"command": "npx",
"args": ["github:bart6114/my-bear-mcp-server"],
"env": {},
"disabled": false,
"autoApprove": []
}
}
}
对于 Claude VS Code 扩展
在 ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json 中添加以下配置:
{
"mcpServers": {
"bear": {
"command": "npx",
"args": ["github:bart6114/my-bear-mcp-server"],
"env": {},
"disabled": false,
"autoApprove": []
}
}
}
可用工具
Bear MCP 服务器提供这些只读工具(所有操作都是非破坏性的,不能修改您的 Bear 数据库):
open_note
通过标题或 ID 打开笔记。
search_notes
通过术语或标签搜索笔记。
get_tags
获取 Bear 中的所有标签。
open_tag
显示具有特定标签的所有笔记。
使用示例
以下是通过 AI 助手与 Bear MCP 工具交互的一些示例:
搜索笔记
让您的 AI 助手搜索包含特定术语的笔记:
Can you find all my notes about "project management"?
打开特定笔记
让您的 AI 助手通过标题检索特定笔记:
Show me my note titled "Meeting Notes - March 2025"
查看标签
让您的 AI 助手列出您所有的 Bear 标签:
What tags do I have in my Bear notes?
查找具有特定标签的笔记
让您的 AI 助手显示具有特定标签的笔记:
Show me all notes with the #work tag
高级选项
如果您的 Bear 数据库位于非标准位置:
npx github:bart6114/my-bear-mcp-server --db-path /path/to/your/database.sqlite
技术细节
只读实现
此 MCP 服务器使用严格的只读连接方式连接到您的 Bear SQLite 数据库。这在数据库驱动程序级别强制执行:
// From src/bear-db.ts
this.db = new Database(dbPath, { readonly: true });
这确保了:
- 无法对您的数据库执行写入操作
- 您的笔记和标签不会被修改、删除或损坏
- 如果尝试写入权限,数据库连接将失败
该服务器执行的所有操作都是仅检索数据而不进行修改的 SELECT 查询。
许可证
本项目采用 MIT 许可证 - 详情请参阅 LICENSE 文件。