@universal-mcp-toolkit/server-notion 0.1.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/.well-known/mcp-server.json +49 -0
- package/LICENSE +21 -0
- package/dist/index.d.ts +294 -0
- package/dist/index.js +1050 -0
- package/package.json +53 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/json",
|
|
3
|
+
"name": "notion",
|
|
4
|
+
"title": "Notion MCP Server",
|
|
5
|
+
"description": "Search Notion pages, inspect page metadata and content, create pages, expose workspace context, and generate summary prompts.",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"packageName": "@universal-mcp-toolkit/server-notion",
|
|
8
|
+
"homepage": "https://github.com/universal-mcp-toolkit/universal-mcp-toolkit#readme",
|
|
9
|
+
"repositoryUrl": "https://github.com/universal-mcp-toolkit/universal-mcp-toolkit",
|
|
10
|
+
"documentationUrl": "https://developers.notion.com/reference/intro",
|
|
11
|
+
"transports": [
|
|
12
|
+
"stdio",
|
|
13
|
+
"sse"
|
|
14
|
+
],
|
|
15
|
+
"authentication": {
|
|
16
|
+
"mode": "environment-variables",
|
|
17
|
+
"required": [
|
|
18
|
+
"NOTION_TOKEN"
|
|
19
|
+
],
|
|
20
|
+
"optional": [
|
|
21
|
+
"NOTION_DEFAULT_PARENT_PAGE_ID",
|
|
22
|
+
"NOTION_WORKSPACE_NAME",
|
|
23
|
+
"NOTION_API_BASE_URL",
|
|
24
|
+
"NOTION_API_VERSION"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"capabilities": {
|
|
28
|
+
"tools": true,
|
|
29
|
+
"resources": true,
|
|
30
|
+
"prompts": true
|
|
31
|
+
},
|
|
32
|
+
"tools": [
|
|
33
|
+
"search-pages",
|
|
34
|
+
"get-page",
|
|
35
|
+
"create-page"
|
|
36
|
+
],
|
|
37
|
+
"resources": [
|
|
38
|
+
"workspace"
|
|
39
|
+
],
|
|
40
|
+
"prompts": [
|
|
41
|
+
"summarize-doc"
|
|
42
|
+
],
|
|
43
|
+
"tags": [
|
|
44
|
+
"notion",
|
|
45
|
+
"knowledge-base",
|
|
46
|
+
"documentation",
|
|
47
|
+
"wiki"
|
|
48
|
+
]
|
|
49
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 universal-mcp-toolkit
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import * as _universal_mcp_toolkit_core from '@universal-mcp-toolkit/core';
|
|
2
|
+
import { ToolkitServer, ToolkitServerMetadata } from '@universal-mcp-toolkit/core';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
declare const pageSummaryShape: {
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
title: z.ZodString;
|
|
8
|
+
url: z.ZodString;
|
|
9
|
+
publicUrl: z.ZodNullable<z.ZodString>;
|
|
10
|
+
createdTime: z.ZodString;
|
|
11
|
+
lastEditedTime: z.ZodString;
|
|
12
|
+
archived: z.ZodBoolean;
|
|
13
|
+
inTrash: z.ZodBoolean;
|
|
14
|
+
isLocked: z.ZodBoolean;
|
|
15
|
+
parent: z.ZodObject<{
|
|
16
|
+
type: z.ZodString;
|
|
17
|
+
pageId: z.ZodNullable<z.ZodString>;
|
|
18
|
+
databaseId: z.ZodNullable<z.ZodString>;
|
|
19
|
+
dataSourceId: z.ZodNullable<z.ZodString>;
|
|
20
|
+
workspace: z.ZodBoolean;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
};
|
|
23
|
+
declare const searchPagesInputSchema: z.ZodObject<{
|
|
24
|
+
query: z.ZodDefault<z.ZodString>;
|
|
25
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
26
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
27
|
+
sortDirection: z.ZodDefault<z.ZodEnum<{
|
|
28
|
+
ascending: "ascending";
|
|
29
|
+
descending: "descending";
|
|
30
|
+
}>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
declare const searchPagesOutputSchema: z.ZodObject<{
|
|
33
|
+
query: z.ZodString;
|
|
34
|
+
resultCount: z.ZodNumber;
|
|
35
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
36
|
+
hasMore: z.ZodBoolean;
|
|
37
|
+
results: z.ZodArray<z.ZodObject<{
|
|
38
|
+
id: z.ZodString;
|
|
39
|
+
title: z.ZodString;
|
|
40
|
+
url: z.ZodString;
|
|
41
|
+
publicUrl: z.ZodNullable<z.ZodString>;
|
|
42
|
+
createdTime: z.ZodString;
|
|
43
|
+
lastEditedTime: z.ZodString;
|
|
44
|
+
archived: z.ZodBoolean;
|
|
45
|
+
inTrash: z.ZodBoolean;
|
|
46
|
+
isLocked: z.ZodBoolean;
|
|
47
|
+
parent: z.ZodObject<{
|
|
48
|
+
type: z.ZodString;
|
|
49
|
+
pageId: z.ZodNullable<z.ZodString>;
|
|
50
|
+
databaseId: z.ZodNullable<z.ZodString>;
|
|
51
|
+
dataSourceId: z.ZodNullable<z.ZodString>;
|
|
52
|
+
workspace: z.ZodBoolean;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
declare const getPageInputSchema: z.ZodObject<{
|
|
57
|
+
pageId: z.ZodString;
|
|
58
|
+
includeContent: z.ZodDefault<z.ZodBoolean>;
|
|
59
|
+
contentLimit: z.ZodDefault<z.ZodNumber>;
|
|
60
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
declare const getPageOutputSchema: z.ZodObject<{
|
|
63
|
+
page: z.ZodObject<{
|
|
64
|
+
properties: z.ZodArray<z.ZodObject<{
|
|
65
|
+
name: z.ZodString;
|
|
66
|
+
type: z.ZodString;
|
|
67
|
+
valuePreview: z.ZodNullable<z.ZodString>;
|
|
68
|
+
}, z.core.$strip>>;
|
|
69
|
+
propertyCount: z.ZodNumber;
|
|
70
|
+
contentBlocks: z.ZodArray<z.ZodObject<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
type: z.ZodString;
|
|
73
|
+
text: z.ZodString;
|
|
74
|
+
hasChildren: z.ZodBoolean;
|
|
75
|
+
}, z.core.$strip>>;
|
|
76
|
+
contentPreview: z.ZodString;
|
|
77
|
+
hasMoreContent: z.ZodBoolean;
|
|
78
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
79
|
+
id: z.ZodString;
|
|
80
|
+
title: z.ZodString;
|
|
81
|
+
url: z.ZodString;
|
|
82
|
+
publicUrl: z.ZodNullable<z.ZodString>;
|
|
83
|
+
createdTime: z.ZodString;
|
|
84
|
+
lastEditedTime: z.ZodString;
|
|
85
|
+
archived: z.ZodBoolean;
|
|
86
|
+
inTrash: z.ZodBoolean;
|
|
87
|
+
isLocked: z.ZodBoolean;
|
|
88
|
+
parent: z.ZodObject<{
|
|
89
|
+
type: z.ZodString;
|
|
90
|
+
pageId: z.ZodNullable<z.ZodString>;
|
|
91
|
+
databaseId: z.ZodNullable<z.ZodString>;
|
|
92
|
+
dataSourceId: z.ZodNullable<z.ZodString>;
|
|
93
|
+
workspace: z.ZodBoolean;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
|
+
declare const createPageInputSchema: z.ZodObject<{
|
|
98
|
+
title: z.ZodString;
|
|
99
|
+
parentPageId: z.ZodOptional<z.ZodString>;
|
|
100
|
+
content: z.ZodOptional<z.ZodString>;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
declare const createPageOutputSchema: z.ZodObject<{
|
|
103
|
+
page: z.ZodObject<{
|
|
104
|
+
id: z.ZodString;
|
|
105
|
+
title: z.ZodString;
|
|
106
|
+
url: z.ZodString;
|
|
107
|
+
publicUrl: z.ZodNullable<z.ZodString>;
|
|
108
|
+
createdTime: z.ZodString;
|
|
109
|
+
lastEditedTime: z.ZodString;
|
|
110
|
+
archived: z.ZodBoolean;
|
|
111
|
+
inTrash: z.ZodBoolean;
|
|
112
|
+
isLocked: z.ZodBoolean;
|
|
113
|
+
parent: z.ZodObject<{
|
|
114
|
+
type: z.ZodString;
|
|
115
|
+
pageId: z.ZodNullable<z.ZodString>;
|
|
116
|
+
databaseId: z.ZodNullable<z.ZodString>;
|
|
117
|
+
dataSourceId: z.ZodNullable<z.ZodString>;
|
|
118
|
+
workspace: z.ZodBoolean;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
usedParentPageId: z.ZodString;
|
|
122
|
+
contentBlockCount: z.ZodNumber;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
declare const summarizeDocPromptArgsSchema: z.ZodObject<{
|
|
125
|
+
pageId: z.ZodString;
|
|
126
|
+
audience: z.ZodDefault<z.ZodString>;
|
|
127
|
+
focus: z.ZodDefault<z.ZodString>;
|
|
128
|
+
contentLimit: z.ZodDefault<z.ZodNumber>;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
declare const workspaceResourceSchema: z.ZodObject<{
|
|
131
|
+
workspaceName: z.ZodNullable<z.ZodString>;
|
|
132
|
+
integration: z.ZodObject<{
|
|
133
|
+
id: z.ZodString;
|
|
134
|
+
name: z.ZodNullable<z.ZodString>;
|
|
135
|
+
type: z.ZodEnum<{
|
|
136
|
+
bot: "bot";
|
|
137
|
+
person: "person";
|
|
138
|
+
}>;
|
|
139
|
+
avatarUrl: z.ZodNullable<z.ZodString>;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
apiBaseUrl: z.ZodString;
|
|
142
|
+
apiVersion: z.ZodString;
|
|
143
|
+
defaultParentPageId: z.ZodNullable<z.ZodString>;
|
|
144
|
+
recentPages: z.ZodArray<z.ZodObject<{
|
|
145
|
+
id: z.ZodString;
|
|
146
|
+
title: z.ZodString;
|
|
147
|
+
url: z.ZodString;
|
|
148
|
+
publicUrl: z.ZodNullable<z.ZodString>;
|
|
149
|
+
createdTime: z.ZodString;
|
|
150
|
+
lastEditedTime: z.ZodString;
|
|
151
|
+
archived: z.ZodBoolean;
|
|
152
|
+
inTrash: z.ZodBoolean;
|
|
153
|
+
isLocked: z.ZodBoolean;
|
|
154
|
+
parent: z.ZodObject<{
|
|
155
|
+
type: z.ZodString;
|
|
156
|
+
pageId: z.ZodNullable<z.ZodString>;
|
|
157
|
+
databaseId: z.ZodNullable<z.ZodString>;
|
|
158
|
+
dataSourceId: z.ZodNullable<z.ZodString>;
|
|
159
|
+
workspace: z.ZodBoolean;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
}, z.core.$strip>>;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
declare const pageDetailSchema: z.ZodObject<{
|
|
164
|
+
properties: z.ZodArray<z.ZodObject<{
|
|
165
|
+
name: z.ZodString;
|
|
166
|
+
type: z.ZodString;
|
|
167
|
+
valuePreview: z.ZodNullable<z.ZodString>;
|
|
168
|
+
}, z.core.$strip>>;
|
|
169
|
+
propertyCount: z.ZodNumber;
|
|
170
|
+
contentBlocks: z.ZodArray<z.ZodObject<{
|
|
171
|
+
id: z.ZodString;
|
|
172
|
+
type: z.ZodString;
|
|
173
|
+
text: z.ZodString;
|
|
174
|
+
hasChildren: z.ZodBoolean;
|
|
175
|
+
}, z.core.$strip>>;
|
|
176
|
+
contentPreview: z.ZodString;
|
|
177
|
+
hasMoreContent: z.ZodBoolean;
|
|
178
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
179
|
+
id: z.ZodString;
|
|
180
|
+
title: z.ZodString;
|
|
181
|
+
url: z.ZodString;
|
|
182
|
+
publicUrl: z.ZodNullable<z.ZodString>;
|
|
183
|
+
createdTime: z.ZodString;
|
|
184
|
+
lastEditedTime: z.ZodString;
|
|
185
|
+
archived: z.ZodBoolean;
|
|
186
|
+
inTrash: z.ZodBoolean;
|
|
187
|
+
isLocked: z.ZodBoolean;
|
|
188
|
+
parent: z.ZodObject<{
|
|
189
|
+
type: z.ZodString;
|
|
190
|
+
pageId: z.ZodNullable<z.ZodString>;
|
|
191
|
+
databaseId: z.ZodNullable<z.ZodString>;
|
|
192
|
+
dataSourceId: z.ZodNullable<z.ZodString>;
|
|
193
|
+
workspace: z.ZodBoolean;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
}, z.core.$strip>;
|
|
196
|
+
type SearchPagesInput = z.infer<typeof searchPagesInputSchema>;
|
|
197
|
+
type SearchPagesOutput = z.infer<typeof searchPagesOutputSchema>;
|
|
198
|
+
type GetPageInput = z.infer<typeof getPageInputSchema>;
|
|
199
|
+
type GetPageOutput = z.infer<typeof getPageOutputSchema>;
|
|
200
|
+
type CreatePageInput = z.infer<typeof createPageInputSchema>;
|
|
201
|
+
type CreatePageOutput = z.infer<typeof createPageOutputSchema>;
|
|
202
|
+
type SummarizeDocPromptArgs = z.infer<typeof summarizeDocPromptArgsSchema>;
|
|
203
|
+
type NotionPageSummary = z.infer<z.ZodObject<typeof pageSummaryShape>>;
|
|
204
|
+
type NotionPageDetail = z.infer<typeof pageDetailSchema>;
|
|
205
|
+
type NotionWorkspaceResource = z.infer<typeof workspaceResourceSchema>;
|
|
206
|
+
interface NotionServerConfig {
|
|
207
|
+
token: string;
|
|
208
|
+
defaultParentPageId: string | null;
|
|
209
|
+
workspaceName: string | null;
|
|
210
|
+
apiBaseUrl: string;
|
|
211
|
+
apiVersion: string;
|
|
212
|
+
}
|
|
213
|
+
interface NotionCreatePageRequest {
|
|
214
|
+
title: string;
|
|
215
|
+
parentPageId: string;
|
|
216
|
+
content?: string;
|
|
217
|
+
}
|
|
218
|
+
interface NotionClientLike {
|
|
219
|
+
searchPages(input: SearchPagesInput): Promise<SearchPagesOutput>;
|
|
220
|
+
getPage(input: GetPageInput): Promise<NotionPageDetail>;
|
|
221
|
+
createPage(input: NotionCreatePageRequest): Promise<CreatePageOutput>;
|
|
222
|
+
getWorkspace(): Promise<NotionWorkspaceResource>;
|
|
223
|
+
}
|
|
224
|
+
interface NotionApiClientOptions {
|
|
225
|
+
config: NotionServerConfig;
|
|
226
|
+
fetchImplementation?: typeof fetch;
|
|
227
|
+
}
|
|
228
|
+
declare class NotionApiClient implements NotionClientLike {
|
|
229
|
+
private readonly config;
|
|
230
|
+
private readonly fetchImplementation;
|
|
231
|
+
private readonly baseUrl;
|
|
232
|
+
constructor(options: NotionApiClientOptions);
|
|
233
|
+
searchPages(input: SearchPagesInput): Promise<SearchPagesOutput>;
|
|
234
|
+
getPage(input: GetPageInput): Promise<NotionPageDetail>;
|
|
235
|
+
createPage(input: NotionCreatePageRequest): Promise<CreatePageOutput>;
|
|
236
|
+
getWorkspace(): Promise<NotionWorkspaceResource>;
|
|
237
|
+
private buildUrl;
|
|
238
|
+
private requestJson;
|
|
239
|
+
}
|
|
240
|
+
declare const metadata: ToolkitServerMetadata;
|
|
241
|
+
declare const serverCard: _universal_mcp_toolkit_core.ToolkitServerCard;
|
|
242
|
+
interface NotionServerDependencies {
|
|
243
|
+
config: NotionServerConfig;
|
|
244
|
+
client: NotionClientLike;
|
|
245
|
+
}
|
|
246
|
+
interface NotionServerFactoryOptions {
|
|
247
|
+
config?: NotionServerConfig;
|
|
248
|
+
envSource?: NodeJS.ProcessEnv;
|
|
249
|
+
client?: NotionClientLike;
|
|
250
|
+
fetchImplementation?: typeof fetch;
|
|
251
|
+
}
|
|
252
|
+
declare class NotionServer extends ToolkitServer {
|
|
253
|
+
private readonly config;
|
|
254
|
+
private readonly client;
|
|
255
|
+
constructor(dependencies: NotionServerDependencies);
|
|
256
|
+
readWorkspaceResource(uri?: URL): Promise<{
|
|
257
|
+
[x: string]: unknown;
|
|
258
|
+
contents: ({
|
|
259
|
+
uri: string;
|
|
260
|
+
text: string;
|
|
261
|
+
mimeType?: string | undefined;
|
|
262
|
+
_meta?: {
|
|
263
|
+
[x: string]: unknown;
|
|
264
|
+
} | undefined;
|
|
265
|
+
} | {
|
|
266
|
+
uri: string;
|
|
267
|
+
blob: string;
|
|
268
|
+
mimeType?: string | undefined;
|
|
269
|
+
_meta?: {
|
|
270
|
+
[x: string]: unknown;
|
|
271
|
+
} | undefined;
|
|
272
|
+
})[];
|
|
273
|
+
_meta?: {
|
|
274
|
+
[x: string]: unknown;
|
|
275
|
+
progressToken?: string | number | undefined;
|
|
276
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
277
|
+
taskId: string;
|
|
278
|
+
} | undefined;
|
|
279
|
+
} | undefined;
|
|
280
|
+
}>;
|
|
281
|
+
buildSummarizeDocPrompt(args: SummarizeDocPromptArgs): Promise<{
|
|
282
|
+
messages: {
|
|
283
|
+
role: "user";
|
|
284
|
+
content: {
|
|
285
|
+
type: "text";
|
|
286
|
+
text: string;
|
|
287
|
+
};
|
|
288
|
+
}[];
|
|
289
|
+
}>;
|
|
290
|
+
}
|
|
291
|
+
declare function createServer(options?: NotionServerFactoryOptions): NotionServer;
|
|
292
|
+
declare function main(argv?: readonly string[]): Promise<void>;
|
|
293
|
+
|
|
294
|
+
export { type CreatePageInput, type CreatePageOutput, type GetPageInput, type GetPageOutput, NotionApiClient, type NotionApiClientOptions, type NotionClientLike, type NotionCreatePageRequest, type NotionPageDetail, type NotionPageSummary, NotionServer, type NotionServerConfig, type NotionServerDependencies, type NotionServerFactoryOptions, type NotionWorkspaceResource, type SearchPagesInput, type SearchPagesOutput, type SummarizeDocPromptArgs, createServer, main, metadata, serverCard };
|