notion-mcp

作者 FR0ZON3

Notion mcp to connect AI agents to notion through markdown | Read and write notion markdown

117
Stars
1,083
Forks
TypeScript
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/FR0ZON3/notion-mcp

快速入门

使用 notion-mcp 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

easy-notion-mcp

Production-oriented MCP server that connects AI agents to Notion through standard markdown instead of raw API JSON.

Agents read and write GFM markdown. The server handles block conversion, database schema mapping, OAuth, and optional Redis-backed persistence for multi-instance deployments.


Feature highlights

CapabilityDetails
Markdown-first I/O42 MCP tools; agents never construct Notion block JSON
Round-trip fidelity24 block types including toggles, columns, callouts, tables, uploads
Database ergonomicsWrite { "Status": "Done" } — schema conversion is automatic
Dual transportStdio (API token) and HTTP (OAuth or bearer-protected static token)
Security defaultsContent-notice prefix, URL sanitization, workspace-root file containment
Optional RedisShared schema cache and OAuth token persistence with graceful fallback
CLI profilesLow-context Notion access via easy-notion with readonly/readwrite modes

Architecture

flowchart TB
  subgraph clients [MCP Clients]
    CC[Claude Code / Cursor]
    HTTP[HTTP MCP clients]
  end

  subgraph transport [Transport Layer]
    STDIO[index.ts — stdio]
    HTTP_SRV[http.ts — Express]
  end

  subgraph core [Application Core]
    SRV[server.ts — MCP tools & resources]
    NC[notion-client.ts — Notion SDK wrapper]
    MD[markdown converters]
  end

  subgraph persistence [Persistence — optional]
    MEM[(In-memory cache)]
    REDIS[(Redis)]
    FS[(Encrypted token files)]
  end

  CC --> STDIO
  HTTP --> HTTP_SRV
  STDIO --> SRV
  HTTP_SRV --> SRV
  SRV --> NC
  SRV --> MD
  NC --> MEM
  NC --> REDIS
  HTTP_SRV --> FS
  HTTP_SRV --> REDIS

Request workflow (tool call)

sequenceDiagram
  participant Agent
  participant MCP as MCP Server
  participant Cache as Cache Store
  participant Notion as Notion API

  Agent->>MCP: tools/call (e.g. read_page)
  MCP->>Notion: blocks.children.list (paginated)
  Notion-->>MCP: block tree
  MCP->>MCP: blocks → markdown
  MCP-->>Agent: { markdown, warnings? }

  Agent->>MCP: tools/call (add_database_entry)
  MCP->>Cache: get schema:dbId
  alt cache miss
    Cache->>Notion: dataSources.retrieve
    Notion-->>Cache: schema
    Cache-->>MCP: schema
  else cache hit
    Cache-->>MCP: schema
  end
  MCP->>MCP: convert property values
  MCP->>Notion: pages.create
  Notion-->>MCP: page
  MCP-->>Agent: { id, url }

Project structure

easy-notion-mcp/
├── src/
│   ├── index.ts              # Stdio entry point
│   ├── http.ts               # HTTP/OAuth entry point
│   ├── cli.ts                # Profile-based CLI
│   ├── server.ts             # MCP tool & resource handlers
│   ├── notion-client.ts      # Notion SDK integration
│   ├── config/env.ts         # Typed environment parsing
│   ├── logging/logger.ts     # Structured logging
│   ├── persistence/          # Cache + Redis integration
│   │   ├── cache-store.ts
│   │   ├── init.ts
│   │   └── redis/
│   └── auth/                   # OAuth token storage
├── tests/                    # Vitest unit & integration tests
├── docs/AUDIT.md             # Engineering audit notes
├── skills/                   # Agent skill definitions
└── dist/                     # Compiled output (generated)

Design decisions

  • Single server module — tool handlers remain in server.ts to preserve the stable public MCP contract; supporting modules handle cross-cutting concerns.
  • Pluggable cacheCacheStore abstraction allows in-memory (default) or Redis backends without changing Notion client logic.
  • Fail-open Redis — if Redis is configured but unreachable, the server logs a warning and continues with in-memory/file persistence.

Installation

Prerequisites

From source

git clone https://github.com/Grey-Iris/easy-notion-mcp.git
cd easy-notion-mcp
npm install
npm run build

Via npx (published package)

npx -y easy-notion-mcp

MCP client configuration (stdio)

{
  "mcpServers": {
    "notion": {
      "command": "npx",
      "args": ["-y", "easy-notion-mcp"],
      "env": {
        "NOTION_TOKEN": "ntn_your_integration_token"
      }
    }
  }
}

Configuration

Copy .env.example to .env when running from a cloned checkout:

cp .env.example .env

Core variables

VariableRequiredDefaultDescription
NOTION_TOKENYes (stdio)Notion integration token
NOTION_ROOT_PAGE_IDNoDefault parent for create_page
NOTION_TRUST_CONTENTNofalseDisable content-notice prefix on reads
NOTION_MCP_WORKSPACE_ROOTNocwdRoot for local file:// uploads
LOG_LEVELNoinfoLogging verbosity

Redis persistence (optional)

VariableDefaultDescription
REDIS_ENABLEDfalseEnable Redis when true or when REDIS_URL is set
REDIS_URLFull connection URL
REDIS_HOST127.0.0.1Host (when URL not set)
REDIS_PORT6379Port
REDIS_PASSWORDAuth password
REDIS_DB0Database index
REDIS_KEY_PREFIXeasy-notion:Key namespace prefix
REDIS_CONNECT_TIMEOUT_MS10000Connection timeout
REDIS_MAX_RETRIES3Retry attempts before fallback

Example with local Redis:

REDIS_ENABLED=true REDIS_URL=redis://127.0.0.1:6379/0 npm start

HTTP transport

VariableRequiredDefaultDescription
NOTION_MCP_BEARERYes (static HTTP)Shared secret for /mcp requests
NOTION_OAUTH_CLIENT_IDOAuth modePublic integration client ID
NOTION_OAUTH_CLIENT_SECRETOAuth modeOAuth client secret
PORTNo3333Listen port
NOTION_MCP_BIND_HOSTNo127.0.0.1Bind address

Development

# Install dependencies
npm install

# Watch mode
npm run dev

# Run stdio server locally
NOTION_TOKEN=ntn_... npm start

# Run HTTP server
NOTION_TOKEN=ntn_... NOTION_MCP_BEARER=$(openssl rand -hex 32) npm run start:http

Quality gates

npm run build      # Compile TypeScript
npm run typecheck  # Type check without emit
npm run lint       # ESLint
npm test           # Vitest unit tests

Testing

# Full unit suite (~850 tests)
npm test

# Watch mode
npm run test:watch

# Live Notion E2E (requires dedicated test workspace)
cp .env.example .env   # set E2E_ROOT_PAGE_ID
npm run test:e2e

Symlink-dependent security tests are automatically skipped on platforms where symlink creation is unavailable (common on Windows without Developer Mode).


Troubleshooting

SymptomLikely causeFix
NOTION_TOKEN is requiredMissing env varSet token in MCP config env block or .env
401 invalid_token (HTTP)Missing/wrong bearerSet NOTION_MCP_BEARER on server; send Authorization: Bearer …
outside the allowed workspace rootFile path escapes rootSet NOTION_MCP_WORKSPACE_ROOT or use absolute paths inside it
Redis warning on startupRedis unreachableStart Redis or set REDIS_ENABLED=false
Unknown property nameStale/wrong schemaCall get_database first; check case sensitivity
Symlink tests skippedOS restrictionEnable Windows Developer Mode or run on Linux/macOS

Enable debug logging:

LOG_LEVEL=debug npm start

Contributing

  1. Fork the repository and create a feature branch from main
  2. Make focused changes with tests where behavior changes
  3. Run npm run build && npm run lint && npm test
  4. Open a pull request with a clear description and test plan

See docs/AUDIT.md for architecture context and known improvement areas.


FAQ

How is this different from the official Notion MCP server?
The official server returns raw Notion JSON (~6–7× more tokens per page read). This server converts to markdown agents already understand, with round-trip fidelity for 24 block types.

Do I need Redis?
No. Redis is optional and improves horizontal scaling (shared schema cache, OAuth tokens across HTTP instances). Single-process stdio deployments work fine without it.

Is markdown round-trip lossless?
For supported block types, yes. Unsupported native blocks (e.g. synced_block, embedded databases) emit warnings so agents avoid destructive rewrites.

Does file upload work over HTTP?
No. file:// uploads are stdio-only for security. Use HTTPS URLs or stdio transport for local files.

What Node version is required?
Node.js 20 or later.


License

MIT — see LICENSE.

常见问题

What is notion-mcp?

notion-mcp is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by FR0ZON3. Notion mcp to connect AI agents to notion through markdown | Read and write notion markdown. It has 117 GitHub stars.

Is notion-mcp safe to use?

notion-mcp failed SkillsLLM's automated security scan, which flagged one or more high-severity issues. Review the Security Report section carefully before using it.

How do I install notion-mcp?

Clone the repository with "git clone https://github.com/FR0ZON3/notion-mcp" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is notion-mcp written in?

notion-mcp is primarily written in TypeScript. It is open-source under FR0ZON3 on GitHub, so you can review or fork the full source.

Are there alternatives to notion-mcp?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh notion-mcp against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情
notion-mcp — Claude Code AI Skill | SkillTip