Skip to content
Back to search

notion-mcp-server

Official Notion MCP Server

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/makenotion--notion-mcp-server/badge.svg)](/listings/makenotion--notion-mcp-server)

HTML

<a href="/listings/makenotion--notion-mcp-server"><img src="/api/listings/makenotion--notion-mcp-server/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

1. Setting up integration in Notion

Go to [https://www.notion.so/profile/integrations](https://www.notion.so/profile/integrations) and create a new **internal** integration or select an existing one.

While we limit the scope of Notion API's exposed (for example, you will not be able to delete databases via MCP), there is a non-zero risk to workspace data by exposing it to LLMs. Security-conscious users may want to further configure the Integration's _Capabilities_.

For example, you can create a read-only integration token by giving only "Read content" access from the "Configuration" tab:

2. Connecting content to integration

Ensure relevant pages and databases are connected to your integration.

To do this, visit the **Access** tab in your internal integration settings. Edit access and select the pages you'd like to use.

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".

3. Adding MCP config to your client

Using npm

Cursor & Claude

Add the following to your `.cursor/mcp.json` or `claude_desktop_config.json` (MacOS: `~/Library/Application\ Support/Claude/claude_desktop_config.json`)

Option 1: Using NOTION_TOKEN (recommended)

{
  "mcpServers": {
    "notionApi": {
      "command": "npx",
      "args": ["-y", "@notionhq/notion-mcp-server"],
      "env": {
        "NOTION_TOKEN": "ntn_****"
      }
    }
  }
}

Option 2: Using OPENAPI_MCP_HEADERS (for advanced use cases)

{
  "mcpServers": {
    "notionApi": {
      "command": "npx",
      "args": ["-y", "@notionhq/notion-mcp-server"],
      "env": {
        "OPENAPI_MCP_HEADERS": "{\"Authorization\": \"Bearer ntn_****\", \"Notion-Version\": \"2025-09-03\" }"
      }
    }
  }
}

Zed

Add the following to your `settings.json`

{
  "context_servers": {
    "some-context-server": {
      "command": {
        "path": "npx",
        "args": ["-y", "@notionhq/notion-mcp-server"],
        "env": {
          "OPENAPI_MCP_HEADERS": "{\"Authorization\": \"Bearer ntn_****\", \"Notion-Version\": \"2025-09-03\" }"
        }
      },
      "settings": {}
    }
  }
}

GitHub Copilot CLI

Use the Copilot CLI to interactively add the MCP server:

/mcp add

Alternatively, create or edit the configuration file `~/.copilot/mcp-config.json` and add:

{
  "mcpServers": {
    "notionApi": {
      "command": "npx",
      "args": ["-y", "@notionhq/notion-mcp-server"],
      "env": {
        "NOTION_TOKEN": "ntn_****"
      }
    }
  }
}

For more information, see the [Copilot CLI documentation](https://docs.github.com/en/copilot/concepts/agents/about-copilot-cli).

Using Docker

There are two options for running the MCP server with Docker:

Option 1: Using the official Docker Hub image

Add the following to your `.cursor/mcp.json` or `claude_desktop_config.json`

Using NOTION_TOKEN (recommended):

{
  "mcpServers": {
    "notionApi": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e", "NOTION_TOKEN",
        "mcp/notion"
      ],
      "env": {
        "NOTION_TOKEN": "ntn_****"
      }
    }
  }
}

Using OPENAPI_MCP_HEADERS (for advanced use cases):

{
  "mcpServers": {
    "notionApi": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e", "OPENAPI_MCP_HEADERS",
        "mcp/notion"
      ],
      "env": {
        "OPENAPI_MCP_HEADERS": "{\"Authorization\":\"Bearer ntn_****\",\"Notion-Version\":\"2025-09-03\"}"
      }
    }
  }
}

This approach:

- Uses the official Docker Hub image - Properly handles JSON escaping via environment variables - Provides a more reliable configuration method

Option 2: Building the Docker image locally

You can also build and run the Docker image locally. First, build the Docker image:

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 528 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Notion MCP Server
  2. > [!NOTE]
  3. >
  4. > For the best experience, use **[Remote Notion MCP](https://developers.notion.com/docs/mcp)**,
  5. > our official hosted MCP server. **This repository is a separate, self-hosted MCP
  6. > server implementation that is no longer actively maintained or supported. Please
  7. > use Remote Notion MCP instead.** It is purpose-built to give AI agents
  8. > **faster results using far fewer tokens**.
  9. >
  10. > Remote Notion MCP can search your workspace and connected apps semantically, read and
  11. > edit pages in Markdown, and return only the most relevant context. That means less
  12. > time waiting, less context-window usage, and lower token costs. It also uses OAuth
  13. > and automatically respects each user's existing Notion permissions—without API
  14. > tokens, JSON configuration, manual page sharing, or a local server to maintain.
  15. >
  16. > | Feature | Remote Notion MCP | This project (local) |
  17. > | --- | :---: | :---: |
  18. > | **Fast, hosted experience** | ✅ | Runs and updates locally |
  19. > | **Token-efficient responses** | ✅ | Limited |
  20. > | Powerful tools tailored for AI agents | ✅ | Basic API-derived tools |
  21. > | Semantic search across your Notion workspace | ✅ | Keyword search only |
  22. > | AI Connector search across connected apps | ✅ | Not available |
  23. > | Markdown-native page reading and editing | ✅ | Limited to two page-content tools |
  24. > | Seamless OAuth setup | ✅ | Manual token and JSON configuration |
  25. > | Respects each user's existing Notion permissions | ✅ | Manual integration permissions and page sharing |
  26. > | Active support and ongoing improvements | ✅ | Not actively supported |
  27. >
  28. > Learn more and get started in the [Remote Notion MCP documentation](https://developers.notion.com/docs/mcp).
  29. >
  30. > We are prioritizing, and only providing active support for, **Remote Notion MCP**. As a result:
  31. >
  32. > - We may sunset this local MCP server repository in the future.
  33. > - Issues and pull requests here are not actively monitored.
  34. > - Please do not file issues relating to the remote MCP here; instead, contact Notion support.
  35. ![notion-mcp-sm](https://github.com/user-attachments/assets/6c07003c-8455-4636-b298-d60ffdf46cd8)
  36. This project implements an [MCP server](https://spec.modelcontextprotocol.io/) for the [Notion API](https://developers.notion.com/reference/intro).
  37. ![mcp-demo](https://github.com/user-attachments/assets/e3ff90a7-7801-48a9-b807-f7dd47f0d3d6)
  38. ---
  39. ## ⚠️ Version 2.0.0 breaking changes
  40. **Version 2.0.0 migrates to the Notion API 2025-09-03** which introduces data sources as the primary abstraction for databases.
  41. ### What changed
  42. **Removed tools (3):**
  43. - `post-database-query` - replaced by `query-data-source`
  44. - `update-a-database` - replaced by `update-a-data-source`
  45. - `create-a-database` - replaced by `create-a-data-source`
  46. **New tools (7):**
  47. - `query-data-source` - Query a data source (database) with filters and sorts
  48. - `retrieve-a-data-source` - Get metadata and schema for a data source
  49. - `update-a-data-source` - Update data source properties
  50. - `create-a-data-source` - Create a new data source
  51. - `list-data-source-templates` - List available templates in a data source
  52. - `move-page` - Move a page to a different parent location
  53. - `retrieve-a-database` - Get database metadata including its data source IDs
  54. **Parameter changes:**
  55. - All database operations now use `data_source_id` instead of `database_id`
  56. - Search filter values changed from `["page", "database"]` to `["page", "data_source"]`
  57. - Page creation now supports both `page_id` and `database_id` parents (for data sources)
  58. ### Do I need to migrate?
  59. **No code changes required.** MCP tools are discovered automatically when the server starts. When you upgrade to v2.0.0, AI clients will automatically see the new tool names and parameters. The old database tools are no longer available.
  60. If you have hardcoded tool names or prompts that reference the old database tools, update them to use the new data source tools:
  61. | Old Tool (v1.x) | New Tool (v2.0) | Parameter Change |
  62. | -------------- | --------------- | ---------------- |
  63. | `post-database-query` | `query-data-source` | `database_id` → `data_source_id` |
  64. | `update-a-database` | `update-a-data-source` | `database_id` → `data_source_id` |
  65. | `create-a-database` | `create-a-data-source` | No change (uses `parent.page_id`) |
  66. > **Note:** `retrieve-a-database` is still available and returns database metadata including the list of data source IDs. Use `retrieve-a-data-source` to get the schema and properties of a specific data source.
  67. **Total tools now: 22** (was 19 in v1.x)
  68. ---
  69. ## Page content as Markdown
  70. The server exposes two tools for working with page content as enhanced Markdown instead of block JSON, which is significantly more token-efficient for AI agents:
  71. - `retrieve-page-markdown` — Read a page's full content as Markdown (`GET /v1/pages/{page_id}/markdown`). Pass `include_transcript: true` to inline meeting-note transcripts.
  72. - `update-page-markdown` — Edit a page's content with Markdown (`PATCH /v1/pages/{page_id}/markdown`). Prefer `replace_content` to overwrite the whole page, or `update_content` for targeted find-and-replace edits.
  73. These endpoints require Notion API version `2026-03-11`. The server now sources the `Notion-Version` header **per operation** from the OpenAPI spec, so these tools use `2026-03-11` while the rest of the API continues to use `2025-09-03` — no configuration needed. If you set `Notion-Version` yourself via `OPENAPI_MCP_HEADERS`, your value takes precedence for every tool.
  74. ---
  75. ### Installation
  76. #### 1. Setting up integration in Notion
  77. Go to [https://www.notion.so/profile/integrations](https://www.notion.so/profile/integrations) and create a new **internal** integration or select an existing one.
  78. ![Creating a Notion Integration token](docs/images/integrations-creation.png)
  79. While we limit the scope of Notion API's exposed (for example, you will not be able to delete databases via MCP), there is a non-zero risk to workspace data by exposing it to LLMs. Security-conscious users may want to further configure the Integration's _Capabilities_.
  80. For example, you can create a read-only integration token by giving only "Read content" access from the "Configuration" tab:
  81. ![Notion Integration Token Capabilities showing Read content checked](docs/images/integrations-capabilities.png)
  82. #### 2. Connecting content to integration
  83. Ensure relevant pages and databases are connected to your integration.
  84. To do this, visit the **Access** tab in your internal integration settings. Edit access and select the pages you'd like to use.
  85. ![Integration Access tab](docs/images/integration-access.png)
  86. ![Edit integration access](docs/images/page-access-edit.png)
  87. 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".
  88. ![Adding Integration Token to Notion Connections](docs/images/connections.png)
  89. #### 3. Adding MCP config to your client
  90. ##### Using npm
  91. ###### Cursor & Claude
  92. Add the following to your `.cursor/mcp.json` or `claude_desktop_config.json` (MacOS: `~/Library/Application\ Support/Claude/claude_desktop_config.json`)
  93. ###### Option 1: Using NOTION_TOKEN (recommended)
  94. ```json
  95. {
  96. "mcpServers": {
  97. "notionApi": {
  98. "command": "npx",
  99. "args": ["-y", "@notionhq/notion-mcp-server"],
  100. "env": {
  101. "NOTION_TOKEN": "ntn_****"
  102. }
  103. }
  104. }
  105. }
  106. ```
  107. ###### Option 2: Using OPENAPI_MCP_HEADERS (for advanced use cases)
  108. ```json
  109. {
  110. "mcpServers": {
  111. "notionApi": {
  112. "command": "npx",
  113. "args": ["-y", "@notionhq/notion-mcp-server"],
  114. "env": {
  115. "OPENAPI_MCP_HEADERS": "{\"Authorization\": \"Bearer ntn_****\", \"Notion-Version\": \"2025-09-03\" }"
  116. }
  117. }
  118. }
  119. }
  120. ```
  121. ###### Zed
  122. Add the following to your `settings.json`
  123. ```json
  124. {
  125. "context_servers": {
  126. "some-context-server": {
  127. "command": {
  128. "path": "npx",
  129. "args": ["-y", "@notionhq/notion-mcp-server"],
  130. "env": {
  131. "OPENAPI_MCP_HEADERS": "{\"Authorization\": \"Bearer ntn_****\", \"Notion-Version\": \"2025-09-03\" }"
  132. }
  133. },
  134. "settings": {}
  135. }
  136. }
  137. }
  138. ```
  139. ###### GitHub Copilot CLI
  140. Use the Copilot CLI to interactively add the MCP server:
  141. ```bash
  142. /mcp add
  143. ```
  144. Alternatively, create or edit the configuration file `~/.copilot/mcp-config.json` and add:
  145. ```json
  146. {
  147. "mcpServers": {
  148. "notionApi": {
  149. "command": "npx",
  150. "args": ["-y", "@notionhq/notion-mcp-server"],
  151. "env": {
  152. "NOTION_TOKEN": "ntn_****"
  153. }
  154. }
  155. }
  156. }
  157. ```
  158. For more information, see the [Copilot CLI documentation](https://docs.github.com/en/copilot/concepts/agents/about-copilot-cli).
  159. ##### Using Docker
  160. There are two options for running the MCP server with Docker:
  161. ###### Option 1: Using the official Docker Hub image
  162. Add the following to your `.cursor/mcp.json` or `claude_desktop_config.json`
  163. Using NOTION_TOKEN (recommended):
  164. ```json
  165. {
  166. "mcpServers": {
  167. "notionApi": {
  168. "command": "docker",
  169. "args": [
  170. "run",
  171. "--rm",
  172. "-i",
  173. "-e", "NOTION_TOKEN",
  174. "mcp/notion"
  175. ],
  176. "env": {
  177. "NOTION_TOKEN": "ntn_****"
  178. }
  179. }
  180. }
  181. }
  182. ```
  183. Using OPENAPI_MCP_HEADERS (for advanced use cases):
  184. ```json
  185. {
  186. "mcpServers": {
  187. "notionApi": {
  188. "command": "docker",
  189. "args": [
  190. "run",
  191. "--rm",
  192. "-i",
  193. "-e", "OPENAPI_MCP_HEADERS",
  194. "mcp/notion"
  195. ],
  196. "env": {
  197. "OPENAPI_MCP_HEADERS": "{\"Authorization\":\"Bearer ntn_****\",\"Notion-Version\":\"2025-09-03\"}"
  198. }
  199. }
  200. }
  201. }
  202. ```
  203. This approach:
  204. - Uses the official Docker Hub image
  205. - Properly handles JSON escaping via environment variables
  206. - Provides a more reliable configuration method
  207. ###### Option 2: Building the Docker image locally
  208. You can also build and run the Docker image locally. First, build the Docker image:
  209. ```bash
  210. docker compose build
  211. ```
  212. Then, add the following to your `.cursor/mcp.json` or `claude_desktop_config.json`
  213. Using NOTION_TOKEN (recommended):
  214. ```json
  215. {
  216. "mcpServers": {
  217. "notionApi": {
  218. "command": "docker",
  219. "args": [
  220. "run",
  221. "--rm",
  222. "-i",
  223. "-e",
  224. "NOTION_TOKEN=ntn_****",
  225. "notion-mcp-server"
  226. ]
  227. }
  228. }
  229. }
  230. ```
  231. Using OPENAPI_MCP_HEADERS (for advanced use cases):
  232. ```json
  233. {
  234. "mcpServers": {
  235. "notionApi": {
  236. "command": "docker",
  237. "args": [
  238. "run",
  239. "--rm",
  240. "-i",
  241. "-e",
  242. "OPENAPI_MCP_HEADERS={\"Authorization\": \"Bearer ntn_****\", \"Notion-Version\": \"2025-09-03\"}",
  243. "notion-mcp-server"
  244. ]
  245. }
  246. }
  247. }
  248. ```
  249. Don't forget to replace `ntn_****` with your integration secret. Find it from your integration configuration tab:
  250. ![Copying your Integration token from the Configuration tab in the developer portal](https://github.com/user-attachments/assets/67b44536-5333-49fa-809c-59581bf5370a)
  251. ### Transport options
  252. The Notion MCP Server supports two transport modes:
  253. #### STDIO transport (default)
  254. The default transport mode uses standard input/output for communication. This is the standard MCP transport used by most clients like Claude Desktop.
  255. ```bash
  256. # Run with default stdio transport
  257. npx @notionhq/notion-mcp-server
  258. # Or explicitly specify stdio
  259. npx @notionhq/notion-mcp-server --transport stdio
  260. ```
  261. #### Streamable HTTP transport
  262. For web-based applications or clients that prefer HTTP communication, you can use the Streamable HTTP transport:
  263. ```bash
  264. # Run with Streamable HTTP transport on port 3000 (default)
  265. npx @notionhq/notion-mcp-server --transport http
  266. # Run on a custom port
  267. npx @notionhq/notion-mcp-server --transport http --port 8080
  268. # Bind to a different host. The default is 127.0.0.1.
  269. npx @notionhq/notion-mcp-server --transport http --host 0.0.0.0
  270. # Run with a custom authentication token
  271. npx @notionhq/notion-mcp-server --transport http --auth-token "your-secret-token"
  272. ```
  273. When using Streamable HTTP transport, the server will be available at `http://127.0.0.1:<port>/mcp` by default.
  274. ##### Authentication
  275. The Streamable HTTP transport requires bearer token authentication for security. You have three options:
  276. ###### Option 1: Auto-generated token (only for development)
  277. ```bash
  278. npx @notionhq/notion-mcp-server --transport http
  279. ```
  280. The server will generate a secure random token and write it to a file with restricted permissions:
  281. ```text
  282. Generated auth token written to: /tmp/.notion-mcp-auth-token-12345
  283. ```
  284. ###### Option 2: Custom token via command line (recommended for production)
  285. ```bash
  286. npx @notionhq/notion-mcp-server --transport http --auth-token "your-secret-token"
  287. ```
  288. ###### Option 3: Custom token via environment variable (recommended for production)
  289. ```bash
  290. AUTH_TOKEN="your-secret-token" npx @notionhq/notion-mcp-server --transport http
  291. ```
  292. The command line argument `--auth-token` takes precedence over the `AUTH_TOKEN` environment variable if both are provided.
  293. ###### Unsafe option: disable HTTP authentication
  294. You can disable bearer token authentication only with the explicit unsafe flag:
  295. ```bash
  296. npx @notionhq/notion-mcp-server --transport http --unsafe-disable-auth
  297. ```
  298. WARNING: `--unsafe-disable-auth` is unsafe. The server may be reachable to pages you visit via DNS rebinding. Only use it on an isolated network.
  299. When authentication is disabled, the server enables DNS rebinding protection by checking the `Host` and `Origin` headers against the configured local host and loopback hosts. The previous `--disable-auth` flag is still accepted as a deprecated alias, but it will print a warning.
  300. ##### Making HTTP requests
  301. All requests to the Streamable HTTP transport must include the bearer token in the Authorization header:
  302. ```bash
  303. # Example request
  304. curl -H "Authorization: Bearer your-token-here" \
  305. -H "Content-Type: application/json" \
  306. -H "mcp-session-id: your-session-id" \
  307. -d '{"jsonrpc": "2.0", "method": "initialize", "params": {}, "id": 1}' \
  308. http://localhost:3000/mcp
  309. ```
  310. **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.
  311. ##### Serving multiple integrations (per-request token passthrough)
  312. By default the server authenticates to Notion with a single token baked in at
  313. startup, which locks one deployment to one Notion integration. To let a single
  314. deployment serve **multiple** integrations, enable token passthrough so each
  315. client supplies its own Notion integration token per connection:
  316. ```bash
  317. # Enable per-request Notion tokens (flag or ENABLE_TOKEN_PASSTHROUGH=true)
  318. npx @notionhq/notion-mcp-server --transport http --enable-token-passthrough
  319. ```
  320. Clients then send their Notion token on the **initialize** request using the
  321. dedicated `Notion-Token` header:
  322. ```bash
  323. curl -H "Authorization: Bearer <server-auth-token>" \
  324. -H "Notion-Token: ntn_****" \
  325. -H "Content-Type: application/json" \
  326. -d '{"jsonrpc": "2.0", "method": "initialize", "params": {}, "id": 1}' \
  327. http://localhost:3000/mcp
  328. ```
  329. How the token is resolved for each connection, in order:
  330. 1. The `Notion-Token` header (preferred — unambiguous, and works alongside the
  331. server's own `Authorization` gateway auth). If present it must be a valid
  332. Notion token, otherwise the request is rejected with `401`.
  333. 2. `Authorization: Bearer ntn_****` — only when the server's own bearer auth is
  334. turned off (`--unsafe-disable-auth`), so the header is free to carry the
  335. Notion token directly.
  336. 3. Otherwise the startup env token (`NOTION_TOKEN` / `OPENAPI_MCP_HEADERS`), if
  337. set, so passthrough and a default integration can coexist on one deployment.
  338. Notes:
  339. - Only values with a Notion token prefix (`ntn_`, legacy `secret_`) are treated
  340. as Notion tokens, so the server's gateway secret and a tenant's Notion token
  341. never collide.
  342. - Each token is bound to its MCP session; tokens are never logged (only a
  343. redacted prefix is emitted).
  344. - This is a deliberate token-passthrough setup. Always deploy it over TLS, and
  345. prefer keeping the server's own bearer auth (`--auth-token`) enabled as a
  346. gateway in front of multi-tenant traffic.
  347. ### Examples
  348. 1. Using the following instruction
  349. ```text
  350. Comment "Hello MCP" on page "Getting started"
  351. ```
  352. AI will correctly plan two API calls, `v1/search` and `v1/comments`, to achieve the task
  353. 1. Similarly, the following instruction will result in a new page named "Notion MCP" added to parent page "Development"
  354. ```text
  355. Add a page titled "Notion MCP" to page "Development"
  356. ```
  357. 1. You may also reference content ID directly
  358. ```text
  359. Get the content of page 1a6b35e6e67f802fa7e1d27686f017f2
  360. ```
  361. ### Development
  362. #### Build & test
  363. ```bash
  364. npm run build
  365. npm test
  366. ```
  367. #### Execute
  368. ```bash
  369. npx -y --prefix /path/to/local/notion-mcp-server @notionhq/notion-mcp-server
  370. ```
  371. Testing changes locally in Cursor:
  372. 1. Run `npm link` command from repository root to create a machine-global symlink to the `notion-mcp-server` package.
  373. 2. Merge the configuration snippet below into Cursor's `mcp.json` (or other MCP client you want to test with).
  374. 3. (Cleanup) run `npm unlink` from repository root.
  375. ```json
  376. {
  377. "mcpServers": {
  378. "notion-local-package": {
  379. "command": "notion-mcp-server",
  380. "env": {
  381. "NOTION_TOKEN": "ntn_..."
  382. }
  383. }
  384. }
  385. }
  386. ```
  387. #### Publish
  388. ```bash
  389. npm login
  390. npm publish --access public
  391. ```

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.