home / mcp / roam research mcp server
Exposes Roam Research API actions via MCP through stdio or HTTP Stream, enabling AI assistants to interact with your graph.
Configuration
View docs{
"mcpServers": {
"camiloluvino-roammcp": {
"command": "roam-research-mcp",
"args": [],
"env": {
"MEMORIES_TAG": "'#[[LLM/Memories]]'",
"ROAM_API_TOKEN": "YOUR_API_TOKEN",
"ROAM_GRAPH_NAME": "YOUR_GRAPH_NAME",
"HTTP_STREAM_PORT": "8088",
"CUSTOM_INSTRUCTIONS_PATH": "/path/to/your/custom_instructions_file.md"
}
}
}
}You can run the Roam Research MCP Server locally to expose Roam Research API functionality through a standard MCP interface. It supports both local, stdio-based communication and networked HTTP Stream access, making it easy to connect AI assistants and other tools to your Roam graph.
You will run the MCP server in either stdio mode for local inter-process communication or HTTP Stream mode for networked access. In stdio mode, you start the server from your terminal and interact with it directly on your machine. In HTTP Stream mode, the server listens on a configurable port and exposes an HTTP-based stream that clients can connect to for real-time updates.
Prerequisites: ensure you have Node.js and npm installed on your system.
Install the MCP server globally and run it directly from your shell, or clone the project and build from source.
Install globally and run:
npm install -g roam-research-mcp
roam-research-mcpOr clone the repository, build, and start the server from source:
git clone https://github.com/2b3pro/roam-research-mcp.git
cd roam-research-mcp
npm install
npm run build
npm startHTTP Stream access is available by default on port 8088 when you use the standard start flow that builds the server. You can customize the port by setting HTTP_STREAM_PORT before starting the server, for example via an environment variable.
Environment variables you may configure include API token and graph details, plus optional memory tagging and a custom instructions file. These variables are loaded from a .env file or from your MCP settings if you are integrating with a client application.
You can containerize the server with Docker. Provide required environment variables when you run the container to supply API credentials and graph details.
In addition to the MCP server, you can use a standalone tool to import Markdown content directly into Roam Research. This tool reads Markdown from stdin and creates or updates Roam pages accordingly.
The server exposes a collection of tools that enable interactions with Roam data, such as fetching pages by title, creating pages, importing Markdown, manipulating blocks and outlines, and performing complex searches across the graph. Each tool is designed to be used from an MCP client and supports batch operations for complex edits.
If something goes wrong, you’ll receive a structured error response that includes an error code, a message, and tips to resolve the issue. Typical problems include missing configuration values, authentication failures, or invalid requests. Detailed logs help you diagnose and fix issues quickly.
To develop or test locally, you can build the server, run it, and use the MCP Inspector tool to interact with available tools and verify responses. This helps you confirm correct behavior before integrating with your own clients.
For best results, identify Roam pages and blocks by their unique identifiers (UIDs) whenever possible to avoid ambiguity. When working with text, be mindful of case sensitivity in Roam content.
Fetch content for a page by its title and return the content in a specified format.
Fetch a block by UID along with its hierarchical children down to a given depth, handling ((UID)) formatting.
Create a new Roam page with optional content and headings, and link it from the current daily page.
Import nested markdown content under a specific block, using batch actions for nesting.
Add a list of todo items to today's daily page through a batch operation.
Add a structured outline to an existing page or block, with support for children view types.
Search for block references within a page or across the graph.
Search for parent or child blocks in the block hierarchy.
Find pages modified since midnight with pagination and sorting.
Search for blocks containing specific text, across all pages or within a specific page.
Search blocks by status (TODO/DONE) across the graph or within a page.
Search for blocks or pages based on creation or modification dates.
Search for blocks containing a specific tag, with optional nearby tag filtering.
Store a memory or piece of information for recall later.
Retrieve all stored memories.
Execute a custom Datomic query on the Roam graph with optional client-side regex filtering.
Provide the Roam Markdown Cheatsheet content, optionally concatenated with custom instructions.
Execute a sequence of block actions (create, update, move, delete) in a single batch for complex nesting.