@atikk-co-jp/notion-mcp-server 0.4.1 → 0.5.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/README.ja.md +51 -12
- package/README.md +51 -12
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/notion-client.d.ts +24 -10
- package/dist/src/notion-client.d.ts.map +1 -1
- package/dist/src/notion-client.js +48 -11
- package/dist/src/schemas/block.d.ts +2 -1
- package/dist/src/schemas/block.d.ts.map +1 -1
- package/dist/src/tools/create-database.js +3 -3
- package/dist/src/tools/create-page-simple.d.ts.map +1 -1
- package/dist/src/tools/create-page-simple.js +6 -5
- package/dist/src/tools/create-page.js +6 -6
- package/dist/src/tools/index.d.ts +4 -2
- package/dist/src/tools/index.d.ts.map +1 -1
- package/dist/src/tools/index.js +8 -3
- package/dist/src/tools/move-page.d.ts.map +1 -1
- package/dist/src/tools/move-page.js +8 -7
- package/dist/src/tools/query-data-source.d.ts +4 -0
- package/dist/src/tools/query-data-source.d.ts.map +1 -0
- package/dist/src/tools/{query-database.js → query-data-source.js} +9 -7
- package/dist/src/tools/retrieve-data-source.d.ts +4 -0
- package/dist/src/tools/retrieve-data-source.d.ts.map +1 -0
- package/dist/src/tools/retrieve-data-source.js +55 -0
- package/dist/src/tools/retrieve-database.d.ts.map +1 -1
- package/dist/src/tools/retrieve-database.js +7 -24
- package/dist/src/tools/search.d.ts.map +1 -1
- package/dist/src/tools/search.js +6 -5
- package/dist/src/tools/update-data-source.d.ts +4 -0
- package/dist/src/tools/update-data-source.d.ts.map +1 -0
- package/dist/src/tools/update-data-source.js +31 -0
- package/dist/src/tools/update-database.d.ts.map +1 -1
- package/dist/src/tools/update-database.js +5 -8
- package/dist/src/tools/update-page.js +1 -1
- package/package.json +1 -1
- package/dist/src/tools/query-database.d.ts +0 -4
- package/dist/src/tools/query-database.d.ts.map +0 -1
package/README.ja.md
CHANGED
|
@@ -6,6 +6,8 @@ Notion API用のMCP(Model Context Protocol)サーバー。AIアシスタン
|
|
|
6
6
|
|
|
7
7
|
> ⚠️ **注意**: これは初期リリースです。APIは変更される可能性があります。
|
|
8
8
|
|
|
9
|
+
> **APIバージョン**: 2025-09-03(最新)
|
|
10
|
+
|
|
9
11
|
## 特徴
|
|
10
12
|
|
|
11
13
|
- **ページ操作**: Notionページの作成、取得、更新、移動
|
|
@@ -34,7 +36,10 @@ Notion API用のMCP(Model Context Protocol)サーバー。AIアシスタン
|
|
|
34
36
|
| | [Retrieve database](https://developers.notion.com/reference/retrieve-a-database) | `retrieve-database` | simple/json |
|
|
35
37
|
| | [Update database](https://developers.notion.com/reference/update-a-database) | `update-database` | JSON |
|
|
36
38
|
| | [Archive database](https://developers.notion.com/reference/update-a-database) | `archive-database` | JSON |
|
|
37
|
-
| |
|
|
39
|
+
| **データソース** | | | |
|
|
40
|
+
| | [Retrieve data source](https://developers.notion.com/reference/retrieve-a-data-source) | `retrieve-data-source` | simple/json |
|
|
41
|
+
| | [Query data source](https://developers.notion.com/reference/post-data-source-query) | `query-data-source` | simple/json |
|
|
42
|
+
| | [Update data source](https://developers.notion.com/reference/patch-data-source) | `update-data-source` | JSON |
|
|
38
43
|
| **ブロック** | | | |
|
|
39
44
|
| | [Retrieve block](https://developers.notion.com/reference/retrieve-a-block) | `retrieve-block` | markdown/json |
|
|
40
45
|
| | [Update block](https://developers.notion.com/reference/update-a-block) | `update-block` | JSON |
|
|
@@ -134,11 +139,11 @@ Claude Desktopの設定ファイル(macOSの場合: `~/.config/claude/claude_d
|
|
|
134
139
|
|
|
135
140
|
### create-page
|
|
136
141
|
|
|
137
|
-
|
|
142
|
+
データソースに新しいページを作成します。
|
|
138
143
|
|
|
139
144
|
```json
|
|
140
145
|
{
|
|
141
|
-
"
|
|
146
|
+
"data_source_id": "データソースのUUID",
|
|
142
147
|
"properties": {
|
|
143
148
|
"Name": {
|
|
144
149
|
"title": [{ "text": { "content": "新しいページタイトル" } }]
|
|
@@ -155,7 +160,7 @@ Claude Desktopの設定ファイル(macOSの場合: `~/.config/claude/claude_d
|
|
|
155
160
|
Markdownを使ってページを作成します。`create-page`と比較して**出力トークン約80%削減**。
|
|
156
161
|
|
|
157
162
|
**パラメータ:**
|
|
158
|
-
- `
|
|
163
|
+
- `data_source_id` (必須): ページを作成するデータソースのID
|
|
159
164
|
- `title` (必須): ページタイトル(文字列)
|
|
160
165
|
- `content` (任意): ページ本文(Markdown形式)
|
|
161
166
|
- `properties` (任意): 追加のNotionプロパティ
|
|
@@ -173,7 +178,7 @@ Markdownを使ってページを作成します。`create-page`と比較して**
|
|
|
173
178
|
|
|
174
179
|
```json
|
|
175
180
|
{
|
|
176
|
-
"
|
|
181
|
+
"data_source_id": "データソースのUUID",
|
|
177
182
|
"title": "バグレポート",
|
|
178
183
|
"content": "## 再現手順\n\n1. ログイン\n2. 設定を開く\n\n## 期待動作\n\n正常に表示される",
|
|
179
184
|
"properties": {
|
|
@@ -204,12 +209,12 @@ Markdownを使ってページを作成します。`create-page`と比較して**
|
|
|
204
209
|
}
|
|
205
210
|
```
|
|
206
211
|
|
|
207
|
-
### query-
|
|
212
|
+
### query-data-source
|
|
208
213
|
|
|
209
|
-
|
|
214
|
+
フィルターやソートを使ってデータソースをクエリします。
|
|
210
215
|
|
|
211
216
|
**パラメータ:**
|
|
212
|
-
- `
|
|
217
|
+
- `data_source_id` (必須): クエリするデータソースのID
|
|
213
218
|
- `filter` (任意): フィルター条件(JSONオブジェクト)
|
|
214
219
|
- `sorts` (任意): ソート条件(配列)
|
|
215
220
|
- `start_cursor` (任意): ページネーション用カーソル
|
|
@@ -220,7 +225,7 @@ Markdownを使ってページを作成します。`create-page`と比較して**
|
|
|
220
225
|
|
|
221
226
|
```json
|
|
222
227
|
{
|
|
223
|
-
"
|
|
228
|
+
"data_source_id": "データソースのUUID",
|
|
224
229
|
"filter": {
|
|
225
230
|
"property": "Status",
|
|
226
231
|
"status": { "equals": "進行中" }
|
|
@@ -258,20 +263,52 @@ Markdownを使ってページを作成します。`create-page`と比較して**
|
|
|
258
263
|
|
|
259
264
|
### update-database
|
|
260
265
|
|
|
261
|
-
|
|
266
|
+
既存のデータベースコンテナ(タイトル、説明、アイコン、カバー)を更新します。
|
|
267
|
+
|
|
268
|
+
**注意:** スキーマ(プロパティ/カラム)の更新には `update-data-source` を使用してください。
|
|
262
269
|
|
|
263
270
|
**パラメータ:**
|
|
264
271
|
- `database_id` (必須): 更新するデータベースのID
|
|
265
272
|
- `title` (任意): 新しいタイトル(リッチテキスト配列)
|
|
266
273
|
- `description` (任意): 新しい説明(リッチテキスト配列)
|
|
267
|
-
- `properties` (任意): 追加、更新、削除するプロパティ(nullで削除)
|
|
268
274
|
- `icon` (任意): アイコン(nullで削除)
|
|
269
275
|
- `cover` (任意): カバー画像(nullで削除)
|
|
276
|
+
- `is_inline` (任意): trueの場合、インラインデータベースとして作成
|
|
270
277
|
- `archived` (任意): trueでアーカイブ
|
|
271
278
|
|
|
272
279
|
```json
|
|
273
280
|
{
|
|
274
281
|
"database_id": "データベースのUUID",
|
|
282
|
+
"title": [{ "type": "text", "text": { "content": "新しいタイトル" } }]
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### retrieve-data-source
|
|
287
|
+
|
|
288
|
+
データソーススキーマをIDで取得します。
|
|
289
|
+
|
|
290
|
+
**パラメータ:**
|
|
291
|
+
- `data_source_id` (必須): データソースのID
|
|
292
|
+
- `format` (任意): 出力形式 - `"simple"` (デフォルト) または `"json"`
|
|
293
|
+
|
|
294
|
+
```json
|
|
295
|
+
{
|
|
296
|
+
"data_source_id": "データソースのUUID",
|
|
297
|
+
"format": "simple"
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### update-data-source
|
|
302
|
+
|
|
303
|
+
データソーススキーマ(プロパティ/カラム)を更新します。
|
|
304
|
+
|
|
305
|
+
**パラメータ:**
|
|
306
|
+
- `data_source_id` (必須): 更新するデータソースのID
|
|
307
|
+
- `properties` (任意): 追加、更新、削除するプロパティ(nullで削除)
|
|
308
|
+
|
|
309
|
+
```json
|
|
310
|
+
{
|
|
311
|
+
"data_source_id": "データソースのUUID",
|
|
275
312
|
"properties": {
|
|
276
313
|
"NewColumn": { "rich_text": {} },
|
|
277
314
|
"OldColumn": null
|
|
@@ -281,7 +318,7 @@ Markdownを使ってページを作成します。`create-page`と比較して**
|
|
|
281
318
|
|
|
282
319
|
### search
|
|
283
320
|
|
|
284
|
-
|
|
321
|
+
すべてのページとデータソースを横断検索します。
|
|
285
322
|
|
|
286
323
|
```json
|
|
287
324
|
{
|
|
@@ -290,6 +327,8 @@ Markdownを使ってページを作成します。`create-page`と比較して**
|
|
|
290
327
|
}
|
|
291
328
|
```
|
|
292
329
|
|
|
330
|
+
**フィルター値:** `"page"` または `"data_source"`
|
|
331
|
+
|
|
293
332
|
### get-block-children
|
|
294
333
|
|
|
295
334
|
ページまたはブロックの子ブロックを取得します。
|
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@ MCP (Model Context Protocol) server for Notion API. Enables AI assistants to int
|
|
|
6
6
|
|
|
7
7
|
> ⚠️ **Note**: This is an early release. API may change.
|
|
8
8
|
|
|
9
|
+
> **API Version**: 2025-09-03 (latest)
|
|
10
|
+
|
|
9
11
|
## Features
|
|
10
12
|
|
|
11
13
|
- **Page Operations**: Create, retrieve, update, and move Notion pages
|
|
@@ -34,7 +36,10 @@ MCP (Model Context Protocol) server for Notion API. Enables AI assistants to int
|
|
|
34
36
|
| | [Retrieve database](https://developers.notion.com/reference/retrieve-a-database) | `retrieve-database` | simple/json |
|
|
35
37
|
| | [Update database](https://developers.notion.com/reference/update-a-database) | `update-database` | JSON |
|
|
36
38
|
| | [Archive database](https://developers.notion.com/reference/update-a-database) | `archive-database` | JSON |
|
|
37
|
-
|
|
|
39
|
+
| **Data Sources** | | | |
|
|
40
|
+
| | [Retrieve data source](https://developers.notion.com/reference/retrieve-a-data-source) | `retrieve-data-source` | simple/json |
|
|
41
|
+
| | [Query data source](https://developers.notion.com/reference/post-data-source-query) | `query-data-source` | simple/json |
|
|
42
|
+
| | [Update data source](https://developers.notion.com/reference/patch-data-source) | `update-data-source` | JSON |
|
|
38
43
|
| **Blocks** | | | |
|
|
39
44
|
| | [Retrieve block](https://developers.notion.com/reference/retrieve-a-block) | `retrieve-block` | markdown/json |
|
|
40
45
|
| | [Update block](https://developers.notion.com/reference/update-a-block) | `update-block` | JSON |
|
|
@@ -134,11 +139,11 @@ Retrieve a Notion page by its ID.
|
|
|
134
139
|
|
|
135
140
|
### create-page
|
|
136
141
|
|
|
137
|
-
Create a new page in a
|
|
142
|
+
Create a new page in a data source.
|
|
138
143
|
|
|
139
144
|
```json
|
|
140
145
|
{
|
|
141
|
-
"
|
|
146
|
+
"data_source_id": "data-source-uuid-here",
|
|
142
147
|
"properties": {
|
|
143
148
|
"Name": {
|
|
144
149
|
"title": [{ "text": { "content": "New Page Title" } }]
|
|
@@ -155,7 +160,7 @@ Create a new page in a database.
|
|
|
155
160
|
Create a new page using Markdown. **~80% fewer output tokens** compared to `create-page`.
|
|
156
161
|
|
|
157
162
|
**Parameters:**
|
|
158
|
-
- `
|
|
163
|
+
- `data_source_id` (required): The data source ID to create the page in
|
|
159
164
|
- `title` (required): Page title as a simple string
|
|
160
165
|
- `content` (optional): Page content in Markdown
|
|
161
166
|
- `properties` (optional): Additional Notion properties
|
|
@@ -173,7 +178,7 @@ Create a new page using Markdown. **~80% fewer output tokens** compared to `crea
|
|
|
173
178
|
|
|
174
179
|
```json
|
|
175
180
|
{
|
|
176
|
-
"
|
|
181
|
+
"data_source_id": "data-source-uuid-here",
|
|
177
182
|
"title": "Bug Report",
|
|
178
183
|
"content": "## Steps to Reproduce\n\n1. Login\n2. Open settings\n\n## Expected Behavior\n\nShould display correctly",
|
|
179
184
|
"properties": {
|
|
@@ -204,12 +209,12 @@ Update a page's properties.
|
|
|
204
209
|
}
|
|
205
210
|
```
|
|
206
211
|
|
|
207
|
-
### query-
|
|
212
|
+
### query-data-source
|
|
208
213
|
|
|
209
|
-
Query a
|
|
214
|
+
Query a data source with optional filters and sorts.
|
|
210
215
|
|
|
211
216
|
**Parameters:**
|
|
212
|
-
- `
|
|
217
|
+
- `data_source_id` (required): The ID of the data source to query
|
|
213
218
|
- `filter` (optional): Filter conditions as a JSON object
|
|
214
219
|
- `sorts` (optional): Sort conditions as an array
|
|
215
220
|
- `start_cursor` (optional): Cursor for pagination
|
|
@@ -220,7 +225,7 @@ Query a database with optional filters and sorts.
|
|
|
220
225
|
|
|
221
226
|
```json
|
|
222
227
|
{
|
|
223
|
-
"
|
|
228
|
+
"data_source_id": "data-source-uuid-here",
|
|
224
229
|
"filter": {
|
|
225
230
|
"property": "Status",
|
|
226
231
|
"status": { "equals": "In Progress" }
|
|
@@ -258,20 +263,52 @@ Create a new database as a subpage of an existing page.
|
|
|
258
263
|
|
|
259
264
|
### update-database
|
|
260
265
|
|
|
261
|
-
Update an existing database
|
|
266
|
+
Update an existing database container (title, description, icon, cover).
|
|
267
|
+
|
|
268
|
+
**Note:** For schema (properties/columns) updates, use `update-data-source` instead.
|
|
262
269
|
|
|
263
270
|
**Parameters:**
|
|
264
271
|
- `database_id` (required): The ID of the database to update
|
|
265
272
|
- `title` (optional): New title as rich text array
|
|
266
273
|
- `description` (optional): New description as rich text array
|
|
267
|
-
- `properties` (optional): Properties to add, update, or delete (set to null)
|
|
268
274
|
- `icon` (optional): Icon (set to null to remove)
|
|
269
275
|
- `cover` (optional): Cover image (set to null to remove)
|
|
276
|
+
- `is_inline` (optional): If true, creates an inline database
|
|
270
277
|
- `archived` (optional): Set to true to archive
|
|
271
278
|
|
|
272
279
|
```json
|
|
273
280
|
{
|
|
274
281
|
"database_id": "database-uuid-here",
|
|
282
|
+
"title": [{ "type": "text", "text": { "content": "New Title" } }]
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### retrieve-data-source
|
|
287
|
+
|
|
288
|
+
Retrieve a data source schema by its ID.
|
|
289
|
+
|
|
290
|
+
**Parameters:**
|
|
291
|
+
- `data_source_id` (required): The ID of the data source
|
|
292
|
+
- `format` (optional): Output format - `"simple"` (default) or `"json"`
|
|
293
|
+
|
|
294
|
+
```json
|
|
295
|
+
{
|
|
296
|
+
"data_source_id": "data-source-uuid-here",
|
|
297
|
+
"format": "simple"
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### update-data-source
|
|
302
|
+
|
|
303
|
+
Update a data source schema (properties/columns).
|
|
304
|
+
|
|
305
|
+
**Parameters:**
|
|
306
|
+
- `data_source_id` (required): The ID of the data source to update
|
|
307
|
+
- `properties` (optional): Properties to add, update, or delete (set to null)
|
|
308
|
+
|
|
309
|
+
```json
|
|
310
|
+
{
|
|
311
|
+
"data_source_id": "data-source-uuid-here",
|
|
275
312
|
"properties": {
|
|
276
313
|
"NewColumn": { "rich_text": {} },
|
|
277
314
|
"OldColumn": null
|
|
@@ -281,7 +318,7 @@ Update an existing database's properties, title, or schema.
|
|
|
281
318
|
|
|
282
319
|
### search
|
|
283
320
|
|
|
284
|
-
Search across all pages and
|
|
321
|
+
Search across all pages and data sources.
|
|
285
322
|
|
|
286
323
|
```json
|
|
287
324
|
{
|
|
@@ -290,6 +327,8 @@ Search across all pages and databases.
|
|
|
290
327
|
}
|
|
291
328
|
```
|
|
292
329
|
|
|
330
|
+
**Filter values:** `"page"` or `"data_source"`
|
|
331
|
+
|
|
293
332
|
### get-block-children
|
|
294
333
|
|
|
295
334
|
Get the child blocks of a page or block.
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createNotionClient, type NotionClient } from './notion-client.js';
|
|
2
2
|
export * from './schemas/index.js';
|
|
3
3
|
export { startServer } from './server.js';
|
|
4
|
-
export { registerAllTools, registerAppendBlockChildren, registerCreateComment, registerCreatePage, registerGetBlockChildren,
|
|
4
|
+
export { registerAllTools, registerAppendBlockChildren, registerCreateComment, registerCreatePage, registerGetBlockChildren, registerQueryDataSource, registerRetrieveDataSource, registerRetrievePage, registerSearch, registerUpdateDataSource, registerUpdatePage, } from './tools/index.js';
|
|
5
5
|
export type { McpResponse, McpTextContent } from './utils/index.js';
|
|
6
6
|
export { formatResponse, formatSuccessMessage, handleError } from './utils/index.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAE1E,cAAc,oBAAoB,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,EACxB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAE1E,cAAc,oBAAoB,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEnE,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -4,6 +4,6 @@ export { createNotionClient } from './notion-client.js';
|
|
|
4
4
|
export * from './schemas/index.js';
|
|
5
5
|
export { startServer } from './server.js';
|
|
6
6
|
// Tool registration
|
|
7
|
-
export { registerAllTools, registerAppendBlockChildren, registerCreateComment, registerCreatePage, registerGetBlockChildren,
|
|
7
|
+
export { registerAllTools, registerAppendBlockChildren, registerCreateComment, registerCreatePage, registerGetBlockChildren, registerQueryDataSource, registerRetrieveDataSource, registerRetrievePage, registerSearch, registerUpdateDataSource, registerUpdatePage, } from './tools/index.js';
|
|
8
8
|
// Utils
|
|
9
9
|
export { formatResponse, formatSuccessMessage, handleError } from './utils/index.js';
|
|
@@ -35,6 +35,8 @@ export declare class NotionClient {
|
|
|
35
35
|
database_id: string;
|
|
36
36
|
} | {
|
|
37
37
|
page_id: string;
|
|
38
|
+
} | {
|
|
39
|
+
data_source_id: string;
|
|
38
40
|
};
|
|
39
41
|
properties: Record<string, PropertyValue>;
|
|
40
42
|
children?: Block[];
|
|
@@ -63,27 +65,40 @@ export declare class NotionClient {
|
|
|
63
65
|
page_id: string;
|
|
64
66
|
} | {
|
|
65
67
|
database_id: string;
|
|
68
|
+
} | {
|
|
69
|
+
data_source_id: string;
|
|
66
70
|
};
|
|
67
71
|
}) => Promise<T>;
|
|
68
72
|
};
|
|
73
|
+
dataSources: {
|
|
74
|
+
retrieve: <T>(params: {
|
|
75
|
+
data_source_id: string;
|
|
76
|
+
}) => Promise<T>;
|
|
77
|
+
query: <T>(params: {
|
|
78
|
+
data_source_id: string;
|
|
79
|
+
filter?: Filter;
|
|
80
|
+
sorts?: Sort[];
|
|
81
|
+
start_cursor?: string;
|
|
82
|
+
page_size?: number;
|
|
83
|
+
}) => Promise<T>;
|
|
84
|
+
update: <T>(params: {
|
|
85
|
+
data_source_id: string;
|
|
86
|
+
properties?: DatabaseProperties;
|
|
87
|
+
}) => Promise<T>;
|
|
88
|
+
};
|
|
69
89
|
databases: {
|
|
70
90
|
create: <T>(params: {
|
|
71
91
|
parent: {
|
|
72
92
|
page_id: string;
|
|
73
93
|
};
|
|
74
94
|
title?: RichText[];
|
|
75
|
-
|
|
95
|
+
initial_data_source?: {
|
|
96
|
+
properties: DatabaseProperties;
|
|
97
|
+
};
|
|
76
98
|
icon?: Icon;
|
|
77
99
|
cover?: Cover;
|
|
78
100
|
is_inline?: boolean;
|
|
79
101
|
}) => Promise<T>;
|
|
80
|
-
query: <T>(params: {
|
|
81
|
-
database_id: string;
|
|
82
|
-
filter?: Filter;
|
|
83
|
-
sorts?: Sort[];
|
|
84
|
-
start_cursor?: string;
|
|
85
|
-
page_size?: number;
|
|
86
|
-
}) => Promise<T>;
|
|
87
102
|
retrieve: <T>(params: {
|
|
88
103
|
database_id: string;
|
|
89
104
|
}) => Promise<T>;
|
|
@@ -91,7 +106,6 @@ export declare class NotionClient {
|
|
|
91
106
|
database_id: string;
|
|
92
107
|
title?: RichText[];
|
|
93
108
|
description?: RichText[];
|
|
94
|
-
properties?: DatabaseProperties;
|
|
95
109
|
icon?: Icon | null;
|
|
96
110
|
cover?: Cover | null;
|
|
97
111
|
is_inline?: boolean;
|
|
@@ -149,7 +163,7 @@ export declare class NotionClient {
|
|
|
149
163
|
search: <T>(params?: {
|
|
150
164
|
query?: string;
|
|
151
165
|
filter?: {
|
|
152
|
-
value: "page" | "
|
|
166
|
+
value: "page" | "data_source";
|
|
153
167
|
property: "object";
|
|
154
168
|
};
|
|
155
169
|
sort?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notion-client.d.ts","sourceRoot":"","sources":["../../src/notion-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAClF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AACrE,OAAO,KA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,YAAY,CAAC,EAAE,MAAM,CAAA;YACrB,SAAS,CAAC,EAAE,MAAM,CAAA;SACnB,KAAG,OAAO,CAAC,CAAC,CAAC;MAKf;IAGD,KAAK;eACI,CAAC,WAAW;YAAE,YAAY,CAAC,EAAE,MAAM,CAAC;YAAC,SAAS,CAAC,EAAE,MAAM,CAAA;SAAE,KAAG,OAAO,CAAC,CAAC,CAAC;mBAMlE,CAAC,UAAU;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,KAAG,OAAO,CAAC,CAAC,CAAC;aAIjD,CAAC,OAAK,OAAO,CAAC,CAAC,CAAC;MAGtB;IAGD,MAAM,GAAI,CAAC,EAAE,SAAS;QACpB,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,MAAM,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC;YAAC,QAAQ,EAAE,QAAQ,CAAA;SAAE,CAAA;QAC9D,IAAI,CAAC,EAAE;YAAE,SAAS,EAAE,WAAW,GAAG,YAAY,CAAC;YAAC,SAAS,EAAE,kBAAkB,CAAA;SAAE,CAAA;QAC/E,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,KAAG,OAAO,CAAC,CAAC,CAAC,CAEb;CACF;AAED,wBAAgB,kBAAkB,IAAI,YAAY,CASjD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const NOTION_API_BASE = 'https://api.notion.com/v1';
|
|
2
|
-
const NOTION_VERSION = '
|
|
2
|
+
const NOTION_VERSION = '2025-09-03';
|
|
3
3
|
export class NotionClient {
|
|
4
4
|
token;
|
|
5
5
|
constructor(options) {
|
|
@@ -40,7 +40,19 @@ export class NotionClient {
|
|
|
40
40
|
// Pages
|
|
41
41
|
pages = {
|
|
42
42
|
create: (params) => {
|
|
43
|
-
|
|
43
|
+
// API 2025-09-03 requires explicit type in parent
|
|
44
|
+
let parentWithType;
|
|
45
|
+
if ('data_source_id' in params.parent) {
|
|
46
|
+
parentWithType = { type: 'data_source_id', data_source_id: params.parent.data_source_id };
|
|
47
|
+
}
|
|
48
|
+
else if ('database_id' in params.parent) {
|
|
49
|
+
parentWithType = { type: 'database_id', database_id: params.parent.database_id };
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
parentWithType = { type: 'page_id', page_id: params.parent.page_id };
|
|
53
|
+
}
|
|
54
|
+
const body = { ...params, parent: parentWithType };
|
|
55
|
+
return this.request('/pages', { method: 'POST', body });
|
|
44
56
|
},
|
|
45
57
|
retrieve: (params) => {
|
|
46
58
|
return this.request(`/pages/${params.page_id}`);
|
|
@@ -56,18 +68,43 @@ export class NotionClient {
|
|
|
56
68
|
});
|
|
57
69
|
},
|
|
58
70
|
move: (params) => {
|
|
59
|
-
|
|
60
|
-
|
|
71
|
+
// API 2025-09-03 requires explicit type in parent
|
|
72
|
+
let parentWithType;
|
|
73
|
+
if ('data_source_id' in params.parent) {
|
|
74
|
+
parentWithType = { type: 'data_source_id', data_source_id: params.parent.data_source_id };
|
|
75
|
+
}
|
|
76
|
+
else if ('database_id' in params.parent) {
|
|
77
|
+
parentWithType = { type: 'database_id', database_id: params.parent.database_id };
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
parentWithType = { type: 'page_id', page_id: params.parent.page_id };
|
|
81
|
+
}
|
|
82
|
+
return this.request(`/pages/${params.page_id}/move`, { method: 'POST', body: { parent: parentWithType } });
|
|
61
83
|
},
|
|
62
84
|
};
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return this.request(
|
|
85
|
+
// Data Sources (new in 2025-09-03)
|
|
86
|
+
dataSources = {
|
|
87
|
+
retrieve: (params) => {
|
|
88
|
+
return this.request(`/data_sources/${params.data_source_id}`);
|
|
67
89
|
},
|
|
68
90
|
query: (params) => {
|
|
69
|
-
const {
|
|
70
|
-
return this.request(`/
|
|
91
|
+
const { data_source_id, ...body } = params;
|
|
92
|
+
return this.request(`/data_sources/${data_source_id}/query`, { method: 'POST', body });
|
|
93
|
+
},
|
|
94
|
+
update: (params) => {
|
|
95
|
+
const { data_source_id, ...body } = params;
|
|
96
|
+
return this.request(`/data_sources/${data_source_id}`, { method: 'PATCH', body });
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
// Databases (container operations only in 2025-09-03)
|
|
100
|
+
databases = {
|
|
101
|
+
create: (params) => {
|
|
102
|
+
// API 2025-09-03 requires explicit type in parent
|
|
103
|
+
const body = {
|
|
104
|
+
...params,
|
|
105
|
+
parent: { type: 'page_id', page_id: params.parent.page_id },
|
|
106
|
+
};
|
|
107
|
+
return this.request('/databases', { method: 'POST', body });
|
|
71
108
|
},
|
|
72
109
|
retrieve: (params) => {
|
|
73
110
|
return this.request(`/databases/${params.database_id}`);
|
|
@@ -127,7 +164,7 @@ export class NotionClient {
|
|
|
127
164
|
return this.request('/users/me');
|
|
128
165
|
},
|
|
129
166
|
};
|
|
130
|
-
// Search
|
|
167
|
+
// Search (filter value changed from 'database' to 'data_source' in 2025-09-03)
|
|
131
168
|
search = (params) => {
|
|
132
169
|
return this.request('/search', { method: 'POST', body: params || {} });
|
|
133
170
|
};
|
|
@@ -17,11 +17,12 @@ export interface Block {
|
|
|
17
17
|
archived?: boolean;
|
|
18
18
|
in_trash?: boolean;
|
|
19
19
|
parent?: {
|
|
20
|
-
type: 'database_id' | 'page_id' | 'block_id' | 'workspace';
|
|
20
|
+
type: 'database_id' | 'page_id' | 'block_id' | 'workspace' | 'data_source_id';
|
|
21
21
|
database_id?: string;
|
|
22
22
|
page_id?: string;
|
|
23
23
|
block_id?: string;
|
|
24
24
|
workspace?: boolean;
|
|
25
|
+
data_source_id?: string;
|
|
25
26
|
};
|
|
26
27
|
[key: string]: unknown;
|
|
27
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../src/schemas/block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAM9B,CAAA;AAGF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAO9B,CAAA;AAGF,eAAO,MAAM,sBAAsB;;;;iBAIjC,CAAA;AAGF,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAoCxC,CAAA;AAED,eAAO,MAAM,mBAAmB,iFAAuB,CAAA"}
|
|
@@ -7,7 +7,7 @@ const inputSchema = {
|
|
|
7
7
|
properties: z
|
|
8
8
|
.record(z.string(), z.any())
|
|
9
9
|
.describe('Property schema (must include one title property)'),
|
|
10
|
-
icon: z.any().optional().describe('Database icon'),
|
|
10
|
+
icon: z.any().optional().describe('Database icon { type: "emoji", emoji: "📝" } or { type: "external", external: { url: "..." } }. Emoji must be an actual emoji character.'),
|
|
11
11
|
cover: z.any().optional().describe('Cover image'),
|
|
12
12
|
is_inline: z.boolean().optional().describe('Inline database'),
|
|
13
13
|
};
|
|
@@ -15,13 +15,13 @@ export function registerCreateDatabase(server, notion) {
|
|
|
15
15
|
server.registerTool('create-database', {
|
|
16
16
|
description: 'Create a new database as a subpage of an existing Notion page. ' +
|
|
17
17
|
'Requires a parent_page_id and properties object defining the database schema. ' +
|
|
18
|
-
'Each database must have exactly one title property.',
|
|
18
|
+
'Each database must have exactly one title property. (API version 2025-09-03)',
|
|
19
19
|
inputSchema,
|
|
20
20
|
}, async ({ parent_page_id, title, properties, icon, cover, is_inline }) => {
|
|
21
21
|
try {
|
|
22
22
|
const params = {
|
|
23
23
|
parent: { page_id: parent_page_id },
|
|
24
|
-
properties: properties,
|
|
24
|
+
initial_data_source: { properties: properties },
|
|
25
25
|
};
|
|
26
26
|
if (title) {
|
|
27
27
|
params.title = title;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-page-simple.d.ts","sourceRoot":"","sources":["../../../src/tools/create-page-simple.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAYvD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"create-page-simple.d.ts","sourceRoot":"","sources":["../../../src/tools/create-page-simple.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAYvD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CA4DtF"}
|
|
@@ -3,19 +3,20 @@ import { markdownToBlocks } from '../converters/index.js';
|
|
|
3
3
|
import { formatResponse, handleError } from '../utils/index.js';
|
|
4
4
|
// Minimal schema for MCP
|
|
5
5
|
const inputSchema = {
|
|
6
|
-
|
|
6
|
+
data_source_id: z.string().describe('Data source ID (required in API 2025-09-03)'),
|
|
7
7
|
title: z.string().describe('Page title'),
|
|
8
8
|
content: z.string().optional().describe('Page content in Markdown'),
|
|
9
9
|
properties: z.record(z.string(), z.any()).optional().describe('Additional properties'),
|
|
10
|
-
icon: z.string().optional().describe('Emoji
|
|
10
|
+
icon: z.string().optional().describe('Emoji character (e.g. "📝", "🐛", "✅"). Must be an actual emoji, not a name.'),
|
|
11
11
|
};
|
|
12
12
|
export function registerCreatePageSimple(server, notion) {
|
|
13
13
|
server.registerTool('create-page-simple', {
|
|
14
14
|
description: 'Create a Notion page with Markdown content. ' +
|
|
15
15
|
'Simpler than create-page: just provide title and markdown text. ' +
|
|
16
|
-
'Supports: headings (#), lists (- or 1.), checkboxes (- [ ]), code blocks (```), quotes (>), images (![]()), bold (**), italic (*), links ([]()), etc.'
|
|
16
|
+
'Supports: headings (#), lists (- or 1.), checkboxes (- [ ]), code blocks (```), quotes (>), images (![]()), bold (**), italic (*), links ([]()), etc. ' +
|
|
17
|
+
'(API version 2025-09-03)',
|
|
17
18
|
inputSchema,
|
|
18
|
-
}, async ({
|
|
19
|
+
}, async ({ data_source_id, title, content, properties, icon }) => {
|
|
19
20
|
try {
|
|
20
21
|
// Build properties with title
|
|
21
22
|
const pageProperties = {
|
|
@@ -32,7 +33,7 @@ export function registerCreatePageSimple(server, notion) {
|
|
|
32
33
|
}
|
|
33
34
|
// Build params
|
|
34
35
|
const params = {
|
|
35
|
-
parent: {
|
|
36
|
+
parent: { data_source_id },
|
|
36
37
|
properties: pageProperties,
|
|
37
38
|
};
|
|
38
39
|
// Convert markdown to blocks if content provided
|
|
@@ -2,22 +2,22 @@ import { z } from 'zod';
|
|
|
2
2
|
import { formatResponse, handleError } from '../utils/index.js';
|
|
3
3
|
// Minimal schema for MCP (full validation by Notion API)
|
|
4
4
|
const inputSchema = {
|
|
5
|
-
|
|
5
|
+
data_source_id: z.string().describe('Data source ID (required in API 2025-09-03)'),
|
|
6
6
|
properties: z.record(z.string(), z.any()).describe('Notion properties object'),
|
|
7
7
|
children: z.array(z.any()).optional().describe('Block objects array'),
|
|
8
|
-
icon: z.any().optional().describe('Page icon'),
|
|
8
|
+
icon: z.any().optional().describe('Page icon { type: "emoji", emoji: "📝" } or { type: "external", external: { url: "..." } }. Emoji must be an actual emoji character.'),
|
|
9
9
|
cover: z.any().optional().describe('Cover image'),
|
|
10
10
|
};
|
|
11
11
|
export function registerCreatePage(server, notion) {
|
|
12
12
|
server.registerTool('create-page', {
|
|
13
|
-
description: 'Create a new page in a Notion
|
|
13
|
+
description: 'Create a new page in a Notion data source. Requires a data_source_id and properties object. ' +
|
|
14
14
|
'Optionally include initial content blocks, icon, and cover image. ' +
|
|
15
|
-
'Returns the created page with its ID and URL.',
|
|
15
|
+
'Returns the created page with its ID and URL. (API version 2025-09-03)',
|
|
16
16
|
inputSchema,
|
|
17
|
-
}, async ({
|
|
17
|
+
}, async ({ data_source_id, properties, children, icon, cover }) => {
|
|
18
18
|
try {
|
|
19
19
|
const params = {
|
|
20
|
-
parent: {
|
|
20
|
+
parent: { data_source_id },
|
|
21
21
|
properties: properties,
|
|
22
22
|
};
|
|
23
23
|
if (children) {
|
|
@@ -13,10 +13,11 @@ import { registerGetBlockChildren } from './get-block-children.js';
|
|
|
13
13
|
import { registerListComments } from './list-comments.js';
|
|
14
14
|
import { registerListUsers } from './list-users.js';
|
|
15
15
|
import { registerMovePage } from './move-page.js';
|
|
16
|
-
import {
|
|
16
|
+
import { registerQueryDataSource } from './query-data-source.js';
|
|
17
17
|
import { registerRetrieveBlock } from './retrieve-block.js';
|
|
18
18
|
import { registerRetrieveBotUser } from './retrieve-bot-user.js';
|
|
19
19
|
import { registerRetrieveDatabase } from './retrieve-database.js';
|
|
20
|
+
import { registerRetrieveDataSource } from './retrieve-data-source.js';
|
|
20
21
|
import { registerRetrievePage } from './retrieve-page.js';
|
|
21
22
|
import { registerRetrievePageProperty } from './retrieve-page-property.js';
|
|
22
23
|
import { registerRetrieveUser } from './retrieve-user.js';
|
|
@@ -24,7 +25,8 @@ import { registerSearch } from './search.js';
|
|
|
24
25
|
import { registerUpdateBlock } from './update-block.js';
|
|
25
26
|
import { registerUpdateBlockSimple } from './update-block-simple.js';
|
|
26
27
|
import { registerUpdateDatabase } from './update-database.js';
|
|
28
|
+
import { registerUpdateDataSource } from './update-data-source.js';
|
|
27
29
|
import { registerUpdatePage } from './update-page.js';
|
|
28
30
|
export declare function registerAllTools(server: McpServer, notion: NotionClient): void;
|
|
29
|
-
export { registerRetrievePage, registerCreatePage, registerCreatePageSimple, registerUpdatePage, registerArchivePage, registerRetrievePageProperty, registerMovePage, registerCreateDatabase, registerUpdateDatabase, registerArchiveDatabase,
|
|
31
|
+
export { registerRetrievePage, registerCreatePage, registerCreatePageSimple, registerUpdatePage, registerArchivePage, registerRetrievePageProperty, registerMovePage, registerCreateDatabase, registerUpdateDatabase, registerArchiveDatabase, registerRetrieveDatabase, registerRetrieveDataSource, registerQueryDataSource, registerUpdateDataSource, registerSearch, registerGetBlockChildren, registerAppendBlockChildren, registerAppendBlocksSimple, registerRetrieveBlock, registerUpdateBlock, registerUpdateBlockSimple, registerDeleteBlock, registerCreateComment, registerListComments, registerListUsers, registerRetrieveUser, registerRetrieveBotUser, };
|
|
30
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AACxE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAA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ACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAErD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAyC9E;AAED,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,4BAA4B,EAC5B,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,EACd,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,GACxB,CAAA"}
|
package/dist/src/tools/index.js
CHANGED
|
@@ -11,10 +11,11 @@ import { registerGetBlockChildren } from './get-block-children.js';
|
|
|
11
11
|
import { registerListComments } from './list-comments.js';
|
|
12
12
|
import { registerListUsers } from './list-users.js';
|
|
13
13
|
import { registerMovePage } from './move-page.js';
|
|
14
|
-
import {
|
|
14
|
+
import { registerQueryDataSource } from './query-data-source.js';
|
|
15
15
|
import { registerRetrieveBlock } from './retrieve-block.js';
|
|
16
16
|
import { registerRetrieveBotUser } from './retrieve-bot-user.js';
|
|
17
17
|
import { registerRetrieveDatabase } from './retrieve-database.js';
|
|
18
|
+
import { registerRetrieveDataSource } from './retrieve-data-source.js';
|
|
18
19
|
import { registerRetrievePage } from './retrieve-page.js';
|
|
19
20
|
import { registerRetrievePageProperty } from './retrieve-page-property.js';
|
|
20
21
|
import { registerRetrieveUser } from './retrieve-user.js';
|
|
@@ -22,6 +23,7 @@ import { registerSearch } from './search.js';
|
|
|
22
23
|
import { registerUpdateBlock } from './update-block.js';
|
|
23
24
|
import { registerUpdateBlockSimple } from './update-block-simple.js';
|
|
24
25
|
import { registerUpdateDatabase } from './update-database.js';
|
|
26
|
+
import { registerUpdateDataSource } from './update-data-source.js';
|
|
25
27
|
import { registerUpdatePage } from './update-page.js';
|
|
26
28
|
export function registerAllTools(server, notion) {
|
|
27
29
|
// Page operations
|
|
@@ -36,8 +38,11 @@ export function registerAllTools(server, notion) {
|
|
|
36
38
|
registerCreateDatabase(server, notion);
|
|
37
39
|
registerUpdateDatabase(server, notion);
|
|
38
40
|
registerArchiveDatabase(server, notion);
|
|
39
|
-
registerQueryDatabase(server, notion);
|
|
40
41
|
registerRetrieveDatabase(server, notion);
|
|
42
|
+
// Data Source operations (API 2025-09-03)
|
|
43
|
+
registerRetrieveDataSource(server, notion);
|
|
44
|
+
registerQueryDataSource(server, notion);
|
|
45
|
+
registerUpdateDataSource(server, notion);
|
|
41
46
|
// Search
|
|
42
47
|
registerSearch(server, notion);
|
|
43
48
|
// Block operations
|
|
@@ -56,4 +61,4 @@ export function registerAllTools(server, notion) {
|
|
|
56
61
|
registerRetrieveUser(server, notion);
|
|
57
62
|
registerRetrieveBotUser(server, notion);
|
|
58
63
|
}
|
|
59
|
-
export { registerRetrievePage, registerCreatePage, registerCreatePageSimple, registerUpdatePage, registerArchivePage, registerRetrievePageProperty, registerMovePage, registerCreateDatabase, registerUpdateDatabase, registerArchiveDatabase,
|
|
64
|
+
export { registerRetrievePage, registerCreatePage, registerCreatePageSimple, registerUpdatePage, registerArchivePage, registerRetrievePageProperty, registerMovePage, registerCreateDatabase, registerUpdateDatabase, registerArchiveDatabase, registerRetrieveDatabase, registerRetrieveDataSource, registerQueryDataSource, registerUpdateDataSource, registerSearch, registerGetBlockChildren, registerAppendBlockChildren, registerAppendBlocksSimple, registerRetrieveBlock, registerUpdateBlock, registerUpdateBlockSimple, registerDeleteBlock, registerCreateComment, registerListComments, registerListUsers, registerRetrieveUser, registerRetrieveBotUser, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"move-page.d.ts","sourceRoot":"","sources":["../../../src/tools/move-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAavD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"move-page.d.ts","sourceRoot":"","sources":["../../../src/tools/move-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAavD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAuC9E"}
|
|
@@ -5,23 +5,24 @@ const inputSchema = {
|
|
|
5
5
|
parent: z
|
|
6
6
|
.object({
|
|
7
7
|
page_id: z.string().optional().describe('Target parent page ID'),
|
|
8
|
-
|
|
8
|
+
data_source_id: z.string().optional().describe('Target data source ID'),
|
|
9
9
|
})
|
|
10
|
-
.describe('New parent (provide either page_id or
|
|
10
|
+
.describe('New parent (provide either page_id or data_source_id)'),
|
|
11
11
|
};
|
|
12
12
|
export function registerMovePage(server, notion) {
|
|
13
13
|
server.registerTool('move-page', {
|
|
14
|
-
description: 'Move a page to a new parent (page or
|
|
15
|
-
'Provide either page_id or
|
|
14
|
+
description: 'Move a page to a new parent (page or data source). ' +
|
|
15
|
+
'Provide either page_id or data_source_id as the new parent. ' +
|
|
16
|
+
'(API version 2025-09-03)',
|
|
16
17
|
inputSchema,
|
|
17
18
|
}, async ({ page_id, parent }) => {
|
|
18
19
|
try {
|
|
19
|
-
if (!parent.page_id && !parent.
|
|
20
|
+
if (!parent.page_id && !parent.data_source_id) {
|
|
20
21
|
return {
|
|
21
22
|
content: [
|
|
22
23
|
{
|
|
23
24
|
type: 'text',
|
|
24
|
-
text: 'Error: Parent must have either page_id or
|
|
25
|
+
text: 'Error: Parent must have either page_id or data_source_id.',
|
|
25
26
|
},
|
|
26
27
|
],
|
|
27
28
|
isError: true,
|
|
@@ -29,7 +30,7 @@ export function registerMovePage(server, notion) {
|
|
|
29
30
|
}
|
|
30
31
|
const parentParam = parent.page_id
|
|
31
32
|
? { page_id: parent.page_id }
|
|
32
|
-
: {
|
|
33
|
+
: { data_source_id: parent.data_source_id };
|
|
33
34
|
const response = await notion.pages.move({
|
|
34
35
|
page_id,
|
|
35
36
|
parent: parentParam,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { NotionClient } from '../notion-client.js';
|
|
3
|
+
export declare function registerQueryDataSource(server: McpServer, notion: NotionClient): void;
|
|
4
|
+
//# sourceMappingURL=query-data-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-data-source.d.ts","sourceRoot":"","sources":["../../../src/tools/query-data-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AA8BvD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAsDrF"}
|
|
@@ -3,20 +3,22 @@ import { pagesToSimple } from '../converters/index.js';
|
|
|
3
3
|
import { formatPaginatedResponse, formatSimplePaginatedResponse, handleError, } from '../utils/index.js';
|
|
4
4
|
// Minimal schema for MCP (full validation by Notion API)
|
|
5
5
|
const inputSchema = {
|
|
6
|
-
|
|
6
|
+
data_source_id: z.string().describe('Data source ID'),
|
|
7
7
|
filter: z.any().optional().describe('Filter conditions'),
|
|
8
8
|
sorts: z.array(z.any()).optional().describe('Sort conditions'),
|
|
9
9
|
start_cursor: z.string().optional().describe('Pagination cursor'),
|
|
10
10
|
page_size: z.number().optional().describe('Results per page (1-100)'),
|
|
11
11
|
format: z.enum(['json', 'simple']).optional().describe('Output format (default: simple)'),
|
|
12
12
|
};
|
|
13
|
-
export function
|
|
14
|
-
server.registerTool('query-
|
|
15
|
-
description:
|
|
13
|
+
export function registerQueryDataSource(server, notion) {
|
|
14
|
+
server.registerTool('query-data-source', {
|
|
15
|
+
description: 'Query a Notion data source with optional filters and sorts. Returns paginated results. ' +
|
|
16
|
+
"Use format='simple' (default) for human-readable output with reduced token usage. " +
|
|
17
|
+
'(API version 2025-09-03)',
|
|
16
18
|
inputSchema,
|
|
17
|
-
}, async ({
|
|
19
|
+
}, async ({ data_source_id, filter, sorts, start_cursor, page_size, format }) => {
|
|
18
20
|
try {
|
|
19
|
-
const params = {
|
|
21
|
+
const params = { data_source_id };
|
|
20
22
|
if (filter) {
|
|
21
23
|
params.filter = filter;
|
|
22
24
|
}
|
|
@@ -30,7 +32,7 @@ export function registerQueryDatabase(server, notion) {
|
|
|
30
32
|
params.page_size = page_size;
|
|
31
33
|
}
|
|
32
34
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
-
const response = await notion.
|
|
35
|
+
const response = await notion.dataSources.query(params);
|
|
34
36
|
if (format === 'simple') {
|
|
35
37
|
const simplePages = pagesToSimple(response.results);
|
|
36
38
|
return formatSimplePaginatedResponse(simplePages, response.has_more, response.next_cursor);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { NotionClient } from '../notion-client.js';
|
|
3
|
+
export declare function registerRetrieveDataSource(server: McpServer, notion: NotionClient): void;
|
|
4
|
+
//# sourceMappingURL=retrieve-data-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieve-data-source.d.ts","sourceRoot":"","sources":["../../../src/tools/retrieve-data-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AA2BvD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAwDxF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { formatResponse, formatSimpleResponse, handleError } from '../utils/index.js';
|
|
3
|
+
const inputSchema = {
|
|
4
|
+
data_source_id: z.string().describe('Data source ID'),
|
|
5
|
+
format: z
|
|
6
|
+
.enum(['json', 'simple'])
|
|
7
|
+
.optional()
|
|
8
|
+
.describe("Output format: 'simple' (default) or 'json'"),
|
|
9
|
+
};
|
|
10
|
+
export function registerRetrieveDataSource(server, notion) {
|
|
11
|
+
server.registerTool('retrieve-data-source', {
|
|
12
|
+
description: 'Retrieve a data source schema by its ID. Returns data source properties (columns) and their types. ' +
|
|
13
|
+
"Use format='simple' (default) for reduced token usage, 'json' for full Notion API response. " +
|
|
14
|
+
'(API version 2025-09-03)',
|
|
15
|
+
inputSchema,
|
|
16
|
+
}, async ({ data_source_id, format = 'simple' }) => {
|
|
17
|
+
try {
|
|
18
|
+
const response = await notion.dataSources.retrieve({ data_source_id });
|
|
19
|
+
if (format === 'json') {
|
|
20
|
+
return formatResponse(response);
|
|
21
|
+
}
|
|
22
|
+
// Simple format: extract essential info
|
|
23
|
+
const simpleProperties = {};
|
|
24
|
+
for (const [name, prop] of Object.entries(response.properties)) {
|
|
25
|
+
const simpleProp = {
|
|
26
|
+
id: prop.id,
|
|
27
|
+
type: prop.type,
|
|
28
|
+
};
|
|
29
|
+
// Include options for select/multi_select/status
|
|
30
|
+
if (prop.type === 'select' && prop.select) {
|
|
31
|
+
const selectProp = prop.select;
|
|
32
|
+
simpleProp.options = selectProp.options;
|
|
33
|
+
}
|
|
34
|
+
else if (prop.type === 'multi_select' && prop.multi_select) {
|
|
35
|
+
const multiSelectProp = prop.multi_select;
|
|
36
|
+
simpleProp.options = multiSelectProp.options;
|
|
37
|
+
}
|
|
38
|
+
else if (prop.type === 'status' && prop.status) {
|
|
39
|
+
const statusProp = prop.status;
|
|
40
|
+
simpleProp.options = statusProp.options;
|
|
41
|
+
}
|
|
42
|
+
simpleProperties[name] = simpleProp;
|
|
43
|
+
}
|
|
44
|
+
const simpleResponse = {
|
|
45
|
+
id: response.id,
|
|
46
|
+
parent_database_id: response.parent.database_id,
|
|
47
|
+
properties: simpleProperties,
|
|
48
|
+
};
|
|
49
|
+
return formatSimpleResponse(simpleResponse);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
return handleError(error);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieve-database.d.ts","sourceRoot":"","sources":["../../../src/tools/retrieve-database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"retrieve-database.d.ts","sourceRoot":"","sources":["../../../src/tools/retrieve-database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AA+BvD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAsCtF"}
|
|
@@ -9,7 +9,8 @@ const inputSchema = {
|
|
|
9
9
|
};
|
|
10
10
|
export function registerRetrieveDatabase(server, notion) {
|
|
11
11
|
server.registerTool('retrieve-database', {
|
|
12
|
-
description: 'Retrieve a database
|
|
12
|
+
description: 'Retrieve a database container by its ID. Returns database metadata and associated data sources. ' +
|
|
13
|
+
'Note: In API 2025-09-03, database properties/schema are retrieved via retrieve-data-source using data_source_id. ' +
|
|
13
14
|
"Use format='simple' (default) for reduced token usage, 'json' for full Notion API response.",
|
|
14
15
|
inputSchema,
|
|
15
16
|
}, async ({ database_id, format = 'simple' }) => {
|
|
@@ -19,35 +20,17 @@ export function registerRetrieveDatabase(server, notion) {
|
|
|
19
20
|
return formatResponse(response);
|
|
20
21
|
}
|
|
21
22
|
// Simple format: extract essential info
|
|
22
|
-
const simpleProperties = {};
|
|
23
|
-
for (const [name, prop] of Object.entries(response.properties)) {
|
|
24
|
-
const simpleProp = {
|
|
25
|
-
id: prop.id,
|
|
26
|
-
type: prop.type,
|
|
27
|
-
};
|
|
28
|
-
// Include options for select/multi_select/status
|
|
29
|
-
if (prop.type === 'select' && prop.select) {
|
|
30
|
-
const selectProp = prop.select;
|
|
31
|
-
simpleProp.options = selectProp.options;
|
|
32
|
-
}
|
|
33
|
-
else if (prop.type === 'multi_select' && prop.multi_select) {
|
|
34
|
-
const multiSelectProp = prop.multi_select;
|
|
35
|
-
simpleProp.options = multiSelectProp.options;
|
|
36
|
-
}
|
|
37
|
-
else if (prop.type === 'status' && prop.status) {
|
|
38
|
-
const statusProp = prop.status;
|
|
39
|
-
simpleProp.options = statusProp.options;
|
|
40
|
-
}
|
|
41
|
-
simpleProperties[name] = simpleProp;
|
|
42
|
-
}
|
|
43
23
|
const simpleResponse = {
|
|
44
24
|
id: response.id,
|
|
45
25
|
title: response.title.map((t) => t.plain_text).join(''),
|
|
46
26
|
description: response.description.map((t) => t.plain_text).join(''),
|
|
47
27
|
url: response.url,
|
|
48
|
-
properties: simpleProperties,
|
|
49
28
|
is_inline: response.is_inline,
|
|
50
|
-
|
|
29
|
+
in_trash: response.in_trash,
|
|
30
|
+
data_sources: response.data_sources,
|
|
31
|
+
icon: response.icon,
|
|
32
|
+
created_time: response.created_time,
|
|
33
|
+
last_edited_time: response.last_edited_time,
|
|
51
34
|
};
|
|
52
35
|
return formatSimpleResponse(simpleResponse);
|
|
53
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/tools/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AA8CvD,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/tools/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AA8CvD,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAiD5E"}
|
package/dist/src/tools/search.js
CHANGED
|
@@ -4,11 +4,11 @@ const inputSchema = {
|
|
|
4
4
|
query: z.string().optional().describe('Text to search for in page titles and content'),
|
|
5
5
|
filter: z
|
|
6
6
|
.object({
|
|
7
|
-
value: z.enum(['page', '
|
|
7
|
+
value: z.enum(['page', 'data_source']),
|
|
8
8
|
property: z.literal('object'),
|
|
9
9
|
})
|
|
10
10
|
.optional()
|
|
11
|
-
.describe('Filter to limit results to pages or
|
|
11
|
+
.describe('Filter to limit results to pages or data sources. ' +
|
|
12
12
|
'Example: { "value": "page", "property": "object" }'),
|
|
13
13
|
sort: z
|
|
14
14
|
.object({
|
|
@@ -31,10 +31,11 @@ const inputSchema = {
|
|
|
31
31
|
};
|
|
32
32
|
export function registerSearch(server, notion) {
|
|
33
33
|
server.registerTool('search', {
|
|
34
|
-
description: 'Search across all pages and
|
|
35
|
-
'Filter results by type (page or
|
|
34
|
+
description: 'Search across all pages and data sources in the workspace by title and content. ' +
|
|
35
|
+
'Filter results by type (page or data_source) and sort by last edited time. ' +
|
|
36
36
|
'Returns paginated results. ' +
|
|
37
|
-
'For querying a specific
|
|
37
|
+
'For querying a specific data source with filters, use query-data-source instead. ' +
|
|
38
|
+
'(API version 2025-09-03)',
|
|
38
39
|
inputSchema,
|
|
39
40
|
}, async ({ query, filter, sort, start_cursor, page_size }) => {
|
|
40
41
|
try {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { NotionClient } from '../notion-client.js';
|
|
3
|
+
export declare function registerUpdateDataSource(server: McpServer, notion: NotionClient): void;
|
|
4
|
+
//# sourceMappingURL=update-data-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-data-source.d.ts","sourceRoot":"","sources":["../../../src/tools/update-data-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAYvD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CA6BtF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { formatResponse, handleError } from '../utils/index.js';
|
|
3
|
+
// Minimal schema for MCP (full validation by Notion API)
|
|
4
|
+
const inputSchema = {
|
|
5
|
+
data_source_id: z.string().describe('Data source ID'),
|
|
6
|
+
properties: z
|
|
7
|
+
.record(z.string(), z.any())
|
|
8
|
+
.optional()
|
|
9
|
+
.describe('Properties to add/update/delete (set to null to delete)'),
|
|
10
|
+
};
|
|
11
|
+
export function registerUpdateDataSource(server, notion) {
|
|
12
|
+
server.registerTool('update-data-source', {
|
|
13
|
+
description: 'Update a data source schema (properties/columns). ' +
|
|
14
|
+
'Use this to add, update, or delete properties. Set a property to null to delete it. ' +
|
|
15
|
+
'(API version 2025-09-03)',
|
|
16
|
+
inputSchema,
|
|
17
|
+
}, async ({ data_source_id, properties }) => {
|
|
18
|
+
try {
|
|
19
|
+
const params = { data_source_id };
|
|
20
|
+
if (properties !== undefined) {
|
|
21
|
+
params.properties = properties;
|
|
22
|
+
}
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
+
const response = await notion.dataSources.update(params);
|
|
25
|
+
return formatResponse(response);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return handleError(error);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-database.d.ts","sourceRoot":"","sources":["../../../src/tools/update-database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAevD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"update-database.d.ts","sourceRoot":"","sources":["../../../src/tools/update-database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAevD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAuDpF"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { formatResponse, handleError } from '../utils/index.js';
|
|
3
3
|
// Minimal schema for MCP (full validation by Notion API)
|
|
4
|
+
// Note: Properties (schema) updates should use update-data-source in API 2025-09-03
|
|
4
5
|
const inputSchema = {
|
|
5
6
|
database_id: z.string().describe('Database ID'),
|
|
6
7
|
title: z.array(z.any()).optional().describe('New title'),
|
|
7
8
|
description: z.array(z.any()).optional().describe('New description'),
|
|
8
|
-
|
|
9
|
-
icon: z.any().optional().describe('Icon (null to remove)'),
|
|
9
|
+
icon: z.any().optional().describe('Icon object { type: "emoji", emoji: "📝" } or null to remove. Emoji must be an actual emoji character.'),
|
|
10
10
|
cover: z.any().optional().describe('Cover (null to remove)'),
|
|
11
11
|
is_inline: z.boolean().optional().describe('Inline database'),
|
|
12
12
|
archived: z.boolean().optional().describe('Archive status'),
|
|
13
13
|
};
|
|
14
14
|
export function registerUpdateDatabase(server, notion) {
|
|
15
15
|
server.registerTool('update-database', {
|
|
16
|
-
description: 'Update
|
|
17
|
-
'
|
|
16
|
+
description: 'Update a Notion database container. Can modify title, description, icon, cover, inline status, and archive status. ' +
|
|
17
|
+
'For schema (properties/columns) updates, use update-data-source instead. (API version 2025-09-03)',
|
|
18
18
|
inputSchema,
|
|
19
|
-
}, async ({ database_id, title, description,
|
|
19
|
+
}, async ({ database_id, title, description, icon, cover, is_inline, archived }) => {
|
|
20
20
|
try {
|
|
21
21
|
const params = {
|
|
22
22
|
database_id,
|
|
@@ -27,9 +27,6 @@ export function registerUpdateDatabase(server, notion) {
|
|
|
27
27
|
if (description !== undefined) {
|
|
28
28
|
params.description = description;
|
|
29
29
|
}
|
|
30
|
-
if (properties !== undefined) {
|
|
31
|
-
params.properties = properties;
|
|
32
|
-
}
|
|
33
30
|
if (icon !== undefined) {
|
|
34
31
|
params.icon = icon;
|
|
35
32
|
}
|
|
@@ -5,7 +5,7 @@ const inputSchema = {
|
|
|
5
5
|
page_id: z.string().describe('Page ID'),
|
|
6
6
|
properties: z.record(z.string(), z.any()).optional().describe('Properties to update'),
|
|
7
7
|
archived: z.boolean().optional().describe('Archive the page'),
|
|
8
|
-
icon: z.any().optional().describe('Page icon
|
|
8
|
+
icon: z.any().optional().describe('Page icon { type: "emoji", emoji: "📝" } or { type: "external", external: { url: "..." } }, or null to remove. Emoji must be an actual emoji character.'),
|
|
9
9
|
cover: z.any().optional().describe('Cover image (null to remove)'),
|
|
10
10
|
};
|
|
11
11
|
export function registerUpdatePage(server, notion) {
|
package/package.json
CHANGED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import type { NotionClient } from '../notion-client.js';
|
|
3
|
-
export declare function registerQueryDatabase(server: McpServer, notion: NotionClient): void;
|
|
4
|
-
//# sourceMappingURL=query-database.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-database.d.ts","sourceRoot":"","sources":["../../../src/tools/query-database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AA8BvD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAoDnF"}
|