roam-research-mcp 0.36.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,18 +7,17 @@
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
8
  [![GitHub](https://img.shields.io/github/license/2b3pro/roam-research-mcp)](https://github.com/2b3pro/roam-research-mcp/blob/main/LICENSE)
9
9
 
10
- A Model Context Protocol (MCP) server that provides comprehensive access to Roam Research's API functionality. This server enables AI assistants like Claude to interact with your Roam Research graph through a standardized interface. It supports standard input/output (stdio), HTTP Stream, and Server-Sent Events (SSE) communication. (A WORK-IN-PROGRESS, personal project not officially endorsed by Roam Research)
10
+ A Model Context Protocol (MCP) server that provides comprehensive access to Roam Research's API functionality. This server enables AI assistants like Claude to interact with your Roam Research graph through a standardized interface. It supports standard input/output (stdio) and HTTP Stream communication. (A WORK-IN-PROGRESS, personal project not officially endorsed by Roam Research)
11
11
 
12
12
  <a href="https://glama.ai/mcp/servers/fzfznyaflu"><img width="380" height="200" src="https://glama.ai/mcp/servers/fzfznyaflu/badge" alt="Roam Research MCP server" /></a>
13
13
  <a href="https://mseep.ai/app/2b3pro-roam-research-mcp"><img width="380" height="200" src="https://mseep.net/pr/2b3pro-roam-research-mcp-badge.png" alt="MseeP.ai Security Assessment Badge" /></a>
14
14
 
15
15
  ## Installation and Usage
16
16
 
17
- This MCP server supports three primary communication methods:
17
+ This MCP server supports two primary communication methods:
18
18
 
19
19
  1. **Stdio (Standard Input/Output):** Ideal for local inter-process communication, command-line tools, and direct integration with applications running on the same machine. This is the default communication method when running the server directly.
20
20
  2. **HTTP Stream:** Provides network-based communication, suitable for web-based clients, remote applications, or scenarios requiring real-time updates over HTTP. The HTTP Stream endpoint runs on port `8088` by default.
21
- 3. **SSE (Server-Sent Events):** A transport for legacy clients that require SSE. The SSE endpoint runs on port `8087` by default. (NOTE: ⚠️ DEPRECATED: The SSE Transport has been deprecated as of MCP specification version 2025-03-26. HTTP Stream Transport preferred.)
22
21
 
23
22
  ### Running with Stdio
24
23
 
@@ -41,16 +40,16 @@ npm start
41
40
 
42
41
  ### Running with HTTP Stream
43
42
 
44
- To run the server with HTTP Stream or SSE support, you can either:
43
+ To run the server with HTTP Stream support, you can either:
45
44
 
46
- 1. **Use the default ports:** Run `npm start` after building (as shown above). The server will automatically listen on port `8088` for HTTP Stream and `8087` for SSE.
47
- 2. **Specify custom ports:** Set the `HTTP_STREAM_PORT` and/or `SSE_PORT` environment variables before starting the server.
45
+ 1. **Use the default ports:** Run `npm start` after building (as shown above). The server will automatically listen on port `8088` for HTTP Stream.
46
+ 2. **Specify custom ports:** Set the `HTTP_STREAM_PORT` environment variable before starting the server.
48
47
 
49
48
  ```bash
50
- HTTP_STREAM_PORT=9000 SSE_PORT=9001 npm start
49
+ HTTP_STREAM_PORT=9000 npm start
51
50
  ```
52
51
 
53
- Or, if using a `.env` file, add `HTTP_STREAM_PORT=9000` and/or `SSE_PORT=9001` to it.
52
+ Or, if using a `.env` file, add `HTTP_STREAM_PORT=9000` to it.
54
53
 
55
54
  ## Docker
56
55
 
@@ -66,16 +65,15 @@ docker build -t roam-research-mcp .
66
65
 
67
66
  ### Run the Docker Container
68
67
 
69
- To run the Docker container and map the necessary ports, you must also provide the required environment variables. Use the `-e` flag to pass `ROAM_API_TOKEN`, `ROAM_GRAPH_NAME`, and optionally `MEMORIES_TAG`, `HTTP_STREAM_PORT`, and `SSE_PORT`:
68
+ To run the Docker container and map the necessary ports, you must also provide the required environment variables. Use the `-e` flag to pass `ROAM_API_TOKEN`, `ROAM_GRAPH_NAME`, and optionally `MEMORIES_TAG` and `HTTP_STREAM_PORT`:
70
69
 
71
70
  ```bash
72
- docker run -p 3000:3000 -p 8088:8088 -p 8087:8087 \
71
+ docker run -p 3000:3000 -p 8088:8088 \
73
72
  -e ROAM_API_TOKEN="your-api-token" \
74
73
  -e ROAM_GRAPH_NAME="your-graph-name" \
75
74
  -e MEMORIES_TAG="#[[LLM/Memories]]" \
76
75
  -e CUSTOM_INSTRUCTIONS_PATH="/path/to/your/custom_instructions_file.md" \
77
76
  -e HTTP_STREAM_PORT="8088" \
78
- -e SSE_PORT="8087" \
79
77
  roam-research-mcp
80
78
  ```
81
79
 
@@ -85,6 +83,59 @@ Alternatively, if you have a `.env` file in the project root (which is copied in
85
83
  docker run -p 3000:3000 -p 8088:8088 --env-file .env roam-research-mcp
86
84
  ```
87
85
 
86
+ ## Standalone CLI: roam-import
87
+
88
+ A standalone command-line tool for importing markdown content directly into Roam Research, without running the MCP server.
89
+
90
+ ### Usage
91
+
92
+ ```bash
93
+ # From a file
94
+ cat document.md | roam-import "Meeting Notes"
95
+
96
+ # From clipboard (macOS)
97
+ pbpaste | roam-import "Ideas"
98
+
99
+ # From here-doc
100
+ roam-import "Quick Note" << EOF
101
+ # Heading
102
+ - Item 1
103
+ - Item 2
104
+ - Nested item
105
+ EOF
106
+ ```
107
+
108
+ ### Features
109
+
110
+ - Reads markdown from stdin
111
+ - Creates a new page with the specified title (or appends to existing page)
112
+ - Automatically links the new page from today's daily page
113
+ - Converts standard markdown to Roam-flavored markdown (bold, italic, highlights, tasks, code blocks)
114
+
115
+ ### Installation
116
+
117
+ After building the project, make the command globally available:
118
+
119
+ ```bash
120
+ npm link
121
+ ```
122
+
123
+ Or run directly without linking:
124
+
125
+ ```bash
126
+ cat document.md | node build/cli/import-markdown.js "Page Title"
127
+ ```
128
+
129
+ ### Requirements
130
+
131
+ Same environment variables as the MCP server:
132
+ - `ROAM_API_TOKEN`: Your Roam Research API token
133
+ - `ROAM_GRAPH_NAME`: Your Roam graph name
134
+
135
+ Configure via `.env` file in the project root or set as environment variables.
136
+
137
+ ---
138
+
88
139
  ## To Test
89
140
 
90
141
  Run [MCP Inspector](https://github.com/modelcontextprotocol/inspector) after build using the provided npm script:
@@ -111,25 +162,26 @@ The server provides powerful tools for interacting with Roam Research:
111
162
 
112
163
  1. `roam_fetch_page_by_title`: Fetch page content by title. Returns content in the specified format.
113
164
  2. `roam_fetch_block_with_children`: Fetch a block by its UID along with its hierarchical children down to a specified depth. Automatically handles `((UID))` formatting.
114
- 3. `roam_create_page`: Create new pages with optional content and headings. Now creates a block on the daily page linking to the newly created page.
115
- 4. `roam_import_markdown`: Import nested markdown content under a specific block. (Internally uses `roam_process_batch_actions`.)
116
- 5. `roam_add_todo`: Add a list of todo items to today's daily page. (Internally uses `roam_process_batch_actions`.)
117
- 6. `roam_create_outline`: Add a structured outline to an existing page or block, with support for `children_view_type`. Best for simpler, sequential outlines. For complex nesting (e.g., tables), consider `roam_process_batch_actions`. If `page_title_uid` and `block_text_uid` are both blank, content defaults to the daily page. (Internally uses `roam_process_batch_actions`.)
118
- 7. `roam_search_block_refs`: Search for block references within a page or across the entire graph.
119
- 8. `roam_search_hierarchy`: Search for parent or child blocks in the block hierarchy.
120
- 9. `roam_find_pages_modified_today`: Find pages that have been modified today (since midnight).
121
- 10. `roam_search_by_text`: Search for blocks containing specific text.
122
- 11. `roam_search_by_status`: Search for blocks with a specific status (TODO/DONE) across all pages or within a specific page.
123
- 12. `roam_search_by_date`: Search for blocks or pages based on creation or modification dates.
124
- 13. `roam_search_for_tag`: Search for blocks containing a specific tag and optionally filter by blocks that also contain another tag nearby or exclude blocks with a specific tag.
125
- 14. `roam_remember`: Add a memory or piece of information to remember. (Internally uses `roam_process_batch_actions`.)
126
- 15. `roam_recall`: Retrieve all stored memories.
127
- 16. `roam_datomic_query`: Execute a custom Datomic query on the Roam graph for advanced data retrieval beyond the available search tools.
128
- 17. `roam_markdown_cheatsheet`: Provides the content of the Roam Markdown Cheatsheet resource, optionally concatenated with custom instructions if `CUSTOM_INSTRUCTIONS_PATH` environment variable is set.
129
- 18. `roam_process_batch_actions`: Execute a sequence of low-level block actions (create, update, move, delete) in a single, non-transactional batch. Provides granular control for complex nesting like tables. (Note: For actions on existing blocks or within a specific page context, it is often necessary to first obtain valid page or block UIDs using tools like `roam_fetch_page_by_title`.)
165
+ 3. `roam_create_page`: Create new pages with optional content and headings. **Now supports mixed content types** - content array can include both text blocks and tables in a single call using `{type: "table", headers, rows}` format. Creates a block on the daily page linking to the newly created page.
166
+ 4. `roam_create_table`: Create a properly formatted Roam table with specified headers and rows. Abstracts Roam's complex nested table structure, validates row/column consistency, and handles empty cells automatically.
167
+ 5. `roam_import_markdown`: Import nested markdown content under a specific block. (Internally uses `roam_process_batch_actions`.)
168
+ 6. `roam_add_todo`: Add a list of todo items to today's daily page. (Internally uses `roam_process_batch_actions`.)
169
+ 7. `roam_create_outline`: Add a structured outline to an existing page or block, with support for `children_view_type`. Best for simpler, sequential outlines. For complex nesting (e.g., tables), consider `roam_process_batch_actions`. If `page_title_uid` and `block_text_uid` are both blank, content defaults to the daily page. (Internally uses `roam_process_batch_actions`.)
170
+ 8. `roam_search_block_refs`: Search for block references within a page or across the entire graph.
171
+ 9. `roam_search_hierarchy`: Search for parent or child blocks in the block hierarchy.
172
+ 10. `roam_find_pages_modified_today`: Find pages that have been modified today (since midnight), with pagination and sorting options.
173
+ 11. `roam_search_by_text`: Search for blocks containing specific text across all pages or within a specific page. This tool supports pagination via the `limit` and `offset` parameters.
174
+ 12. `roam_search_by_status`: Search for blocks with a specific status (TODO/DONE) across all pages or within a specific page.
175
+ 13. `roam_search_by_date`: Search for blocks or pages based on creation or modification dates.
176
+ 14. `roam_search_for_tag`: Search for blocks containing a specific tag and optionally filter by blocks that also contain another tag nearby or exclude blocks with a specific tag. This tool supports pagination via the `limit` and `offset` parameters.
177
+ 15. `roam_remember`: Add a memory or piece of information to remember. (Internally uses `roam_process_batch_actions`.)
178
+ 16. `roam_recall`: Retrieve all stored memories.
179
+ 17. `roam_datomic_query`: Execute a custom Datomic query on the Roam graph for advanced data retrieval beyond the available search tools. Now supports client-side regex filtering for enhanced post-query processing. Optimal for complex filtering (including regex), highly complex boolean logic, arbitrary sorting criteria, and proximity search.
180
+ 18. `roam_markdown_cheatsheet`: Provides the content of the Roam Markdown Cheatsheet resource, optionally concatenated with custom instructions if `CUSTOM_INSTRUCTIONS_PATH` environment variable is set.
181
+ 19. `roam_process_batch_actions`: Execute a sequence of low-level block actions (create, update, move, delete) in a single, non-transactional batch. Provides granular control for complex nesting like tables. **Now includes pre-validation** that catches errors before API execution, with structured error responses and automatic rate limit retry with exponential backoff. (Note: For actions on existing blocks or within a specific page context, it is often necessary to first obtain valid page or block UIDs using tools like `roam_fetch_page_by_title`.)
130
182
 
131
183
  **Deprecated Tools**:
132
- The following tools have been deprecated as of `v1.36.0` in favor of the more powerful and flexible `roam_process_batch_actions`:
184
+ The following tools have been deprecated as of `v0.36.2` in favor of the more powerful and flexible `roam_process_batch_actions`:
133
185
 
134
186
  - `roam_create_block`: Use `roam_process_batch_actions` with the `create-block` action.
135
187
  - `roam_update_block`: Use `roam_process_batch_actions` with the `update-block` action.
@@ -176,20 +228,6 @@ Please note that while the `roam_process_batch_actions` tool can set block headi
176
228
 
177
229
  ---
178
230
 
179
- ## Propose Improvements
180
-
181
- ### Pagination for Search Tools
182
-
183
- The `roam_search_for_tag` and `roam_search_by_text` tools now support `limit` and `offset` parameters, enabling basic pagination. To achieve full, robust pagination (e.g., retrieving "page 2" of results), the client consuming these tools would need to:
184
-
185
- 1. Make an initial call with `limit` and `offset=0` to get the first set of results and the `total_count`.
186
- 2. Calculate the total number of pages based on `total_count` and the desired `limit`.
187
- 3. Make subsequent calls, incrementing the `offset` by `limit` for each "page" of results.
188
-
189
- Example: To get the second page of 10 results, the call would be `roam_search_by_text(text: "your query", limit: 10, offset: 10)`.
190
-
191
- ---
192
-
193
231
  ## Example Prompts
194
232
 
195
233
  Here are some examples of how to creatively use the Roam tool in an LLM to interact with your Roam graph, particularly leveraging `roam_process_batch_actions` for complex operations.
@@ -232,12 +270,25 @@ This demonstrates moving a block from one location to another and simultaneously
232
270
 
233
271
  ### Example 4: Making a Table
234
272
 
235
- This demonstrates moving a block from one location to another and simultaneously updating its content.
273
+ This demonstrates creating a standalone table on a page.
236
274
 
237
275
  ```
238
276
  "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."
239
277
  ```
240
278
 
279
+ ### Example 5: Creating a Page with Mixed Content (Text + Table)
280
+
281
+ This demonstrates creating a new page with both text blocks and a table in a single call using `roam_create_page`.
282
+
283
+ ```
284
+ "Create a new Roam page titled 'Product Comparison' with:
285
+ - A heading 'Overview'
286
+ - An introduction paragraph explaining the comparison
287
+ - A comparison table with columns: Feature, Plan A, Plan B
288
+ - Rows: Price ($10, $20), Storage (10GB, 50GB), Support (Email, 24/7)
289
+ - A conclusion section"
290
+ ```
291
+
241
292
  ---
242
293
 
243
294
  ## Setup
@@ -260,7 +311,6 @@ This demonstrates moving a block from one location to another and simultaneously
260
311
  MEMORIES_TAG='#[[LLM/Memories]]'
261
312
  CUSTOM_INSTRUCTIONS_PATH='/path/to/your/custom_instructions_file.md'
262
313
  HTTP_STREAM_PORT=8088 # Or your desired port for HTTP Stream communication
263
- SSE_PORT=8087 # Or your desired port for SSE communication
264
314
  ```
265
315
 
266
316
  Option 2: Using MCP settings (Alternative method)
@@ -280,8 +330,7 @@ This demonstrates moving a block from one location to another and simultaneously
280
330
  "ROAM_GRAPH_NAME": "your-graph-name",
281
331
  "MEMORIES_TAG": "#[[LLM/Memories]]",
282
332
  "CUSTOM_INSTRUCTIONS_PATH": "/path/to/your/custom_instructions_file.md",
283
- "HTTP_STREAM_PORT": "8088",
284
- "SSE_PORT": "8087"
333
+ "HTTP_STREAM_PORT": "8088"
285
334
  }
286
335
  }
287
336
  }