article
README
🚀 Notion MCP 服务器
本项目是一个用于实现 Claude AI 和 Notion 工作区之间无缝集成的 Model Context Protocol (MCP) 服务器,支持读写功能,能让 Claude AI 与 Notion 高效协作。
🚀 快速开始
1. 设置 Notion API 访问权限
- 前往 https://www.notion.so/my-integrations 创建一个 Notion 集成。
- 为你的集成命名(例如:“Claude MCP Integration”)。
- 将集成类型设置为“Internal”。
- 复制你的 API 密钥。
- 通过点击任何页面/数据库右上角的“...”菜单并选择“添加连接”来共享你的 Notion 页面和数据库。
2. 安装依赖项
npm install
3. 配置环境变量
在项目根目录创建一个 .env 文件,包含你的 Notion API 密钥:
NOTION_API_KEY=your_api_key_here
此步骤仅在你开发服务器时需要。
4. 构建
构建服务器,准备由 Claude 使用。
npm run build
如果你正在开发服务器,可以运行 npm run dev 或 npm run inspect。
5. 添加到 Claude Desktop 配置
打开 claude_desktop_config.json(导航至 Settings > Developer 并点击 Edit Config),添加以下内容:
"notion": {
"command": "node",
"args": [
"path/to/mcp-server-notion/dist/index.js"
],
"env": {
"NOTION_API_KEY": "your_notion_api_key_here"
}
}
6. 重启 Claude
重启 Claude 后,你就可以开始使用了!
✨ 主要特性
该项目旨在构建一个 MCP 服务器,连接 Claude AI 和 Notion 工作区,允许 Claude:
- 从 Notion 数据库和页面中读取内容
- 更新现有内容
- 在整个 Notion 工作区中搜索
- 查询和过滤数据库条目
- 获取详细页面内容和数据库架构
📦 安装指南
先决条件
- Node.js (v16+)
- Notion API 密钥
- Claude Desktop
安装步骤
见“快速开始”部分。
💻 使用示例
基础用法
该 MCP 服务器提供以下工具:
search_notion: 使用查询字符串在 Notion 整个工作区中搜索get_notion_page: 获取特定 Notion 页面的详细内容get_notion_database: 获取 Notion 数据库的元数据和架构query_notion_database: 支持复杂查询,在 Notion 数据库中搜索和过滤条目
📚 详细文档
资源与参考
📄 许可证
该项目在 MIT 许可证下发布,详细信息见 LICENSE 文件。
贡献
欢迎贡献!请随意提交 Pull Request。
扫码联系在线客服