Cloud Services·
intermediate
·10 min read·Nov 19, 2026·Updated Nov 24, 2026
·Independent maintainer·Verification Charter

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.

MCPNotionCodexClaudeCursorsetupAPIintegration
Config Target: claude_desktop_config.json
{
  "mcpServers": {
    "notion": {
      "command": "npx",
      "args": [
        "-y",
        "@notionhq/notion-mcp-server"
      ],
      "env": {
        "NOTION_TOKEN": "ntn_xxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
Interactive Tool
1-Click Export

Generate & Test Notion MCP Server Config

One-click export with environment variables & path locators for Claude Desktop, Cursor, Windsurf, and OpenAI Codex CLI.

Open in Generator

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:

diagram

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:

  1. ▸Open the Notion Integrations Dashboard (opens in a new tab) and click Create new integration.
  2. ▸Set the Integration Name to MCP-Codex-Agent, choose your workspace, and select Internal as the integration type.
  3. ▸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)
  4. ▸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:

  1. ▸Open the Notion page or database you want to expose to Claude, Cursor, or OpenAI Codex CLI.
  2. ▸Click the ••• (three dots) menu in the top-right corner of the Notion window.
  3. ▸Scroll down to Connections → Connect to and select MCP-Codex-Agent.
  4. ▸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 custom Notion-Version pinning.

1. OpenAI Codex CLI (~/.codex/config.toml)

Add the official Notion MCP server to your Codex CLI configuration file:

toml
[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:

bash
codex mcp add notion --env NOTION_TOKEN=ntn_your_internal_integration_token -- npx -y @notionhq/notion-mcp-server

2. Claude Desktop (claude_desktop_config.json)

  • ▸macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • ▸Windows: %APPDATA%\Claude\claude_desktop_config.json
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

json
{
  "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 NameAPI Endpoint MappedPrimary Use Case
post-searchPOST /v1/searchSearch pages and data sources by title keyword across connected workspace trees
query-data-sourcePOST /v1/data_sources/{id}/queryFilter and sort rows in a data source (the current database abstraction)
retrieve-a-pageGET /v1/pages/{page_id}Fetch page properties, metadata, and parent hierarchy
get-block-childrenGET /v1/blocks/{id}/childrenRead the prose, headings, code blocks, and checklists inside a page
patch-block-childrenPATCH /v1/blocks/{id}/childrenAppend paragraphs, code snippets, or to-do items to an existing page
post-pagePOST /v1/pagesCreate a new child page or insert a new row into a Notion database
retrieve-page-markdownGET /v1/pages/{page_id}/markdownRead 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/revoked ntn_ secret.
  • ▸Fix: Switch to the cleaner NOTION_TOKEN environment variable in your env block 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 call get-block-children with page_size: 50 on specific relevant pages. Alternatively use retrieve-page-markdown, which returns a compact Markdown representation.

External References

Ready to Deploy?

Build your full agent toolstack in the Visual Generator

Combine Notion with databases, search APIs, and memory graphs in a single configuration file.

Customize in Generator
Developer Verification & Feedback
0 reports

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.

RT✓

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.

Editorial Integrity: Package names verified via npm registry API. Repositories verified via GitHub REST API.
Verification Charter →

Related Guides