Token导航 LogoToken导航TokenDH.com
Notion CLI logo
开发工具stdio官方级别未说明来源级核验

Notion CLI

MCP Server

skills

一个用于通过远程MCP(模型上下文协议)管理Notion工作空间的命令行工具,支持搜索、创建和管理页面、数据库及评论等功能。

工具数

0

提示词数

0

GitHub Stars

32

资源数

0
命令行工具GoClaudeClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

lox

提供方

lox

最后核验

2026/5/17 20:21

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx skills add lox/notion-cli

详细介绍

概念cli

](https://golang.org/) ![License](LICENSE)

Notion使用远程MCP(模型上下文协议)的命令行界面。

受到启发 线性气候 -在管理Notion工作区时,请留在终端中。

与AI代理配合得很好 --包括a 技能 它允许代理在代码旁边搜索、创建和管理您的Notion工作区。

安装

源自

go install github.com/lox/notion-cli@latest

本地建设

git clone https://github.com/lox/notion-cli
cd notion-cli
mise run build

快速开始

# Authenticate with Notion (opens browser for OAuth)
notion-cli auth login

# Search your workspace
notion-cli search "meeting notes"

# View a page with open comments inline by default
notion-cli page view "https://notion.so/My-Page-abc123"

# Hide page and block comments when you only want the body
notion-cli page view "Meeting Notes" --no-comments

# List your pages
notion-cli page list

# Create a page
notion-cli page create --title "New Page" --content "# Hello World"

命令

认证

notion-cli auth login      # Authenticate with Notion via OAuth
notion-cli auth refresh    # Refresh the access token
notion-cli auth status     # Show authentication status
notion-cli auth logout     # Clear stored credentials

# Official API fallback auth for features MCP cannot handle directly
notion-cli auth api setup     # Opens the internal integrations page, prompts for token, warns if format looks wrong
notion-cli auth api status
notion-cli auth api verify
notion-cli auth api unset

页面

notion-cli page list                           # List pages
notion-cli page list --limit 50                # Limit results
notion-cli page list --json                    # Output as JSON

notion-cli page view 
                    # View page content with comments
notion-cli page view 
 --no-comments      # Hide page and block comments
notion-cli page view 
 --raw              # View raw Notion markup
notion-cli page view 
 --json             # Output as JSON

notion-cli page create --title "Title"         # Create a page
notion-cli page create --title "T" --content "Body text"
notion-cli page create --title "T" --parent 

notion-cli page archive 
       # Archive a page via the official API

# Upload a markdown file as a new page
notion-cli page upload ./document.md                        # Title from # heading or filename
notion-cli page upload ./document.md --title "Custom Title" # Explicit title
notion-cli page upload ./document.md --parent "Engineering" # Parent by name or ID
notion-cli page upload ./document.md --parent-db     # Upload as database entry
notion-cli page upload ./document.md --icon "📄"             # Set emoji icon
notion-cli page upload ./document.md                        # Uploads standalone local images when configured
notion-cli page upload ./document.md --skip-local-images    # Strips standalone local image lines instead

# Sync a markdown file (create or update)
notion-cli page sync ./document.md                          # Creates page, writes notion-id to frontmatter
notion-cli page sync ./document.md                          # Updates page using notion-id from frontmatter
notion-cli page sync ./document.md --parent "Engineering"   # Set parent on first sync
notion-cli page sync ./document.md --parent-db       # Sync as database entry
notion-cli page sync ./document.md                          # Uploads standalone local images when configured
notion-cli page sync ./document.md --skip-local-images      # Strips standalone local image lines instead

# Edit an existing page
notion-cli page edit 
 --replace "New content"                      # Replace all content
notion-cli page edit 
 --replace "New content" --allow-deleting-content # Allow replacing pages with child content
notion-cli page edit 
 --find "old text" --replace-with "new text"  # Find and replace
notion-cli page edit 
 --find "section" --append "extra content"    # Append after match
notion-cli page edit 
 -P "Status=Done" -P "Priority=1"             # Update page properties

参数接受URL、ID或页面名称。

page archive 接受页面URL或页面ID,并通过官方API将该页面移到垃圾桶中。这需要通过配置官方API令牌 auth api setupNOTION_API_TOKEN.

page view 默认情况下,显示打开页面级别的评论和内联块讨论。内联讨论在上下文中呈现,锚文本包裹在 [[...]] 下面显示的讨论。使用 --no-comments 为了抑制评论, --raw 检查原始Notion标记,以及 --json 返回页面加上a Comments 阵列。

page uploadpage sync 支持本地图像上传,用于独立的markdown图像行,如 ![Alt](./diagram.png)当存在局部图像时, notion-cli 通过官方的Notion API上传这些文件,并按文档顺序保存。这需要通过配置官方API令牌 auth api setupNOTION_API_TOKEN.通行证 --skip-local-images 默默地删除独立的本地图像行,而不是上传它们。内联或混合内容本地图像语法被拒绝,而不是被猜测。

搜索

notion-cli search "query"                      # Search workspace
notion-cli search "query" --limit 10           # Limit results
notion-cli search "query" --json               # Output as JSON

数据库

notion-cli db list                             # List databases
notion-cli db list -q "project"                # Filter by name
notion-cli db list --json                      # Output as JSON

notion-cli db query               # Query database
notion-cli db query  --json                # Output as JSON

# Create an entry in a database
notion-cli db create  --title "Entry Title"
notion-cli db create  -t "Title" --prop "Status=Not started"
notion-cli db create  -t "Title" --prop "Status=Done" --prop "date:Due:start=2026-03-01"
notion-cli db create  -t "Title" --content "Body text"
notion-cli db create  -t "Title" --file ./notes.md
notion-cli db create  -t "Title" --json

这 ` 参数接受URL、ID或名称。日期属性使用扩展密钥格式: date: :start, date: :end`.

评论

notion-cli comment list 
                 # List open page and block comments
notion-cli comment list 
 --resolved      # Include resolved discussions too
notion-cli comment list 
 --json          # Output as JSON
notion-cli comment list "Meeting Notes"        # Resolve the page by name

notion-cli comment create 
 --content "Comment text"
notion-cli comment create https://notion.so/... --content "Looks good"

注释命令接受页面URL、ID或名称。 comment list 默认情况下,包括页面级和块级讨论,除非您通过,否则仅显示打开的讨论 --resolved.

其他

notion-cli tools                               # List available MCP tools
notion-cli tools --json                        # Output tools as JSON
notion-cli version                             # Show version
notion-cli --version                           # Alias for version
notion-cli -v                                  # Short alias for version
notion-cli --help                              # Show help

配置

CLI使用Notion的远程MCP服务器进行OAuth身份验证。在第一次运行时, notion-cli auth login 将打开浏览器,通过Notion工作区授权CLI。

注: 访问令牌将在1小时后过期。当令牌过期或即将过期时,CLI会自动刷新令牌,因此您通常不需要考虑这一点。使用 notion-cli auth refresh 如果需要,可以手动刷新。

环境变量

变量描述
NOTION_ACCESS_TOKEN用于CI/无头使用的访问令牌(跳过OAuth)
NOTION_API_TOKEN用于上传回退和验证的官方Notion API令牌
NOTION_API_BASE_URL覆盖官方的Notion API基础URL
NOTION_API_NOTION_VERSION覆盖官方Notion API版本

运作原理

此CLI连接到 Notion的远程MCP服务器https://mcp.notion.com/mcp 使用模型上下文协议。这提供了:

  • OAuth身份验证 -没有要管理的API令牌
  • Notion风格的Markdown -自然地创建/编辑内容
  • 语义搜索 -也可以在连接的应用程序中搜索
  • 针对CLI进行了优化 -高效响应

技能

cli概念包括一种帮助AI代理有效使用cli的技能。

安培/克劳德码

使用安装技能 技能s.sh:

npx skills add lox/notion-cli

或者手动添加到Amp/Claude配置中:

# Amp
amp skill add https://github.com/lox/notion-cli/tree/main/skills/notion-cli

# Claude Code
claude plugin marketplace add lox/notion-cli
claude plugin install notion-cli@notion-cli

在以下网址查看技能: 技能/概念/SKILL.md

链接

许可证

MIT许可证-请参阅 许可证 了解详情。

目录标签

目录标签

命令行工具GoClaude本地部署Notion集成工作空间管理AI代理支持

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

oauth

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

skills

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiooauth部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP