The Roam Research MCP server provides an interface for AI assistants like Claude to interact with your Roam Research graph. It acts as a bridge between AI systems and your Roam database, allowing for searching, reading, and writing operations through a standardized protocol.
You can install the package globally using npm:
npm install -g roam-research-mcp
roam-research-mcp
Alternatively, clone and build from source:
git clone https://github.com/2b3pro/roam-research-mcp.git
cd roam-research-mcp
npm install
npm run build
npm start
For containerized deployment:
# Build the image
docker build -t roam-research-mcp .
# Run with environment variables
docker run -p 3000:3000 -p 8088:8088 -p 8087:8087 \
-e ROAM_API_TOKEN="your-api-token" \
-e ROAM_GRAPH_NAME="your-graph-name" \
-e MEMORIES_TAG="#[[LLM/Memories]]" \
-e CUSTOM_INSTRUCTIONS_PATH="/path/to/your/custom_instructions_file.md" \
-e HTTP_STREAM_PORT="8088" \
-e SSE_PORT="8087" \
roam-research-mcp
Create a .env
file in the root directory with:
ROAM_API_TOKEN=your-api-token
ROAM_GRAPH_NAME=your-graph-name
MEMORIES_TAG='#[[LLM/Memories]]'
CUSTOM_INSTRUCTIONS_PATH='/path/to/your/custom_instructions_file.md'
HTTP_STREAM_PORT=8088
SSE_PORT=8087
The server supports three communication methods:
Run the MCP Inspector to test your installation:
npm run inspector
The server provides numerous tools for interacting with Roam, including:
roam_fetch_page_by_title
: Get page content by titleroam_search_by_text
: Find blocks containing specific textroam_create_page
: Create new pages with optional contentroam_import_markdown
: Import nested markdown contentroam_process_batch_actions
: Execute multiple block operations in a single batchroam_create_outline
: Add structured outlines to pagesroam_remember
and roam_recall
: Store and retrieve memories"Create a new Roam page titled 'Project Alpha Planning' and add the following outline:
- Overview
- Goals
- Scope
- Team Members
- John Doe
- Jane Smith
- Tasks
- Task 1
- Subtask 1.1
- Subtask 1.2
- Task 2
- Deadlines"
"In Roam, add a new table on the page "Fruity Tables" that compares four types of fruits: apples, oranges, grapes, and dates. Choose randomly four areas to compare."
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "roam-research" '{"command":"node","args":["/path/to/roam-research-mcp/build/index.js"],"env":{"ROAM_API_TOKEN":"your-api-token","ROAM_GRAPH_NAME":"your-graph-name","MEMORIES_TAG":"#[[LLM/Memories]]"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"roam-research": {
"command": "node",
"args": [
"/path/to/roam-research-mcp/build/index.js"
],
"env": {
"ROAM_API_TOKEN": "your-api-token",
"ROAM_GRAPH_NAME": "your-graph-name",
"MEMORIES_TAG": "#[[LLM/Memories]]"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"roam-research": {
"command": "node",
"args": [
"/path/to/roam-research-mcp/build/index.js"
],
"env": {
"ROAM_API_TOKEN": "your-api-token",
"ROAM_GRAPH_NAME": "your-graph-name",
"MEMORIES_TAG": "#[[LLM/Memories]]"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect