This MCP server provides a standardized interface for AI assistants like Claude to interact with your Roam Research graph. It supports multiple communication methods and offers a comprehensive set of tools to query, create, and modify content in Roam Research through API calls.
npm install -g roam-research-mcp
roam-research-mcp
Or build from source:
git clone https://github.com/2b3pro/roam-research-mcp.git
cd roam-research-mcp
npm install
npm run build
npm start
Before using the server, you need to set up your Roam Research API token:
Create a Roam Research API token:
Configure the environment variables using a .env
file:
ROAM_API_TOKEN=your-api-token
ROAM_GRAPH_NAME=your-graph-name
MEMORIES_TAG='#[[LLM/Memories]]'
HTTP_STREAM_PORT=8088
SSE_PORT=8087
The server supports three communication methods:
8088
(default)8087
(deprecated)To run with custom ports:
HTTP_STREAM_PORT=9000 SSE_PORT=9001 npm start
To containerize with Docker:
# Build the image
docker build -t roam-research-mcp .
# Run the container 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 HTTP_STREAM_PORT="8088" \
-e SSE_PORT="8087" \
roam-research-mcp
Or with an environment file:
docker run -p 3000:3000 -p 8088:8088 --env-file .env roam-research-mcp
Run the MCP Inspector to test your server:
npm run inspector
The server provides the following tools for interacting with Roam Research:
Page Operations:
roam_fetch_page_by_title
: Retrieve page contentroam_create_page
: Create new pages with optional contentroam_find_pages_modified_today
: Find pages modified todayBlock Operations:
roam_process_batch_actions
: Execute multiple block actions in a single batchroam_import_markdown
: Import nested markdown contentroam_create_outline
: Add structured outlines to pagesroam_add_todo
: Add todo items to the daily pageSearch Operations:
roam_search_block_refs
: Find block referencesroam_search_hierarchy
: Search parent/child blocksroam_search_by_text
: Find blocks containing specific textroam_search_by_status
: Find TODO/DONE blocksroam_search_by_date
: Search by creation/modification datesroam_search_for_tag
: Find blocks with specific tagsMemory Operations:
roam_remember
: Store information to rememberroam_recall
: Retrieve stored memoriesAdvanced Operations:
roam_datomic_query
: Execute custom Datomic queriesPre-computation and Context Loading:
Using Unique Identifiers:
roam_fetch_page_by_title
if you only have titlesCase-Sensitivity:
Iterative Operations:
Tool Selection:
roam_create_outline
for simple sequential outlinesroam_process_batch_actions
for complex structures like tablesCreating a Project Outline:
"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"
Managing To-Dos:
"Mark 'Finish report' and 'Review presentation' as done on today's daily page, and add a new todo 'Prepare for meeting'."
Creating Tables:
"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."
The server provides comprehensive error handling for common scenarios:
Each error response includes a standard MCP error code, detailed message, and resolution suggestions when applicable.
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