Notion MCP Server
N

Notion MCP Server

Set up the Notion API key and permissions, and interact with Notion through a Python script.
2 points
9.0K

Installation

Copy the following command to your Client for configuration
Note: Your key is sensitive information, do not share it with anyone.

🚀 Configuring Notion API Keys and Permissions

This guide offers a detailed walk - through on configuring Notion API keys and permissions, along with code examples and setup instructions in Claude.

✨ Features

  • Step - by - step guide to create a Notion API key.
  • Instructions for configuring page permissions to use the integration.
  • Code updates and examples for using the Notion API.
  • Setup guidance in Claude, including installing tools and setting environment variables.
  • Installation instructions for the Notion library.
  • Examples of generating docstrings for functions.

📦 Installation

Install the Notion Library

Use pip to install the notion - client:

pip install notion - client

💻 Usage Examples

Create a Notion API Key

  1. Access Notion Integrations:
    • Visit [Notion Integrations](https://www.notion.so/my - integrations) and log in with your Notion account.
  2. Create a New Integration:
    • Click "New Integration", fill in the required fields (e.g., integration name), and select the workspace you want to connect.
  3. Save the Integration:
    • After submission, an API key will be generated. Copy and securely save this key for subsequent API request authentication.
  4. Retrieve the API Key:
    • Copy the generated API key and ensure its security.

Configure Page Permissions to Use the Integration

  1. Open a Notion Page:
    • Open the Notion page to which you want to grant permissions.
  2. Share the Page:
    • Click the "Share" button at the top - right of the page.
  3. Invite the Integration:
    • Enter your integration name in the "Invite" text box and select it from the dropdown list. This will grant the integration access to the page.
  4. Set Permissions:
    • Ensure that the integration has the necessary permissions to perform the required operations (e.g., read, write).

Code Updates

In the notion_sdk.py file, update PAGE_ID to the ID of the page you created earlier. You can obtain this ID by copying the page link.

Example Notion Page ID

https://www.notion.so/MCP - Parent - Page - 1d21f7216bdb80789f88fccd964b5031

Curl Example

The following is an example of using the Notion API to create a new page:

curl --location --request POST 'https://api.notion.com/v1/pages' \
--header 'Authorization: Bearer $NOTION_API_KEY' \
--header 'Content - Type: application/json' \
--header 'Notion - Version: 2021 - 05 - 13' \
--data '{
"parent": { "page_id": "1d21f7216bdb80789f88fccd964b5031" },
"properties": {
    "title": [
        {
            "text": {
                "content": "New Page Title"
            }
        }
    ]
}
'

Setup in Claude

Install the uv Tool

If you are using a Mac, install it via the following command:

brew install uv

Verify the installation:

uv --version

Run a Python script:

uv run <script>.py

Set Environment Variables

In Claude, you need to add NOTION_API_KEY to the environment variables. For example:

export NOTION_API_KEY=your_api_key_here

Alternatively, specify the executable file path in the configuration file:

{
  "executors": {
    "default_python": {
      "command": "/usr/bin/python3",
      "env": {
        "NOTION_API_KEY": "your_api_key"
      }
    }
  }
}

Generate Docstring Examples

The following are examples of docstrings for functions to help LLMs and humans understand the usage and parameters of the tools:

Example Function and Its Docstring

def get_page_content(page_id: str) -> dict:
    """
    Get the content of a specified page.
    
    Args:
        page_id (str): The ID of the page whose content needs to be retrieved.
        
    Returns:
        dict: The page content, including the title and other attributes.
    """
    # Specific implementation code

Another Example

def create_new_page(parent_id: str, title: str) -> str:
    """
    Create a new page under a specified parent page.
    
    Args:
        parent_id (str): The ID of the parent page.
        title (str): The title of the new page.
        
    Returns:
        str: The ID of the newly created page.
    """
    # Specific implementation code

Usage Notes

  • Summary: Briefly describe the purpose of the function.
  • Parameters: Explain each input parameter, its type, and its purpose in detail.
  • Return Value: Clearly define the type and meaning of the return value.

By following these specifications, you can ensure that docstrings are both human - friendly and model - friendly.

Alternatives

M
MCP
The Microsoft official MCP server provides search and access functions for the latest Microsoft technical documentation for AI assistants
9.7K
5 points
A
Aderyn
Aderyn is an open - source Solidity smart contract static analysis tool written in Rust, which helps developers and security researchers discover vulnerabilities in Solidity code. It supports Foundry and Hardhat projects, can generate reports in multiple formats, and provides a VSCode extension.
Rust
5.9K
5 points
D
Devtools Debugger MCP
The Node.js Debugger MCP server provides complete debugging capabilities based on the Chrome DevTools protocol, including breakpoint setting, stepping execution, variable inspection, and expression evaluation.
TypeScript
5.4K
4 points
S
Scrapling
Scrapling is an adaptive web scraping library that can automatically learn website changes and re - locate elements. It supports multiple scraping methods and AI integration, providing high - performance parsing and a developer - friendly experience.
Python
7.8K
5 points
M
Mcpjungle
MCPJungle is a self-hosted MCP gateway used to centrally manage and proxy multiple MCP servers, providing a unified tool access interface for AI agents.
Go
0
4.5 points
C
Cipher
Cipher is an open-source memory layer framework designed for programming AI agents. It integrates with various IDEs and AI coding assistants through the MCP protocol, providing core functions such as automatic memory generation, team memory sharing, and dual-system memory management.
TypeScript
0
5 points
N
Nexus
Nexus is an AI tool aggregation gateway that supports connecting multiple MCP servers and LLM providers, providing tool search, execution, and model routing functions through a unified endpoint, and supporting security authentication and rate limiting.
Rust
0
4 points
S
Shadcn Ui MCP Server
An MCP server that provides shadcn/ui component integration for AI workflows, supporting React, Svelte, and Vue frameworks. It includes functions for accessing component source code, examples, and metadata.
TypeScript
12.1K
5 points
G
Gitlab MCP Server
Certified
The GitLab MCP server is a project based on the Model Context Protocol that provides a comprehensive toolset for interacting with GitLab accounts, including code review, merge request management, CI/CD configuration, and other functions.
TypeScript
16.6K
4.3 points
N
Notion Api MCP
Certified
A Python-based MCP Server that provides advanced to-do list management and content organization functions through the Notion API, enabling seamless integration between AI models and Notion.
Python
14.8K
4.5 points
M
Markdownify MCP
Markdownify is a multi-functional file conversion service that supports converting multiple formats such as PDFs, images, audio, and web page content into Markdown format.
TypeScript
24.5K
5 points
D
Duckduckgo MCP Server
Certified
The DuckDuckGo Search MCP Server provides web search and content scraping services for LLMs such as Claude.
Python
44.7K
4.3 points
U
Unity
Certified
UnityMCP is a Unity editor plugin that implements the Model Context Protocol (MCP), providing seamless integration between Unity and AI assistants, including real - time state monitoring, remote command execution, and log functions.
C#
20.2K
5 points
F
Figma Context MCP
Framelink Figma MCP Server is a server that provides access to Figma design data for AI programming tools (such as Cursor). By simplifying the Figma API response, it helps AI more accurately achieve one - click conversion from design to code.
TypeScript
45.3K
4.5 points
M
Minimax MCP Server
The MiniMax Model Context Protocol (MCP) is an official server that supports interaction with powerful text-to-speech, video/image generation APIs, and is suitable for various client tools such as Claude Desktop and Cursor.
Python
30.2K
4.8 points
G
Gmail MCP Server
A Gmail automatic authentication MCP server designed for Claude Desktop, supporting Gmail management through natural language interaction, including complete functions such as sending emails, label management, and batch operations.
TypeScript
15.8K
4.5 points
AIBase
Zhiqi Future, Your AI Solution Think Tank
© 2025AIBase