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

Notion Agent

MCP Server

notion-agent

为AI代理和自动化脚本设计的Notion API命令行工具和MCP服务器,提供对Notion工作空间的程序化读写和查询功能。

工具数

29

提示词数

0

GitHub Stars

1

资源数

0
Notion集成命令行工具TypeScriptClaudeClaude DesktopClaudeCursor

安装说明

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

作者 / 组织

bcharleson

提供方

bcharleson

最后核验

2026/5/17 20:19

运行时

Node.js

快速接入

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

命令预览

npx notion-agent databases list

详细介绍

概念代理

](https://www.npmjs.com/package/notion-agent) ![license](LICENSE)

Notion API的代理本地CLI+MCP服务器。每个Notion端点都是一个CLI命令和一个MCP工具——一个集成,两个接口,零重复。

专为需要以编程方式读取、写入和查询Notion工作区的AI代理(Claude、Cursor、OpenClaw)和自动化脚本而构建。

______________________________________________________________________

安装

npm install -g notion-agent

或者在不安装的情况下运行:

npx notion-agent databases list

______________________________________________________________________

认证

您需要一个Notion集成令牌。创建一个 notion.so/my集成.

令牌格式: 令牌以开头 secret_ (较旧的集成)或 ntn_ (较新的集成)。两者都得到了支持。

选项1——环境变量(建议用于CI/CD代理):

export NOTION_TOKEN=ntn_xxxxxxxxxxxx

选项2——交互式登录(保存到 ~/.notion-cli/config.json):

notion login
# Prompts: Paste your Notion integration token (secret_... or ntn_...):

选项3——每个命令标志:

notion --token ntn_xxxxxxxxxxxx databases list
重要提示: 您的集成只看到与其显式共享的页面和数据库。在Notion中,打开一个页面/数据库→ 分享邀请 → 搜索您的集成名称。

______________________________________________________________________

快速开始

# Verify auth + show workspace
notion workspace info

# List accessible databases
notion databases list --pretty

# Search pages by title
notion search pages --query "Project Brief"

# Query a database with filter
notion databases query \
  --database-id abc123 \
  --filter '{"property":"Status","select":{"equals":"In Progress"}}' \
  --flat --pretty

# Get a page as Markdown (great for agents)
notion pages markdown --page-id abc123

# Append a block to a page
notion blocks append --block-id 
 --type heading_1 --text "Meeting Notes"
notion blocks append --block-id 
 --type to_do --text "Follow up with client" --checked false

# Create a page in a database
notion pages create \
  --parent-database-id abc123 \
  --title "New Task" \
  --pretty

______________________________________________________________________

全球旗帜

这些命令适用于每个命令:

标志描述
--token 以(权力)否决 NOTION_TOKEN 有人是。
--pretty漂亮的打印JSON输出
--quiet抑制输出(仅退出代码)
--fields 仅返回指定的顶级字段
--flat将页面属性值平铺为可读标量

--flat 旗帜

Notion将属性作为深度嵌套的对象返回。 --flat 将它们转换为人类可读的标量:

# Without --flat: {"Name": {"type":"title","title":[{"plain_text":"My Task",...}]}}
# With --flat:    {"Name": "My Task"}
notion databases query --database-id abc123 --flat --pretty

______________________________________________________________________

命令

databases

子命令描述
list列出所有可访问的数据库
get获取数据库元数据和属性架构
schema人类可读的模式——属性名、类型和选项
properties物业名称和类型的简单列表
query使用筛选器和排序查询数据库行
create在父页面下创建新数据库
update更新标题、描述或存档数据库
notion databases query --database-id  \
  --filter '{"property":"Status","select":{"equals":"Done"}}' \
  --sorts '[{"property":"Created","direction":"descending"}]' \
  --page-size 50 --flat --pretty

pages

子命令描述
get检索页面及其属性
create创建页面(子页面或数据库行)
update更新页面属性
archive将页面移至回收站
restore从回收站还原页面
property获取单个属性(用于>25个引用)
content以块的形式获取页面内容
markdown以Markdown文本形式获取页面内容
# Get page as Markdown — best for agents reading content
notion pages markdown --page-id 

blocks

子命令描述
get检索单个块
children列出封锁儿童(一级深度)
append将块附加到页面或块
update更新块内容
delete删除块(从Notion可逆)
# Append different block types
notion blocks append --block-id  --type paragraph --text "Some text"
notion blocks append --block-id  --type code --text "console.log('hi')" --language typescript
notion blocks append --block-id  --type divider
notion blocks append --block-id  --blocks '[{"object":"block","type":"paragraph","paragraph":{"rich_text":[{"type":"text","text":{"content":"Hello"}}]}}]'

users

子命令描述
list列出所有工作区成员
get通过ID获取特定用户
me获取此集成的机器人用户

comments

子命令描述
list在页面或块上列出评论
create向页面或讨论线程添加评论

search

子命令描述
all按标题搜索页面和数据库
pages仅搜索页面
databases仅搜索数据库
注意:Notion搜索匹配 仅标题,而不是页面正文内容。

workspace

子命令描述
info验证auth+显示工作区名称和机器人身份

______________________________________________________________________

输出

stdout上的所有输出都是JSON。错误将转到stderr。退出码 0 =成功, 1 =错误。

# Machine-readable (default)
notion databases list

# Human-readable
notion databases list --pretty

# Pipe to jq
notion databases query --database-id abc123 --flat | jq '.results[] | .properties.Name'

______________________________________________________________________

MCP服务器

使用Claude Code、Claude Desktop、Cursor或任何MCP客户端作为MCP服务器。

克劳德代码

# Install globally first
npm install -g notion-agent

# Add as MCP server
claude mcp add notion -- notion-mcp

NOTION_TOKEN 在启动Claude Code之前,请在您的环境中执行以下操作,或将其内联传递:

NOTION_TOKEN=ntn_xxx claude

克劳德桌面

添加 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)或 %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "notion": {
      "command": "notion-mcp",
      "env": {
        "NOTION_TOKEN": "ntn_xxxxxxxxxxxx"
      }
    }
  }
}

光标

添加到光标MCP设置(~/.cursor/mcp.json):

{
  "mcpServers": {
    "notion": {
      "command": "notion-mcp",
      "env": {
        "NOTION_TOKEN": "ntn_xxxxxxxxxxxx"
      }
    }
  }
}

任何MCP客户端

MCP服务器在stdio上运行。从以下内容开始:

NOTION_TOKEN=ntn_xxx notion-mcp

可用的MCP工具

所有29个命令都可以作为具有命名约定的MCP工具使用 _:

databases_list, databases_get, databases_schema, databases_properties, databases_query, databases_create, databases_update, pages_get, pages_create, pages_update, pages_archive, pages_restore, pages_property, pages_content, pages_markdown, blocks_get, blocks_children, blocks_append, blocks_update, blocks_delete, users_list, users_get, users_me, comments_list, comments_create, search_all, search_pages, search_databases, workspace_info

______________________________________________________________________

速率限制

概念强制执行 3个请求/秒 平均每次整合。该工具尊重这一点——如果你达到了速率限制(429 错误),增加批量操作之间的延迟。

______________________________________________________________________

贡献

欢迎在 .

git clone https://github.com/bcharleson/notion-agent.git
cd notion-agent
npm install
npm run dev -- databases list --help   # run CLI in dev mode
npm run dev:mcp                         # run MCP server in dev mode
npm run build                           # compile to dist/
npm run typecheck                       # TypeScript check without build

______________________________________________________________________

许可证

麻省理工学院--

目录标签

目录标签

Notion集成命令行工具TypeScriptClaude本地部署自动化脚本AI代理MCP服务器

支持客户端

Claude DesktopClaudeCursor

接入字段

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

stdio

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

token

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

notion-agent

工具数量(toolCount,工具数)

29

资源数量(resourceCount,资源数)

0

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

0

权限和风险

stdiotoken部署方式未说明

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

安装前确认

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

来源信息

继续浏览同类 MCP