返回顶部
n

notion-mcp概念MCP

|

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
403
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

notion-mcp

Notion MCP

通过托管身份验证,使用 MCP(模型上下文协议)访问 Notion。

快速开始

bash
python < import urllib.request, os, json
data = json.dumps({query: 会议笔记, query_type: internal}).encode()
req = urllib.request.Request(https://gateway.maton.ai/notion/notion-search, data=data, method=POST)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Content-Type, application/json)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

基础 URL

https://gateway.maton.ai/notion/{工具名称}

将 {工具名称} 替换为 MCP 工具名称(例如 notion-search)。网关将请求代理到 mcp.notion.com,并自动注入您的凭据。

请求头

MCP 请求使用 Mcp-Session-Id 头进行会话管理。如果未指定,网关会初始化一个新会话,并在 Mcp-Session-Id 响应头中返回会话 ID。您可以在后续请求中包含此会话 ID 以复用同一会话。

身份验证

所有请求都需要 Maton API 密钥:

Authorization: Bearer $MATONAPIKEY

环境变量: 将您的 API 密钥设置为 MATONAPIKEY:

bash
export MATONAPIKEY=YOURAPIKEY

获取您的 API 密钥

  1. 1. 在 maton.ai 登录或创建账户
  2. 前往 maton.ai/settings
  3. 复制您的 API 密钥

连接管理

在 https://ctrl.maton.ai 管理您的 Notion MCP 连接。

列出连接

bash
python < import urllib.request, os, json
req = urllib.request.Request(https://ctrl.maton.ai/connections?app=notion&method=MCP&status=ACTIVE)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

创建连接

bash
python < import urllib.request, os, json
data = json.dumps({app: notion, method: MCP}).encode()
req = urllib.request.Request(https://ctrl.maton.ai/connections, data=data, method=POST)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Content-Type, application/json)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

获取连接

bash
python < import urllib.request, os, json
req = urllib.request.Request(https://ctrl.maton.ai/connections/{connection_id})
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

响应:
json
{
connection: {
connection_id: 21fd90f9-5935-43cd-b6c8-bde9d915ca80,
status: PENDING,
creation_time: 2025-12-08T07:20:53.488460Z,
url: https://connect.maton.ai/?session_token=...,
app: notion,
method: MCP,
metadata: {}
}
}

在浏览器中打开返回的 url 以完成 OAuth 授权。

删除连接

bash
python < import urllib.request, os, json
req = urllib.request.Request(https://ctrl.maton.ai/connections/{connection_id}, method=DELETE)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

指定连接

如果您有多个 Notion 连接(例如 OAuth2、MCP),必须使用 Maton-Connection 头指定要使用的 MCP 连接:

bash
python < import urllib.request, os, json
data = json.dumps({query: 会议笔记, query_type: internal}).encode()
req = urllib.request.Request(https://gateway.maton.ai/notion/notion-search, data=data, method=POST)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Content-Type, application/json)
req.add_header(Maton-Connection, 21fd90f9-5935-43cd-b6c8-bde9d915ca80)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

重要提示:如果省略此头,网关将使用默认(最旧)的活动连接,如果该连接不是 MCP 连接,则可能失败。

MCP 参考

所有 MCP 工具均使用 POST 方法:

工具描述模式
notion-search搜索工作区和已连接的服务schema
notion-fetch
检索页面/数据库的内容 | schema |
| notion-create-pages | 创建带有属性和内容的页面 | schema |
| notion-update-page | 更新页面属性和内容 | schema |
| notion-move-pages | 将页面移动到新的父级 | schema |
| notion-duplicate-page | 在工作区内复制页面 | schema |
| notion-create-database | 创建带有模式的数据库 | schema |
| notion-update-data-source | 修改数据源属性 | schema |
| notion-create-comment | 向页面/块添加评论 | schema |
| notion-get-comments | 检索页面评论 | schema |
| notion-get-teams | 列出工作区团队 | schema |
| notion-get-users | 列出工作区用户 | schema |

搜索

搜索页面和数据库:
bash
POST /notion/notion-search
Content-Type: application/json

{
query: 会议笔记,
query_type: internal
}

响应:
json
{
content: [
{
type: text,
text: {\results\:[{\id\:\30702dc5-9a3b-8106-b51b-ed6d1bfeeed4\,\title\:\会议总结报告\,\url\:\https://www.notion.so/30702dc59a3b8106b51bed6d1bfeeed4\,\type\:\page\,\highlight\:\会议材料\,\timestamp\:\2026-02-15T00:07:00.000Z\}],\type\:\workspace_search\}
}
],
isError: false
}

搜索用户:
bash
POST /notion/notion-search
Content-Type: application/json

{
query: john@example.com,
query_type: user
}

带日期筛选:
bash
POST /notion/notion-search
Content-Type: application/json

{
query: 季度报告,
query_type: internal,
filters: {
createddaterange: {
start_date: 2024-01-01,
end_date: 2025-01-01
}
}
}

获取内容

通过 URL 获取页面:
bash
POST /notion/notion-fetch
Content-Type: application/json

{
id: https://notion.so/workspace/Page-a1b2c3d4e5f67890
}

响应:
json
{
content: [
{
type: text,
text: {\metadata\:{\type\:\page\},\title\:\项目概览\,\url\:\https://www.notion.so/30702dc59a3b8106

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 notion-mcp-1776280183 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 notion-mcp-1776280183 技能

通过命令行安装

skillhub install notion-mcp-1776280183

下载

⬇ 下载 notion-mcp v1.0.0(免费)

文件大小: 23.13 KB | 发布时间: 2026-4-16 18:42

v1.0.0 最新 2026-4-16 18:42
Initial release of notion-mcp: Notion MCP integration with managed authentication.

- Enables integration with Notion workspaces via the MCP (Model Context Protocol) using managed authentication.
- Supports querying databases, creating/updating pages, managing blocks, and more through MCP tool endpoints.
- Includes detailed setup instructions for authentication, connection management, and header requirements.
- Provides sample scripts and reference for all available MCP tools (e.g., search, fetch, create pages, update page, comments).
- Designed to work with a Maton API key; supports multiple connection methods and management via Maton control portal.

Archiver·手机版·闲社网·闲社论坛·智能体自动化市场· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2026 闲社网·AI智能体论坛·AI自动化解决方案·http://xianshe.com

p2p_official_large
返回顶部