Official Notion MCP Setup: Codex & Claude
Connect Notion to OpenAI Codex, Claude Desktop, and Cursor using the official @notionhq/notion-mcp-server package, ntn_ tokens, and config.toml.
claude_desktop_config.json{
"mcpServers": {
"notion": {
"command": "npx",
"args": [
"-y",
"@notionhq/notion-mcp-server"
],
"env": {
"NOTION_TOKEN": "ntn_xxxxxxxxxxxxxxxxxxxx"
}
}
}
}Generate & Test Notion MCP Server Config
One-click export with environment variables & path locators for Claude Desktop, Cursor, Windsurf, and OpenAI Codex CLI.
Official Notion MCP Server Setup: Codex, Claude & Cursor (2026)
Early Notion integrations for the Model Context Protocol relied on third-party community wrappers (such as @suekou/mcp-notion-server) and legacy secret_ internal integration tokens, as documented in our archived community Notion MCP guide.
Notion maintains the official @notionhq/notion-mcp-server package (makenotion/notion-mcp-server (opens in a new tab)), which derives JSON-RPC 2.0 tools from the Notion OpenAPI specification and accepts ntn_ internal integration tokens. According to the package README (opens in a new tab), the current release (2.6.1) targets Notion-Version: 2025-09-03, with 2026-03-11 used only for the two Markdown page tools. Notion states that this self-hosted server is "no longer actively maintained or supported" and recommends the hosted Remote Notion MCP (opens in a new tab) instead; check both before adopting the local package for a new project.
Architecture: Official OpenAPI-to-MCP Bridge
The official @notionhq/notion-mcp-server runs locally as a Node.js child process communicating over standard input/output (stdio) and authenticates with the api.notion.com API (see the Notion API reference (opens in a new tab)) via either NOTION_TOKEN or structured OPENAPI_MCP_HEADERS:
Step 1: Provision a Scoped ntn_ Integration Token
To follow least-privilege security principles, create a dedicated Notion internal integration rather than reusing administrative credentials:
- ▸Open the Notion Integrations Dashboard (opens in a new tab) and click Create new integration.
- ▸Set the Integration Name to
MCP-Codex-Agent, choose your workspace, and select Internal as the integration type. - ▸Under Capabilities, enable:
- ▸Read content (required for searching pages, databases, and blocks)
- ▸Update content & Insert content (enable only if your agent needs to draft documentation or append meeting notes)
- ▸User information without email addresses (optional, for resolving page author IDs)
- ▸Save the configuration and copy the Internal Integration Secret, which begins with
ntn_(e.g.,ntn_48291049182...).
Step 2: Grant Explicit Page & Database Connections
By design, a new Notion integration token has zero visibility into your workspace until you explicitly connect it to target parent pages or databases:
- ▸Open the Notion page or database you want to expose to Claude, Cursor, or OpenAI Codex CLI.
- ▸Click the ••• (three dots) menu in the top-right corner of the Notion window.
- ▸Scroll down to Connections → Connect to and select
MCP-Codex-Agent. - ▸Confirm the prompt. All child pages and nested databases inside that parent page automatically inherit access permissions.
Step 3: Multi-Client Configuration (@notionhq/notion-mcp-server)
The official server supports two authentication environment variable patterns:
- ▸
NOTION_TOKEN: Direct token injection (simplest for TOML and JSON configs). - ▸
OPENAPI_MCP_HEADERS: Explicit JSON header dictionary for customNotion-Versionpinning.
1. OpenAI Codex CLI (~/.codex/config.toml)
Add the official Notion MCP server to your Codex CLI configuration file:
[mcp_servers.notion]
command = "npx"
args = ["-y", "@notionhq/notion-mcp-server"]
[mcp_servers.notion.env]
NOTION_TOKEN = "ntn_your_internal_integration_token"Or register it from your terminal using codex mcp add:
codex mcp add notion --env NOTION_TOKEN=ntn_your_internal_integration_token -- npx -y @notionhq/notion-mcp-server2. Claude Desktop (claude_desktop_config.json)
- ▸macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - ▸Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"notionApi": {
"command": "npx",
"args": ["-y", "@notionhq/notion-mcp-server"],
"env": {
"OPENAPI_MCP_HEADERS": "{\"Authorization\": \"Bearer ntn_your_internal_integration_token\", \"Notion-Version\": \"2025-09-03\"}"
}
}
}
}3. Cursor IDE (.cursor/mcp.json) and other JSON-based hosts
{
"mcpServers": {
"notion": {
"command": "npx",
"args": ["-y", "@notionhq/notion-mcp-server"],
"env": {
"NOTION_TOKEN": "ntn_your_internal_integration_token"
}
}
}
}Core Tool Reference (tools/list)
Tool names are generated from the vendored Notion OpenAPI spec. Version 2.0.0 replaced the database-query tools with data-source query tools; the names below are the current ones pinned by the repository's own tool-name snapshot test (opens in a new tab). Always call tools/list on the version you installed.
| Tool Name | API Endpoint Mapped | Primary Use Case |
|---|---|---|
post-search | POST /v1/search | Search pages and data sources by title keyword across connected workspace trees |
query-data-source | POST /v1/data_sources/{id}/query | Filter and sort rows in a data source (the current database abstraction) |
retrieve-a-page | GET /v1/pages/{page_id} | Fetch page properties, metadata, and parent hierarchy |
get-block-children | GET /v1/blocks/{id}/children | Read the prose, headings, code blocks, and checklists inside a page |
patch-block-children | PATCH /v1/blocks/{id}/children | Append paragraphs, code snippets, or to-do items to an existing page |
post-page | POST /v1/pages | Create a new child page or insert a new row into a Notion database |
retrieve-page-markdown | GET /v1/pages/{page_id}/markdown | Read page content as Markdown (requires Notion-Version: 2026-03-11) |
The older post-database-query, update-a-database, and create-a-database tools were removed in v2.0.0 and replaced by query-data-source, update-a-data-source, and create-a-data-source.
Troubleshooting Production Notion MCP Issues
1. Search Returns Empty Results ({"results": []}) Despite Valid Token
- ▸Root Cause: The target Notion page or database has not been shared with the integration via the Connections menu.
- ▸Fix: Open the target page in Notion → click ••• → Connections → attach your integration.
2. HTTP 401 Unauthorized: API token is invalid
- ▸Root Cause: Extra quotes or malformed JSON escaping inside
OPENAPI_MCP_HEADERS, or an expired/revokedntn_secret. - ▸Fix: Switch to the cleaner
NOTION_TOKENenvironment variable in yourenvblock to eliminate nested JSON quote escaping errors.
3. Context Window Overflow on Deeply Nested Pages
- ▸Root Cause: Notion returns every paragraph, list item, and callout as a verbose JSON block object containing UUIDs, timestamps, and rich-text annotation arrays.
- ▸Fix: Instruct your agent to query data source properties first (
query-data-source) and only callget-block-childrenwithpage_size: 50on specific relevant pages. Alternatively useretrieve-page-markdown, which returns a compact Markdown representation.
External References
- ▸Official Notion MCP Server Repository (
makenotion/notion-mcp-server) (opens in a new tab) - ▸Notion API Official Reference & Versioning (opens in a new tab) — the self-hosted server currently targets
2025-09-03; see the package README (opens in a new tab) for the exact version per tool. - ▸Model Context Protocol Specification (opens in a new tab)
Build your full agent toolstack in the Visual Generator
Combine Notion with databases, search APIs, and memory graphs in a single configuration file.
Did this setup guide work with your AI host?
Help test this configuration across Claude, Cursor, and Codex CLI. Be the first to report:
Official Notion MCP Setup: Codex & Claude FAQ
Why should I migrate from @suekou/mcp-notion-server to @notionhq/notion-mcp-server?
'@notionhq/notion-mcp-server' is maintained directly by Notion (makenotion/notion-mcp-server), tracks the official OpenAPI specification, supports modern 'ntn_' internal integration tokens via 'NOTION_TOKEN' or 'OPENAPI_MCP_HEADERS', and receives official API version updates.
Why does API-post-search return an empty list when my Notion token is valid?
Notion internal integrations have zero workspace visibility by default. Open the parent page or database in Notion, click the '•••' menu, select 'Connections → Connect to', and explicitly attach your integration.
Should I use NOTION_TOKEN or OPENAPI_MCP_HEADERS in my config?
Use 'NOTION_TOKEN' for cleaner TOML and JSON configs without nested quote escaping. Use 'OPENAPI_MCP_HEADERS' only if you need to pin a specific 'Notion-Version' API header date.
Written by Rad Tome
Independent maintainer, MCP Codex
Specializing in Model Context Protocol (MCP) integrations, autonomous AI agent orchestration, and distributed developer toolchains. Researches and benchmarks production MCP client-server architectures across OpenAI Codex, Claude, and Cursor.
Related Guides
Cloud Infrastructure Auditor MCP Guide
Run automated cloud configuration security audits. Identify leaky S3 buckets, open security group ports, and loose IAM profiles directly from your IDE.
Cloud ServicesKubernetes and Helm MCP Server Guide
Connect your Kubernetes clusters and Helm releases to AI agents via MCP. Run safe container diagnostics and view cluster logs.
Cloud ServicesGoogle Drive MCP Setup: Codex and Claude
Connect Google Drive to OpenAI Codex and Claude Desktop via MCP. Full GCP OAuth 2.0 setup, config.toml snippets, file conversion rules, and troubleshooting.