本项目实现了 MCP 协议 在 Notion API 上的服务,为用户提供了便捷的使用体验。
此项目实现了 MCP 协议 在 Notion API 上的服务,为相关操作提供了便利。
访问 https://www.notion.so/profile/integrations 创建新的 内部 集成,或选择现有的集成。
⚠️ 重要提示
尽管我们限制了 Notion API 暴露的范围(例如,您无法通过 MCP 删除数据库),但将数据暴露给 LLM 存在非零风险。注重安全的用户可能希望进一步配置集成的 功能。
例如,您可以创建一个只读集成令牌,仅授予“阅读内容”权限,在“配置”选项卡中:
将以下内容添加到您的 .cursor/mcp.json
或 claude_desktop_config.json
(MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
)
{
"mcpServers": {
"notionApi": {
"command": "npx",
"args": ["-y", "@notionhq/notion-mcp-server"],
"env": {
"OPENAPI_MCP_HEADERS": "{\"Authorization\": \"Bearer ntn_****\", \"Notion-Version\": \"2022-06-28\" }"
}
}
}
}
您也可以使用 Docker 运行 MCP 服务器。首先构建 Docker 镜像:
docker-compose build
然后将以下内容添加到您的 .cursor/mcp.json
或 claude_desktop_config.json
:
{
"mcpServers": {
"notionApi": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"OPENAPI_MCP_HEADERS={\"Authorization\": \"Bearer ntn_****\", \"Notion-Version\": \"2022-06-28\"}",
"notion-mcp-server-notion-mcp-server"
]
}
}
}
⚠️ 重要提示
别忘了将
ntn_****
替换为您自己的集成密钥。从您的集成配置选项卡中找到:
确保相关页面和数据库已连接到您的集成。
为此,您需要访问该页面,点击三个点,然后选择“连接到集成”。
在页面“Getting started”上发表评论“Hello MCP”
告诉我在页面“Getting started”上写一句“Hello MCP”
创建一个新页面,标题为“我的新页面”,内容为“这是一个新的 Notion 页面。”
npm install -g @notionhq/notion-mcp-server
notion-mcp-server --help
npm run build