PN

pbohannon/notion-api-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

28 stars 20 forks 质量 66 趋势 0MIT

一个基于 Python 的 MCP,用于向大型语言模型(LLM)展示 Notion 功能

概览

一款模型上下文协议(MCP)服务器,通过 Notion 的 API 提供先进的待办事项管理和内容组织功能。MCP 使 AI 模型能够与外部工具和服务交互,实现与 Notion 强大功能的无缝集成。 基于 Python 的 MCP 服务器,使 AI 模型能够与 Notion API 交互,提供以下功能:- : 创建、更新和跟踪包含富文本、截止日期、优先级和嵌套子任务的任务 - : 创建和管理带有自定义属性、筛选器和视图的 Notion 数据库 - : 通过 Markdown 支持、层级列表和块操作结构化和格式化内容 - : 通过干净的异步实现,直接与 Notion 的工作区、页面和数据库交互 - 1. 进入https://www.notion.so/my-integrations 2.点击“新集成” 3.为你的集成命名(例如,“我的MCP集成”)4.选择你将使用集成的工作区 5.

概述(AI 翻译)

一款模型上下文协议(MCP)服务器,通过 Notion 的 API 提供先进的待办事项管理和内容组织功能。MCP 使 AI 模型能够与外部工具和服务交互,实现与 Notion 强大功能的无缝集成。

MCP概览

基于Python的MCP服务器,使AI模型能够与Notion的API交互,提供:

  • 待办管理:创建、更新和跟踪带有富文本、截止日期、优先级和嵌套子任务的任务
  • 数据库操作:创建和管理带有自定义属性、过滤器和视图的 Notion 数据库
  • 内容组织:支持Markdown、层级列表和块操作的结构化和格式化内容
  • 实时集成:通过干净的异步实现,直接与Notion的工作区、页面和数据库交互

完整功能列表→

快速启动

开始

1.创建 Notion 集成

  1. 前往https://www.notion.so/my-integrations
  2. 点击“新集成”
  3. 命名你的集成(例如,“我的MCP集成”)
  4. 选择你将使用该集成的工作区

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Notion API MCP

A Model Context Protocol (MCP) server that provides advanced todo list management and content organization capabilities through Notion’s API. MCP enables AI models to interact with external tools and services, allowing seamless integration with Notion’s powerful features.

MCP Overview

Python-based MCP server that enables AI models to interact with Notion’s API, providing:

  • Todo Management: Create, update, and track tasks with rich text, due dates, priorities, and nested subtasks
  • Database Operations: Create and manage Notion databases with custom properties, filters, and views
  • Content Organization: Structure and format content with Markdown support, hierarchical lists, and block operations
  • Real-time Integration: Direct interaction with Notion’s workspace, pages, and databases through clean async implementation

Full feature list →

Quick Start

# Clone and setup
git clone https://github.com/yourusername/notion-api-mcp.git
cd notion-api-mcp
uv venv && source .venv/bin/activate

# Install and configure
uv pip install -e .
cp .env.integration.template .env

# Add your Notion credentials to .env:
# NOTION_API_KEY=ntn_your_integration_token_here
# NOTION_PARENT_PAGE_ID=your_page_id_here  # For new databases
# NOTION_DATABASE_ID=your_database_id_here  # For existing databases

# Run the server
python -m notion_api_mcp

Getting Started

1. Create a Notion Integration

  1. Go to https://www.notion.so/my-integrations
  2. Click “New integration”
  3. Name your integration (e.g., “My MCP Integration”)
  4. Select the workspace where you’ll use the integration
  5. Copy the “Internal Integration Token” - this will be your NOTION_API_KEY
    • Should start with “ntn_”

2. Set Up Notion Access

You’ll need either a parent page (for creating new databases) or an existing database ID:

Option A: Parent Page for New Databases

  1. Open Notion in your browser
  2. Create a new page or open an existing one where you want to create databases
  3. Click the ••• menu in the top right
  4. Select “Add connections” and choose your integration
  5. Copy the page ID from the URL - it’s the string after the last slash and before the question mark
    • Example: In https://notion.so/myworkspace/123456abcdef..., the ID is 123456abcdef...
    • This will be your NOTION_PARENT_PAGE_ID

Option B: Existing Database

  1. Open your existing Notion database
  2. Make sure it’s connected to your integration (••• menu > Add connections)
  3. Copy the database ID from the URL
    • Example: In https://notion.so/myworkspace/123456abcdef...?v=..., the ID is 123456abcdef...
    • This will be your NOTION_DATABASE_ID

3. Install the MCP Server

  1. Create virtual environment:
cd notion-api-mcp
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install dependencies:
uv pip install -e .
  1. Configure environment:
cp .env.integration.template .env
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "notion-api": { "command": "/path/to/your/.venv/bin/python", "args": ["-m", "notion_api_mcp"], "env": { "NOTION_API_KEY": "ntn_your_integration_token_here", // Choose one or both: "NOTION_PARENT_PAGE_ID": "your_page_id_here", "NOTION_DATABASE_ID": "your_database_id_here" } } } }