npx skills add https://github.com/75002425/notion-helper --skill notion-helper安全的 Notion 集成工具,零外部依赖(纯 Python 标准库),帮你高效管理 Notion 工作区。
使用前必须完成两步配置:
agent 或 notion-helper)广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
ntn_Windows (PowerShell):
[System.Environment]::SetEnvironmentVariable('NOTION_API_KEY', '你的API_KEY', 'User')
Linux / Mac:
echo 'export NOTION_API_KEY="你的API_KEY"' >> ~/.bashrc
source ~/.bashrc
在需要访问的 Notion 页面上:
··· 菜单只有被授权的页面(及其子页面)才能被 API 访问。
每次操作前,先运行 scripts/notion_api.py 中的 API 客户端连接 Notion。脚本会:
自动读取环境变量中的 API Key
自动检测系统代理设置(Windows 注册表)
无需手动配置代理
import subprocess, sys, os
skill_dir = os.path.dirname(os.path.abspath(file))
sys.path.insert(0, skill_dir) from scripts.notion_api import NotionAPI
api = NotionAPI()
帮我搜索 Notion 中包含"项目"关键词的页面
执行方式:调用 api.search("项目")
帮我在 Notion 创建一个笔记,标题是"会议记录",内容是今天讨论了项目进度
执行流程:
api.search("") 找到可用的父页面scripts/formatter.py 中的 text_to_blocks() 将内容转为 Notion 块api.create_page(parent_id, title, blocks) 创建页面把我们刚才讨论的内容整理成 Notion 文档
执行流程:
帮我整理 Notion 中"工作笔记"页面的子页面
执行流程:
api.search("工作笔记") 找到目标页面api.get_block_children(page_id) 获取子内容帮我在那个页面后面加一段内容
执行流程:
api.append_blocks(page_id, new_blocks) 追加内容api.update_block(block_id, new_content) 修改指定块api.delete_block(block_id) 删除指定块scripts/formatter.py 提供以下格式转换函数:
| 函数 | 用途 | 示例 |
|---|---|---|
text_to_blocks(text) | Markdown 文本 → Notion 块 | 自动识别 # 标题、- 列表、段落 |
create_callout(text, emoji) | 创建提示框 | 💡 高亮提示信息 |
create_code_block(code, lang) | 创建代码块 | 支持语法高亮 |
create_divider() | 创建分隔线 | — |
create_toc() | 创建目录 | 自动生成页面目录 |
create_toggle(title, children) | 创建折叠块 | 可展开/收起的内容 |
rich(text, bold, code, color) | 富文本构造器 | 粗体、代码、颜色 |
当 formatter 不够用时,可以直接构造 Notion API 的块格式:
# 带格式的段落
block = {
"object": "block",
"type": "paragraph",
"paragraph": {
"rich_text": [
{"type": "text", "text": {"content": "普通文本"}},
{"type": "text", "text": {"content": "粗体"}, "annotations": {"bold": True}},
{"type": "text", "text": {"content": "代码"}, "annotations": {"code": True}},
]
}
}
scripts/notion_api.py 执行,无需安装任何第三方包append_blocksWeekly Installs
1
Repository
First Seen
1 day ago
Security Audits
Installed on
mcpjam1
claude-code1
replit1
junie1
windsurf1
zencoder1
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
31,600 周安装