@notionhq/notion-mcp-server 1.8.1 → 1.9.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/Dockerfile CHANGED
@@ -1,3 +1,4 @@
1
+ # Generated by https://smithery.ai. See: https://smithery.ai/docs/build/project-config
1
2
  # syntax=docker/dockerfile:1
2
3
 
3
4
  # Use Node.js LTS as the base image
@@ -33,4 +34,4 @@ COPY --from=builder /usr/local/bin/notion-mcp-server /usr/local/bin/notion-mcp-s
33
34
  ENV OPENAPI_MCP_HEADERS="{}"
34
35
 
35
36
  # Set entrypoint
36
- ENTRYPOINT ["notion-mcp-server"]
37
+ ENTRYPOINT ["notion-mcp-server"]
package/README.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Notion MCP Server
2
2
 
3
+ > [!NOTE]
4
+ >
5
+ > We’ve introduced **Notion MCP**, a remote MCP server with the following improvements:
6
+ > - Easy installation via standard OAuth. No need to fiddle with JSON or API token anymore.
7
+ > - Powerful tools tailored to AI agents. These tools are designed with optimized token consumption in mind.
8
+ >
9
+ > Learn more and try it out [here](https://developers.notion.com/docs/mcp)
10
+
11
+
3
12
  ![notion-mcp-sm](https://github.com/user-attachments/assets/6c07003c-8455-4636-b298-d60ffdf46cd8)
4
13
 
5
14
  This project implements an [MCP server](https://spec.modelcontextprotocol.io/) for the [Notion API](https://developers.notion.com/reference/intro).
@@ -22,15 +31,39 @@ For example, you can create a read-only integration token by giving only "Read c
22
31
  #### 2. Connecting content to integration:
23
32
  Ensure relevant pages and databases are connected to your integration.
24
33
 
25
- To do this, you'll need to visit that page, and click on the 3 dots, and select "Connect to integration".
34
+ To do this, visit the **Access** tab in your internal integration settings. Edit access and select the pages you'd like to use.
35
+ ![Integration Access tab](docs/images/integration-access.png)
36
+
37
+ ![Edit integration access](docs/images/page-access-edit.png)
38
+
39
+ Alternatively, you can grant page access individually. You'll need to visit the target page, and click on the 3 dots, and select "Connect to integration".
26
40
 
27
41
  ![Adding Integration Token to Notion Connections](docs/images/connections.png)
28
42
 
29
43
  #### 3. Adding MCP config to your client:
30
44
 
31
45
  ##### Using npm:
46
+
47
+ **Cursor & Claude:**
48
+
32
49
  Add the following to your `.cursor/mcp.json` or `claude_desktop_config.json` (MacOS: `~/Library/Application\ Support/Claude/claude_desktop_config.json`)
33
50
 
51
+ **Option 1: Using NOTION_TOKEN (recommended)**
52
+ ```javascript
53
+ {
54
+ "mcpServers": {
55
+ "notionApi": {
56
+ "command": "npx",
57
+ "args": ["-y", "@notionhq/notion-mcp-server"],
58
+ "env": {
59
+ "NOTION_TOKEN": "ntn_****"
60
+ }
61
+ }
62
+ }
63
+ }
64
+ ```
65
+
66
+ **Option 2: Using OPENAPI_MCP_HEADERS (for advanced use cases)**
34
67
  ```javascript
35
68
  {
36
69
  "mcpServers": {
@@ -45,6 +78,27 @@ Add the following to your `.cursor/mcp.json` or `claude_desktop_config.json` (Ma
45
78
  }
46
79
  ```
47
80
 
81
+ **Zed**
82
+
83
+ Add the following to your `settings.json`
84
+
85
+ ```json
86
+ {
87
+ "context_servers": {
88
+ "some-context-server": {
89
+ "command": {
90
+ "path": "npx",
91
+ "args": ["-y", "@notionhq/notion-mcp-server"],
92
+ "env": {
93
+ "OPENAPI_MCP_HEADERS": "{\"Authorization\": \"Bearer ntn_****\", \"Notion-Version\": \"2022-06-28\" }"
94
+ }
95
+ },
96
+ "settings": {}
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
48
102
  ##### Using Docker:
49
103
 
50
104
  There are two options for running the MCP server with Docker:
@@ -53,6 +107,28 @@ There are two options for running the MCP server with Docker:
53
107
 
54
108
  Add the following to your `.cursor/mcp.json` or `claude_desktop_config.json`:
55
109
 
110
+ **Using NOTION_TOKEN (recommended):**
111
+ ```javascript
112
+ {
113
+ "mcpServers": {
114
+ "notionApi": {
115
+ "command": "docker",
116
+ "args": [
117
+ "run",
118
+ "--rm",
119
+ "-i",
120
+ "-e", "NOTION_TOKEN",
121
+ "mcp/notion"
122
+ ],
123
+ "env": {
124
+ "NOTION_TOKEN": "ntn_****"
125
+ }
126
+ }
127
+ }
128
+ }
129
+ ```
130
+
131
+ **Using OPENAPI_MCP_HEADERS (for advanced use cases):**
56
132
  ```javascript
57
133
  {
58
134
  "mcpServers": {
@@ -83,11 +159,31 @@ This approach:
83
159
  You can also build and run the Docker image locally. First, build the Docker image:
84
160
 
85
161
  ```bash
86
- docker-compose build
162
+ docker compose build
87
163
  ```
88
164
 
89
165
  Then, add the following to your `.cursor/mcp.json` or `claude_desktop_config.json`:
90
166
 
167
+ **Using NOTION_TOKEN (recommended):**
168
+ ```javascript
169
+ {
170
+ "mcpServers": {
171
+ "notionApi": {
172
+ "command": "docker",
173
+ "args": [
174
+ "run",
175
+ "--rm",
176
+ "-i",
177
+ "-e",
178
+ "NOTION_TOKEN=ntn_****",
179
+ "notion-mcp-server"
180
+ ]
181
+ }
182
+ }
183
+ }
184
+ ```
185
+
186
+ **Using OPENAPI_MCP_HEADERS (for advanced use cases):**
91
187
  ```javascript
92
188
  {
93
189
  "mcpServers": {
@@ -110,6 +206,87 @@ Don't forget to replace `ntn_****` with your integration secret. Find it from yo
110
206
 
111
207
  ![Copying your Integration token from the Configuration tab in the developer portal](https://github.com/user-attachments/assets/67b44536-5333-49fa-809c-59581bf5370a)
112
208
 
209
+
210
+ #### Installing via Smithery
211
+
212
+ [![smithery badge](https://smithery.ai/badge/@makenotion/notion-mcp-server)](https://smithery.ai/server/@makenotion/notion-mcp-server)
213
+
214
+ To install Notion API Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@makenotion/notion-mcp-server):
215
+
216
+ ```bash
217
+ npx -y @smithery/cli install @makenotion/notion-mcp-server --client claude
218
+ ```
219
+
220
+ ### Transport Options
221
+
222
+ The Notion MCP Server supports two transport modes:
223
+
224
+ #### STDIO Transport (Default)
225
+ The default transport mode uses standard input/output for communication. This is the standard MCP transport used by most clients like Claude Desktop.
226
+
227
+ ```bash
228
+ # Run with default stdio transport
229
+ npx @notionhq/notion-mcp-server
230
+
231
+ # Or explicitly specify stdio
232
+ npx @notionhq/notion-mcp-server --transport stdio
233
+ ```
234
+
235
+ #### Streamable HTTP Transport
236
+ For web-based applications or clients that prefer HTTP communication, you can use the Streamable HTTP transport:
237
+
238
+ ```bash
239
+ # Run with Streamable HTTP transport on port 3000 (default)
240
+ npx @notionhq/notion-mcp-server --transport http
241
+
242
+ # Run on a custom port
243
+ npx @notionhq/notion-mcp-server --transport http --port 8080
244
+
245
+ # Run with a custom authentication token
246
+ npx @notionhq/notion-mcp-server --transport http --auth-token "your-secret-token"
247
+ ```
248
+
249
+ When using Streamable HTTP transport, the server will be available at `http://0.0.0.0:<port>/mcp`.
250
+
251
+ ##### Authentication
252
+ The Streamable HTTP transport requires bearer token authentication for security. You have three options:
253
+
254
+ **Option 1: Auto-generated token (recommended for development)**
255
+ ```bash
256
+ npx @notionhq/notion-mcp-server --transport http
257
+ ```
258
+ The server will generate a secure random token and display it in the console:
259
+ ```
260
+ Generated auth token: a1b2c3d4e5f6789abcdef0123456789abcdef0123456789abcdef0123456789ab
261
+ Use this token in the Authorization header: Bearer a1b2c3d4e5f6789abcdef0123456789abcdef0123456789abcdef0123456789ab
262
+ ```
263
+
264
+ **Option 2: Custom token via command line (recommended for production)**
265
+ ```bash
266
+ npx @notionhq/notion-mcp-server --transport http --auth-token "your-secret-token"
267
+ ```
268
+
269
+ **Option 3: Custom token via environment variable (recommended for production)**
270
+ ```bash
271
+ AUTH_TOKEN="your-secret-token" npx @notionhq/notion-mcp-server --transport http
272
+ ```
273
+
274
+ The command line argument `--auth-token` takes precedence over the `AUTH_TOKEN` environment variable if both are provided.
275
+
276
+ ##### Making HTTP Requests
277
+ All requests to the Streamable HTTP transport must include the bearer token in the Authorization header:
278
+
279
+ ```bash
280
+ # Example request
281
+ curl -H "Authorization: Bearer your-token-here" \
282
+ -H "Content-Type: application/json" \
283
+ -H "mcp-session-id: your-session-id" \
284
+ -d '{"jsonrpc": "2.0", "method": "initialize", "params": {}, "id": 1}' \
285
+ http://localhost:3000/mcp
286
+ ```
287
+
288
+ **Note:** Make sure to set either the `NOTION_TOKEN` environment variable (recommended) or the `OPENAPI_MCP_HEADERS` environment variable with your Notion integration token when using either transport mode.
289
+
113
290
  ### Examples
114
291
 
115
292
  1. Using the following instruction