Notion MCP Server

by ccabanillas

Integrations

  • Provides a standardized interface for interacting with Notion's API, allowing users to list and query databases, create and update pages, and search across a Notion workspace.

Not MCP 服务器

用于 Notion 集成的模型上下文协议 (MCP) 服务器实现,提供与 Notion API 交互的标准化接口。兼容 Claude Desktop 和其他 MCP 客户端。

特征

  • 列出并查询 Notion 数据库
  • 创建和更新页面
  • 在 Notion 工作区中搜索
  • 获取数据库详细信息并阻止子项
  • 通过 httpx 提供完整的 async/await 支持
  • 使用 Pydantic v2 模型实现类型安全
  • 通过详细的日志记录正确处理错误
  • 与 MCP 1.6.0 兼容

安装

  1. 克隆存储库:
git clone https://github.com/ccabanillas/notion-mcp.git cd notion-mcp
  1. 创建虚拟环境并安装依赖项(使用 uv):
uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate uv pip install -e .

或者,使用标准 venv:

python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -e .
  1. 在项目根目录中创建一个.env文件:
NOTION_API_KEY=your_notion_integration_token

用法

  1. 测试服务器(它应该正常运行):
python -m notion_mcp
  1. 要将其与 Claude Desktop 一起使用,请调整您的claude_desktop_config.json文件(位于 macOS 上的~/Library/Application Support/Claude/claude_desktop_config.json ):
{ "servers": { "notion-mcp": { "command": "/Users/username/Projects/notion-mcp/.venv/bin/python", "args": ["-m", "notion_mcp"], "cwd": "/Users/username/Projects/notion-mcp" } } }

请务必将/Users/username/替换为您的实际主目录路径。

发展

项目结构

notion-mcp/ ├── src/ │ └── notion_mcp/ │ ├── models/ │ │ ├── __init__.py │ │ └── notion.py # Pydantic models for Notion objects │ ├── __init__.py │ ├── __main__.py # Entry point │ ├── client.py # Notion API client │ └── server.py # MCP server implementation ├── .env # Environment variables (add your Notion API key here) ├── .gitignore ├── pyproject.toml # Project dependencies └── README.md

运行测试

pytest

配置

服务器需要 Notion 集成令牌。设置方法如下:

  1. 前往https://www.notion.so/my-integrations
  2. 创建具有适当功能的新集成(根据需要读/写)
  3. 复制集成令牌
  4. 将其添加到项目根目录中的.env文件中:
NOTION_API_KEY=your_notion_integration_token
  1. 通过集成共享您的 Notion 数据库(从数据库的“共享”菜单)

贡献

  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 许可证 - 使用风险自负

故障排除

常见问题

  • 连接错误:请确保您的 Notion API 密钥正确并且您可以访问互联网
  • 权限错误:确保您的集成已获得您尝试访问的数据库的访问权限
  • Claude Desktop 集成:如果 Claude Desktop 未连接,请检查您的配置路径是否正确,以及服务器是否正在运行且未记录到 stdout

致谢

  • 专为与 Claude Desktop 和其他 MCP 客户端配合使用而设计
  • 使用 Notion 的 API(最新兼容版本 2022-02-22)
  • 保持 MCP 1.6.0 兼容性
  • 特别感谢danhilse ,我参考了他的notion-mcp-server项目
-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

模型上下文协议服务器提供与 Notion API 交互的标准化接口,使用户能够列出数据库、创建页面并在他们的 Notion 工作区中进行搜索。

  1. 特征
    1. 安装
      1. 用法
        1. 发展
          1. 项目结构
          2. 运行测试
        2. 配置
          1. 贡献
            1. 执照
              1. 故障排除
                1. 常见问题
              2. 致谢

                Related MCP Servers

                • -
                  security
                  A
                  license
                  -
                  quality
                  A Model Context Protocol server that integrates with Notion's API to manage personal todo lists, allowing users to view, add, and update tasks directly from Claude.
                  Last updated -
                  3
                  Python
                  MIT License
                • -
                  security
                  F
                  license
                  -
                  quality
                  A Model Context Protocol server that enables Claude and other LLMs to interact with Notion workspaces, providing capabilities like searching, retrieving, creating and updating pages, as well as managing databases.
                  Last updated -
                  275
                  2
                  TypeScript
                • -
                  security
                  F
                  license
                  -
                  quality
                  A Model Context Protocol server that provides a comprehensive interface for interacting with the ConnectWise Manage API, simplifying API discovery, execution, and management for both developers and AI assistants.
                  Last updated -
                  46
                  2
                  Python
                  • Linux
                  • Apple
                • -
                  security
                  F
                  license
                  -
                  quality
                  A Model Context Protocol server that connects AI assistants like Claude to Notion workspaces, enabling them to view, search, create, and update Notion databases, pages, and content blocks.
                  Last updated -
                  275
                  JavaScript
                  • Apple

                View all related MCP servers

                ID: 694u8ecn1f