Skip to main content
Glama
awkoy

notion-mcp-server

by awkoy

Not MCP 服务器

执照TypeScript模型上下文协议 铁匠徽章 NPM 下载星星

Notion MCP 服务器是一个模型上下文协议 (MCP) 服务器实现,使 AI 助手能够与 Notion 的 API 进行交互。这款生产就绪的服务器提供了一整套工具和端点,用于通过自然语言交互读取、创建和修改 Notion 内容。

🚧积极开发:数据库支持现已推出!评论和用户管理工具也已添加。如果您觉得这个项目有用,请考虑点个星——这有助于我了解这项工作对社区的价值,并激励我们进一步开发。

📑 目录

Related MCP server: Notion MCP Server

🚀 入门与集成

设置过程

  1. 获取 Not API 密钥

  2. 为您的页面启用集成

    • 在 Notion 中选择一个现有页面或创建一个新页面

    • 点击右上角的“...”菜单

    • 前往“连接”

    • 从列表中查找并启用您的集成概念页面连接

  3. 选择您的集成方法

    • 根据您首选的 MCP 客户端,遵循以下集成选项之一

  4. 让你的人工智能助手与 Notion 互动

    • “创建一个包含今日任务的新页面”

    • “在 Notion 中更新我的会议记录”

    • “将项目符号添加到我的会议记录页面”

    • “创建一个新的数据库来跟踪项目”

    • “向我的任务数据库添加新条目”

    • “向我的项目页面添加评论”

    • “显示此文档的所有评论”

    • “列出我的工作区中的所有用户”

    • “获取特定用户的信息”

光标集成

方法 1:使用 mcp.json

  1. 在您的项目目录中创建或编辑.cursor/mcp.json文件:

{
  "mcpServers": {
    "notion-mcp-server": {
      "command": "env NOTION_TOKEN=YOUR_KEY NOTION_PAGE_ID=YOUR_PAGE_ID npx",
      "args": ["-y", "notion-mcp-server"]
    }
  }
}
  1. 用您的实际 Notion API 密钥和页面 ID 替换YOUR_KEY和YOUR_PAGE_ID

  2. 重新启动 Cursor 以应用更改

方法二:手动模式

  1. 打开 Cursor 并转到“设置”

  2. 导航到“MCP”或“模型上下文协议”部分

  3. 单击“添加服务器”或同等按钮

  4. 在相应的字段中输入以下命令:

env NOTION_TOKEN=YOUR_KEY NOTION_PAGE_ID=YOUR_PAGE_ID npx -y notion-mcp-server
  1. 用您的实际 Notion API 密钥和页面 ID 替换YOUR_KEY和YOUR_PAGE_ID

  2. 保存设置并根据需要重新启动 Cursor

Claude 桌面集成

  1. 在您的配置目录中创建或编辑mcp.json文件:

{
  "mcpServers": {
    "notion-mcp-server": {
      "command": "npx",
      "args": ["-y", "notion-mcp-server"],
      "env": {
        "NOTION_TOKEN": "YOUR_KEY",
        "NOTION_PAGE_ID": "YOUR_PAGE_ID"
      }
    }
  }
}
  1. 用您的实际 Notion API 密钥和页面 ID 替换YOUR_KEY和YOUR_PAGE_ID

  2. 重新启动 Claude Desktop 以应用更改

🌟 功能

  • 📝 Notion 集成- 与 Notion 数据库、页面和块进行交互

  • 🔌 通用 MCP 兼容性- 适用于所有 MCP 客户端,包括 Cursor、Claude Desktop、Cline 和 Zed

  • 🔍 数据检索- 从 Notion 页面、块和数据库获取信息

  • ✏️ 内容创建- 创建和更新 Notion 页面和区块

  • 📊 区块管理- 在 Notion 页面中附加、更新和删除区块

  • 💾 数据库操作- 创建、查询和更新数据库

  • 🔄 批量操作- 在单个请求中执行多个操作

  • 🗑️ 存档和恢复- 存档和恢复 Notion 页面

  • 🔎 搜索功能- 按标题搜索 Notion 页面和数据库

  • 💬 评论管理——获取、创建和回复页面和讨论的评论

  • 👥 用户管理- 检索工作区用户和用户信息

📚 文档

可用工具

该服务器提供了以下与 Notion 交互的整合工具:

notion_pages

全面的页面操作工具,包括:

  • 创建具有指定内容的新页面

  • 更新页面属性

  • 存档页面(移至垃圾箱)

  • 恢复之前存档的页面

  • 按标题搜索页面

示例操作:

{
  "payload": {
    "action": "create_page", // One of: "create_page", "archive_page", "restore_page", "search_pages", "update_page_properties"
    "params": {
      // Parameters specific to the chosen action
    }
  }
}

notion_blocks

完整的区块操作工具包包括:

  • 检索块内容

  • 获取子块

  • 将新块附加到父块

  • 更新现有区块

  • 删除块

  • 执行批量操作(追加、更新、删除、混合)

示例操作:

{
  "payload": {
    "action": "append_block_children", // One of: "append_block_children", "retrieve_block", "retrieve_block_children", "update_block", "delete_block", "batch_append_block_children", "batch_update_blocks", "batch_delete_blocks", "batch_mixed_operations"
    "params": {
      // Parameters specific to the chosen action
    }
  }
}

notion_database

用于数据库交互的强大工具,包括:

  • 使用自定义属性创建新数据库

  • 使用过滤器和排序查询数据库

  • 更新数据库结构和属性

示例操作:

{
  "payload": {
    "action": "create_database", // One of: "create_database", "query_database", "update_database"
    "params": {
      // Parameters specific to the chosen action
    }
  }
}

notion_comments

用于管理 Notion 内容评论的工具:

  • 从页面和区块中检索评论

  • 向页面添加新评论

  • 回复现有讨论

示例操作:

{
  "payload": {
    "action": "get_comments", // One of: "get_comments", "add_page_comment", "add_discussion_comment"
    "params": {
      // Parameters specific to the chosen action
    }
  }
}

notion_users

访问用户信息的工具:

  • 列出所有工作区用户

  • 获取特定用户的详细信息

  • 检索有关当前机器人用户的信息

示例操作:

{
  "payload": {
    "action": "list_users", // One of: "list_users", "get_user", "get_bot_user"
    "params": {
      // Parameters specific to the chosen action
    }
  }
}

可用资源

服务器目前不公开任何资源,而是专注于基于工具的操作。

🛠 开发

  1. 克隆存储库

    git clone https://github.com/awkoy/notion-mcp-server.git
    cd notion-mcp-server
  2. 安装依赖项

    npm install
  3. 设置环境变量

    • 创建.env文件:

      NOTION_TOKEN=your_notion_api_key
      NOTION_PAGE_ID=your_notion_page_id
  4. 构建项目

    npm run build
  5. 运行检查器

    npm run inspector

🔧 技术细节

  • 使用 TypeScript 和 MCP SDK(版本 1.7.0+)构建

  • 使用官方 Notion API 客户端(@notionhq/client v2.3.0+)

  • 遵循模型上下文协议规范

  • 实现对 Notion 页面、块和数据库进行 CRUD 操作的工具

  • 支持高效的批量操作,以优化性能

  • 使用 Zod 模式验证输入/输出

❓ 故障排除

  • 常见问题

    • 身份验证错误:确保您的 Notion 令牌具有正确的权限,并且已为您的页面/数据库启用集成

    • 页面访问问题:确保您的集成已添加到您尝试访问的页面

    • 速率限制:Notion API 有速率限制 - 使用批处理操作来优化请求

  • 获取帮助

🤝 贡献

欢迎贡献代码!欢迎提交 Pull 请求。

  1. 分叉存储库

  2. 创建你的功能分支( git checkout -b feature/amazing-feature )

  3. 提交您的更改( git commit -m 'Add some amazing feature' )

  4. 推送到分支( git push origin feature/amazing-feature )

  5. 打开拉取请求

📄 许可证

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

Available Tools

3 tools
notion_describeNotion DescribeA
Read-only

Return the JSON Schema and a working example for one operation, plus which tool runs it (notion_read or notion_write). Use this BEFORE calling the operation when the payload shape is non-trivial (query filters, structured block trees, database property definitions). For simple ops, just call it — errors carry the schema.

ParametersJSON Schema
NameRequiredDescriptionDefault
operationYesOperation name to describe, as listed by notion_read / notion_write.

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and destructiveHint=false. The description adds meaningful behavioral context: the tool returns both a schema and a working example, determines which sibling tool executes the operation, and that errors carry the schema, making the describe call skippable for simple operations. This goes beyond the structured annotations without contradicting them.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no filler. The primary return value is stated first, followed by precise usage conditions and an explicit exclusion case. Every clause earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a lightweight describe tool with one parameter, clear annotations, and no output schema, the description fully covers what the agent needs: what it returns, when to call it, and when to skip it. The mention of notion_read/notion_write links it to its siblings adequately.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the single parameter 'operation' is well-documented in the schema. The description adds only marginal semantic value by clarifying that the operation name is 'as listed by notion_read / notion_write', which is useful but largely redundant with the schema description. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb ('Return') and resource ('JSON Schema and a working example for one operation, plus which tool runs it'). It clearly distinguishes this meta-tool from the sibling tools notion_read and notion_write by stating it describes operations rather than performing them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to use it ('BEFORE calling the operation when the payload shape is non-trivial'), gives concrete examples of such cases, and explains when it is unnecessary ('For simple ops, just call it'). This is decisive routing guidance with no ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

notion_readNotion ReadA
Read-onlyIdempotent

Run one Notion read operation by name. Nothing is modified.

Call: { operation, payload } — payload carries that operation's fields. Common: search_pages { query }, get_page { page_id }, get_page_markdown { page_id }, query_database { database_id, where? }, get_block_children { block_id }.

Responses are slimmed; pass verbose:true in payload for the raw Notion object. Every id field (page_id, block_id, database_id, view_id, …) also accepts a Notion URL, as copied from Share → Copy link. A block link's #fragment is used for block_id fields and a database link's ?v= for view_id fields.

If the payload is malformed, the error response includes the schema + a working example so you can correct and retry in one round-trip. Call notion_describe(operation) ahead of time only for complex shapes (query_database filters).

ParametersJSON Schema
NameRequiredDescriptionDefault
payloadYesOperation parameters. Pass either single-op fields directly, or { items: [...], atomic?, idempotency_key?, concurrency? } for batch.
operationYesThe read operation to run. This list is the complete menu of read operations enabled on this server; notion_describe(operation) returns any operation's full schema.

TDQS

A5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate read-only, idempotent, and non-destructive behavior; the description adds valuable behavioral details: responses are slimmed, verbose:true returns raw Notion objects, id fields accept Notion URLs with fragment/v parameters, and malformed payloads return a schema plus working example for one-round-trip retry.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core purpose, then the call shape, common operations, and edge-case behavior. Every sentence contributes actionable detail; no fluff or repetition of schema contents.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a multi-operation read dispatcher with many enum values and no output schema, the description covers operation selection, payload examples, response verbosity, URL input flexibility, error recovery, and when to consult notion_describe. An agent has everything needed to call and recover from errors.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although schema coverage is 100%, the description enriches parameter meaning substantially: it shows the { operation, payload } dispatch shape, gives per-operation example payloads, explains the verbose flag, and clarifies URL flexibility for every id field. This goes well beyond enum/property names in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific action and scope: 'Run one Notion read operation by name.' Immediately clarifies that 'Nothing is modified,' and lists common operations, making it distinguishable from notion_describe (which only returns schemas) and notion_write (which modifies).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit routing guidance: 'Call notion_describe(operation) ahead of time only for complex shapes (query_database filters).' It also explains the call shape and provides concrete examples for common operations, so the agent knows how to select and invoke this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

notion_writeNotion WriteA
Destructive

Run one Notion write operation by name. Archive, trash and delete operations remove content — confirm with the user before running them.

Two ways to call: • Single: { operation: "set_page_title", payload: { page_id, title } } • Batch: { operation: "set_page_title", payload: { items: [{page_id, title}, ...], atomic?: false, idempotency_key?: "...", concurrency?: 3 } } create_page, append_blocks, update_block and update_page_markdown also take a markdown string.

Responses are slimmed; pass verbose:true inside payload (single) or per item (batch) for the raw Notion object. Every id field (page_id, block_id, database_id, view_id, …) also accepts a Notion URL, as copied from Share → Copy link.

If the payload is malformed, the error response includes the schema + a working example so you can correct and retry in one round-trip. Call notion_describe(operation) ahead of time only for complex shapes (block trees, database property definitions, batch_mixed_blocks).

ParametersJSON Schema
NameRequiredDescriptionDefault
payloadYesOperation parameters. Pass either single-op fields directly, or { items: [...], atomic?, idempotency_key?, concurrency? } for batch.
operationYesThe write operation to run. This list is the complete menu of write operations enabled on this server; notion_describe(operation) returns any operation's full schema.

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Despite annotations already flagging destructive behavior, the description goes further by naming exactly which operations (archive, trash, delete) remove content and instructing the agent to confirm with the user. It also discloses response slimming, the verbose:true escape hatch, URL acceptance for IDs, and the error-recovery behavior. This adds significant value beyond the annotations and never contradicts them.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact for the complexity it covers, front-loading the core purpose and destructive warning. It uses bullet-like formatting for the call modes and keeps each sentence informative. It is a bit dense—three paragraphs of dense detail—but there is no filler or repetition; it earns its length.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 26 operations, batch support, and no output schema, the description covers every critical aspect an agent needs: the destructive actions, call syntax, response slimming, URL handling, error feedback, and when to consult notion_describe. Nothing essential is missing; it even handles the malformed-payload case to keep the agent on track.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema is minimal—payload is just an object with propertyNames and additionalProperties, so it conveys almost nothing about the actual shape. The description fills that void by explaining the single vs. batch call modes, the batch-specific fields (items, atomic, idempotency_key, concurrency), and the per-operation markdown strings. It also documents the verbose:true parameter and URL flexibility, all of which the schema omits.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a precise verb and resource: 'Run one Notion write operation by name.' It immediately distinguishes itself from the sibling tools (notion_read, notion_describe) by framing itself as the write dispatcher, and the long operation enum makes the scope unmistakable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit guidance on when to call notion_describe for complex shapes and warns which operations are destructive, requiring user confirmation. However, it never explicitly contrasts with notion_read for reads, so the when-not-to-use instruction is only implied by the tool name rather than stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv3.0.1
    • Changednotion_describe2 fields changed
      • changedInput schema / $schema
        Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
      • changedInput schema / properties / operation / description
        Previous value: -"Operation name to describe."New value: +"Operation name to describe, as listed by notion_read / notion_write."
    • Removednotion_execute
    • Addednotion_read
    • Addednotion_write
  2. 15 tool updatesv1.0.1
    • Removedappend_block_children
    • Removedarchive_page
    • Removedbatch_append_block_children
    • Removedbatch_delete_blocks
    • Removedbatch_mixed_operations
    • Removedbatch_update_blocks
    • Removedcreate_page
    • Removeddelete_block
    • Addednotion_describe
    • Addednotion_execute
    • Removedrestore_page
    • Removedretrieve_block
    • Removedretrieve_block_children
    • Removedsearch_pages
    • Removedupdate_block
  3. 13 tool updatesv1.0.0
    • First observedappend_block_children
    • First observedarchive_page
    • First observedbatch_append_block_children
    • First observedbatch_delete_blocks
    • First observedbatch_mixed_operations
    • First observedbatch_update_blocks
    • First observedcreate_page
    • First observeddelete_block
    • First observedrestore_page
    • First observedretrieve_block
    • First observedretrieve_block_children
    • First observedsearch_pages
    • First observedupdate_block

TDQS

A4.7/5.0

Scored across 3 tools

Disambiguation5/5

notion_read, notion_describe, and notion_write have clearly separated intents: execute a read, fetch schema guidance, or execute a write. There is no overlap between tool purposes, and the payload-level operations are cleanly scoped by tool.

Naming Consistency5/5

All tool names follow the same notion_ prefix with a single lowercase verb: read, describe, and write. The naming pattern is uniform, predictable, and easy for an agent to reason about.

Tool Count5/5

Three tools is well-scoped for a dispatcher-style server because each tool covers a broad category of Notion operations. The count is not too thin, and each tool earns its place in the set.

Completeness4/5

The read/write tools cover core Notion workflows including search, page retrieval, database queries, block children, page creation, block appending, updates, and delete/archive operations. The main gap is that the full set of supported operation names is not explicitly enumerated, relying on describe/errors for discovery.

Maintenance

ActivityActive
ResponsivenessWithin a week

Related MCP Connectors

Related MCP Servers

  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    An MCP server that enables natural language interaction with the Notion API, allowing users to search, comment, create pages, and access content within their Notion workspace.
    193,560 npm
    -
  • A
    license
    A
    quality
    C
    maintenance
    An MCP server for Notion API with optimized token efficiency and full database property filtering, enabling AI assistants to manage pages, databases, and blocks.
    32
    21 npm
    1
    MIT