Notion MCP Server

Notion MCP Server

site icon
2025.04.21 0
TypeScriptNotion API 集成内容管理交流协作
Notion MCP Server 是一个实现了 Notion API 的 MCP 服务器,允许用户通过 MCP 协议与 Notion 进行交互。它提供了对 Notion 内容的读取和操作能力,适用于需要自动化管理 Notion 内容的场景。
View on GitHub

Overview

基本能力

产品定位

Notion MCP Server 是一个基于 MCP 协议的 Notion API 服务器,旨在通过 MCP 协议提供对 Notion 内容的访问和操作能力。

核心功能

  1. 实现对 Notion API 的 MCP 服务器封装。
  2. 提供对 Notion 内容的读取和操作能力(如搜索页面、添加评论、创建新页面等)。
  3. 支持通过 npm 或 Docker 快速安装和部署。

适用场景

  1. 自动化管理 Notion 内容(如自动添加评论、创建页面等)。
  2. 与 AI 工具集成,实现智能化的 Notion 内容操作。
  3. 开发需要与 Notion 集成的应用程序。

工具列表

  1. npm:用于安装和运行 MCP 服务器。
  2. Docker:用于容器化部署 MCP 服务器。

常见问题解答

  1. 如何获取 Notion Integration Token?
  2. 在 Notion 的 Integration 配置页面创建或选择现有的 Internal Integration,并复制其 Token。
  3. 如何限制集成权限?
  4. 在 Integration 的 Capabilities 配置中,可以设置为只读权限(仅 "Read content")。
  5. 如何连接内容到集成?
  6. 在 Notion 页面中点击 "Connect to integration" 将页面连接到集成。

使用教程

使用依赖

  1. 确保已安装 Node.js 和 npm 或 Docker。

安装教程

使用 npm

  1. .cursor/mcp.jsonclaude_desktop_config.json 中添加以下配置:
{
  "mcpServers": {
    "notionApi": {
      "command": "npx",
      "args": ["-y", "@notionhq/notion-mcp-server"],
      "env": {
        "OPENAPI_MCP_HEADERS": "{\"Authorization\": \"Bearer ntn_****\", \"Notion-Version\": \"2022-06-28\" }"
      }
    }
  }
}

使用 Docker

  1. 构建 Docker 镜像:
docker-compose build
  1. .cursor/mcp.jsonclaude_desktop_config.json 中添加以下配置:
{
  "mcpServers": {
    "notionApi": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "OPENAPI_MCP_HEADERS={\"Authorization\": \"Bearer ntn_****\", \"Notion-Version\": \"2022-06-28\"}",
        "notion-mcp-server-notion-mcp-server"
      ]
    }
  }
}

调试方式

  1. 运行 MCP 服务器后,可以通过以下指令测试功能:
Comment "Hello MCP" on page "Getting started"
  1. 检查是否成功添加评论或创建页面。

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。