mcpField
N
Notion MCP Server

Notion MCP Server

本地服务
github.com/SAhmadUmass记忆与知识386 周前更新

关于 Notion MCP Server

Notion MCP Server 让 Claude 等 LLM 与 Notion 工作区交互,提供页面和数据库操作的 MCP 工具。

主要功能

  1. 01搜索工作区内容
  2. 02获取页面内容
  3. 03创建和更新页面
  4. 04创建和查询数据库
  5. 05添加和更新数据库行

适用场景

  1. 01查找工作区中的会议记录
  2. 02读取或修改 Notion 页面
  3. 03创建任务跟踪数据库
  4. 04按状态筛选数据库条目

MCP 相关

向 MCP 客户端提供 Notion 搜索、页面和数据库操作工具。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

Notion MCP 服务

用于集成 Notion 的 Model Context Protocol 服务,让 Claude 和其他大模型能够与你的 Notion 工作区交互。

功能

  • 搜索 Notion:搜索整个 Notion 工作区
  • 获取页面:检索指定 Notion 页面的内容
  • 创建页面:在 Notion 工作区中创建新页面
  • 更新页面:使用新内容或标题更新现有页面
  • 创建数据库:使用自定义属性创建新数据库
  • 查询数据库:使用筛选条件和排序方式查询数据库
  • 更新数据库条目:更新数据库条目的属性
  • 创建数据库行:使用自定义属性向现有数据库添加新行

设置

  1. 克隆此代码库

  2. 安装依赖项

    npm install
    
  3. 配置 Notion API 密钥

    • 在 Notion 开发者门户中创建集成
    • 复制 API 密钥
    • 你可以选择:
      • 编辑 .env 文件,将 your_notion_api_key_here 替换为实际的 API 密钥,或
      • 在 Claude for Desktop 配置中直接传入密钥(推荐,见下文)
  4. 构建服务

    npm run build
    
  5. 运行服务

    npm start
    

使用 Claude for Desktop 进行设置

  1. 安装 Claude for Desktop(如果尚未安装)

  2. 打开 Claude for Desktop 应用配置:

    • 在 macOS 上:~/Library/Application Support/Claude/claude_desktop_config.json
    • 如果文件不存在,请创建该文件
  3. 将 Notion 服务添加到配置中:

    {
      "mcpServers": {
        "notion": {
          "command": "node",
          "args": [
            "/Users/shaheerahmad/Documents/notion-mcp-server/dist/index.js",
            "--notion-api-key=YOUR_ACTUAL_API_KEY_HERE"
          ]
        }
      }
    }
    

    替换:

    • 将 /Users/shaheerahmad/Documents/notion-mcp-server 替换为项目目录的完整路径
    • 将 YOUR_ACTUAL_API_KEY_HERE 替换为实际的 Notion API 密钥
  4. 重启 Claude for Desktop

使用服务

连接到 Claude for Desktop 后,你可以向 Claude 提出以下问题来使用该服务:

  • “搜索我的 Notion 工作区中的会议笔记”
  • “获取我的项目规划页面的内容”(你需要提供页面 ID)
  • “在 Notion 中创建一个包含任务列表的新页面”
  • “使用内容‘这里是要添加到页面的一些新内容。’更新 ID 为 1aaada269d1b8003adceda69cf7bcd97 的 Notion 页面”
  • “在 ID 为 1aaada269d1b8003adceda69cf7bcd97 的 Notion 页面中创建一个新数据库”
  • “查询 ID 为 1aaada269d1b8003adceda69cf7bcd97 的 Notion 数据库,查找状态为‘已完成’的条目”

Claude 会根据你的请求自动使用相应的工具。

工具使用示例
搜索 Notion
Search for "meeting notes" in my Notion workspace
获取页面内容
Get the content of my Notion page with ID 1aaada269d1b8003adceda69cf7bcd97
创建新页面
Create a new page in Notion with title "Weekly Report" and content "This week we accomplished the following tasks..."
更新现有页面
Update my Notion page with ID 1aaada269d1b8003adceda69cf7bcd97 with content "Adding this new information to the page."

你也可以更新标题:

Update my Notion page with ID 1aaada269d1b8003adceda69cf7bcd97 with title "New Title" and content "New content to add."
创建新数据库
Create a new database in my Notion page with ID 1aaada269d1b8003adceda69cf7bcd97 with title "Task Tracker" and properties {
  "Task Name": { "title": {} },
  "Status": {
    "select": {
      "options": [
        { "name": "Not Started", "color": "red" },
        { "name": "In Progress", "color": "yellow" },
        { "name": "Completed", "color": "green" }
      ]
    }
  },
  "Priority": {
    "select": {
      "options": [
        { "name": "Low", "color": "blue" },
        { "name": "Medium", "color": "yellow" },
        { "name": "High", "color": "red" }
      ]
    }
  },
  "Due Date": { "date": {} }
}
查询数据库
Query my Notion database with ID 1aaada269d1b8003adceda69cf7bcd97 with filter {
  "property": "Status",
  "select": {
    "equals": "Completed"
  }
}

你也可以添加排序:

Query my Notion database with ID 1aaada269d1b8003adceda69cf7bcd97 with sort {
  "property": "Due Date",
  "direction": "ascending"
}
更新数据库条目

更新现有数据库条目(数据库中的页面)的属性。

{
  "tool_name": "update-database-entry",
  "tool_params": {
    "pageId": "page_id_of_database_entry",
    "properties": {
      "Status": {
        "select": {
          "name": "Completed"
        }
      },
      "Priority": {
        "select": {
          "name": "High"
        }
      },
      "Due Date": {
        "date": {
          "start": "2023-12-31"
        }
      }
    }
  }
}

properties 参数应符合 Notion API 对数据库中特定属性类型所要求的结构。不同的属性类型(文本、选择、日期等)需要使用不同格式。

创建数据库行

使用自定义属性向现有数据库添加新行。

{
  "tool_name": "create-database-row",
  "tool_params": {
    "databaseId": "your_database_id_here",
    "properties": {
      "Name": {
        "title": [
          {
            "text": {
              "content": "New Task"
            }
          }
        ]
      },
      "Status": {
        "select": {
          "name": "Not Started"
        }
      },
      "Priority": {
        "select": {
          "name": "Medium"
        }
      },
      "Due Date": {
        "date": {
          "start": "2023-12-15"
        }
      },
      "Notes": {
        "rich_text": [
          {
            "text": {
              "content": "This is a new task created via the API"
            }
          }
        ]
      }
    }
  }
}

properties 参数必须包含数据库要求的所有属性,并遵循 Notion API 对各属性类型规定的结构。

故障排除

  • 如果工具没有显示,请检查 Claude for Desktop 日志:

    tail -n 20 -f ~/Library/Logs/Claude/mcp*.log
    
  • 确保 Notion API 密钥设置正确,并且你的集成已获准访问你希望交互的页面。

  • 如果在日志中看到“Unexpected token”错误,很可能是 console.log 语句干扰了 MCP 协议。此版本的服务已更新,可避免这些问题。

后续改进

  • 添加数据库查询功能
  • 改进内容格式
  • 支持更多块类型

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。