roam-research-mcp 1.0.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 +84 -17
- package/build/Roam_Markdown_Cheatsheet.md +519 -175
- package/build/cache/page-uid-cache.js +55 -0
- package/build/cli/import-markdown.js +98 -0
- package/build/config/environment.js +4 -2
- package/build/markdown-utils.js +51 -5
- package/build/server/roam-server.js +69 -10
- package/build/shared/errors.js +84 -0
- package/build/shared/index.js +5 -0
- package/build/shared/validation.js +268 -0
- package/build/tools/operations/batch.js +165 -3
- package/build/tools/operations/memory.js +29 -19
- package/build/tools/operations/outline.js +110 -70
- package/build/tools/operations/pages.js +159 -60
- package/build/tools/operations/table.js +142 -0
- package/build/tools/schemas.js +87 -9
- package/build/tools/tool-handlers.js +8 -2
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -83,6 +83,59 @@ Alternatively, if you have a `.env` file in the project root (which is copied in
|
|
|
83
83
|
docker run -p 3000:3000 -p 8088:8088 --env-file .env roam-research-mcp
|
|
84
84
|
```
|
|
85
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
|
+
|
|
86
139
|
## To Test
|
|
87
140
|
|
|
88
141
|
Run [MCP Inspector](https://github.com/modelcontextprotocol/inspector) after build using the provided npm script:
|
|
@@ -109,22 +162,23 @@ The server provides powerful tools for interacting with Roam Research:
|
|
|
109
162
|
|
|
110
163
|
1. `roam_fetch_page_by_title`: Fetch page content by title. Returns content in the specified format.
|
|
111
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.
|
|
112
|
-
3. `roam_create_page`: Create new pages with optional content and headings. Now
|
|
113
|
-
4. `
|
|
114
|
-
5. `
|
|
115
|
-
6. `
|
|
116
|
-
7. `
|
|
117
|
-
8. `
|
|
118
|
-
9. `
|
|
119
|
-
10. `
|
|
120
|
-
11. `
|
|
121
|
-
12. `
|
|
122
|
-
13. `
|
|
123
|
-
14. `
|
|
124
|
-
15. `
|
|
125
|
-
16. `
|
|
126
|
-
17. `
|
|
127
|
-
18. `
|
|
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`.)
|
|
128
182
|
|
|
129
183
|
**Deprecated Tools**:
|
|
130
184
|
The following tools have been deprecated as of `v0.36.2` in favor of the more powerful and flexible `roam_process_batch_actions`:
|
|
@@ -216,12 +270,25 @@ This demonstrates moving a block from one location to another and simultaneously
|
|
|
216
270
|
|
|
217
271
|
### Example 4: Making a Table
|
|
218
272
|
|
|
219
|
-
This demonstrates
|
|
273
|
+
This demonstrates creating a standalone table on a page.
|
|
220
274
|
|
|
221
275
|
```
|
|
222
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."
|
|
223
277
|
```
|
|
224
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
|
+
|
|
225
292
|
---
|
|
226
293
|
|
|
227
294
|
## Setup
|