CLI 目录 横向对比 FCRS-1.0 标准 /llms.txt
← 返回 CLI 目录

Notion CLI

$ notion 社区开源 中风险
Community (4ier) · 办公协作与 SaaS · MIT · macos / linux / windows

Notion CLI(notion,4ier/notion-cli)是一个轻量单文件 Go 二进制,全面覆盖 Notion 页面、数据库、块、评论与搜索。它为脚本和 Agent 提供一致的 --json 输出,并原生支持 Markdown 转换与简写 --filter 查询语法。

FCRS-1.0 综合评分
82 /100
良好 (Good)
中置信度 (源码/文档)
零摩擦安装命令
brew install 4ier/tap/notion-cli
CLI vs MCP 选型建议 CLI + MCP 搭配

需要确定性 --json 管道处理、Markdown 块导出与 Shell 数据库检索时用 notion CLI;若希望基于 OAuth 用户级权限而非集成令牌访问,可使用 Notion 官方托管 MCP。

Agent 友好度体检单

✓ 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
✓ 自省/Schema 发现
— 官方 SKILL.md

当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。

FCRS-1.0 六维评分拆解

Agent 友好度 21 / 25

专为脚本与 Agent 打造:全面支持 --json、Markdown 块转换、简写过滤与 NOTION_TOKEN 无头鉴权。

  • --json supported consistently across search, page, db, and block
  • Non-interactive NOTION_TOKEN and --with-token auth
安全与权限边界 20 / 25

Notion 集成令牌仅能访问显式分享给该集成的页面与数据库,天然形成权限隔离边界。

  • Integration-level page sharing restricts workspace exposure
  • Supports read-only Notion integration capabilities
安装与运行摩擦 14 / 15

单 Go 二进制支持 Homebrew Tap、npm(@4ier/notion-cli)、go install、Scoop 与 Docker。

  • brew install 4ier/tap/notion-cli and npm install -g @4ier/notion-cli
能力覆盖与边际价值 13 / 15

内置 Markdown 与 Notion Block 双向转换及简写 --filter,显著减少复杂 JSON 拼接。

  • Markdown-to-block and block-to-Markdown conversion
维护与来源背书 7 / 10

由社区维护的 MIT 开源项目(4ier/notion-cli),非 Notion Labs 官方出品。

  • Third-party maintainer rather than official Notion organization
文档与可验证性 7 / 10

GitHub README 与内置 --help 清晰实用,但文档规范度略逊于官方 SDK。

  • GitHub README and command help pages

安全边界、鉴权与放权指南

鉴权方式
环境变量密钥 本地配置文件
凭证存储位置

从环境变量读取 NOTION_TOKEN,或通过 notion auth login --with-token 将集成令牌保存在本地配置。

潜在副作用
只读查询 远端写入 破坏性删除
费用与配额提示

CLI 开源免费(MIT);Notion 集成令牌适用于包括免费版在内的所有 Notion 套餐。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# Notion CLI Agent Rules
- Share only specific target pages/databases with the `NOTION_TOKEN` integration so the blast radius is scoped by Notion permissions.
- Always pass `--json` on read/search commands and check parent IDs before creating pages.
- Require explicit human approval before archiving, deleting blocks, or bulk-updating database properties.

Agent 高频安全命令配方

只读查询(安全推荐)

以 JSON 搜索 Notion 页面与数据库
notion search "architecture" --json

检索已授权给当前集成令牌的页面与数据库,并返回 JSON 元数据。

以 JSON 读取 Notion 页面属性
notion page get <PAGE_ID> --json

只读获取指定页面的属性与元数据,不改动工作区内容。

受控写入与预演

在已知父页面下创建草稿子页面
notion page create --parent <PARENT_PAGE_ID> --title "Agent Research Notes" --json

在经过确认的父页面 ID 下新建单个子页面。

核心优势

  • + --json 输出与 NOTION_TOKEN 环境变量非常适合 Agent 流水线。
  • + 原生 Markdown 转换免去手写冗长的 Notion Block JSON 结构。
  • + Notion 集成授权机制天然限制了令牌可触及的页面范围。

注意事项与踩坑点

  • ! 属于社区项目(4ier/notion-cli),并非 Notion 官方工具。
  • ! 需先创建 Notion Internal Integration 并手动将目标页面/数据库共享给它。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI