by bejaminjones
A Model Context Protocol (MCP) server that provides Claude with comprehensive access to your Bear notes using a hybrid sync-safe approach - combining direct database reads with Bear's API for writes.
๐ Sync-Safe Hybrid Mode: All operations now work safely with iCloud sync!
This tool uses a hybrid approach: direct database reads + Bear API writes. While comprehensive safety measures are implemented:
git clone <repository-url> cd bear-notes-mcp npm install npm run build
~/Library/Application Support/Claude/claude_desktop_config.json
:*Configuration content*
How it works: Uses Bear's x-callback-url API for writes, database for reads!
Category | Tools | Status | Key Features |
---|---|---|---|
Basic Operations | 6 | โ Active | Get notes, search, browse tags, database stats |
Advanced Search | 8 | โ Active | Full-text search, similarity matching, complex queries |
Analytics | 6 | โ Active | Content analysis, relationship mapping, usage patterns |
Metadata | 6 | โ Active | File attachments, content structure, organization insights |
Write Operations | 6 | โ Active | Sync-safe via Bear API - full write capability restored! |
The server automatically finds your Bear database at:
~/Library/Group Containers/9K33E3U3T4.net.shinyfrog.bear/Application Data/database.sqlite
BEAR_DB_PATH
: Override default database location (for reads)NODE_ENV
: Set to 'development' for debug logging"Show me my recent notes"
"Find all notes tagged with 'project'"
"Create a new note about today's meeting"
"Search for notes containing 'API documentation'"
"Update my project notes with the latest status"
"Analyze my note-taking patterns this month"
"Find notes similar to my current project"
"Show me notes with attachments"
"What are my most-used tags?"
"Archive old notes from last year"
"Find duplicate or similar notes"
"Show me notes that might need better tags"
"Duplicate this note with a new title"
"Add tags to organize my notes better"
โ RECOMMENDED TAG FORMATS:
work
, personal
, urgent
, meeting
work/projects
, personal/health
, study/math
2024
, january
, q1
proj001
, alpha
, beta
โ AVOID THESE FORMATS (auto-corrected):
project-alpha
โ becomes projectalpha
work meeting
โ becomes workmeeting
ProjectAlpha
โ becomes projectalpha
๐ง Automatic Tag Sanitization:
The server automatically validates and sanitizes all tags:
Project
โ project
tag name
โ tagname
project-alpha
โ projectalpha
tag,name
โ tagname
project/alpha
โ project/alpha
(for nested tags)Tag warnings are returned when tags are modified, so you'll know exactly what changes were made.
โ Completely refactored from monolith to modern service-oriented architecture!
We've completely rebuilt the system from a 2,589-line monolithic BearService into a modern, testable, service-oriented architecture:
๐ง Service-Based Design
๐ก๏ธ Hybrid Sync-Safe Architecture
ZUNIQUEIDENTIFIER
bridge๐ Quality & Performance
ServiceContainer (Dependency Injection)
โโโ DatabaseService (SQLite operations & connection management)
โโโ CacheService (Performance optimization & intelligent caching)
โโโ LoggingService (Structured logging with Winston)
โโโ HealthService (System monitoring & health checks)
โโโ ValidationService (Input validation & data sanitization)
โโโ NoteService (Note CRUD & lifecycle management)
โโโ SearchService (Advanced search & content discovery)
โโโ TagService (Tag management & organization)
The Problem: Monolithic code was hard to test, maintain, and extend.
The Solution: Service-oriented architecture with clear separation of concerns.
The Result:
any
typesSpecial thanks to Danilo from the Bear team who provided the key insight that led to this solution!
The iCloud sync challenge has been solved! ๐ Now we're focused on making this the best Bear integration possible. Whether you're a:
Your contribution can help thousands of Bear users get even more from their AI assistants!
Together, we can build the most powerful Bear integration for AI assistants!
๐ Read Operations (26 tools) - โ ACTIVE
get_database_stats
- Overview of your Bear databaseget_notes
- List notes with filtering optionsget_note_by_id
- Get specific note by IDget_note_by_title
- Find note by exact titleget_tags
- List all tags with usage countsget_notes_by_tag
- Find notes with specific tagget_notes_advanced
- Complex filtering and sortingget_notes_with_criteria
- Multi-criteria searchsearch_notes_fulltext
- Full-text search with relevance scoringget_search_suggestions
- Auto-complete for searchesfind_similar_notes
- Content similarity matchingget_related_notes
- Find related notes by tags and contentget_recent_notes
- Recently created or modified notesget_note_counts_by_status
- Statistics by note statusget_note_analytics
- Comprehensive note statisticsanalyze_note_metadata
- Content pattern analysisget_notes_with_metadata
- Filter by content characteristicsget_file_attachments
- File attachment managementget_tag_hierarchy
- Tag relationship analysisget_tag_analytics
- Tag usage patternsanalyze_tag_relationships
- Tag optimization suggestionsget_tag_usage_trends
- Tag usage over timesearch_notes_regex
- Pattern matching (when available)โ๏ธ Write Operations (6 tools) - โ ACTIVE (Sync-Safe)
create_note
- โ
Create new notes with tags and contentupdate_note
- โ
Update existing notes safelyduplicate_note
- โ
Create copies of existing notesarchive_note
- โ
Archive/unarchive notestrigger_hashtag_parsing
- โ
Force hashtag reprocessingbatch_trigger_hashtag_parsing
- โ
Bulk hashtag processingโ All operations are now sync-safe:
Perfect integration between database reads and API writes!
"Database not found" error:
~/Library/Group Containers/9K33E3U3T4.net.shinyfrog.bear/Application Data/
"Permission denied" error:
Write operations not working:
Slow performance:
limit
parametersNODE_ENV=development
open "bear://x-callback-url/create?title=Test"
MIT License - see LICENSE file for details.
Made with โค๏ธ for the Bear community
1 contributor