ldraney-notion-mcp 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl
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.
- {ldraney_notion_mcp-0.1.3.dist-info → ldraney_notion_mcp-0.1.5.dist-info}/METADATA +1 -1
- ldraney_notion_mcp-0.1.5.dist-info/RECORD +15 -0
- notion_mcp/tools/blocks.py +21 -16
- notion_mcp/tools/comments.py +13 -12
- notion_mcp/tools/databases.py +49 -51
- notion_mcp/tools/pages.py +33 -30
- notion_mcp/tools/search.py +12 -11
- notion_mcp/tools/users.py +5 -2
- ldraney_notion_mcp-0.1.3.dist-info/RECORD +0 -15
- {ldraney_notion_mcp-0.1.3.dist-info → ldraney_notion_mcp-0.1.5.dist-info}/WHEEL +0 -0
- {ldraney_notion_mcp-0.1.3.dist-info → ldraney_notion_mcp-0.1.5.dist-info}/entry_points.txt +0 -0
- {ldraney_notion_mcp-0.1.3.dist-info → ldraney_notion_mcp-0.1.5.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
notion_mcp/__init__.py,sha256=Wy2Os0Ww79mbGvySlmb9IVPW9t-oUPO246-8PppLqUI,105
|
|
2
|
+
notion_mcp/__main__.py,sha256=8iuAFwnkWnvYNFN7qLyPeNa-qlKbzQMO6b7li5yrRFU,83
|
|
3
|
+
notion_mcp/server.py,sha256=eJPqXMqo1AGVTozjWkON8ys1oe5wraiB1dmHz1wqU6M,2324
|
|
4
|
+
notion_mcp/tools/__init__.py,sha256=Dak6lGr2H_aG5SYNAfi_1lACTqwAPDAAjIyVmGja8as,496
|
|
5
|
+
notion_mcp/tools/blocks.py,sha256=c9fBMrr1LFv_2kkt13Be4R_T9kZzR67Ptik82dA0foM,3487
|
|
6
|
+
notion_mcp/tools/comments.py,sha256=OoH5hhWgmuHn94fzIemL8I7OhmOp7QnaCNTZ35qfECc,2436
|
|
7
|
+
notion_mcp/tools/databases.py,sha256=d9NF695xB-1Z8KXEYuPD-evjQUC4FonXHa_t_TxGNHw,10044
|
|
8
|
+
notion_mcp/tools/pages.py,sha256=pBQdwEB5aZc1yUulnlsVfJ1NMT5Fr-rcFeXX8mCtodM,5233
|
|
9
|
+
notion_mcp/tools/search.py,sha256=7rhAFS4ROJFqlJvFFuLiCd2KJ_qrVeidqHtSVH-v0Rs,1700
|
|
10
|
+
notion_mcp/tools/users.py,sha256=psYUJm0PT--xVfSSQA1XzBCzNewgDbmCjkF1_XTcsoE,1117
|
|
11
|
+
ldraney_notion_mcp-0.1.5.dist-info/METADATA,sha256=hKqlj4yFn03agAJ56ElkHMh1LH5pQi4WU7GH-Sz0JWw,4542
|
|
12
|
+
ldraney_notion_mcp-0.1.5.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
13
|
+
ldraney_notion_mcp-0.1.5.dist-info/entry_points.txt,sha256=rv-l84lsnJ83vSLGoJlfoQsc-IQHRevhU1_NiIZyI3M,62
|
|
14
|
+
ldraney_notion_mcp-0.1.5.dist-info/top_level.txt,sha256=lFXGlrgRGHEtgwNKPCohd0H0PxUReLzGdpd6YzborzM,11
|
|
15
|
+
ldraney_notion_mcp-0.1.5.dist-info/RECORD,,
|
notion_mcp/tools/blocks.py
CHANGED
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Annotated, Any
|
|
7
|
+
|
|
8
|
+
from pydantic import Field
|
|
7
9
|
|
|
8
10
|
from ..server import mcp, get_client, _parse_json, _error_response
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
@mcp.tool()
|
|
12
|
-
def get_block(
|
|
14
|
+
def get_block(
|
|
15
|
+
block_id: Annotated[str, Field(description="The UUID of the block to retrieve")],
|
|
16
|
+
) -> str:
|
|
13
17
|
"""Retrieve a Notion block by its ID.
|
|
14
18
|
|
|
15
19
|
Args:
|
|
@@ -24,9 +28,9 @@ def get_block(block_id: str) -> str:
|
|
|
24
28
|
|
|
25
29
|
@mcp.tool()
|
|
26
30
|
def get_block_children(
|
|
27
|
-
block_id: str,
|
|
28
|
-
start_cursor: str | None = None,
|
|
29
|
-
page_size: int | None = None,
|
|
31
|
+
block_id: Annotated[str, Field(description="The UUID of the parent block")],
|
|
32
|
+
start_cursor: Annotated[str | None, Field(description="Cursor for pagination")] = None,
|
|
33
|
+
page_size: Annotated[int | None, Field(description="Number of results per page")] = None,
|
|
30
34
|
) -> str:
|
|
31
35
|
"""List child blocks of a Notion block.
|
|
32
36
|
|
|
@@ -47,14 +51,15 @@ def get_block_children(
|
|
|
47
51
|
|
|
48
52
|
|
|
49
53
|
@mcp.tool()
|
|
50
|
-
def append_block_children(
|
|
54
|
+
def append_block_children(
|
|
55
|
+
block_id: Annotated[str, Field(description="The UUID of the parent block to append children to")],
|
|
56
|
+
children: Annotated[str | list, Field(description="JSON string or array for a list of block objects to append")],
|
|
57
|
+
) -> str:
|
|
51
58
|
"""Append child blocks to a Notion block.
|
|
52
59
|
|
|
53
|
-
IMPORTANT: The children parameter must be passed as a JSON-encoded string, NOT as an object.
|
|
54
|
-
|
|
55
60
|
Args:
|
|
56
61
|
block_id: The UUID of the parent block to append children to.
|
|
57
|
-
children: JSON string for a list of block objects to append.
|
|
62
|
+
children: JSON string or array for a list of block objects to append.
|
|
58
63
|
"""
|
|
59
64
|
try:
|
|
60
65
|
result = get_client().append_block_children(
|
|
@@ -68,17 +73,15 @@ def append_block_children(block_id: str, children: str) -> str:
|
|
|
68
73
|
|
|
69
74
|
@mcp.tool()
|
|
70
75
|
def update_block(
|
|
71
|
-
block_id: str,
|
|
72
|
-
content: str | None = None,
|
|
76
|
+
block_id: Annotated[str, Field(description="The UUID of the block to update")],
|
|
77
|
+
content: Annotated[str | dict | None, Field(description="JSON string or object of block properties to update. The keys depend on the block type, e.g. {\"paragraph\": {\"rich_text\": [...]}}")] = None,
|
|
73
78
|
) -> str:
|
|
74
79
|
"""Update a Notion block.
|
|
75
80
|
|
|
76
|
-
IMPORTANT: The content parameter must be passed as a JSON-encoded string, NOT as an object.
|
|
77
|
-
|
|
78
81
|
Args:
|
|
79
82
|
block_id: The UUID of the block to update.
|
|
80
|
-
content: JSON string of block properties to update. The keys depend
|
|
81
|
-
on the block type (e.g.
|
|
83
|
+
content: JSON string or object of block properties to update. The keys depend
|
|
84
|
+
on the block type (e.g. {"paragraph": {"rich_text": [...]}}).
|
|
82
85
|
"""
|
|
83
86
|
try:
|
|
84
87
|
kwargs: dict[str, Any] = {}
|
|
@@ -91,7 +94,9 @@ def update_block(
|
|
|
91
94
|
|
|
92
95
|
|
|
93
96
|
@mcp.tool()
|
|
94
|
-
def delete_block(
|
|
97
|
+
def delete_block(
|
|
98
|
+
block_id: Annotated[str, Field(description="The UUID of the block to delete")],
|
|
99
|
+
) -> str:
|
|
95
100
|
"""Delete (archive) a Notion block.
|
|
96
101
|
|
|
97
102
|
Args:
|
notion_mcp/tools/comments.py
CHANGED
|
@@ -3,25 +3,26 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
|
+
from typing import Annotated
|
|
7
|
+
|
|
8
|
+
from pydantic import Field
|
|
6
9
|
|
|
7
10
|
from ..server import mcp, get_client, _parse_json, _error_response
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
@mcp.tool()
|
|
11
14
|
def create_comment(
|
|
12
|
-
parent: str,
|
|
13
|
-
rich_text: str,
|
|
14
|
-
discussion_id: str | None = None,
|
|
15
|
+
parent: Annotated[str | dict, Field(description="JSON string or object for the parent, e.g. {\"page_id\": \"...\"}")],
|
|
16
|
+
rich_text: Annotated[str | list, Field(description="JSON string or array for the rich-text content, e.g. [{\"type\": \"text\", \"text\": {\"content\": \"Hello!\"}}]")],
|
|
17
|
+
discussion_id: Annotated[str | None, Field(description="UUID of an existing discussion thread to reply to. Omit to start a new top-level comment.")] = None,
|
|
15
18
|
) -> str:
|
|
16
19
|
"""Create a comment on a Notion page or block.
|
|
17
20
|
|
|
18
|
-
IMPORTANT: parent and rich_text must be passed as JSON-encoded strings, NOT as objects.
|
|
19
|
-
|
|
20
21
|
Args:
|
|
21
|
-
parent: JSON string for the parent
|
|
22
|
-
e.g.
|
|
23
|
-
rich_text: JSON string for the rich-text content
|
|
24
|
-
e.g.
|
|
22
|
+
parent: JSON string or object for the parent,
|
|
23
|
+
e.g. {"page_id": "..."}.
|
|
24
|
+
rich_text: JSON string or array for the rich-text content,
|
|
25
|
+
e.g. [{"type": "text", "text": {"content": "Hello!"}}].
|
|
25
26
|
discussion_id: Optional UUID of an existing discussion thread
|
|
26
27
|
to reply to. Omit to start a new top-level comment.
|
|
27
28
|
"""
|
|
@@ -41,9 +42,9 @@ def create_comment(
|
|
|
41
42
|
|
|
42
43
|
@mcp.tool()
|
|
43
44
|
def get_comments(
|
|
44
|
-
block_id: str,
|
|
45
|
-
start_cursor: str | None = None,
|
|
46
|
-
page_size: int | None = None,
|
|
45
|
+
block_id: Annotated[str, Field(description="The UUID of the block or page to list comments for")],
|
|
46
|
+
start_cursor: Annotated[str | None, Field(description="Cursor for pagination")] = None,
|
|
47
|
+
page_size: Annotated[int | None, Field(description="Number of results per page")] = None,
|
|
47
48
|
) -> str:
|
|
48
49
|
"""List comments on a Notion block or page.
|
|
49
50
|
|
notion_mcp/tools/databases.py
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Annotated, Any
|
|
7
|
+
|
|
8
|
+
from pydantic import Field
|
|
7
9
|
|
|
8
10
|
from ..server import mcp, get_client, _parse_json, _error_response
|
|
9
11
|
|
|
@@ -15,22 +17,20 @@ from ..server import mcp, get_client, _parse_json, _error_response
|
|
|
15
17
|
|
|
16
18
|
@mcp.tool()
|
|
17
19
|
def create_database(
|
|
18
|
-
parent: str,
|
|
19
|
-
title: str,
|
|
20
|
-
initial_data_source: str | None = None,
|
|
20
|
+
parent: Annotated[str | dict, Field(description="JSON string or object for the parent, e.g. {\"type\": \"page_id\", \"page_id\": \"...\"}")],
|
|
21
|
+
title: Annotated[str | list, Field(description="JSON string or array for the title rich-text array, e.g. [{\"type\": \"text\", \"text\": {\"content\": \"My DB\"}}]")],
|
|
22
|
+
initial_data_source: Annotated[str | dict | None, Field(description="JSON string or object for the initial data source configuration including properties")] = None,
|
|
21
23
|
) -> str:
|
|
22
24
|
"""Create a new Notion database.
|
|
23
25
|
|
|
24
26
|
In Notion API v2025-09-03, database properties live on data sources.
|
|
25
27
|
Pass properties inside initial_data_source.properties.
|
|
26
28
|
|
|
27
|
-
IMPORTANT: All structured parameters must be passed as JSON-encoded strings, NOT as objects.
|
|
28
|
-
|
|
29
29
|
Args:
|
|
30
|
-
parent: JSON string for the parent
|
|
31
|
-
title: JSON string for the title rich-text array,
|
|
32
|
-
e.g.
|
|
33
|
-
initial_data_source: Optional JSON string for the initial data source
|
|
30
|
+
parent: JSON string or object for the parent, e.g. {"type": "page_id", "page_id": "..."}.
|
|
31
|
+
title: JSON string or array for the title rich-text array,
|
|
32
|
+
e.g. [{"type": "text", "text": {"content": "My DB"}}].
|
|
33
|
+
initial_data_source: Optional JSON string or object for the initial data source
|
|
34
34
|
configuration including properties.
|
|
35
35
|
"""
|
|
36
36
|
try:
|
|
@@ -45,7 +45,9 @@ def create_database(
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
@mcp.tool()
|
|
48
|
-
def get_database(
|
|
48
|
+
def get_database(
|
|
49
|
+
database_id: Annotated[str, Field(description="The UUID of the database to retrieve")],
|
|
50
|
+
) -> str:
|
|
49
51
|
"""Retrieve a Notion database by its ID.
|
|
50
52
|
|
|
51
53
|
Note: In v2025-09-03 the response contains data_sources but NOT
|
|
@@ -63,22 +65,20 @@ def get_database(database_id: str) -> str:
|
|
|
63
65
|
|
|
64
66
|
@mcp.tool()
|
|
65
67
|
def update_database(
|
|
66
|
-
database_id: str,
|
|
67
|
-
title: str | None = None,
|
|
68
|
-
description: str | None = None,
|
|
69
|
-
icon: str | None = None,
|
|
70
|
-
cover: str | None = None,
|
|
68
|
+
database_id: Annotated[str, Field(description="The UUID of the database to update")],
|
|
69
|
+
title: Annotated[str | list | None, Field(description="JSON string or array for the new title rich-text array")] = None,
|
|
70
|
+
description: Annotated[str | list | None, Field(description="JSON string or array for the description rich-text array")] = None,
|
|
71
|
+
icon: Annotated[str | dict | None, Field(description="JSON string or object for the database icon, e.g. {\"type\": \"emoji\", \"emoji\": \"...\"}")] = None,
|
|
72
|
+
cover: Annotated[str | dict | None, Field(description="JSON string or object for the database cover, e.g. {\"type\": \"external\", \"external\": {\"url\": \"https://...\"}}")] = None,
|
|
71
73
|
) -> str:
|
|
72
74
|
"""Update a Notion database.
|
|
73
75
|
|
|
74
|
-
IMPORTANT: All structured parameters must be passed as JSON-encoded strings, NOT as objects.
|
|
75
|
-
|
|
76
76
|
Args:
|
|
77
77
|
database_id: The UUID of the database to update.
|
|
78
|
-
title: Optional JSON string for the new title rich-text array.
|
|
79
|
-
description: Optional JSON string for the description rich-text array.
|
|
80
|
-
icon: Optional JSON string for the database icon.
|
|
81
|
-
cover: Optional JSON string for the database cover.
|
|
78
|
+
title: Optional JSON string or array for the new title rich-text array.
|
|
79
|
+
description: Optional JSON string or array for the description rich-text array.
|
|
80
|
+
icon: Optional JSON string or object for the database icon.
|
|
81
|
+
cover: Optional JSON string or object for the database cover.
|
|
82
82
|
"""
|
|
83
83
|
try:
|
|
84
84
|
kwargs: dict[str, Any] = {}
|
|
@@ -97,7 +97,9 @@ def update_database(
|
|
|
97
97
|
|
|
98
98
|
|
|
99
99
|
@mcp.tool()
|
|
100
|
-
def archive_database(
|
|
100
|
+
def archive_database(
|
|
101
|
+
database_id: Annotated[str, Field(description="The UUID of the database to archive")],
|
|
102
|
+
) -> str:
|
|
101
103
|
"""Archive a Notion database.
|
|
102
104
|
|
|
103
105
|
Args:
|
|
@@ -112,23 +114,21 @@ def archive_database(database_id: str) -> str:
|
|
|
112
114
|
|
|
113
115
|
@mcp.tool()
|
|
114
116
|
def query_database(
|
|
115
|
-
database_id: str,
|
|
116
|
-
filter: str | None = None,
|
|
117
|
-
sorts: str | None = None,
|
|
118
|
-
start_cursor: str | None = None,
|
|
119
|
-
page_size: int | None = None,
|
|
117
|
+
database_id: Annotated[str, Field(description="The UUID of the database to query")],
|
|
118
|
+
filter: Annotated[str | dict | None, Field(description="JSON string or object for a filter, e.g. {\"property\": \"Status\", \"select\": {\"equals\": \"Done\"}}")] = None,
|
|
119
|
+
sorts: Annotated[str | list | None, Field(description="JSON string or array for a list of sort objects, e.g. [{\"property\": \"Created\", \"direction\": \"descending\"}]")] = None,
|
|
120
|
+
start_cursor: Annotated[str | None, Field(description="Cursor for pagination")] = None,
|
|
121
|
+
page_size: Annotated[int | None, Field(description="Number of results per page")] = None,
|
|
120
122
|
) -> str:
|
|
121
123
|
"""Query a Notion database for pages/rows.
|
|
122
124
|
|
|
123
125
|
Automatically resolves the first data source and queries it.
|
|
124
126
|
If you already know the data source ID, use query_data_source instead.
|
|
125
127
|
|
|
126
|
-
IMPORTANT: filter and sorts must be passed as JSON-encoded strings, NOT as objects.
|
|
127
|
-
|
|
128
128
|
Args:
|
|
129
129
|
database_id: The UUID of the database to query.
|
|
130
|
-
filter: Optional JSON string for a filter
|
|
131
|
-
sorts: Optional JSON string for a list of sort objects.
|
|
130
|
+
filter: Optional JSON string or object for a filter.
|
|
131
|
+
sorts: Optional JSON string or array for a list of sort objects.
|
|
132
132
|
start_cursor: Optional cursor for pagination.
|
|
133
133
|
page_size: Optional number of results per page.
|
|
134
134
|
"""
|
|
@@ -151,7 +151,9 @@ def query_database(
|
|
|
151
151
|
|
|
152
152
|
|
|
153
153
|
@mcp.tool()
|
|
154
|
-
def get_data_source(
|
|
154
|
+
def get_data_source(
|
|
155
|
+
data_source_id: Annotated[str, Field(description="The UUID of the data source to retrieve")],
|
|
156
|
+
) -> str:
|
|
155
157
|
"""Retrieve a Notion data source (includes properties).
|
|
156
158
|
|
|
157
159
|
Args:
|
|
@@ -166,16 +168,14 @@ def get_data_source(data_source_id: str) -> str:
|
|
|
166
168
|
|
|
167
169
|
@mcp.tool()
|
|
168
170
|
def update_data_source(
|
|
169
|
-
data_source_id: str,
|
|
170
|
-
properties: str | None = None,
|
|
171
|
+
data_source_id: Annotated[str, Field(description="The UUID of the data source to update")],
|
|
172
|
+
properties: Annotated[str | dict | None, Field(description="JSON string or object for properties to update")] = None,
|
|
171
173
|
) -> str:
|
|
172
174
|
"""Update a Notion data source.
|
|
173
175
|
|
|
174
|
-
IMPORTANT: The properties parameter must be passed as a JSON-encoded string, NOT as an object.
|
|
175
|
-
|
|
176
176
|
Args:
|
|
177
177
|
data_source_id: The UUID of the data source to update.
|
|
178
|
-
properties: Optional JSON string for properties to update.
|
|
178
|
+
properties: Optional JSON string or object for properties to update.
|
|
179
179
|
"""
|
|
180
180
|
try:
|
|
181
181
|
kwargs: dict[str, Any] = {}
|
|
@@ -189,20 +189,18 @@ def update_data_source(
|
|
|
189
189
|
|
|
190
190
|
@mcp.tool()
|
|
191
191
|
def query_data_source(
|
|
192
|
-
data_source_id: str,
|
|
193
|
-
filter: str | None = None,
|
|
194
|
-
sorts: str | None = None,
|
|
195
|
-
start_cursor: str | None = None,
|
|
196
|
-
page_size: int | None = None,
|
|
192
|
+
data_source_id: Annotated[str, Field(description="The UUID of the data source to query")],
|
|
193
|
+
filter: Annotated[str | dict | None, Field(description="JSON string or object for a filter, e.g. {\"property\": \"Status\", \"select\": {\"equals\": \"Done\"}}")] = None,
|
|
194
|
+
sorts: Annotated[str | list | None, Field(description="JSON string or array for a list of sort objects, e.g. [{\"property\": \"Created\", \"direction\": \"descending\"}]")] = None,
|
|
195
|
+
start_cursor: Annotated[str | None, Field(description="Cursor for pagination")] = None,
|
|
196
|
+
page_size: Annotated[int | None, Field(description="Number of results per page")] = None,
|
|
197
197
|
) -> str:
|
|
198
198
|
"""Query rows in a Notion data source.
|
|
199
199
|
|
|
200
|
-
IMPORTANT: filter and sorts must be passed as JSON-encoded strings, NOT as objects.
|
|
201
|
-
|
|
202
200
|
Args:
|
|
203
201
|
data_source_id: The UUID of the data source to query.
|
|
204
|
-
filter: Optional JSON string for a filter
|
|
205
|
-
sorts: Optional JSON string for a list of sort objects.
|
|
202
|
+
filter: Optional JSON string or object for a filter.
|
|
203
|
+
sorts: Optional JSON string or array for a list of sort objects.
|
|
206
204
|
start_cursor: Optional cursor for pagination.
|
|
207
205
|
page_size: Optional number of results per page.
|
|
208
206
|
"""
|
|
@@ -221,10 +219,10 @@ def query_data_source(
|
|
|
221
219
|
|
|
222
220
|
@mcp.tool()
|
|
223
221
|
def list_data_source_templates(
|
|
224
|
-
data_source_id: str,
|
|
225
|
-
name: str | None = None,
|
|
226
|
-
start_cursor: str | None = None,
|
|
227
|
-
page_size: int | None = None,
|
|
222
|
+
data_source_id: Annotated[str, Field(description="The UUID of the data source")],
|
|
223
|
+
name: Annotated[str | None, Field(description="Name filter for templates")] = None,
|
|
224
|
+
start_cursor: Annotated[str | None, Field(description="Cursor for pagination")] = None,
|
|
225
|
+
page_size: Annotated[int | None, Field(description="Number of results per page")] = None,
|
|
228
226
|
) -> str:
|
|
229
227
|
"""List templates for a Notion data source.
|
|
230
228
|
|
notion_mcp/tools/pages.py
CHANGED
|
@@ -3,30 +3,30 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Annotated, Any
|
|
7
|
+
|
|
8
|
+
from pydantic import Field
|
|
7
9
|
|
|
8
10
|
from ..server import mcp, get_client, _parse_json, _error_response
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
@mcp.tool()
|
|
12
14
|
def create_page(
|
|
13
|
-
parent: str,
|
|
14
|
-
properties: str,
|
|
15
|
-
children: str | None = None,
|
|
16
|
-
template: str | None = None,
|
|
15
|
+
parent: Annotated[str | dict, Field(description="JSON string or object for the parent, e.g. {\"type\": \"page_id\", \"page_id\": \"...\"}")],
|
|
16
|
+
properties: Annotated[str | dict, Field(description="JSON string or object for the page properties mapping")],
|
|
17
|
+
children: Annotated[str | list | None, Field(description="JSON string or array for a list of block children to append. Cannot be used together with template.")] = None,
|
|
18
|
+
template: Annotated[str | dict | None, Field(description="JSON string or object for a data-source template, e.g. {\"type\": \"none\"}, {\"type\": \"default\"}, or {\"type\": \"template_id\", \"template_id\": \"<uuid>\"}")] = None,
|
|
17
19
|
) -> str:
|
|
18
20
|
"""Create a new Notion page.
|
|
19
21
|
|
|
20
|
-
IMPORTANT: All structured parameters must be passed as JSON-encoded strings, NOT as objects.
|
|
21
|
-
|
|
22
22
|
Args:
|
|
23
|
-
parent: JSON string for the parent object, e.g.
|
|
24
|
-
properties: JSON string for the page properties mapping.
|
|
25
|
-
children: Optional JSON string for a list of block children to append.
|
|
23
|
+
parent: JSON string or object for the parent object, e.g. {"type": "page_id", "page_id": "..."}.
|
|
24
|
+
properties: JSON string or object for the page properties mapping.
|
|
25
|
+
children: Optional JSON string or array for a list of block children to append.
|
|
26
26
|
Cannot be used together with template.
|
|
27
|
-
template: Optional JSON string for a data-source template, e.g.
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
template: Optional JSON string or object for a data-source template, e.g.
|
|
28
|
+
{"type": "none"}, {"type": "default"}, or
|
|
29
|
+
{"type": "template_id", "template_id": "<uuid>"}.
|
|
30
30
|
"""
|
|
31
31
|
try:
|
|
32
32
|
result = get_client().create_page(
|
|
@@ -41,7 +41,9 @@ def create_page(
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
@mcp.tool()
|
|
44
|
-
def get_page(
|
|
44
|
+
def get_page(
|
|
45
|
+
page_id: Annotated[str, Field(description="The UUID of the page to retrieve")],
|
|
46
|
+
) -> str:
|
|
45
47
|
"""Retrieve a Notion page by its ID.
|
|
46
48
|
|
|
47
49
|
Args:
|
|
@@ -56,23 +58,21 @@ def get_page(page_id: str) -> str:
|
|
|
56
58
|
|
|
57
59
|
@mcp.tool()
|
|
58
60
|
def update_page(
|
|
59
|
-
page_id: str,
|
|
60
|
-
properties: str | None = None,
|
|
61
|
-
erase_content: bool | None = None,
|
|
62
|
-
icon: str | None = None,
|
|
63
|
-
cover: str | None = None,
|
|
61
|
+
page_id: Annotated[str, Field(description="The UUID of the page to update")],
|
|
62
|
+
properties: Annotated[str | dict | None, Field(description="JSON string or object of properties to update")] = None,
|
|
63
|
+
erase_content: Annotated[bool | None, Field(description="If true, clears ALL block content from the page. WARNING: This is destructive and irreversible.")] = None,
|
|
64
|
+
icon: Annotated[str | dict | None, Field(description="JSON string or object for the page icon, e.g. {\"type\": \"emoji\", \"emoji\": \"...\"}")] = None,
|
|
65
|
+
cover: Annotated[str | dict | None, Field(description="JSON string or object for the page cover, e.g. {\"type\": \"external\", \"external\": {\"url\": \"https://...\"}}")] = None,
|
|
64
66
|
) -> str:
|
|
65
67
|
"""Update a Notion page's properties, icon, or cover.
|
|
66
68
|
|
|
67
|
-
IMPORTANT: All structured parameters must be passed as JSON-encoded strings, NOT as objects.
|
|
68
|
-
|
|
69
69
|
Args:
|
|
70
70
|
page_id: The UUID of the page to update.
|
|
71
|
-
properties: Optional JSON string of properties to update.
|
|
71
|
+
properties: Optional JSON string or object of properties to update.
|
|
72
72
|
erase_content: If true, clears ALL block content from the page.
|
|
73
73
|
WARNING: This is destructive and irreversible.
|
|
74
|
-
icon: Optional JSON string for the page icon.
|
|
75
|
-
cover: Optional JSON string for the page cover.
|
|
74
|
+
icon: Optional JSON string or object for the page icon.
|
|
75
|
+
cover: Optional JSON string or object for the page cover.
|
|
76
76
|
"""
|
|
77
77
|
try:
|
|
78
78
|
kwargs: dict[str, Any] = {}
|
|
@@ -93,7 +93,9 @@ def update_page(
|
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
@mcp.tool()
|
|
96
|
-
def archive_page(
|
|
96
|
+
def archive_page(
|
|
97
|
+
page_id: Annotated[str, Field(description="The UUID of the page to archive")],
|
|
98
|
+
) -> str:
|
|
97
99
|
"""Archive (soft-delete) a Notion page.
|
|
98
100
|
|
|
99
101
|
Args:
|
|
@@ -107,15 +109,16 @@ def archive_page(page_id: str) -> str:
|
|
|
107
109
|
|
|
108
110
|
|
|
109
111
|
@mcp.tool()
|
|
110
|
-
def move_page(
|
|
112
|
+
def move_page(
|
|
113
|
+
page_id: Annotated[str, Field(description="The UUID of the page to move")],
|
|
114
|
+
parent: Annotated[str | dict, Field(description="JSON string or object for the new parent, e.g. {\"type\": \"page_id\", \"page_id\": \"...\"}")],
|
|
115
|
+
) -> str:
|
|
111
116
|
"""Move a Notion page to a new parent.
|
|
112
117
|
|
|
113
|
-
IMPORTANT: The parent parameter must be passed as a JSON-encoded string, NOT as an object.
|
|
114
|
-
|
|
115
118
|
Args:
|
|
116
119
|
page_id: The UUID of the page to move.
|
|
117
|
-
parent: JSON string for the new parent object,
|
|
118
|
-
e.g.
|
|
120
|
+
parent: JSON string or object for the new parent object,
|
|
121
|
+
e.g. {"type": "page_id", "page_id": "..."}.
|
|
119
122
|
"""
|
|
120
123
|
try:
|
|
121
124
|
result = get_client().move_page(
|
notion_mcp/tools/search.py
CHANGED
|
@@ -3,28 +3,29 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
|
+
from typing import Annotated
|
|
7
|
+
|
|
8
|
+
from pydantic import Field
|
|
6
9
|
|
|
7
10
|
from ..server import mcp, get_client, _parse_json, _error_response
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
@mcp.tool()
|
|
11
14
|
def search(
|
|
12
|
-
query: str | None = None,
|
|
13
|
-
filter: str | None = None,
|
|
14
|
-
sort: str | None = None,
|
|
15
|
-
start_cursor: str | None = None,
|
|
16
|
-
page_size: int | None = None,
|
|
15
|
+
query: Annotated[str | None, Field(description="Text query to search for")] = None,
|
|
16
|
+
filter: Annotated[str | dict | None, Field(description="JSON string or object for a filter, e.g. {\"value\": \"page\", \"property\": \"object\"}")] = None,
|
|
17
|
+
sort: Annotated[str | dict | None, Field(description="JSON string or object for a sort, e.g. {\"direction\": \"ascending\", \"timestamp\": \"last_edited_time\"}")] = None,
|
|
18
|
+
start_cursor: Annotated[str | None, Field(description="Cursor for pagination")] = None,
|
|
19
|
+
page_size: Annotated[int | None, Field(description="Number of results per page")] = None,
|
|
17
20
|
) -> str:
|
|
18
21
|
"""Search Notion pages and databases.
|
|
19
22
|
|
|
20
|
-
IMPORTANT: filter and sort must be passed as JSON-encoded strings, NOT as objects.
|
|
21
|
-
|
|
22
23
|
Args:
|
|
23
24
|
query: Optional text query to search for.
|
|
24
|
-
filter: Optional JSON string for a filter
|
|
25
|
-
e.g.
|
|
26
|
-
sort: Optional JSON string for a sort
|
|
27
|
-
e.g.
|
|
25
|
+
filter: Optional JSON string or object for a filter,
|
|
26
|
+
e.g. {"value": "page", "property": "object"}.
|
|
27
|
+
sort: Optional JSON string or object for a sort,
|
|
28
|
+
e.g. {"direction": "ascending", "timestamp": "last_edited_time"}.
|
|
28
29
|
start_cursor: Optional cursor for pagination.
|
|
29
30
|
page_size: Optional number of results per page.
|
|
30
31
|
"""
|
notion_mcp/tools/users.py
CHANGED
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
|
+
from typing import Annotated
|
|
7
|
+
|
|
8
|
+
from pydantic import Field
|
|
6
9
|
|
|
7
10
|
from ..server import mcp, get_client, _error_response
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
@mcp.tool()
|
|
11
14
|
def get_users(
|
|
12
|
-
start_cursor: str | None = None,
|
|
13
|
-
page_size: int | None = None,
|
|
15
|
+
start_cursor: Annotated[str | None, Field(description="Cursor for pagination")] = None,
|
|
16
|
+
page_size: Annotated[int | None, Field(description="Number of results per page")] = None,
|
|
14
17
|
) -> str:
|
|
15
18
|
"""List all users in the Notion workspace.
|
|
16
19
|
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
notion_mcp/__init__.py,sha256=Wy2Os0Ww79mbGvySlmb9IVPW9t-oUPO246-8PppLqUI,105
|
|
2
|
-
notion_mcp/__main__.py,sha256=8iuAFwnkWnvYNFN7qLyPeNa-qlKbzQMO6b7li5yrRFU,83
|
|
3
|
-
notion_mcp/server.py,sha256=eJPqXMqo1AGVTozjWkON8ys1oe5wraiB1dmHz1wqU6M,2324
|
|
4
|
-
notion_mcp/tools/__init__.py,sha256=Dak6lGr2H_aG5SYNAfi_1lACTqwAPDAAjIyVmGja8as,496
|
|
5
|
-
notion_mcp/tools/blocks.py,sha256=4PKePYbmzyHuIcjIoqKh1BvtE-a7Gk8zKk6uif9i4dE,2871
|
|
6
|
-
notion_mcp/tools/comments.py,sha256=bDTisXV2r9t2gkbMWgcggKykcGwfTpreNSu5U58KFh0,1889
|
|
7
|
-
notion_mcp/tools/databases.py,sha256=TVlK6gK98_viLv6Dj_s15BdNEkDxNo40jewJ0zJ9J_o,7838
|
|
8
|
-
notion_mcp/tools/pages.py,sha256=ckI-8_m8BauW3kpRy45PqzXVrC5Mkt-RJ2-5-y5cPxc,3940
|
|
9
|
-
notion_mcp/tools/search.py,sha256=ZbhqNQ5dCJ09amdaR0djA5YQQAOBtUJN_yxoMawF0xI,1280
|
|
10
|
-
notion_mcp/tools/users.py,sha256=C0ytVNk7lDpQfcw4Wir39QII97LUtINf62j7fKpD-IQ,945
|
|
11
|
-
ldraney_notion_mcp-0.1.3.dist-info/METADATA,sha256=lwLPAyAbfrK6LoE84N9V3m2oRyXdOEJOzASn45A2aJ4,4542
|
|
12
|
-
ldraney_notion_mcp-0.1.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
13
|
-
ldraney_notion_mcp-0.1.3.dist-info/entry_points.txt,sha256=rv-l84lsnJ83vSLGoJlfoQsc-IQHRevhU1_NiIZyI3M,62
|
|
14
|
-
ldraney_notion_mcp-0.1.3.dist-info/top_level.txt,sha256=lFXGlrgRGHEtgwNKPCohd0H0PxUReLzGdpd6YzborzM,11
|
|
15
|
-
ldraney_notion_mcp-0.1.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|