Bear MCP Server

by bart6114
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Requires macOS with Bear app installed for the MCP server to function properly by connecting to the Bear SQLite database.

  • Connects to the Bear SQLite database in read-only mode to safely retrieve note data without modifying the underlying database.

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 或更高版本

配置

对于克劳德桌面应用程序

将其添加到您的配置文件~/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 数据库):

打开笔记

按标题或 ID 打开笔记。

搜索笔记

按术语或标签搜索笔记。

获取标签

获取 Bear 中的所有标签。

open_tag

显示带有特定标签的所有笔记。

示例用法

以下是如何通过 AI 助手与 Bear MCP 工具交互的示例:

搜索笔记

让你的人工智能助手搜索包含特定术语的笔记:

Can you find all my notes about "project management"?

打开特定笔记

要求你的人工智能助手按标题检索特定的笔记:

Show me my note titled "Meeting Notes - March 2025"

查看标签

让你的 AI 助手列出你所有的 Bear 标签:

What tags do I have in my Bear notes?

查找具有特定标签的笔记

让你的人工智能助手显示带有特定标签的笔记:

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文件。

ID: q04mrxtyp0