使用说明
OpenClaw概念MCP包装器
生产就绪的Notion MCP服务器包装,具有运行状况监视、自动重新连接和透明的直接REST API回退。专为在无头/云环境中运行的OpenClaw代理而构建。
同伴技能: openclaw概念md转换器 --Markdown→ Notion阻止转换。
AI代理快速参考
# Skill identity (SKILL.md frontmatter)
name: notion-mcp-wrapper
version: "2.0.1"
triggers:
- "notion"
- "mcp"
- "notion-mcp-wrapper"
- "move page"
- "notion health"
# Runtime requirements
requires:
bins: [node, npm]
env: [NOTION_TOKEN] # or NOTION_API_KEY
# Install
run: cd ~/.openclaw/skills/notion-mcp-wrapper && npm install
何时调用:
- 检查Notion MCP连接/健康状态
- 通过MCP执行通知操作(movePage、createPage、updatePage、deletePage)
- MCP服务器崩溃或超时后自动重新连接
- 当MCP不可用时,回退到直接通知REST API
何时不调用:
- Simple Notion直接通过MCP工具读取
- 非通知操作
特性
| 特性 | 描述 |
|---|---|
| 健康监测 | 连续MCP ping;报告 healthy / degraded / down 有延迟 |
| 自动重连 | 指数回退重试--可配置 maxRetries 和 baseDelayMs |
| 无缝回退 | 当MCP出现故障时,自动切换到Notion REST API;对呼叫者透明 |
| 运营支持 | movePage、getPage、updatePage、createPage、deletePage(带回退) |
| 完整测试套件 | 通过Jest进行单元+集成测试 |
安装
git clone https://github.com/Charpup/openclaw-notion-mcp-wrapper.git \
~/.openclaw/skills/notion-mcp-wrapper
cd ~/.openclaw/skills/notion-mcp-wrapper
npm install
环境:
export NOTION_TOKEN="ntn_YOUR_INTERNAL_INTEGRATION_TOKEN"
# Alternative:
export NOTION_API_KEY="ntn_YOUR_INTERNAL_INTEGRATION_TOKEN"
无头/云设置: 使用A 内部集成令牌 --无需浏览器OAuth。使用前,与您的集成共享目标Notion页面。
用法
作为图书馆
const { NotionMCPWrapper } = require('./lib/notion-mcp-wrapper');
const wrapper = new NotionMCPWrapper({
maxRetries: 5,
baseDelayMs: 1000,
enableHealthMonitor: true,
enableFallback: true,
});
await wrapper.start();
// Execute with automatic MCP → API fallback
const result = await wrapper.execute('movePage', {
page_id: 'abc123def456',
parent: { page_id: 'xyz789ghi012' },
});
console.log(result.source); // 'mcp' | 'fallback'
await wrapper.stop();
命令行界面
npm run health # Check MCP health
node bin/notion-mcp-wrapper.js move-page <page-id> <parent-id>
npm test # Run test suite
支持的操作
| 操作 | MCP工具 | API回退 |
|---|---|---|
movePage |
API-move-page |
✅ |
getPage |
API-retrieve-a-page |
✅ |
updatePage |
API-patch-page |
✅ |
createPage |
API-post-page |
✅ |
deletePage |
API-delete-a-block |
✅ |
getBlockChildren |
API-get-block-children |
❌ |
appendBlocks |
API-patch-block-children |
❌ |
queryDatabase |
API-query-data-source |
❌ |
search |
API-post-search |
❌ |
建筑
NotionMCPWrapper ← entry point
├── HealthMonitor periodic MCP ping → healthy / degraded / down
├── RetryPolicy exponential backoff, configurable maxRetries
├── MCPClient stdio-based MCP protocol communication
└── FallbackStrategy Notion REST API when MCP unavailable
评估
技能测试用例在 evals/evals.json 遵循技能创建者标准:
| ID | 场景 | 预期触发器 |
|---|---|---|
| 1 | 检查Notion MCP健康状态 | ✅ 是的 |
| 2 | 通过带有回退功能的MCP包装器移动页面 | ✅ 是的 |
| 3 | 编写JavaScript字符串反转函数 | ❌ 没有 |
版本历史记录
| 版本 | 更改 |
|---|---|
| v2.0.1 | 添加 metadata.openclaw 合规障碍;添加 evals/evals.json (3例) |
| v2.0.0版本 | 生产重写:HealthMonitor、重试策略、回退策略、完整测试 |
相关项目
- openclaw概念md转换器 --Markdown→ 概念块
- 特里杰耶夫 --金三角工作流程(使用此技能)
- 开爪 --代理框架
许可证
麻省理工学院-- 小狗
更新日志
- 2026-03-11:技能审核升级——将Skill.md前台规范化
name+description,重新验证了触发措辞,并重新检查了与OpenClaw的轻质棉绒/烟雾兼容性。