roam-research-mcp 0.2.0

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.
@@ -0,0 +1,147 @@
1
+ // Tool definitions and input schemas for Roam Research MCP server
2
+ export const toolSchemas = {
3
+ roam_add_todo: {
4
+ name: 'roam_add_todo',
5
+ description: 'Add a list of todo items as individual blocks to today\'s daily page in Roam. Each item becomes its own actionable block with todo status.',
6
+ inputSchema: {
7
+ type: 'object',
8
+ properties: {
9
+ todos: {
10
+ type: 'array',
11
+ items: {
12
+ type: 'string',
13
+ description: 'Todo item text'
14
+ },
15
+ description: 'List of todo items to add'
16
+ }
17
+ },
18
+ required: ['todos'],
19
+ },
20
+ },
21
+ roam_fetch_page_by_title: {
22
+ name: 'roam_fetch_page_by_title',
23
+ description: 'Retrieve complete page contents by exact title, including all nested blocks and resolved block references. Use for reading and analyzing existing Roam pages.',
24
+ inputSchema: {
25
+ type: 'object',
26
+ properties: {
27
+ title: {
28
+ type: 'string',
29
+ description: 'Title of the page to fetch and read',
30
+ },
31
+ },
32
+ required: ['title'],
33
+ },
34
+ },
35
+ roam_create_page: {
36
+ name: 'roam_create_page',
37
+ description: 'Create a new standalone page in Roam from markdown with given title. Best for hierarchical content, reference materials, markdown tables, and topics that deserve their own namespace. Optional initial content will be properly nested as blocks.',
38
+ inputSchema: {
39
+ type: 'object',
40
+ properties: {
41
+ title: {
42
+ type: 'string',
43
+ description: 'Title of the new page',
44
+ },
45
+ content: {
46
+ type: 'string',
47
+ description: 'Initial content for the page (optional)',
48
+ },
49
+ },
50
+ required: ['title'],
51
+ },
52
+ },
53
+ roam_create_block: {
54
+ name: 'roam_create_block',
55
+ description: 'Add a new block to an existing Roam page. If no page specified, adds to today\'s daily note. Best for capturing immediate thoughts, additions to discussions, or content that doesn\'t warrant its own page. Can specify page by title or UID.',
56
+ inputSchema: {
57
+ type: 'object',
58
+ properties: {
59
+ content: {
60
+ type: 'string',
61
+ description: 'Content of the block',
62
+ },
63
+ page_uid: {
64
+ type: 'string',
65
+ description: 'Optional: UID of the page to add block to',
66
+ },
67
+ title: {
68
+ type: 'string',
69
+ description: 'Optional: Title of the page to add block to (defaults to today\'s date if neither page_uid nor title provided)',
70
+ },
71
+ },
72
+ required: ['content'],
73
+ },
74
+ },
75
+ roam_create_outline: {
76
+ name: 'roam_create_outline',
77
+ description: 'Create a structured outline in Roam from an array of outline items with explicit levels. Can be added under a specific page or block.',
78
+ inputSchema: {
79
+ type: 'object',
80
+ properties: {
81
+ page_title_uid: {
82
+ type: 'string',
83
+ description: 'Title (or UID if known) of the page. Leave blank to use the default daily page'
84
+ },
85
+ block_text_uid: {
86
+ type: 'string',
87
+ description: 'A relevant title heading for the outline (or UID, if known) of the block under which outline content will be nested. If blank, content will be nested under the page title.'
88
+ },
89
+ outline: {
90
+ type: 'array',
91
+ description: 'Array of outline items with block text and level',
92
+ items: {
93
+ type: 'object',
94
+ properties: {
95
+ text: {
96
+ type: 'string',
97
+ description: 'Content of the block'
98
+ },
99
+ level: {
100
+ type: 'integer',
101
+ description: 'Indentation level (1-5, where 1 is top level)'
102
+ }
103
+ },
104
+ required: ['text', 'level']
105
+ }
106
+ }
107
+ },
108
+ required: ['outline']
109
+ }
110
+ },
111
+ roam_import_markdown: {
112
+ name: 'roam_import_markdown',
113
+ description: 'Import nested markdown content into Roam under a specific block. Can locate the parent block by UID or by exact string match within a specific page.',
114
+ inputSchema: {
115
+ type: 'object',
116
+ properties: {
117
+ content: {
118
+ type: 'string',
119
+ description: 'Nested markdown content to import'
120
+ },
121
+ page_uid: {
122
+ type: 'string',
123
+ description: 'Optional: UID of the page containing the parent block'
124
+ },
125
+ page_title: {
126
+ type: 'string',
127
+ description: 'Optional: Title of the page containing the parent block (ignored if page_uid provided)'
128
+ },
129
+ parent_uid: {
130
+ type: 'string',
131
+ description: 'Optional: UID of the parent block to add content under'
132
+ },
133
+ parent_string: {
134
+ type: 'string',
135
+ description: 'Optional: Exact string content of the parent block to add content under (must provide either page_uid or page_title)'
136
+ },
137
+ order: {
138
+ type: 'string',
139
+ description: 'Optional: Where to add the content under the parent ("first" or "last")',
140
+ enum: ['first', 'last'],
141
+ default: 'first'
142
+ }
143
+ },
144
+ required: ['content']
145
+ }
146
+ },
147
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ // Helper function to get ordinal suffix for numbers (1st, 2nd, 3rd, etc.)
2
+ export function getOrdinalSuffix(n) {
3
+ const j = n % 10;
4
+ const k = n % 100;
5
+ if (j === 1 && k !== 11)
6
+ return "st";
7
+ if (j === 2 && k !== 12)
8
+ return "nd";
9
+ if (j === 3 && k !== 13)
10
+ return "rd";
11
+ return "th";
12
+ }
13
+ // Format date in Roam's preferred format (e.g., "January 1st, 2024")
14
+ export function formatRoamDate(date) {
15
+ const month = date.toLocaleDateString('en-US', { month: 'long' });
16
+ const day = date.getDate();
17
+ const year = date.getFullYear();
18
+ return `${month} ${day}${getOrdinalSuffix(day)}, ${year}`;
19
+ }
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "roam-research-mcp",
3
+ "version": "0.2.0",
4
+ "description": "A Model Context Protocol (MCP) server for Roam Research API integration",
5
+ "private": false,
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/2b3pro/roam-research-mcp.git"
9
+ },
10
+ "keywords": [
11
+ "mcp",
12
+ "roam-research",
13
+ "api",
14
+ "claude",
15
+ "model-context-protocol"
16
+ ],
17
+ "author": "Ian Shen / 2B3 PRODUCTIONS LLC",
18
+ "license": "MIT",
19
+ "bugs": {
20
+ "url": "https://github.com/2b3pro/roam-research-mcp/issues"
21
+ },
22
+ "homepage": "https://github.com/2b3pro/roam-research-mcp#readme",
23
+ "type": "module",
24
+ "bin": {
25
+ "roam-research": "./build/index.js"
26
+ },
27
+ "files": [
28
+ "build"
29
+ ],
30
+ "scripts": {
31
+ "build": "tsc && chmod 755 build/index.js",
32
+ "prepare": "npm run build",
33
+ "watch": "tsc --watch",
34
+ "inspector": "npx @modelcontextprotocol/inspector build/index.js"
35
+ },
36
+ "dependencies": {
37
+ "@modelcontextprotocol/sdk": "0.6.0",
38
+ "@roam-research/roam-api-sdk": "^0.10.0",
39
+ "dotenv": "^16.4.7"
40
+ },
41
+ "devDependencies": {
42
+ "@types/node": "^20.11.24",
43
+ "ts-node": "^10.9.2",
44
+ "typescript": "^5.3.3"
45
+ }
46
+ }