Skip to main content
Glama
Notion MCP Server

Notion MCP Server

by detutag

Notion MCP Server (Cloudflare Workers)

無狀態 Streamable HTTP MCP Server,零依賴,適用 Workers Free plan。 端點:POST /mcp 健康檢查:GET /health

工具

notion_search · notion_get_page · notion_read_page_content · notion_get_database · notion_query_database · notion_create_page · notion_update_page · notion_append_content

Related MCP server: Notion MCP Server

部署

  1. 到 https://www.notion.so/profile/integrations 建立 Internal integration,複製 secret。

  2. 在要開放的 Notion 頁面 / 資料庫右上 … → Connections → 加入該 integration。

  3. 安裝並部署(用 CLI,不需要 Git 連線 / Workers Builds):

npm install
npx wrangler login
npx wrangler secret put NOTION_TOKEN      # 貼上 Notion secret
npx wrangler secret put MCP_AUTH_TOKEN    # 例如:openssl rand -hex 32
npx wrangler deploy

本機測試:複製 .dev.vars.example 為 .dev.vars,執行 npm run dev。

測試

URL=https://notion-mcp.<你的子網域>.workers.dev/mcp
TOKEN=<MCP_AUTH_TOKEN>

curl -s $URL -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

curl -s $URL -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"notion_search","arguments":{"query":"","page_size":5}}}'

接到客戶端

# Claude Code
claude mcp add --transport http notion https://notion-mcp.<子網域>.workers.dev/mcp \
  --header "Authorization: Bearer <MCP_AUTH_TOKEN>"

Cursor / VS Code 等:{"url": ".../mcp", "headers": {"Authorization": "Bearer ..."}}

若客戶端無法設定自訂 header,可設 ALLOW_QUERY_TOKEN=true(wrangler secret put 或 vars), 改用 https://.../mcp?key=<token>。注意 URL 可能出現在日誌中,安全性較低。

免費方案注意事項

  • CPU 10ms/請求:只做 JSON 轉換,足夠;Notion 的等待時間不計入 CPU。

  • 每次呼叫最多 50 個 subrequest:程式內設上限 40,notion_read_page_content 超過會附上 [truncated],可降低 max_depth 或分段讀。

  • 10 萬請求/天。

  • Notion API 版本預設 2022-06-28(支援 /databases/{id}/query)。可用 NOTION_VERSION 覆寫,但 2025-09-03 起資料庫改為 data sources,需要改寫查詢工具。

  • 本伺服器為 stateless:不提供 GET SSE 串流與 session(規格允許,回 405)。

若用 GitHub Actions 部署(不經 Workers Builds)

新增 .github/workflows/deploy.yml:

name: Deploy to Cloudflare Workers
on:
  push:
    branches: [main]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: npm ci
      - run: npx wrangler deploy
        env:
          CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

在 repo 的 Settings → Secrets and variables → Actions 加入 CLOUDFLARE_API_TOKEN 與 CLOUDFLARE_ACCOUNT_ID。 (npm ci 需要 package-lock.json 一併 commit;NOTION_TOKEN / MCP_AUTH_TOKEN 只需事先用 wrangler secret put 設定一次,不必進 CI。)

授權

MIT © detutag/cloudflare-notion-mcp

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents like Claude, Cursor, and VS Code to read and write Notion content through a token-authenticated connection, covering pages, databases, blocks, comments, and file uploads. It supports headless and CI use with context-efficient tooling, batched mutations, and idempotent retries.
      5,773 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Gives AI agents and coding assistants read/write access to Notion — creating and editing pages, querying databases, appending blocks, applying templates, commenting, and uploading files — through just three context-efficient tools. It authenticates with a single token so it works headless in automation, CI, and self-hosted deployments, with batched mutations, idempotency keys, and retry handling built in.
      5,773 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Gives AI clients token-authenticated read/write access to Notion, letting them create and rewrite pages, query databases, append blocks, apply templates, comment, and upload files through natural language. It exposes 47 operations behind only three tools to keep context usage small, and runs headless with batched mutations, idempotency keys, and retry on rate limits.
      5,773 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Gives AI agents read/write access to Notion through a single token, letting them search, create and edit pages, query databases, comment, and upload files in plain language. Works headlessly in CI, cron jobs, and background agents while keeping context usage low.
      5,773 npm
      MIT