notion-mcp-server 0.1.0__tar.gz
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.
- notion_mcp_server-0.1.0/.env.example +10 -0
- notion_mcp_server-0.1.0/.gitignore +53 -0
- notion_mcp_server-0.1.0/LICENSE +21 -0
- notion_mcp_server-0.1.0/PKG-INFO +311 -0
- notion_mcp_server-0.1.0/README.md +273 -0
- notion_mcp_server-0.1.0/pyproject.toml +78 -0
- notion_mcp_server-0.1.0/src/notion_mcp/__init__.py +3 -0
- notion_mcp_server-0.1.0/src/notion_mcp/client.py +11 -0
- notion_mcp_server-0.1.0/src/notion_mcp/config.py +20 -0
- notion_mcp_server-0.1.0/src/notion_mcp/helpers/__init__.py +0 -0
- notion_mcp_server-0.1.0/src/notion_mcp/helpers/blocks_to_markdown.py +116 -0
- notion_mcp_server-0.1.0/src/notion_mcp/helpers/cache.py +33 -0
- notion_mcp_server-0.1.0/src/notion_mcp/helpers/errors.py +59 -0
- notion_mcp_server-0.1.0/src/notion_mcp/helpers/markdown_to_blocks.py +233 -0
- notion_mcp_server-0.1.0/src/notion_mcp/helpers/property_builder.py +191 -0
- notion_mcp_server-0.1.0/src/notion_mcp/helpers/url_parser.py +48 -0
- notion_mcp_server-0.1.0/src/notion_mcp/server.py +303 -0
- notion_mcp_server-0.1.0/src/notion_mcp/tools/__init__.py +0 -0
- notion_mcp_server-0.1.0/src/notion_mcp/tools/blocks.py +173 -0
- notion_mcp_server-0.1.0/src/notion_mcp/tools/comments.py +47 -0
- notion_mcp_server-0.1.0/src/notion_mcp/tools/databases.py +246 -0
- notion_mcp_server-0.1.0/src/notion_mcp/tools/pages.py +335 -0
- notion_mcp_server-0.1.0/src/notion_mcp/tools/productivity.py +356 -0
- notion_mcp_server-0.1.0/src/notion_mcp/tools/search.py +54 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Get from: https://www.notion.so/my-integrations
|
|
2
|
+
NOTION_TOKEN=secret_your_integration_token_here
|
|
3
|
+
|
|
4
|
+
# Default privacy: "private" or "public"
|
|
5
|
+
DEFAULT_PRIVACY=private
|
|
6
|
+
|
|
7
|
+
# Default parent page for new pages (when no parent specified)
|
|
8
|
+
# Use a top-level page like "Getting Started" or a custom "📚 My Workspace"
|
|
9
|
+
# Leave empty to require parent_id always
|
|
10
|
+
DEFAULT_PARENT_PAGE_ID=
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Python-generated files
|
|
2
|
+
Python
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
*.so
|
|
7
|
+
.Python
|
|
8
|
+
build/
|
|
9
|
+
develop-eggs/
|
|
10
|
+
dist/
|
|
11
|
+
downloads/
|
|
12
|
+
eggs/
|
|
13
|
+
.eggs/
|
|
14
|
+
lib/
|
|
15
|
+
lib64/
|
|
16
|
+
parts/
|
|
17
|
+
sdist/
|
|
18
|
+
var/
|
|
19
|
+
wheels/
|
|
20
|
+
share/python-wheels/
|
|
21
|
+
*.egg-info/
|
|
22
|
+
.installed.cfg
|
|
23
|
+
*.egg
|
|
24
|
+
MANIFEST
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# Virtual environments
|
|
28
|
+
.venv/
|
|
29
|
+
venv/
|
|
30
|
+
ENV/
|
|
31
|
+
env/
|
|
32
|
+
.mcp.json
|
|
33
|
+
.env
|
|
34
|
+
# IDE
|
|
35
|
+
.vscode/
|
|
36
|
+
.idea/
|
|
37
|
+
.claude/
|
|
38
|
+
.codemie/
|
|
39
|
+
*.swp
|
|
40
|
+
*.swo
|
|
41
|
+
*~
|
|
42
|
+
.DS_Store
|
|
43
|
+
|
|
44
|
+
# Build
|
|
45
|
+
dist/
|
|
46
|
+
build/
|
|
47
|
+
*.egg-info/
|
|
48
|
+
|
|
49
|
+
# uv
|
|
50
|
+
.uv/
|
|
51
|
+
# (uv.lock should be committed!)
|
|
52
|
+
# OS
|
|
53
|
+
Thumbs.db
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kuldeep Jha
|
|
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.
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: notion-mcp-server
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Powerful MCP server for Notion - read, create, search, and manage pages and databases through Claude
|
|
5
|
+
Project-URL: Homepage, https://github.com/KuldeepJha5176/notion-mcp-server
|
|
6
|
+
Project-URL: Documentation, https://github.com/KuldeepJha5176/notion-mcp-server#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/KuldeepJha5176/notion-mcp-server
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/KuldeepJha5176/notion-mcp-server/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/KuldeepJha5176/notion-mcp-server/releases
|
|
10
|
+
Author-email: Kuldeep Jha <ranacjha@gmail.com>
|
|
11
|
+
Maintainer-email: Kuldeep Jha <ranacjha@gmail.com>
|
|
12
|
+
License: MIT
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Keywords: ai,anthropic,automation,claude,mcp,model-context-protocol,notion,notion-api,productivity
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Topic :: Office/Business
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
|
+
Classifier: Topic :: Utilities
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Requires-Dist: fastmcp>=3.3.1
|
|
30
|
+
Requires-Dist: httpx>=0.28.1
|
|
31
|
+
Requires-Dist: notion-client>=3.1.0
|
|
32
|
+
Requires-Dist: python-dotenv>=1.2.2
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
|
|
39
|
+
# Notion MCP Server
|
|
40
|
+
|
|
41
|
+
> 🚀 Powerful Notion integration for Claude — read, create, search, and manage your entire Notion workspace through natural language.
|
|
42
|
+
|
|
43
|
+
[](https://pypi.org/project/notion-mcp-server/)
|
|
44
|
+
[](https://www.python.org/downloads/)
|
|
45
|
+
[](https://opensource.org/licenses/MIT)
|
|
46
|
+
[](https://modelcontextprotocol.io)
|
|
47
|
+
|
|
48
|
+
## ✨ Features
|
|
49
|
+
|
|
50
|
+
- 🔍 **Smart Search** — Find pages and databases instantly
|
|
51
|
+
- 📄 **Page Management** — Create, read, update, archive, duplicate pages
|
|
52
|
+
- 🎨 **Full Markdown Support** — Seamless markdown ↔ Notion blocks conversion
|
|
53
|
+
- 🗂 **Database Operations** — Query with filters, sort, bulk add rows
|
|
54
|
+
- ⚡ **Productivity Shortcuts** — Quick notes, daily journal, task management
|
|
55
|
+
- 🧱 **Block-Level Control** — Read, update, delete individual blocks
|
|
56
|
+
- 💬 **Comments Support** — Add and read page comments
|
|
57
|
+
- 🎓 **Learning Dashboard** — Track AI/ML or any learning database progress
|
|
58
|
+
- 🔒 **Privacy First** — All pages private by default
|
|
59
|
+
- ⚡ **Fast & Async** — Built with FastMCP, schema caching, auto-retry
|
|
60
|
+
|
|
61
|
+
## 🎬 What You Can Do
|
|
62
|
+
|
|
63
|
+
Ask Claude things like:
|
|
64
|
+
|
|
65
|
+
- *"Search my Notion for 'machine learning'"*
|
|
66
|
+
- *"Create a page called 'Project Plan' with a roadmap"*
|
|
67
|
+
- *"Add 20 AI/ML topics to my Topics database"*
|
|
68
|
+
- *"Show me all tasks marked Critical priority"*
|
|
69
|
+
- *"What's on my schedule today?"*
|
|
70
|
+
- *"Add a quick note: meeting was great"*
|
|
71
|
+
- *"Show my learning dashboard"*
|
|
72
|
+
|
|
73
|
+
## 📦 Installation
|
|
74
|
+
|
|
75
|
+
### Prerequisites
|
|
76
|
+
|
|
77
|
+
- Python 3.10 or higher
|
|
78
|
+
- A Notion account
|
|
79
|
+
- Claude Desktop, Claude Code, or any MCP-compatible client
|
|
80
|
+
|
|
81
|
+
### Install with uv (recommended)
|
|
82
|
+
|
|
83
|
+
\`\`\`bash
|
|
84
|
+
uv tool install notion-mcp-server
|
|
85
|
+
\`\`\`
|
|
86
|
+
|
|
87
|
+
### Install with pip
|
|
88
|
+
|
|
89
|
+
\`\`\`bash
|
|
90
|
+
pip install notion-mcp-server
|
|
91
|
+
\`\`\`
|
|
92
|
+
|
|
93
|
+
## 🔧 Setup (5 minutes)
|
|
94
|
+
|
|
95
|
+
### Step 1: Create a Notion Integration
|
|
96
|
+
|
|
97
|
+
1. Go to [notion.so/my-integrations](https://www.notion.so/my-integrations)
|
|
98
|
+
2. Click **"+ New integration"**
|
|
99
|
+
3. Name it (e.g., "Claude MCP")
|
|
100
|
+
4. Select your workspace
|
|
101
|
+
5. Click **Submit**
|
|
102
|
+
6. Copy the **Internal Integration Secret** (starts with `secret_` or `ntn_`)
|
|
103
|
+
|
|
104
|
+
### Step 2: Share Pages with Integration
|
|
105
|
+
|
|
106
|
+
For each page or database you want Claude to access:
|
|
107
|
+
|
|
108
|
+
1. Open the page in Notion
|
|
109
|
+
2. Click **"..."** menu (top right)
|
|
110
|
+
3. Click **"Connections"** → **"Connect to"**
|
|
111
|
+
4. Select your integration
|
|
112
|
+
|
|
113
|
+
> 💡 **Pro tip:** Sharing a parent page automatically gives access to all sub-pages. Create one "Workspace Hub" page and share that.
|
|
114
|
+
|
|
115
|
+
### Step 3: Configure Claude Desktop
|
|
116
|
+
|
|
117
|
+
**Mac/Linux:**
|
|
118
|
+
\`\`\`bash
|
|
119
|
+
~/Library/Application\ Support/Claude/claude_desktop_config.json
|
|
120
|
+
\`\`\`
|
|
121
|
+
|
|
122
|
+
**Windows:**
|
|
123
|
+
\`\`\`
|
|
124
|
+
%APPDATA%\\Claude\\claude_desktop_config.json
|
|
125
|
+
\`\`\`
|
|
126
|
+
|
|
127
|
+
Add this configuration:
|
|
128
|
+
|
|
129
|
+
\`\`\`json
|
|
130
|
+
{
|
|
131
|
+
"mcpServers": {
|
|
132
|
+
"notion": {
|
|
133
|
+
"command": "uvx",
|
|
134
|
+
"args": ["notion-mcp-server"],
|
|
135
|
+
"env": {
|
|
136
|
+
"NOTION_TOKEN": "secret_your_token_here",
|
|
137
|
+
"DEFAULT_PRIVACY": "private",
|
|
138
|
+
"DEFAULT_PARENT_PAGE_ID": "optional_parent_page_id"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
\`\`\`
|
|
144
|
+
|
|
145
|
+
### Step 4: Restart Claude Desktop
|
|
146
|
+
|
|
147
|
+
**Fully quit** (including system tray) and reopen.
|
|
148
|
+
|
|
149
|
+
### Step 5: Test It!
|
|
150
|
+
|
|
151
|
+
Ask Claude:
|
|
152
|
+
> *"Check my Notion connection"*
|
|
153
|
+
|
|
154
|
+
If you see ✅ Connected — you're all set!
|
|
155
|
+
|
|
156
|
+
## 🛠 Available Tools (22 Total)
|
|
157
|
+
|
|
158
|
+
### 🔍 Search & Connection
|
|
159
|
+
- `search_notion(query, filter_type, limit)` — Search pages/databases
|
|
160
|
+
- `check_connection()` — Verify integration works
|
|
161
|
+
|
|
162
|
+
### 📄 Page Operations
|
|
163
|
+
- `get_page(page_id_or_url)` — Read page as markdown
|
|
164
|
+
- `create_page(title, parent_id, content, privacy)` — Create new page
|
|
165
|
+
- `append_to_page(page_id_or_url, content)` — Append content
|
|
166
|
+
- `update_page_title(page_id_or_url, new_title)` — Rename page
|
|
167
|
+
- `archive_page(page_id_or_url)` — Soft-delete page
|
|
168
|
+
- `restore_page(page_id_or_url)` — Restore archived page
|
|
169
|
+
- `duplicate_page(page_id_or_url, new_title)` — Clone page
|
|
170
|
+
|
|
171
|
+
### 🗂 Database Operations
|
|
172
|
+
- `list_databases()` — List all databases
|
|
173
|
+
- `get_database_schema(database_id_or_url)` — See columns and types
|
|
174
|
+
- `query_database(database_id_or_url, filters, sort_by, ...)` — Query rows
|
|
175
|
+
- `add_database_row(database_id_or_url, properties, content)` — Add row
|
|
176
|
+
- `update_database_row(page_id_or_url, properties)` — Update row
|
|
177
|
+
- `bulk_add_rows(database_id_or_url, rows)` — Add many rows at once
|
|
178
|
+
|
|
179
|
+
### 🧱 Block Operations
|
|
180
|
+
- `get_block_children(block_id_or_url)` — Read all blocks
|
|
181
|
+
- `update_block(block_id_or_url, new_content)` — Edit a block
|
|
182
|
+
- `delete_block(block_id_or_url)` — Delete a block
|
|
183
|
+
|
|
184
|
+
### 💬 Comments
|
|
185
|
+
- `add_comment(page_id_or_url, comment_text)` — Add a comment
|
|
186
|
+
- `get_comments(page_id_or_url)` — Read comments
|
|
187
|
+
|
|
188
|
+
### ⚡ Productivity Shortcuts
|
|
189
|
+
- `quick_note(content, title)` — Quick note to default parent
|
|
190
|
+
- `daily_journal(entry)` — Append timestamped entry to journal
|
|
191
|
+
- `add_task(title, due_date, priority, status, tags)` — Smart-add task
|
|
192
|
+
- `get_today_tasks()` — Tasks due today or overdue
|
|
193
|
+
- `complete_task(task_name_or_id)` — Mark task done
|
|
194
|
+
- `get_recent_pages(limit)` — Recently edited pages
|
|
195
|
+
- `learning_dashboard()` — Learning progress overview
|
|
196
|
+
|
|
197
|
+
## 🎨 Markdown Support
|
|
198
|
+
|
|
199
|
+
Full bidirectional conversion:
|
|
200
|
+
|
|
201
|
+
| Markdown | Notion Block |
|
|
202
|
+
|----------|--------------|
|
|
203
|
+
| `# Heading 1` | Heading 1 |
|
|
204
|
+
| `## Heading 2` | Heading 2 |
|
|
205
|
+
| `### Heading 3` | Heading 3 |
|
|
206
|
+
| `- bullet` | Bulleted list |
|
|
207
|
+
| `1. numbered` | Numbered list |
|
|
208
|
+
| `- [ ] todo` | To-do (unchecked) |
|
|
209
|
+
| `- [x] done` | To-do (checked) |
|
|
210
|
+
| `> quote` | Quote block |
|
|
211
|
+
| ` ```code``` ` | Code block |
|
|
212
|
+
| `---` | Divider |
|
|
213
|
+
| `**bold**` | Bold text |
|
|
214
|
+
| `*italic*` | Italic text |
|
|
215
|
+
| `` `inline code` `` | Inline code |
|
|
216
|
+
| `[link](url)` | Link |
|
|
217
|
+
|
|
218
|
+
## ⚙️ Configuration
|
|
219
|
+
|
|
220
|
+
| Environment Variable | Required | Description |
|
|
221
|
+
|---------------------|----------|-------------|
|
|
222
|
+
| \`NOTION_TOKEN\` | ✅ Yes | Your integration secret |
|
|
223
|
+
| \`DEFAULT_PRIVACY\` | ❌ No | \`private\` (default) or \`public\` |
|
|
224
|
+
| \`DEFAULT_PARENT_PAGE_ID\` | ❌ No | Default parent for new pages |
|
|
225
|
+
|
|
226
|
+
## 💡 Examples
|
|
227
|
+
|
|
228
|
+
### Example 1: Bulk Create Database Entries
|
|
229
|
+
|
|
230
|
+
> *"Add 20 AI/ML topics to my Topics database with appropriate categories and priorities"*
|
|
231
|
+
|
|
232
|
+
Claude uses \`bulk_add_rows\` to create all 20 entries with one command.
|
|
233
|
+
|
|
234
|
+
### Example 2: Daily Workflow
|
|
235
|
+
|
|
236
|
+
\`\`\`
|
|
237
|
+
You: "What tasks do I have today?"
|
|
238
|
+
Claude: [shows your today_tasks]
|
|
239
|
+
|
|
240
|
+
You: "Mark 'Review PR #123' as done"
|
|
241
|
+
Claude: [calls complete_task]
|
|
242
|
+
|
|
243
|
+
You: "Add a journal entry: Productive day, finished 5 tasks"
|
|
244
|
+
Claude: [appends to journal page]
|
|
245
|
+
\`\`\`
|
|
246
|
+
|
|
247
|
+
### Example 3: Smart Querying
|
|
248
|
+
|
|
249
|
+
> *"Show me high-priority topics that aren't started yet, sorted by category"*
|
|
250
|
+
|
|
251
|
+
Claude builds a complex filter and returns organized results.
|
|
252
|
+
|
|
253
|
+
## 🐛 Troubleshooting
|
|
254
|
+
|
|
255
|
+
### "Object not found" errors
|
|
256
|
+
The page/database isn't shared with your integration.
|
|
257
|
+
**Fix:** Open page → ... → Connections → Connect to your integration.
|
|
258
|
+
|
|
259
|
+
### Empty search results
|
|
260
|
+
You haven't shared any pages with the integration yet.
|
|
261
|
+
**Fix:** Share at least one page (and its sub-pages will inherit access).
|
|
262
|
+
|
|
263
|
+
### "Cannot create workspace-level page"
|
|
264
|
+
Internal integrations can't create pages at workspace root.
|
|
265
|
+
**Fix:** Set \`DEFAULT_PARENT_PAGE_ID\` in your config to a parent page.
|
|
266
|
+
|
|
267
|
+
### Rate limit errors
|
|
268
|
+
Notion API allows ~3 requests/second.
|
|
269
|
+
**Fix:** Server has built-in auto-retry with exponential backoff.
|
|
270
|
+
|
|
271
|
+
## 🤝 Contributing
|
|
272
|
+
|
|
273
|
+
Pull requests welcome! For major changes, please open an issue first.
|
|
274
|
+
|
|
275
|
+
\`\`\`bash
|
|
276
|
+
git clone https://github.com/KuldeepJha5176/notion-mcp-server
|
|
277
|
+
cd notion-mcp-server
|
|
278
|
+
uv sync
|
|
279
|
+
uv run pytest
|
|
280
|
+
\`\`\`
|
|
281
|
+
|
|
282
|
+
## 🔒 Security
|
|
283
|
+
|
|
284
|
+
- Each user provides their own Notion token
|
|
285
|
+
- Tokens stored locally in user's environment
|
|
286
|
+
- Server never collects, stores, or transmits user data
|
|
287
|
+
- All communication is direct: User → Notion API
|
|
288
|
+
- See [SECURITY.md](SECURITY.md) for vulnerability reporting
|
|
289
|
+
|
|
290
|
+
## 📄 License
|
|
291
|
+
|
|
292
|
+
MIT — see [LICENSE](LICENSE) file.
|
|
293
|
+
|
|
294
|
+
## 🙏 Acknowledgments
|
|
295
|
+
|
|
296
|
+
Built with:
|
|
297
|
+
- [FastMCP](https://github.com/jlowin/fastmcp) — Excellent MCP framework
|
|
298
|
+
- [notion-client](https://github.com/ramnes/notion-sdk-py) — Notion Python SDK
|
|
299
|
+
- [Anthropic MCP](https://modelcontextprotocol.io) — The protocol that makes it possible
|
|
300
|
+
|
|
301
|
+
## ⭐ Show Your Support
|
|
302
|
+
|
|
303
|
+
If this server helps you, please:
|
|
304
|
+
- ⭐ **Star** this repo
|
|
305
|
+
- 🐦 **Tweet** about it
|
|
306
|
+
- 📝 **Blog** about how you use it
|
|
307
|
+
- 🐛 **Report bugs** to make it better
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
**Made with ❤️ for the Claude community by [Kuldeep Jha](https://github.com/KuldeepJha5176)**
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# Notion MCP Server
|
|
2
|
+
|
|
3
|
+
> 🚀 Powerful Notion integration for Claude — read, create, search, and manage your entire Notion workspace through natural language.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/notion-mcp-server/)
|
|
6
|
+
[](https://www.python.org/downloads/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://modelcontextprotocol.io)
|
|
9
|
+
|
|
10
|
+
## ✨ Features
|
|
11
|
+
|
|
12
|
+
- 🔍 **Smart Search** — Find pages and databases instantly
|
|
13
|
+
- 📄 **Page Management** — Create, read, update, archive, duplicate pages
|
|
14
|
+
- 🎨 **Full Markdown Support** — Seamless markdown ↔ Notion blocks conversion
|
|
15
|
+
- 🗂 **Database Operations** — Query with filters, sort, bulk add rows
|
|
16
|
+
- ⚡ **Productivity Shortcuts** — Quick notes, daily journal, task management
|
|
17
|
+
- 🧱 **Block-Level Control** — Read, update, delete individual blocks
|
|
18
|
+
- 💬 **Comments Support** — Add and read page comments
|
|
19
|
+
- 🎓 **Learning Dashboard** — Track AI/ML or any learning database progress
|
|
20
|
+
- 🔒 **Privacy First** — All pages private by default
|
|
21
|
+
- ⚡ **Fast & Async** — Built with FastMCP, schema caching, auto-retry
|
|
22
|
+
|
|
23
|
+
## 🎬 What You Can Do
|
|
24
|
+
|
|
25
|
+
Ask Claude things like:
|
|
26
|
+
|
|
27
|
+
- *"Search my Notion for 'machine learning'"*
|
|
28
|
+
- *"Create a page called 'Project Plan' with a roadmap"*
|
|
29
|
+
- *"Add 20 AI/ML topics to my Topics database"*
|
|
30
|
+
- *"Show me all tasks marked Critical priority"*
|
|
31
|
+
- *"What's on my schedule today?"*
|
|
32
|
+
- *"Add a quick note: meeting was great"*
|
|
33
|
+
- *"Show my learning dashboard"*
|
|
34
|
+
|
|
35
|
+
## 📦 Installation
|
|
36
|
+
|
|
37
|
+
### Prerequisites
|
|
38
|
+
|
|
39
|
+
- Python 3.10 or higher
|
|
40
|
+
- A Notion account
|
|
41
|
+
- Claude Desktop, Claude Code, or any MCP-compatible client
|
|
42
|
+
|
|
43
|
+
### Install with uv (recommended)
|
|
44
|
+
|
|
45
|
+
\`\`\`bash
|
|
46
|
+
uv tool install notion-mcp-server
|
|
47
|
+
\`\`\`
|
|
48
|
+
|
|
49
|
+
### Install with pip
|
|
50
|
+
|
|
51
|
+
\`\`\`bash
|
|
52
|
+
pip install notion-mcp-server
|
|
53
|
+
\`\`\`
|
|
54
|
+
|
|
55
|
+
## 🔧 Setup (5 minutes)
|
|
56
|
+
|
|
57
|
+
### Step 1: Create a Notion Integration
|
|
58
|
+
|
|
59
|
+
1. Go to [notion.so/my-integrations](https://www.notion.so/my-integrations)
|
|
60
|
+
2. Click **"+ New integration"**
|
|
61
|
+
3. Name it (e.g., "Claude MCP")
|
|
62
|
+
4. Select your workspace
|
|
63
|
+
5. Click **Submit**
|
|
64
|
+
6. Copy the **Internal Integration Secret** (starts with `secret_` or `ntn_`)
|
|
65
|
+
|
|
66
|
+
### Step 2: Share Pages with Integration
|
|
67
|
+
|
|
68
|
+
For each page or database you want Claude to access:
|
|
69
|
+
|
|
70
|
+
1. Open the page in Notion
|
|
71
|
+
2. Click **"..."** menu (top right)
|
|
72
|
+
3. Click **"Connections"** → **"Connect to"**
|
|
73
|
+
4. Select your integration
|
|
74
|
+
|
|
75
|
+
> 💡 **Pro tip:** Sharing a parent page automatically gives access to all sub-pages. Create one "Workspace Hub" page and share that.
|
|
76
|
+
|
|
77
|
+
### Step 3: Configure Claude Desktop
|
|
78
|
+
|
|
79
|
+
**Mac/Linux:**
|
|
80
|
+
\`\`\`bash
|
|
81
|
+
~/Library/Application\ Support/Claude/claude_desktop_config.json
|
|
82
|
+
\`\`\`
|
|
83
|
+
|
|
84
|
+
**Windows:**
|
|
85
|
+
\`\`\`
|
|
86
|
+
%APPDATA%\\Claude\\claude_desktop_config.json
|
|
87
|
+
\`\`\`
|
|
88
|
+
|
|
89
|
+
Add this configuration:
|
|
90
|
+
|
|
91
|
+
\`\`\`json
|
|
92
|
+
{
|
|
93
|
+
"mcpServers": {
|
|
94
|
+
"notion": {
|
|
95
|
+
"command": "uvx",
|
|
96
|
+
"args": ["notion-mcp-server"],
|
|
97
|
+
"env": {
|
|
98
|
+
"NOTION_TOKEN": "secret_your_token_here",
|
|
99
|
+
"DEFAULT_PRIVACY": "private",
|
|
100
|
+
"DEFAULT_PARENT_PAGE_ID": "optional_parent_page_id"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
\`\`\`
|
|
106
|
+
|
|
107
|
+
### Step 4: Restart Claude Desktop
|
|
108
|
+
|
|
109
|
+
**Fully quit** (including system tray) and reopen.
|
|
110
|
+
|
|
111
|
+
### Step 5: Test It!
|
|
112
|
+
|
|
113
|
+
Ask Claude:
|
|
114
|
+
> *"Check my Notion connection"*
|
|
115
|
+
|
|
116
|
+
If you see ✅ Connected — you're all set!
|
|
117
|
+
|
|
118
|
+
## 🛠 Available Tools (22 Total)
|
|
119
|
+
|
|
120
|
+
### 🔍 Search & Connection
|
|
121
|
+
- `search_notion(query, filter_type, limit)` — Search pages/databases
|
|
122
|
+
- `check_connection()` — Verify integration works
|
|
123
|
+
|
|
124
|
+
### 📄 Page Operations
|
|
125
|
+
- `get_page(page_id_or_url)` — Read page as markdown
|
|
126
|
+
- `create_page(title, parent_id, content, privacy)` — Create new page
|
|
127
|
+
- `append_to_page(page_id_or_url, content)` — Append content
|
|
128
|
+
- `update_page_title(page_id_or_url, new_title)` — Rename page
|
|
129
|
+
- `archive_page(page_id_or_url)` — Soft-delete page
|
|
130
|
+
- `restore_page(page_id_or_url)` — Restore archived page
|
|
131
|
+
- `duplicate_page(page_id_or_url, new_title)` — Clone page
|
|
132
|
+
|
|
133
|
+
### 🗂 Database Operations
|
|
134
|
+
- `list_databases()` — List all databases
|
|
135
|
+
- `get_database_schema(database_id_or_url)` — See columns and types
|
|
136
|
+
- `query_database(database_id_or_url, filters, sort_by, ...)` — Query rows
|
|
137
|
+
- `add_database_row(database_id_or_url, properties, content)` — Add row
|
|
138
|
+
- `update_database_row(page_id_or_url, properties)` — Update row
|
|
139
|
+
- `bulk_add_rows(database_id_or_url, rows)` — Add many rows at once
|
|
140
|
+
|
|
141
|
+
### 🧱 Block Operations
|
|
142
|
+
- `get_block_children(block_id_or_url)` — Read all blocks
|
|
143
|
+
- `update_block(block_id_or_url, new_content)` — Edit a block
|
|
144
|
+
- `delete_block(block_id_or_url)` — Delete a block
|
|
145
|
+
|
|
146
|
+
### 💬 Comments
|
|
147
|
+
- `add_comment(page_id_or_url, comment_text)` — Add a comment
|
|
148
|
+
- `get_comments(page_id_or_url)` — Read comments
|
|
149
|
+
|
|
150
|
+
### ⚡ Productivity Shortcuts
|
|
151
|
+
- `quick_note(content, title)` — Quick note to default parent
|
|
152
|
+
- `daily_journal(entry)` — Append timestamped entry to journal
|
|
153
|
+
- `add_task(title, due_date, priority, status, tags)` — Smart-add task
|
|
154
|
+
- `get_today_tasks()` — Tasks due today or overdue
|
|
155
|
+
- `complete_task(task_name_or_id)` — Mark task done
|
|
156
|
+
- `get_recent_pages(limit)` — Recently edited pages
|
|
157
|
+
- `learning_dashboard()` — Learning progress overview
|
|
158
|
+
|
|
159
|
+
## 🎨 Markdown Support
|
|
160
|
+
|
|
161
|
+
Full bidirectional conversion:
|
|
162
|
+
|
|
163
|
+
| Markdown | Notion Block |
|
|
164
|
+
|----------|--------------|
|
|
165
|
+
| `# Heading 1` | Heading 1 |
|
|
166
|
+
| `## Heading 2` | Heading 2 |
|
|
167
|
+
| `### Heading 3` | Heading 3 |
|
|
168
|
+
| `- bullet` | Bulleted list |
|
|
169
|
+
| `1. numbered` | Numbered list |
|
|
170
|
+
| `- [ ] todo` | To-do (unchecked) |
|
|
171
|
+
| `- [x] done` | To-do (checked) |
|
|
172
|
+
| `> quote` | Quote block |
|
|
173
|
+
| ` ```code``` ` | Code block |
|
|
174
|
+
| `---` | Divider |
|
|
175
|
+
| `**bold**` | Bold text |
|
|
176
|
+
| `*italic*` | Italic text |
|
|
177
|
+
| `` `inline code` `` | Inline code |
|
|
178
|
+
| `[link](url)` | Link |
|
|
179
|
+
|
|
180
|
+
## ⚙️ Configuration
|
|
181
|
+
|
|
182
|
+
| Environment Variable | Required | Description |
|
|
183
|
+
|---------------------|----------|-------------|
|
|
184
|
+
| \`NOTION_TOKEN\` | ✅ Yes | Your integration secret |
|
|
185
|
+
| \`DEFAULT_PRIVACY\` | ❌ No | \`private\` (default) or \`public\` |
|
|
186
|
+
| \`DEFAULT_PARENT_PAGE_ID\` | ❌ No | Default parent for new pages |
|
|
187
|
+
|
|
188
|
+
## 💡 Examples
|
|
189
|
+
|
|
190
|
+
### Example 1: Bulk Create Database Entries
|
|
191
|
+
|
|
192
|
+
> *"Add 20 AI/ML topics to my Topics database with appropriate categories and priorities"*
|
|
193
|
+
|
|
194
|
+
Claude uses \`bulk_add_rows\` to create all 20 entries with one command.
|
|
195
|
+
|
|
196
|
+
### Example 2: Daily Workflow
|
|
197
|
+
|
|
198
|
+
\`\`\`
|
|
199
|
+
You: "What tasks do I have today?"
|
|
200
|
+
Claude: [shows your today_tasks]
|
|
201
|
+
|
|
202
|
+
You: "Mark 'Review PR #123' as done"
|
|
203
|
+
Claude: [calls complete_task]
|
|
204
|
+
|
|
205
|
+
You: "Add a journal entry: Productive day, finished 5 tasks"
|
|
206
|
+
Claude: [appends to journal page]
|
|
207
|
+
\`\`\`
|
|
208
|
+
|
|
209
|
+
### Example 3: Smart Querying
|
|
210
|
+
|
|
211
|
+
> *"Show me high-priority topics that aren't started yet, sorted by category"*
|
|
212
|
+
|
|
213
|
+
Claude builds a complex filter and returns organized results.
|
|
214
|
+
|
|
215
|
+
## 🐛 Troubleshooting
|
|
216
|
+
|
|
217
|
+
### "Object not found" errors
|
|
218
|
+
The page/database isn't shared with your integration.
|
|
219
|
+
**Fix:** Open page → ... → Connections → Connect to your integration.
|
|
220
|
+
|
|
221
|
+
### Empty search results
|
|
222
|
+
You haven't shared any pages with the integration yet.
|
|
223
|
+
**Fix:** Share at least one page (and its sub-pages will inherit access).
|
|
224
|
+
|
|
225
|
+
### "Cannot create workspace-level page"
|
|
226
|
+
Internal integrations can't create pages at workspace root.
|
|
227
|
+
**Fix:** Set \`DEFAULT_PARENT_PAGE_ID\` in your config to a parent page.
|
|
228
|
+
|
|
229
|
+
### Rate limit errors
|
|
230
|
+
Notion API allows ~3 requests/second.
|
|
231
|
+
**Fix:** Server has built-in auto-retry with exponential backoff.
|
|
232
|
+
|
|
233
|
+
## 🤝 Contributing
|
|
234
|
+
|
|
235
|
+
Pull requests welcome! For major changes, please open an issue first.
|
|
236
|
+
|
|
237
|
+
\`\`\`bash
|
|
238
|
+
git clone https://github.com/KuldeepJha5176/notion-mcp-server
|
|
239
|
+
cd notion-mcp-server
|
|
240
|
+
uv sync
|
|
241
|
+
uv run pytest
|
|
242
|
+
\`\`\`
|
|
243
|
+
|
|
244
|
+
## 🔒 Security
|
|
245
|
+
|
|
246
|
+
- Each user provides their own Notion token
|
|
247
|
+
- Tokens stored locally in user's environment
|
|
248
|
+
- Server never collects, stores, or transmits user data
|
|
249
|
+
- All communication is direct: User → Notion API
|
|
250
|
+
- See [SECURITY.md](SECURITY.md) for vulnerability reporting
|
|
251
|
+
|
|
252
|
+
## 📄 License
|
|
253
|
+
|
|
254
|
+
MIT — see [LICENSE](LICENSE) file.
|
|
255
|
+
|
|
256
|
+
## 🙏 Acknowledgments
|
|
257
|
+
|
|
258
|
+
Built with:
|
|
259
|
+
- [FastMCP](https://github.com/jlowin/fastmcp) — Excellent MCP framework
|
|
260
|
+
- [notion-client](https://github.com/ramnes/notion-sdk-py) — Notion Python SDK
|
|
261
|
+
- [Anthropic MCP](https://modelcontextprotocol.io) — The protocol that makes it possible
|
|
262
|
+
|
|
263
|
+
## ⭐ Show Your Support
|
|
264
|
+
|
|
265
|
+
If this server helps you, please:
|
|
266
|
+
- ⭐ **Star** this repo
|
|
267
|
+
- 🐦 **Tweet** about it
|
|
268
|
+
- 📝 **Blog** about how you use it
|
|
269
|
+
- 🐛 **Report bugs** to make it better
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
**Made with ❤️ for the Claude community by [Kuldeep Jha](https://github.com/KuldeepJha5176)**
|