Notion API 服务器
参考视频
为了方便使用 Notion API,自定义服务器。它使用 Express.js 实现,并将 Notion API 的各种功能作为 REST API 公开。
如何安装
安装所需的软件包:
运行服务器:
服务器在http://localhost:3000运行。
如何设置
在 server.js 文件中的
NOTION_TOKEN变量中设置 Notion API 令牌:
如果需要,您可以通过修改 PORT 变量在不同的端口上运行它。
API 功能
搜索 API
POST /api/search:搜索 Notion 工作区内的页面和数据库。
数据库 API
POST /api/databases:创建数据库GET /api/databases/:id:查询数据库PATCH /api/databases/:id: 更新数据库POST /api/databases/:id/query:数据库查询
页面 API
POST /api/pages:创建页面GET /api/pages/:id:查看页面信息PATCH /api/pages/:id: 更新页面GET /api/pages/:page_id/properties/:property_id:查看页面属性
块 API
GET /api/blocks/:id: 区块查询GET /api/blocks/:id/children:查看区块内容PATCH /api/blocks/:id: 更新区块PATCH /api/blocks/:id/children: 添加块内容DELETE /api/blocks/:id:删除块
用户 API
GET /api/users:查看用户列表GET /api/users/:id:用户搜索GET /api/users/me:查看自己的用户信息
评论API
POST /api/comments:创建评论GET /api/comments?block_id=...: 查看评论
光标 MCP 集成
将以下设置添加到
.cursor/mcp.json文件:
您可以在服务器运行时使用 Cursor 中的 MCP 函数访问 Notion API。
使用示例
示例搜索请求
页面创建示例
创建数据库的示例
API 文档
运行服务器时,可以在以下 URL 上获取 API 文档:
Swagger 用户界面: http://localhost:3000/api-docs
OpenAPI 模式: http://localhost:3000/openapi.json
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
为 Notion 提供 REST API 接口的自定义服务器,允许通过 Cursor 的 MCP 功能轻松访问 Notion 的功能。
Related MCP Servers
- Asecurity-licenseAqualityMCP Server for the Notion API, enabling Claude to interact with Notion workspaces.Last updated -18329825MIT License
- Asecurity-licenseAqualityA high-performance MCP server that integrates Notion into AI workflows, enabling interaction with Notion pages, databases, and comments through a standardized protocol.Last updated -1824
- Asecurity-licenseAqualityNotion MCP Server is a MCP server implementation that enables AI assistants to interact with Notion's API.Last updated -13305136MIT License
Notion MCP Serverofficial
Asecurity-licenseAqualityAn MCP server that enables AI assistants to interact with the Notion API, allowing them to search, read, comment on, and create content in Notion workspaces through natural language commands.Last updated -1912,7353,269MIT License