Back to MCP directory
publicPublicdnsLocal runtime

chemican-mcp

该项目为Notion API实现了一个MCP服务器,允许通过MCP协议与Notion内容进行交互,支持搜索、评论和创建页面等操作。

article

README

🚀 Notion MCP 服务器

本项目实现了 MCP 协议Notion API 上的服务,为用户提供了便捷的使用体验。

notion-mcp-sm mcp-demo

🚀 快速开始

此项目实现了 MCP 协议Notion API 上的服务,为相关操作提供了便利。

📦 安装指南

1. 在 Notion 中设置集成

访问 https://www.notion.so/profile/integrations 创建新的 内部 集成,或选择现有的集成。

创建 Notion 集成令牌

⚠️ 重要提示

尽管我们限制了 Notion API 暴露的范围(例如,您无法通过 MCP 删除数据库),但将数据暴露给 LLM 存在非零风险。注重安全的用户可能希望进一步配置集成的 功能

例如,您可以创建一个只读集成令牌,仅授予“阅读内容”权限,在“配置”选项卡中:

Notion 集成令牌功能显示“阅读内容”已选

2. 将 MCP 配置添加到客户端

使用 npm

将以下内容添加到您的 .cursor/mcp.jsonclaude_desktop_config.json(MacOS: ~/Library/Application\ Support/Claude/claude_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

您也可以使用 Docker 运行 MCP 服务器。首先构建 Docker 镜像:

docker-compose build

然后将以下内容添加到您的 .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"
      ]
    }
  }
}

⚠️ 重要提示

别忘了将 ntn_**** 替换为您自己的集成密钥。从您的集成配置选项卡中找到:

复制您在开发者控制面板中的集成令牌

3. 将内容连接到集成

确保相关页面和数据库已连接到您的集成。

为此,您需要访问该页面,点击三个点,然后选择“连接到集成”。

将集成令牌添加到 Notion 连接中

💻 使用示例

基础用法

1. 使用以下指令

在页面“Getting started”上发表评论“Hello MCP”

2. 指令示例

告诉我在页面“Getting started”上写一句“Hello MCP”

3. 新建页面

创建一个新页面,标题为“我的新页面”,内容为“这是一个新的 Notion 页面。”

🔧 技术细节

开发

依赖项

  • Node.js 和 npm 已安装。

安装

npm install -g @notionhq/notion-mcp-server

运行

notion-mcp-server --help

发布

npm run build
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client