@notionhq/notion-mcp-server 1.8.1 → 1.9.1

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
@@ -33,4 +33,4 @@ COPY --from=builder /usr/local/bin/notion-mcp-server /usr/local/bin/notion-mcp-s
33
33
  ENV OPENAPI_MCP_HEADERS="{}"
34
34
 
35
35
  # Set entrypoint
36
- ENTRYPOINT ["notion-mcp-server"]
36
+ 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,76 @@ 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
+ ### Transport Options
210
+
211
+ The Notion MCP Server supports two transport modes:
212
+
213
+ #### STDIO Transport (Default)
214
+ The default transport mode uses standard input/output for communication. This is the standard MCP transport used by most clients like Claude Desktop.
215
+
216
+ ```bash
217
+ # Run with default stdio transport
218
+ npx @notionhq/notion-mcp-server
219
+
220
+ # Or explicitly specify stdio
221
+ npx @notionhq/notion-mcp-server --transport stdio
222
+ ```
223
+
224
+ #### Streamable HTTP Transport
225
+ For web-based applications or clients that prefer HTTP communication, you can use the Streamable HTTP transport:
226
+
227
+ ```bash
228
+ # Run with Streamable HTTP transport on port 3000 (default)
229
+ npx @notionhq/notion-mcp-server --transport http
230
+
231
+ # Run on a custom port
232
+ npx @notionhq/notion-mcp-server --transport http --port 8080
233
+
234
+ # Run with a custom authentication token
235
+ npx @notionhq/notion-mcp-server --transport http --auth-token "your-secret-token"
236
+ ```
237
+
238
+ When using Streamable HTTP transport, the server will be available at `http://0.0.0.0:<port>/mcp`.
239
+
240
+ ##### Authentication
241
+ The Streamable HTTP transport requires bearer token authentication for security. You have three options:
242
+
243
+ **Option 1: Auto-generated token (recommended for development)**
244
+ ```bash
245
+ npx @notionhq/notion-mcp-server --transport http
246
+ ```
247
+ The server will generate a secure random token and display it in the console:
248
+ ```
249
+ Generated auth token: a1b2c3d4e5f6789abcdef0123456789abcdef0123456789abcdef0123456789ab
250
+ Use this token in the Authorization header: Bearer a1b2c3d4e5f6789abcdef0123456789abcdef0123456789abcdef0123456789ab
251
+ ```
252
+
253
+ **Option 2: Custom token via command line (recommended for production)**
254
+ ```bash
255
+ npx @notionhq/notion-mcp-server --transport http --auth-token "your-secret-token"
256
+ ```
257
+
258
+ **Option 3: Custom token via environment variable (recommended for production)**
259
+ ```bash
260
+ AUTH_TOKEN="your-secret-token" npx @notionhq/notion-mcp-server --transport http
261
+ ```
262
+
263
+ The command line argument `--auth-token` takes precedence over the `AUTH_TOKEN` environment variable if both are provided.
264
+
265
+ ##### Making HTTP Requests
266
+ All requests to the Streamable HTTP transport must include the bearer token in the Authorization header:
267
+
268
+ ```bash
269
+ # Example request
270
+ curl -H "Authorization: Bearer your-token-here" \
271
+ -H "Content-Type: application/json" \
272
+ -H "mcp-session-id: your-session-id" \
273
+ -d '{"jsonrpc": "2.0", "method": "initialize", "params": {}, "id": 1}' \
274
+ http://localhost:3000/mcp
275
+ ```
276
+
277
+ **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.
278
+
113
279
  ### Examples
114
280
 
115
281
  1. Using the following instruction