@node2flow/notion-mcp 1.0.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.
- package/LICENSE +21 -0
- package/README.md +110 -0
- package/dist/client.d.ts +99 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +196 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +170 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +11 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +118 -0
- package/dist/server.js.map +1 -0
- package/dist/tools.d.ts +7 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +326 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +113 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/worker.d.ts +10 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +70 -0
- package/dist/worker.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,EAAE,YAAY,oBAgFrB;AAED,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,eAAe,aA8CpD"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared MCP Server — used by both Node.js (index.ts) and CF Worker (worker.ts)
|
|
3
|
+
*/
|
|
4
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
+
import { NotionClient } from './client.js';
|
|
6
|
+
import { TOOLS } from './tools.js';
|
|
7
|
+
export function handleToolCall(toolName, args, client) {
|
|
8
|
+
switch (toolName) {
|
|
9
|
+
// ========== Search ==========
|
|
10
|
+
case 'notion_search':
|
|
11
|
+
return client.search(args);
|
|
12
|
+
// ========== Pages ==========
|
|
13
|
+
case 'notion_create_page':
|
|
14
|
+
return client.createPage(args);
|
|
15
|
+
case 'notion_get_page':
|
|
16
|
+
return client.getPage(args.page_id);
|
|
17
|
+
case 'notion_update_page':
|
|
18
|
+
return client.updatePage(args.page_id, args);
|
|
19
|
+
case 'notion_move_page':
|
|
20
|
+
return client.movePage(args.page_id, args.new_parent);
|
|
21
|
+
case 'notion_get_page_property':
|
|
22
|
+
return client.getPageProperty(args.page_id, args.property_id, args);
|
|
23
|
+
// ========== Blocks ==========
|
|
24
|
+
case 'notion_get_block':
|
|
25
|
+
return client.getBlock(args.block_id);
|
|
26
|
+
case 'notion_get_block_children':
|
|
27
|
+
return client.getBlockChildren(args.block_id, args);
|
|
28
|
+
case 'notion_append_blocks':
|
|
29
|
+
return client.appendBlocks(args.block_id, args.children);
|
|
30
|
+
case 'notion_update_block':
|
|
31
|
+
return client.updateBlock(args.block_id, args.data);
|
|
32
|
+
case 'notion_delete_block':
|
|
33
|
+
return client.deleteBlock(args.block_id);
|
|
34
|
+
// ========== Data Sources ==========
|
|
35
|
+
case 'notion_create_data_source':
|
|
36
|
+
return client.createDataSource(args.database_id, {
|
|
37
|
+
title: args.title,
|
|
38
|
+
properties: args.properties,
|
|
39
|
+
});
|
|
40
|
+
case 'notion_get_data_source':
|
|
41
|
+
return client.getDataSource(args.data_source_id);
|
|
42
|
+
case 'notion_update_data_source':
|
|
43
|
+
return client.updateDataSource(args.data_source_id, {
|
|
44
|
+
title: args.title,
|
|
45
|
+
properties: args.properties,
|
|
46
|
+
});
|
|
47
|
+
case 'notion_query_data_source':
|
|
48
|
+
return client.queryDataSource(args.data_source_id, args);
|
|
49
|
+
case 'notion_list_data_source_templates':
|
|
50
|
+
return client.listDataSourceTemplates(args.data_source_id, args);
|
|
51
|
+
// ========== Databases (legacy) ==========
|
|
52
|
+
case 'notion_get_database':
|
|
53
|
+
return client.getDatabase(args.database_id);
|
|
54
|
+
case 'notion_query_database':
|
|
55
|
+
return client.queryDatabase(args.database_id, args);
|
|
56
|
+
case 'notion_create_database':
|
|
57
|
+
return client.createDatabase(args);
|
|
58
|
+
// ========== Comments ==========
|
|
59
|
+
case 'notion_create_comment': {
|
|
60
|
+
const commentParams = { rich_text: args.rich_text };
|
|
61
|
+
if (args.parent_page_id)
|
|
62
|
+
commentParams.parent = { page_id: args.parent_page_id };
|
|
63
|
+
if (args.discussion_id)
|
|
64
|
+
commentParams.discussion_id = args.discussion_id;
|
|
65
|
+
return client.createComment(commentParams);
|
|
66
|
+
}
|
|
67
|
+
case 'notion_get_comments':
|
|
68
|
+
return client.getComments(args.block_id, args);
|
|
69
|
+
case 'notion_get_comment':
|
|
70
|
+
return client.getComment(args.comment_id);
|
|
71
|
+
// ========== Users ==========
|
|
72
|
+
case 'notion_list_users':
|
|
73
|
+
return client.listUsers(args);
|
|
74
|
+
case 'notion_get_user':
|
|
75
|
+
return client.getUser(args.user_id);
|
|
76
|
+
case 'notion_get_bot_user':
|
|
77
|
+
return client.getBotUser();
|
|
78
|
+
default:
|
|
79
|
+
throw new Error(`Unknown tool: ${toolName}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export function createServer(config) {
|
|
83
|
+
const server = new McpServer({
|
|
84
|
+
name: 'notion-mcp',
|
|
85
|
+
version: '1.0.0',
|
|
86
|
+
});
|
|
87
|
+
let client = null;
|
|
88
|
+
for (const tool of TOOLS) {
|
|
89
|
+
server.tool(tool.name, tool.description, tool.inputSchema, async (args) => {
|
|
90
|
+
const apiKey = config?.apiKey ||
|
|
91
|
+
args.NOTION_API_KEY;
|
|
92
|
+
if (!apiKey) {
|
|
93
|
+
return {
|
|
94
|
+
content: [{ type: 'text', text: 'Error: NOTION_API_KEY is required' }],
|
|
95
|
+
isError: true,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
if (!client || config?.apiKey !== apiKey) {
|
|
99
|
+
client = new NotionClient({ apiKey });
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
const result = await handleToolCall(tool.name, args, client);
|
|
103
|
+
return {
|
|
104
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
105
|
+
isError: false,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
return {
|
|
110
|
+
content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }],
|
|
111
|
+
isError: true,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return server;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAMnC,MAAM,UAAU,cAAc,CAC5B,QAAgB,EAChB,IAA6B,EAC7B,MAAoB;IAEpB,QAAQ,QAAQ,EAAE,CAAC;QACjB,+BAA+B;QAC/B,KAAK,eAAe;YAClB,OAAO,MAAM,CAAC,MAAM,CAAC,IAAW,CAAC,CAAC;QAEpC,8BAA8B;QAC9B,KAAK,oBAAoB;YACvB,OAAO,MAAM,CAAC,UAAU,CAAC,IAAW,CAAC,CAAC;QACxC,KAAK,iBAAiB;YACpB,OAAO,MAAM,C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,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;oBAC3E,OAAO,EAAE,KAAK;iBACf,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;oBAC9G,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,eAAO,MAAM,KAAK,EAAE,iBAAiB,EAsUpC,CAAC"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notion MCP Tool Definitions (25 tools)
|
|
3
|
+
* All prefixed with notion_
|
|
4
|
+
*/
|
|
5
|
+
export const TOOLS = [
|
|
6
|
+
// ========== Search (1) ==========
|
|
7
|
+
{
|
|
8
|
+
name: 'notion_search',
|
|
9
|
+
description: 'Search pages and databases in your Notion workspace by title. Filter by object type and sort by last edited time.',
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
query: { type: 'string', description: 'Search text to match against titles' },
|
|
14
|
+
filter_object: { type: 'string', enum: ['page', 'database'], description: 'Limit results to pages or databases only' },
|
|
15
|
+
sort_direction: { type: 'string', enum: ['ascending', 'descending'], description: 'Sort by last_edited_time' },
|
|
16
|
+
start_cursor: { type: 'string', description: 'Pagination cursor from previous response' },
|
|
17
|
+
page_size: { type: 'number', description: 'Results per page (max 100)' },
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
// ========== Pages (5) ==========
|
|
22
|
+
{
|
|
23
|
+
name: 'notion_create_page',
|
|
24
|
+
description: 'Create a new page in Notion. Set parent as a data source (data_source_id) or another page (page_id). Provide properties matching the parent schema. Optionally include initial content blocks.',
|
|
25
|
+
inputSchema: {
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
parent: { type: 'object', description: 'Parent: { "data_source_id": "..." } for database pages, or { "page_id": "..." } for sub-pages' },
|
|
29
|
+
properties: { type: 'object', description: 'Page properties. For title: { "Name": { "title": [{ "text": { "content": "..." } }] } }' },
|
|
30
|
+
children: { type: 'array', description: 'Initial content blocks (optional)' },
|
|
31
|
+
icon: { type: 'object', description: 'Page icon: { "type": "emoji", "emoji": "..." }' },
|
|
32
|
+
cover: { type: 'object', description: 'Cover image: { "type": "external", "external": { "url": "..." } }' },
|
|
33
|
+
},
|
|
34
|
+
required: ['parent', 'properties'],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'notion_get_page',
|
|
39
|
+
description: 'Retrieve a Notion page by ID. Returns properties, parent, timestamps, and URL. Use notion_get_block_children to read the page content.',
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {
|
|
43
|
+
page_id: { type: 'string', description: 'Page ID (UUID, with or without dashes)' },
|
|
44
|
+
},
|
|
45
|
+
required: ['page_id'],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'notion_update_page',
|
|
50
|
+
description: 'Update a Notion page. Change properties, icon, cover, or archive/trash status. Use block tools to update page content.',
|
|
51
|
+
inputSchema: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
properties: {
|
|
54
|
+
page_id: { type: 'string', description: 'Page ID to update' },
|
|
55
|
+
properties: { type: 'object', description: 'Updated properties' },
|
|
56
|
+
icon: { type: 'object', description: 'New page icon' },
|
|
57
|
+
cover: { type: 'object', description: 'New cover image' },
|
|
58
|
+
archived: { type: 'boolean', description: 'Set true to archive' },
|
|
59
|
+
in_trash: { type: 'boolean', description: 'Set true to move to trash' },
|
|
60
|
+
},
|
|
61
|
+
required: ['page_id'],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'notion_move_page',
|
|
66
|
+
description: 'Move a page to a new parent page or data source.',
|
|
67
|
+
inputSchema: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
properties: {
|
|
70
|
+
page_id: { type: 'string', description: 'Page ID to move' },
|
|
71
|
+
new_parent: { type: 'object', description: 'New parent: { "page_id": "..." } or { "data_source_id": "..." }' },
|
|
72
|
+
},
|
|
73
|
+
required: ['page_id', 'new_parent'],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'notion_get_page_property',
|
|
78
|
+
description: 'Retrieve a specific property value from a page. Useful for paginated properties like relations or rollups.',
|
|
79
|
+
inputSchema: {
|
|
80
|
+
type: 'object',
|
|
81
|
+
properties: {
|
|
82
|
+
page_id: { type: 'string', description: 'Page ID' },
|
|
83
|
+
property_id: { type: 'string', description: 'Property ID (from page properties response)' },
|
|
84
|
+
start_cursor: { type: 'string', description: 'Pagination cursor' },
|
|
85
|
+
page_size: { type: 'number', description: 'Items per page' },
|
|
86
|
+
},
|
|
87
|
+
required: ['page_id', 'property_id'],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
// ========== Blocks (5) ==========
|
|
91
|
+
{
|
|
92
|
+
name: 'notion_get_block',
|
|
93
|
+
description: 'Retrieve a single block by ID. Returns block type, content, and whether it has children.',
|
|
94
|
+
inputSchema: {
|
|
95
|
+
type: 'object',
|
|
96
|
+
properties: {
|
|
97
|
+
block_id: { type: 'string', description: 'Block ID (a page ID also works)' },
|
|
98
|
+
},
|
|
99
|
+
required: ['block_id'],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'notion_get_block_children',
|
|
104
|
+
description: 'Get child blocks of a page or block. This is how you read page content. Returns a paginated list of blocks.',
|
|
105
|
+
inputSchema: {
|
|
106
|
+
type: 'object',
|
|
107
|
+
properties: {
|
|
108
|
+
block_id: { type: 'string', description: 'Block or page ID' },
|
|
109
|
+
start_cursor: { type: 'string', description: 'Pagination cursor' },
|
|
110
|
+
page_size: { type: 'number', description: 'Blocks per page (max 100)' },
|
|
111
|
+
},
|
|
112
|
+
required: ['block_id'],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'notion_append_blocks',
|
|
117
|
+
description: 'Append content blocks to a page or block. Max 100 blocks, 2 levels of nesting. Common types: paragraph, heading_1/2/3, bulleted_list_item, numbered_list_item, to_do, code, quote, callout, divider, table.',
|
|
118
|
+
inputSchema: {
|
|
119
|
+
type: 'object',
|
|
120
|
+
properties: {
|
|
121
|
+
block_id: { type: 'string', description: 'Page or block ID to append to' },
|
|
122
|
+
children: { type: 'array', description: 'Block objects. Example: { "type": "paragraph", "paragraph": { "rich_text": [{ "type": "text", "text": { "content": "Hello" } }] } }' },
|
|
123
|
+
},
|
|
124
|
+
required: ['block_id', 'children'],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: 'notion_update_block',
|
|
129
|
+
description: 'Update a block\'s content. Send the block type key with updated data, e.g. { "paragraph": { "rich_text": [...] } }.',
|
|
130
|
+
inputSchema: {
|
|
131
|
+
type: 'object',
|
|
132
|
+
properties: {
|
|
133
|
+
block_id: { type: 'string', description: 'Block ID to update' },
|
|
134
|
+
data: { type: 'object', description: 'Block type key with content: { "paragraph": { "rich_text": [...] } }' },
|
|
135
|
+
},
|
|
136
|
+
required: ['block_id', 'data'],
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: 'notion_delete_block',
|
|
141
|
+
description: 'Delete (archive) a block. The block is moved to trash.',
|
|
142
|
+
inputSchema: {
|
|
143
|
+
type: 'object',
|
|
144
|
+
properties: {
|
|
145
|
+
block_id: { type: 'string', description: 'Block ID to delete' },
|
|
146
|
+
},
|
|
147
|
+
required: ['block_id'],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
// ========== Data Sources - 2025-09-03 (5) ==========
|
|
151
|
+
{
|
|
152
|
+
name: 'notion_create_data_source',
|
|
153
|
+
description: 'Create a new data source (table) under an existing database. Data sources are individual tables within a database (API 2025-09-03).',
|
|
154
|
+
inputSchema: {
|
|
155
|
+
type: 'object',
|
|
156
|
+
properties: {
|
|
157
|
+
database_id: { type: 'string', description: 'Parent database ID' },
|
|
158
|
+
title: { type: 'array', description: 'Title as rich text: [{ "type": "text", "text": { "content": "My Table" } }]' },
|
|
159
|
+
properties: { type: 'object', description: 'Property schema definitions' },
|
|
160
|
+
},
|
|
161
|
+
required: ['database_id'],
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: 'notion_get_data_source',
|
|
166
|
+
description: 'Retrieve a data source by ID. Returns title, property schema, and timestamps.',
|
|
167
|
+
inputSchema: {
|
|
168
|
+
type: 'object',
|
|
169
|
+
properties: {
|
|
170
|
+
data_source_id: { type: 'string', description: 'Data source ID' },
|
|
171
|
+
},
|
|
172
|
+
required: ['data_source_id'],
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'notion_update_data_source',
|
|
177
|
+
description: 'Update a data source title or property schema.',
|
|
178
|
+
inputSchema: {
|
|
179
|
+
type: 'object',
|
|
180
|
+
properties: {
|
|
181
|
+
data_source_id: { type: 'string', description: 'Data source ID' },
|
|
182
|
+
title: { type: 'array', description: 'New title as rich text' },
|
|
183
|
+
properties: { type: 'object', description: 'Updated property schema' },
|
|
184
|
+
},
|
|
185
|
+
required: ['data_source_id'],
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: 'notion_query_data_source',
|
|
190
|
+
description: 'Query pages in a data source with filters and sorts. For new API (2025-09-03). For legacy databases use notion_query_database.',
|
|
191
|
+
inputSchema: {
|
|
192
|
+
type: 'object',
|
|
193
|
+
properties: {
|
|
194
|
+
data_source_id: { type: 'string', description: 'Data source ID to query' },
|
|
195
|
+
filter: { type: 'object', description: 'Filter: { "property": "Status", "select": { "equals": "Done" } }' },
|
|
196
|
+
sorts: { type: 'array', description: 'Sorts: [{ "property": "Created", "direction": "descending" }]' },
|
|
197
|
+
start_cursor: { type: 'string', description: 'Pagination cursor' },
|
|
198
|
+
page_size: { type: 'number', description: 'Results per page (max 100)' },
|
|
199
|
+
},
|
|
200
|
+
required: ['data_source_id'],
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: 'notion_list_data_source_templates',
|
|
205
|
+
description: 'List page templates available in a data source.',
|
|
206
|
+
inputSchema: {
|
|
207
|
+
type: 'object',
|
|
208
|
+
properties: {
|
|
209
|
+
data_source_id: { type: 'string', description: 'Data source ID' },
|
|
210
|
+
start_cursor: { type: 'string', description: 'Pagination cursor' },
|
|
211
|
+
page_size: { type: 'number', description: 'Results per page' },
|
|
212
|
+
},
|
|
213
|
+
required: ['data_source_id'],
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
// ========== Databases - Legacy (3) ==========
|
|
217
|
+
{
|
|
218
|
+
name: 'notion_get_database',
|
|
219
|
+
description: 'Get a database by ID (legacy endpoint). Returns schema with properties and title. For new integrations prefer data source endpoints.',
|
|
220
|
+
inputSchema: {
|
|
221
|
+
type: 'object',
|
|
222
|
+
properties: {
|
|
223
|
+
database_id: { type: 'string', description: 'Database ID' },
|
|
224
|
+
},
|
|
225
|
+
required: ['database_id'],
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
name: 'notion_query_database',
|
|
230
|
+
description: 'Query a database with filters and sorts (legacy endpoint). For new integrations prefer notion_query_data_source.',
|
|
231
|
+
inputSchema: {
|
|
232
|
+
type: 'object',
|
|
233
|
+
properties: {
|
|
234
|
+
database_id: { type: 'string', description: 'Database ID to query' },
|
|
235
|
+
filter: { type: 'object', description: 'Filter object (Notion filter syntax)' },
|
|
236
|
+
sorts: { type: 'array', description: 'Sort criteria array' },
|
|
237
|
+
start_cursor: { type: 'string', description: 'Pagination cursor' },
|
|
238
|
+
page_size: { type: 'number', description: 'Results per page (max 100)' },
|
|
239
|
+
},
|
|
240
|
+
required: ['database_id'],
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: 'notion_create_database',
|
|
245
|
+
description: 'Create a new inline database inside a page (legacy). Must include at least one title property in the schema.',
|
|
246
|
+
inputSchema: {
|
|
247
|
+
type: 'object',
|
|
248
|
+
properties: {
|
|
249
|
+
parent: { type: 'object', description: 'Parent page: { "type": "page_id", "page_id": "..." }' },
|
|
250
|
+
title: { type: 'array', description: 'Database title as rich text' },
|
|
251
|
+
properties: { type: 'object', description: 'Property schema. Must include a title property.' },
|
|
252
|
+
},
|
|
253
|
+
required: ['parent', 'title', 'properties'],
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
// ========== Comments (3) ==========
|
|
257
|
+
{
|
|
258
|
+
name: 'notion_create_comment',
|
|
259
|
+
description: 'Create a comment on a page or reply in a discussion thread. Integration must have comment capabilities enabled.',
|
|
260
|
+
inputSchema: {
|
|
261
|
+
type: 'object',
|
|
262
|
+
properties: {
|
|
263
|
+
parent_page_id: { type: 'string', description: 'Page ID to comment on (use this OR discussion_id)' },
|
|
264
|
+
discussion_id: { type: 'string', description: 'Discussion thread ID to reply to' },
|
|
265
|
+
rich_text: { type: 'array', description: 'Comment content: [{ "type": "text", "text": { "content": "My comment" } }]' },
|
|
266
|
+
},
|
|
267
|
+
required: ['rich_text'],
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
name: 'notion_get_comments',
|
|
272
|
+
description: 'List unresolved comments on a page or block.',
|
|
273
|
+
inputSchema: {
|
|
274
|
+
type: 'object',
|
|
275
|
+
properties: {
|
|
276
|
+
block_id: { type: 'string', description: 'Page or block ID' },
|
|
277
|
+
start_cursor: { type: 'string', description: 'Pagination cursor' },
|
|
278
|
+
page_size: { type: 'number', description: 'Comments per page' },
|
|
279
|
+
},
|
|
280
|
+
required: ['block_id'],
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
name: 'notion_get_comment',
|
|
285
|
+
description: 'Retrieve a single comment by ID.',
|
|
286
|
+
inputSchema: {
|
|
287
|
+
type: 'object',
|
|
288
|
+
properties: {
|
|
289
|
+
comment_id: { type: 'string', description: 'Comment ID' },
|
|
290
|
+
},
|
|
291
|
+
required: ['comment_id'],
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
// ========== Users (3) ==========
|
|
295
|
+
{
|
|
296
|
+
name: 'notion_list_users',
|
|
297
|
+
description: 'List all users in the workspace. Returns names, types (person/bot), and avatars.',
|
|
298
|
+
inputSchema: {
|
|
299
|
+
type: 'object',
|
|
300
|
+
properties: {
|
|
301
|
+
start_cursor: { type: 'string', description: 'Pagination cursor' },
|
|
302
|
+
page_size: { type: 'number', description: 'Users per page' },
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
name: 'notion_get_user',
|
|
308
|
+
description: 'Get a user by ID.',
|
|
309
|
+
inputSchema: {
|
|
310
|
+
type: 'object',
|
|
311
|
+
properties: {
|
|
312
|
+
user_id: { type: 'string', description: 'User ID' },
|
|
313
|
+
},
|
|
314
|
+
required: ['user_id'],
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: 'notion_get_bot_user',
|
|
319
|
+
description: 'Get the bot user info for this integration. Useful for checking identity and permissions.',
|
|
320
|
+
inputSchema: {
|
|
321
|
+
type: 'object',
|
|
322
|
+
properties: {},
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
];
|
|
326
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,CAAC,MAAM,KAAK,GAAwB;IACxC,mCAAmC;IACnC;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,mHAAmH;QAChI,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qCAAqC,EAAE;gBAC7E,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,WAAW,EAAE,0CAA0C,EAAE;gBACtH,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,WAAW,EAAE,0BAA0B,EAAE;gBAC9G,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0CAA0C,EAAE;gBACzF,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;aACzE;SACF;KACF;IAED,kCAAkC;IAClC;QACE,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EAAE,gMAAgM;QAC7M,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+FAA+F,EAAE;gBACxI,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,yFAAyF,EAAE;gBACt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ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notion MCP Plugin - Type Definitions
|
|
3
|
+
* API Version: 2025-09-03
|
|
4
|
+
*/
|
|
5
|
+
export interface NotionConfig {
|
|
6
|
+
apiKey: string;
|
|
7
|
+
}
|
|
8
|
+
export interface RichText {
|
|
9
|
+
type: 'text' | 'mention' | 'equation';
|
|
10
|
+
text?: {
|
|
11
|
+
content: string;
|
|
12
|
+
link?: {
|
|
13
|
+
url: string;
|
|
14
|
+
} | null;
|
|
15
|
+
};
|
|
16
|
+
annotations?: {
|
|
17
|
+
bold?: boolean;
|
|
18
|
+
italic?: boolean;
|
|
19
|
+
strikethrough?: boolean;
|
|
20
|
+
underline?: boolean;
|
|
21
|
+
code?: boolean;
|
|
22
|
+
color?: string;
|
|
23
|
+
};
|
|
24
|
+
plain_text?: string;
|
|
25
|
+
href?: string | null;
|
|
26
|
+
}
|
|
27
|
+
export interface NotionParent {
|
|
28
|
+
type: string;
|
|
29
|
+
database_id?: string;
|
|
30
|
+
data_source_id?: string;
|
|
31
|
+
page_id?: string;
|
|
32
|
+
workspace?: boolean;
|
|
33
|
+
block_id?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface NotionPage {
|
|
36
|
+
object: 'page';
|
|
37
|
+
id: string;
|
|
38
|
+
created_time: string;
|
|
39
|
+
last_edited_time: string;
|
|
40
|
+
archived: boolean;
|
|
41
|
+
in_trash: boolean;
|
|
42
|
+
parent: NotionParent;
|
|
43
|
+
properties: Record<string, unknown>;
|
|
44
|
+
icon?: unknown;
|
|
45
|
+
cover?: unknown;
|
|
46
|
+
url: string;
|
|
47
|
+
}
|
|
48
|
+
export interface NotionBlock {
|
|
49
|
+
object: 'block';
|
|
50
|
+
id: string;
|
|
51
|
+
type: string;
|
|
52
|
+
created_time: string;
|
|
53
|
+
last_edited_time: string;
|
|
54
|
+
archived: boolean;
|
|
55
|
+
in_trash: boolean;
|
|
56
|
+
has_children: boolean;
|
|
57
|
+
parent: NotionParent;
|
|
58
|
+
[key: string]: unknown;
|
|
59
|
+
}
|
|
60
|
+
export interface NotionDataSource {
|
|
61
|
+
object: 'data_source';
|
|
62
|
+
id: string;
|
|
63
|
+
title: RichText[];
|
|
64
|
+
properties: Record<string, unknown>;
|
|
65
|
+
created_time: string;
|
|
66
|
+
last_edited_time: string;
|
|
67
|
+
parent: {
|
|
68
|
+
type: 'database';
|
|
69
|
+
database_id: string;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export interface NotionDatabase {
|
|
73
|
+
object: 'database';
|
|
74
|
+
id: string;
|
|
75
|
+
title: RichText[];
|
|
76
|
+
properties: Record<string, unknown>;
|
|
77
|
+
created_time: string;
|
|
78
|
+
last_edited_time: string;
|
|
79
|
+
archived: boolean;
|
|
80
|
+
url: string;
|
|
81
|
+
}
|
|
82
|
+
export interface NotionComment {
|
|
83
|
+
object: 'comment';
|
|
84
|
+
id: string;
|
|
85
|
+
parent: NotionParent;
|
|
86
|
+
discussion_id: string;
|
|
87
|
+
rich_text: RichText[];
|
|
88
|
+
created_time: string;
|
|
89
|
+
created_by: {
|
|
90
|
+
object: string;
|
|
91
|
+
id: string;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export interface NotionUser {
|
|
95
|
+
object: 'user';
|
|
96
|
+
id: string;
|
|
97
|
+
type: 'person' | 'bot';
|
|
98
|
+
name: string;
|
|
99
|
+
avatar_url: string | null;
|
|
100
|
+
}
|
|
101
|
+
export interface NotionList<T> {
|
|
102
|
+
object: 'list';
|
|
103
|
+
results: T[];
|
|
104
|
+
next_cursor: string | null;
|
|
105
|
+
has_more: boolean;
|
|
106
|
+
type: string;
|
|
107
|
+
}
|
|
108
|
+
export interface MCPToolDefinition {
|
|
109
|
+
name: string;
|
|
110
|
+
description: string;
|
|
111
|
+
inputSchema: Record<string, unknown>;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|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AC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C;AAID,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,GAAG,KAAK,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAID,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAID,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
package/dist/worker.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare Worker entry — Stateless Streamable HTTP MCP
|
|
3
|
+
*
|
|
4
|
+
* Each request creates a new transport + server (CF Workers can't share memory between isolates).
|
|
5
|
+
*/
|
|
6
|
+
declare const _default: {
|
|
7
|
+
fetch(request: Request): Promise<Response>;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;mBA+BoB,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;;AADlD,wBAsDE"}
|