Org-roam MCP Server
Enables interaction with org-roam knowledge bases, allowing search, retrieval, creation, and linking of notes while respecting org-roam's file structure and conventions.
README
Org-roam MCP Server
A Model Context Protocol (MCP) server that enables Claude Code and other MCP clients to interact with your org-roam knowledge base.
Features
- Read Operations: Search and retrieve org-roam nodes, explore backlinks and relationships
- Write Operations: Create new notes, update existing content, add links between nodes
- Full Integration: Respects org-roam's file structure, UUID system, and conventions
- Auto-Detection: Automatically finds your org-roam database and directory
- Fast Search: Leverages org-roam's SQLite database for efficient queries
- Robust Error Handling: Comprehensive input validation and descriptive error messages
- Path Normalization: Handles quoted/unquoted file paths and node IDs consistently
- Database Synchronization: Automatic refresh after file operations for immediate updates
Recent Improvements
v0.2.0 - Enhanced Reliability (Latest)
- 🔧 Fixed File Path Handling: Resolved issues with quoted file paths from the org-roam database
- 🆔 Improved Node ID Support: Now handles both quoted and unquoted node ID formats seamlessly
- 🔄 Enhanced Search Synchronization: Database automatically refreshes after create/update operations
- ✅ Better Error Handling: Added comprehensive input validation with clear error messages
- 🧹 Path Cleaning: Automatic normalization of file paths with quote removal
- 📝 Improved Logging: Better error reporting and debugging information
Installation
# Using uvx (recommended)
uvx org-roam-mcp
# Or with pip in a virtual environment
pip install org-roam-mcp
Configuration
Auto-Detection
The server automatically detects your org-roam setup by looking for:
Database locations:
~/.emacs.d/org-roam.db~/org-roam.db~/.config/emacs/org-roam.db~/Documents/org-roam/org-roam.db
Directory locations:
~/org-roam/~/Documents/org-roam/~/Dropbox/org-roam/~/Notes/
Manual Configuration
Override auto-detection with environment variables:
export ORG_ROAM_DB_PATH="/path/to/your/org-roam.db"
export ORG_ROAM_DIR="/path/to/your/org-roam-directory"
export ORG_ROAM_MAX_SEARCH_RESULTS=100 # Default: 50
Usage with Claude Code
Add to your Claude Code MCP configuration (~/.claude_code/mcp.json):
{
"mcpServers": {
"org-roam": {
"command": "uvx",
"args": ["org-roam-mcp"]
}
}
}
Or for local development:
{
"mcpServers": {
"org-roam": {
"command": "python",
"args": ["-m", "org_roam_mcp.server"],
"env": {
"ORG_ROAM_DB_PATH": "/path/to/your/org-roam.db",
"ORG_ROAM_DIR": "/path/to/your/org-roam"
}
}
}
}
Available Tools
Search and Discovery
search_nodes: Search for nodes by title, tags, or aliasesget_node: Get detailed information about a specific nodeget_backlinks: Find all nodes that link to a specific nodelist_files: List all org files in your org-roam directory
Content Creation and Modification
create_node: Create a new org-roam node with title, content, and tagsupdate_node: Update the content of an existing nodeadd_link: Create a link from one node to another
Resources
The server provides these resources for read-only access:
org-roam://nodes: List of all nodes in your databaseorg-roam://stats: Database statistics (node count, file count, etc.)org-roam://node/{id}: Detailed information about a specific node
Examples
Creating a New Note
# Through Claude Code
"Create a new org-roam note titled 'Machine Learning Concepts' with the tag 'AI'"
Searching Your Knowledge Base
# Through Claude Code
"Search my org-roam notes for anything related to 'neural networks'"
Exploring Connections
# Through Claude Code
"Show me all the notes that link to my 'Deep Learning' note"
Development
Running from Source
- Clone the repository:
git clone <repository-url>
cd org-roam-mcp
- Create virtual environment and install:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e .
- Run tests:
pytest tests/ -v
- Run the server:
python -m org_roam_mcp.server
Project Structure
org-roam-mcp/
├── src/org_roam_mcp/
│ ├── __init__.py
│ ├── server.py # Main MCP server implementation
│ ├── database.py # SQLite database interface
│ ├── file_manager.py # Org file operations
│ └── config.py # Configuration management
├── tests/
│ ├── test_database.py
│ └── test_file_manager.py
├── pyproject.toml
└── README.md
File Format Compatibility
The server creates org-roam files with the standard structure:
:PROPERTIES:
:ID: 12345678-1234-1234-1234-123456789abc
:END:
#+title: Your Note Title
#+filetags: :tag1: :tag2:
Your note content here...
Requirements
- Python 3.8+
- Existing org-roam setup with SQLite database
- Read/write access to your org-roam directory
Troubleshooting
Database Not Found
If you get a "Database not found" error:
- Check that org-roam is set up and has created a database
- Run
M-x org-roam-db-syncin Emacs to ensure the database exists - Set
ORG_ROAM_DB_PATHenvironment variable to the correct path
Permission Issues
Ensure the MCP server has read/write access to:
- Your org-roam database file
- Your org-roam directory and all subdirectories
Integration Issues
- Restart Claude Code after adding the MCP server configuration
- Check Claude Code logs for any connection errors
- Verify the server starts correctly by running it manually
Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
License
MIT License - see LICENSE file for details
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。