Notion集成协议

MCP Notion是一个提供HTTP端点的服务,用于与Notion API交互,支持数据库查询、页面内容获取和搜索功能。

  • by GsusFC
  • Rust
  • 本地部署
  • 更新于
在 GitHub 查看 GsusFC/MCP-Notion

使用说明

MCP概念

用于与Notion API集成的MCP服务器(模型上下文协议)。提供HTTP端点以与数据库和Notion页面交互。

🚀 特征

  • 概念搜索
  • 获取页面和内容
  • 数据基础咨询
  • CORS支架
  • 鲁棒错误处理
  • 测井集成

📋 先决条件

  • Rust(最新稳定版本)
  • 通知API令牌
  • 用于交互的Notion数据库或页面

🔧 安装

  1. 克隆存储库:
git clone https://github.com/GsusFC/MCP-Notion.git
cd MCP-Notion
  1. 配置环境变量:
cp .env.example .env
# Editar .env y añadir tu NOTION_API_KEY
  1. 编译和执行:
cargo build
cargo run

服务器将在 http://localhost:3004 默认 。

🔌 API终点

搜索

POST /api/search
Content-Type: application/json

{
    "query": "término de búsqueda",
    "limit": 10
}

获取页面

GET /api/get_page/{page_id}

获取页面内容

GET /api/get_page_content/{page_id}

查看数据库

POST /api/query_database
Content-Type: application/json

{
    "database_id": "tu-database-id",
    "page_size": 100
}

⚙️ 配置

可用环境变量:

  • NOTION_API_KEY:Notion API令牌(必需)
  • MCP_PORT:服务器端口(默认值:3004)
  • RUST_LOG:Nivel日志清除(默认值:info)

🔍 使用示例

简单搜索

curl -X POST http://localhost:3004/api/search \
  -H "Content-Type: application/json" \
  -d '{"query": "", "limit": 5}'

查看数据库

curl -X POST http://localhost:3004/api/query_database \
  -H "Content-Type: application/json" \
  -d '{"database_id": "tu-database-id", "page_size": 10}'

🤝 贡献

  1. 叉项目
  2. 为您的功能创建分支(git checkout -b feature/AmazingFeature)
  3. 提交您的更改(git commit -m 'Add some AmazingFeature')
  4. 推拉拉马(git push origin feature/AmazingFeature)
  5. Abrir取消拉取请求

📝 许可证

这个项目在麻省理工学院的许可下-查看文件 许可证 更多细节。

✨ 感谢

  • Notion团队以其出色的API
  • 工具和书店生锈社区