Bear MCP Server
Provides comprehensive access to Bear notes using a hybrid sync-safe approach - direct database reads for performance and Bear's official API for writes, enabling natural language note management, search, organization, and analysis while maintaining iCloud sync compatibility.
README
Bear MCP Server
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!
⚠️ Disclaimer
This tool uses a hybrid approach: direct database reads + Bear API writes. While comprehensive safety measures are implemented:
- Read operations access Bear's database directly (read-only, safe)
- Write operations use Bear's official API (sync-safe)
- The tool is not affiliated with Bear's developers
- Always maintain regular Bear backups as good practice
🚀 Quick Start (5 minutes)
Prerequisites
- Bear app installed on macOS
- Claude Desktop app
- Node.js 18+ installed
Installation
- Clone and setup:
git clone <repository-url>
cd bear-notes-mcp
npm install
npm run build
- Add to Claude Desktop configuration:
Edit
~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"bear": {
"command": "node",
"args": ["/path/to/bear-notes-mcp/dist/index.js"],
"env": {}
}
}
}
- Start using:
- Restart Claude Desktop
- Ask Claude: "What Bear notes do I have?"
- Begin managing your notes with natural language!
✨ What You Can Do
📖 Read Operations (26 tools) - ✅ ACTIVE
- Search & Discovery: Full-text search, find similar notes, get suggestions
- Organization: Browse by tags, analyze note relationships, get statistics
- Content Analysis: Extract metadata, analyze attachments, find patterns
- Advanced Queries: Complex filtering, date ranges, content criteria
✏️ Write Operations (6 tools) - ✅ ACTIVE (Sync-Safe)
- Create Notes: ✅ Via Bear API (sync-safe)
- Edit Notes: ✅ Via Bear API (sync-safe)
- Organize: ✅ Via Bear API (sync-safe)
- Tag Management: ✅ Via Bear API (sync-safe)
- Hashtag Parsing: ✅ Via Bear API (sync-safe)
How it works: Uses Bear's x-callback-url API for writes, database for reads!
🛡️ Safety Features
- Hybrid Architecture: Database reads + API writes for maximum safety
- iCloud Sync Safe: All write operations use Bear's API
- Conflict Detection: Prevents overwriting concurrent changes
- Tag Validation: Automatic tag sanitization with warnings
- Error Handling: Robust error management for all operations
📊 Capabilities Overview
| 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! |
🔧 Configuration
Database Location
The server automatically finds your Bear database at:
~/Library/Group Containers/9K33E3U3T4.net.shinyfrog.bear/Application Data/database.sqlite
Environment Variables
BEAR_DB_PATH: Override default database location (for reads)NODE_ENV: Set to 'development' for debug logging
📚 Usage Examples
Basic Note Management
"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"
Advanced Operations
"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?"
Organization & Cleanup
"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"
🛡️ Safety & Best Practices
⚠️ Safety Guidelines
- Bear can run during operations - Write operations use Bear's API safely
- Automatic tag validation - Tags are sanitized with warnings
- iCloud sync compatible - No conflicts or sync issues
- Keep Bear updated - Ensure API compatibility
💡 Best Practices
- Read operations are instant - direct database access
- Write operations work with Bear running or closed
- Tag warnings show when tags are auto-corrected
- Use specific search terms for better results
- Archive notes instead of deleting when possible
🏷️ Tag Formatting Guidelines
✅ RECOMMENDED TAG FORMATS:
- Simple tags:
work,personal,urgent,meeting - Nested categories:
work/projects,personal/health,study/math - Time-based:
2024,january,q1 - Project codes:
proj001,alpha,beta
❌ AVOID THESE FORMATS (auto-corrected):
- Hyphens:
project-alpha→ becomesprojectalpha - Spaces:
work meeting→ becomesworkmeeting - Mixed case:
ProjectAlpha→ becomesprojectalpha
🔧 Automatic Tag Sanitization: The server automatically validates and sanitizes all tags:
- Lowercase only:
Project→project - No spaces:
tag name→tagname - No hyphens:
project-alpha→projectalpha - No commas:
tag,name→tagname - ✅ Forward slashes preserved:
project/alpha→project/alpha(for nested tags)
Tag warnings are returned when tags are modified, so you'll know exactly what changes were made.
🏗️ REFACTORED SERVICE ARCHITECTURE
✅ Completely refactored from monolith to modern service-oriented architecture!
Transformation Overview
We've completely rebuilt the system from a 2,589-line monolithic BearService into a modern, testable, service-oriented architecture:
🔧 Service-Based Design
- 7 specialized services with clear responsibilities
- Dependency injection for testability and flexibility
- Interface-driven development for maintainability
- 384 comprehensive tests across all services
🛡️ Hybrid Sync-Safe Architecture
- Read Operations: Direct SQLite database access for maximum performance
- Write Operations: Bear's x-callback-url API for sync safety
- Perfect coordination using
ZUNIQUEIDENTIFIERbridge
📊 Quality & Performance
- 100% TypeScript with strict type checking
- Comprehensive error handling and validation
- Multi-level caching for performance optimization
- Structured logging and health monitoring
Service Architecture
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)
Why This Architecture Works
The Problem: Monolithic code was hard to test, maintain, and extend.
The Solution: Service-oriented architecture with clear separation of concerns.
The Result:
- ✅ Maintainable code - Clear service boundaries and responsibilities
- ✅ 100% test coverage - 384 tests across all services
- ✅ Type safety - Eliminated 50+
anytypes - ✅ Performance optimized - Multi-level caching and query optimization
- ✅ Production ready - Comprehensive logging, monitoring, and error handling
- ✅ Sync-safe operations - Hybrid approach eliminates iCloud conflicts
Current Status
- ✅ All read operations - Direct database access (26 tools)
- ✅ All write operations - Sync-safe Bear API (6 tools)
- ✅ Full feature parity - Everything works as designed
- ✅ iCloud sync compatible - No conflicts or issues
- ✅ Duplicate title fix - Notes display titles correctly (no duplication)
🙏 Thanks to Bear Team
Special thanks to Danilo from the Bear team who provided the key insight that led to this solution!
🤝 Contributing & Community
The iCloud sync challenge has been solved! 🎉 Now we're focused on making this the best Bear integration possible. Whether you're a:
- macOS/iOS developer with API experience
- Database expert familiar with SQLite optimization
- Bear power user with workflow insights
- Developer wanting to contribute to MCP ecosystem
Your contribution can help thousands of Bear users get even more from their AI assistants!
Current Priorities
- 🚀 Add new features - More ways to analyze and work with notes
- 📖 Improve documentation - Help others understand and contribute
- 🧪 Expand test coverage - Ensure reliability across Bear versions
- ⚡ Performance optimization - Make operations even faster
Quick Ways to Help
- ⭐ Star the repo if you find it useful
- 🐛 Report issues you encounter
- 💡 Share ideas for new features or solutions
- 🔗 Spread the word to developers who might help
- 📝 Contribute documentation improvements
Together, we can build the most powerful Bear integration for AI assistants!
🔍 All Available Tools
<details> <summary><strong>📖 Read Operations (26 tools) - ✅ ACTIVE</strong></summary>
Basic Operations (6 tools)
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 tag
Advanced Search (8 tools)
get_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 status
Analytics & Insights (6 tools)
get_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 patterns
Content Analysis (6 tools)
analyze_tag_relationships- Tag optimization suggestionsget_tag_usage_trends- Tag usage over timesearch_notes_regex- Pattern matching (when available)- Advanced content categorization
- Link and reference analysis
- Writing pattern insights
</details>
<details> <summary><strong>✏️ Write Operations (6 tools) - ✅ ACTIVE (Sync-Safe)</strong></summary>
Note Management - SYNC-SAFE VIA BEAR API
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:
- Uses Bear's x-callback-url API for all writes
- No iCloud sync conflicts or data corruption
- Respects Bear's internal sync coordination
- Full write functionality restored
Perfect integration between database reads and API writes!
</details>
🔧 Troubleshooting
Common Issues
"Database not found" error:
- Verify Bear is installed and has been opened at least once
- Check database path:
~/Library/Group Containers/9K33E3U3T4.net.shinyfrog.bear/Application Data/
"Permission denied" error:
- Ensure Claude Desktop has necessary file system permissions
- Check that the database file is readable
Write operations not working:
- Ensure Bear app is installed and has been opened at least once
- Check that Bear's x-callback-url functionality is enabled
- Try opening Bear manually to verify it's working
Slow performance:
- Large databases (10,000+ notes) may take longer for reads
- Use specific search terms instead of broad queries
- Consider using pagination with
limitparameters
Getting Help
- Check the troubleshooting guide
- Review common usage patterns
- Enable debug logging with
NODE_ENV=development - Test Bear's API directly:
open "bear://x-callback-url/create?title=Test"
📈 Performance
- Read operations: Instant (direct database access)
- Write operations: 1-2 seconds (Bear API processing)
- Large databases: Tested with 10,000+ notes
- Memory usage: ~50MB typical, ~100MB for complex operations
- Concurrent operations: Read operations can run simultaneously
- API operations: Processed through Bear's URL scheme
📄 License
MIT License - see LICENSE file for details.
Made with ❤️ for the Bear community
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。