Notion MCP Server

by snowan

Not MCP 服务器

连接到 Notion API 并通过 Claude 的机器上下文协议 (MCP) 公开功能的服务器。

特征

  • 按标题或内容搜索 Not 页面
  • 检索页面详细信息和内容
  • 查询 Notion 数据库
  • 在 Notion 中创建新页面

设置

  1. 克隆此存储库:
git clone https://github.com/yourusername/notion-mcp-server.git cd notion-mcp-server
  1. 安装依赖项:
npm install
  1. 在根目录中创建一个.env文件,其内容如下:
NOTION_API_KEY=your_notion_api_key_here PORT=3000 # Optional: if you want to query a specific database by default NOTION_DATABASE_ID=your_notion_database_id_here
  1. 获取您的 Notion API 密钥:
  2. 将您的 Notion 集成连接到您的工作区:
    • 转到 Notion 工作区中的页面或数据库
    • 点击右上角的“...”菜单
    • 选择“添加连接”
    • 查找并添加您的集成

运行服务器

以开发模式启动服务器:

npm run dev

或者在生产模式下:

npm start

服务器将在您的.env文件中指定的端口上运行(默认值:3000)。

API 端点

常规 HTTP 端点

  • POST /api/notion/search
    • 在 Notion 中搜索页面
    • 正文: { "query": "search term" }
  • POST /api/notion/page
    • 通过 ID 获取页面
    • 正文: { "page_id": "page-id-here" }
  • POST /api/notion/database/查询
    • 查询数据库
    • 正文: { "database_id": "database-id-here", "filter": {}, "sorts": [] }
  • POST /api/notion/page/create
    • 创建新页面
    • 主体: { "parent": {}, "properties": {}, "children": [] }

MCP 集成

服务器在/mcp/manifest.json中公开了一个 MCP 清单,其中描述了可用的功能。

要调用 MCP 函数,请向/api/notion/mcp/invoke发送 POST 请求,其结构如下:

{ "function_name": "search_pages", "parameters": { "query": "search term" } }

可用的 MCP 功能

  • search_pages - 按标题或内容搜索 Notion 页面
  • get_page - 通过 ID 获取 Notion 页面
  • query_database - 查询 Notion 数据库
  • create_page - 在 Notion 中创建新页面

执照

麻省理工学院

-
security - not tested
-
license - not tested
-
quality - not tested

连接到 Notion API 并通过 Claude 的机器上下文协议公开功能的服务器,支持搜索、检索、查询和创建 Notion 页面和数据库。

  1. 特征
    1. 设置
      1. 运行服务器
        1. API 端点
          1. 常规 HTTP 端点
          2. MCP 集成
        2. 可用的 MCP 功能
          1. 执照
            ID: 9j2gf4yo67