article
README
🚀 个人待办事项列表的简单 MCP 服务器(Notion 集成)
这是一个简单的 Model Context Protocol (MCP) 服务器,它集成了 Notion API,主要用于管理个人的待办事项列表。
🚀 快速开始
演示

视觉指南
Notion MCP 查询 1

Notion MCP 查询 2

Notion MCP 查询 3

✨ 主要特性
- 显示任务:可列出所有待办事项。
- 添加任务:支持创建新的待办事项。
- 更新任务状态:能够标记任务为完成。
📦 安装指南
先决条件
- Python 3.11 或更高版本
- Notion 账户及 API 访问权限
- Notion 集成令牌
- 用于管理待办事项的 Notion 页面
- Claude Desktop 客户端
安装步骤
通过 Smithery 安装
使用 Smithery 自动安装 Notion MCP:
npx -y @smithery/cli install @Badhansen/notion-mcp --client claude
手动安装
- 克隆仓库:
git clone https://github.com/Badhansen/notion-mcp.git
cd notion-mcp
- 设置 Python 环境:
uv venv
source .venv/bin/activate
uv pip install -e .
-
创建 Notion 集成:
- 访问 https://www.notion.so/my-integrations
- 创建新的集成
- 复制 API 令牌
-
将您的数据库/页面与集成共享:
- 打开 Notion 工作区中的数据库/表格或页面
- 点击菜单中的 "..."
- 转到 "添加连接"
- 选择您的集成(搜索名称)
配置
- 创建
.env文件:
cp .env.example .env
- 在
.env中配置 Notion 凭据:
NOTION_TOKEN=<你的 Notion API 令牌>
PAGE_ID=<你的 Notion 页面 ID>
NOTION_VERSION="2022-06-28"
NOTION_BASE_URL="https://api.notion.com/v1"
- 要与 Claude Desktop 配合使用,请调整您的
claude_desktop_config.json文件。 前往Claude Desktop -> 设置 -> 开发人员 -> 配置文件并编辑:
{
"mcpServers": {
"notionMcp": {
"url": "http://localhost:5000",
"enabled": true
}
}
}
💻 使用示例
基础用法
显示所有任务
{
"command": "listTasks"
}
添加新任务
{
"command": "addTask",
"task": "购买杂货"
}
标记任务为完成
{
"command": "completeTask",
"taskId": "unique_task_id_123"
}
🔧 技术细节
项目结构
notion-mcp/
├── server.py # 主服务器文件
├── config.py # 配置参数
├── routes/ # 路由定义
│ ├── tasks.py # 待办事项相关路由
├── utils/ # 辅助函数
│ ├── notion_utils.py # Notion API 工具
└── README.md # 项目文档
🤝 贡献指南
- Fork 仓库:在 GitHub 上 Fork 此项目。
- 创建分支:为新功能或修复创建新分支。
- 提交更改:提交您的修改并添加详细说明。
- Push 到远程仓库。
- 打开 Pull Request:针对主分支提出合并请求。
📄 许可证
本项目采用 MIT 协议。
Scan to contact