Skip to main content
Glama

Not MCP 服务器

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

特征

  • 列出并查询 Notion 数据库

  • 创建和更新页面

  • 在 Notion 工作区中搜索

  • 获取数据库详细信息并阻止子项

  • 通过 httpx 提供完整的 async/await 支持

  • 使用 Pydantic v2 模型实现类型安全

  • 通过详细的日志记录正确处理错误

  • 与 MCP 1.6.0 兼容

Related MCP server: Notion MCP Server

安装

  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

Resources

Looking for Admin?

Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ccabanillas/notion-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server