A Model Context Protocol (MCP) server that provides integration with the Bear notes application on macOS. This server allows AI assistants like Claude to interact with your Bear notes through a secure, standardized interface.
- Create Notes: Create new notes with titles, content, and tags
- Search Notes: Full-text search through titles and content
- Get Notes: Retrieve specific notes by title or unique identifier
- Update Notes: Replace entire note content
- Append to Notes: Add content to existing notes
- Open Notes: Open notes in the Bear app
- Trash Notes: Move notes to trash
- Archive Notes: Archive notes
- List Tags: View all tags in your Bear collection
- Get Notes by Tag: Retrieve all notes with a specific tag
- Delete Tags: Remove tags from Bear
- Recent Notes: Get notes modified in the last N days
- Backlinks: Find notes that link to a given note
- Node.js: Version 18 or higher
- Bear App: Must be installed on macOS
- macOS: Required for Bear app integration
- Build tools: Required for
better-sqlite3native compilation (Xcode Command Line Tools)
npm install -g bear-mcp-server-
Clone the repository:
git clone https://github.com/johnskish/bear-mcp-server.git cd bear-mcp-server -
Install dependencies:
npm install
-
Build the project:
npm run build
| Variable | Description | Default |
|---|---|---|
BEAR_DB_PATH |
Custom path to Bear's SQLite database | Auto-detected |
BEAR_API_TOKEN |
Bear API token for URL scheme operations | None |
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):
If installed via npm:
{
"mcpServers": {
"bear": {
"command": "npx",
"args": ["-y", "bear-mcp-server"]
}
}
}If installed from source:
{
"mcpServers": {
"bear": {
"command": "node",
"args": ["/path/to/bear-mcp-server/build/index.js"]
}
}
}Note: If you have multiple Node.js versions, use the full path to the Node binary that matches the version used during npm install.
npm run devnpm startnpm run typecheckCreates a new note in Bear.
title(required): Title of the notecontent(required): Content of the note (supports Markdown)tags(optional): Array of tags to add to the note
Searches for notes in Bear and returns results with content.
query(required): Search querylimit(optional): Maximum number of results (default: 10, max: 100)
Retrieves a specific note by title or ID.
identifier(required): Note title or unique identifier
Updates an existing note (replaces entire content).
identifier(required): Note title or unique identifiercontent(required): New content for the notetags(optional): Array of tags to add
Appends content to an existing note.
identifier(required): Note title or unique identifiercontent(required): Content to appendseparator(optional): Separator before appended content (default:\n\n)
Opens a specific note in the Bear app.
identifier(required): Note title or unique identifier
Moves a note to trash.
identifier(required): Note title or unique identifiershow_window(optional): Whether to show Bear window (default: false)
Archives a note.
identifier(required): Note title or unique identifiershow_window(optional): Whether to show Bear window (default: false)
Gets notes modified in the last N days.
days(optional): Number of days to look back (default: 7, max: 365)limit(optional): Maximum number of results (default: 50, max: 100)
Gets notes that link to a given note.
identifier(required): Note title or unique identifier
Lists all tags in your Bear collection.
Gets all notes with a specific tag.
tag(required): Tag name (without # prefix)limit(optional): Maximum number of results (default: 50, max: 100)
Deletes a tag from Bear.
name(required): Tag name (without # prefix)show_window(optional): Whether to show Bear window (default: false)
Run the test suite:
npm testTests are non-destructive — they never touch Bear's database or create/modify/delete any notes. All write operations are mocked, and database tests use an in-memory SQLite database seeded with test fixtures.
Test coverage:
- Schema validation (all 13 Zod schemas)
- API URL construction and encoding (mocked
execFile) - Database queries (in-memory SQLite with Bear's schema)
- Configuration loading
- Server tool registration and response formatting
The server reads from Bear's SQLite database located at:
~/Library/Group Containers/9K33E3U3T4.net.shinyfrog.bear/Application Data/database.sqlite
- Read operations: Direct SQLite access using
better-sqlite3(fast, synchronous) - Write operations: Bear's URL scheme API (
bear://x-callback-url/...)
All tools return structured JSON responses:
{
"count": 3,
"notes": [
{
"id": "unique-identifier",
"title": "Note Title",
"content": "Note content...",
"createdAt": "2024-12-24T10:00:00.000Z",
"modifiedAt": "2024-12-24T12:30:00.000Z",
"isPinned": false,
"isArchived": false
}
]
}src/
├── index.ts # Entry point
├── server.ts # MCP server and tool registration
├── config/
│ └── index.ts # Configuration management
├── database/
│ ├── index.ts # BearDatabase class
│ ├── queries.ts # SQL query constants
│ └── types.ts # Type definitions
├── api/
│ └── index.ts # Bear URL scheme API
└── schemas/
└── index.ts # Zod validation schemas
MIT
Created for use with Model Context Protocol compatible AI assistants.