article
README
🚀 Notion MCP 服务器指南
Notion MCP(模型上下文协议)服务器能够让大语言模型(如Claude)与Notion进行交互,实现更智能的内容管理和自动化操作。本指南将详细介绍该服务器的设置、配置和使用方法。
🚀 快速开始
📦 安装指南
安装依赖
- 确保已经安装了Node.js和npm。
- 克隆项目仓库:
git clone https://github.com/your-repository.git cd your-repository - 安装依赖项:
npm install
构建与启动
- 在项目根目录下运行构建命令:
npm run build - 启动服务器:
npm start
🔧 配置与集成
配置Notion API密钥
在config.json文件中添加你的Notion API密钥:
{
"notion": {
"apiKey": "your_notion_api_key_here"
}
}
创建数据库和页面
- 在Notion中创建一个新数据库,并授予API访问权限。
- 使用生成的
databaseId进行后续操作。
💻 使用示例
基础用法
更新数据库条目
{
"tool_name": "update-database-entry",
"tool_params": {
"pageId": "your_page_id_here",
"properties": {
"Status": {
"select": {
"name": "Completed"
}
},
"Priority": {
"select": {
"name": "High"
}
},
"Due Date": {
"date": {
"start": "2023-12-31"
}
}
}
}
}
创建数据库行
{
"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"
}
}
]
}
}
}
}
📚 详细文档
故障排除
- 如果工具未显示,请检查Claude桌面版日志:
tail -n 20 -f ~/Library/Logs/Claude/mcp*.log - 确保Notion API密钥正确设置,并且集成获得了相应页面的访问权限。
未来改进
- 增加数据库查询功能
- 支持更多内容格式化选项
- 扩展对更多块类型的支持
微信扫一扫