MCP HubMCP Hub
ccabanillas

notion-mcp

by: ccabanillas

A Model Context Protocol (MCP) server implementation for Notion integration, providing a standardized interface for interacting with Notion's API.

94created 04/12/2024
Visit
Notion
API

πŸ“ŒOverview

Purpose: The Notion MCP Server facilitates seamless integration with Notion's API by providing a standardized interface for developers.

Overview: This server implementation of the Model Context Protocol (MCP) allows users to easily connect and interact with various functionalities available within Notion, supporting tasks such as querying databases and managing pages in real-time.

Key Features:

  • Database Management: Enables users to list, query, and manage Notion databases efficiently, enhancing productivity by allowing streamlined data operations.

  • Page Operations: Supports the creation and updating of pages, ensuring that users can dynamically interact with their content as needed.

  • Workspace Search: Facilitates quick searching across the Notion workspace, making it easier to find specific information swiftly.

  • Asynchronous Support: Full async/await functionality is provided, improving performance by allowing non-blocking operations.

  • Type Safety: Utilizes Pydantic models for type safety, ensuring robust code quality and reducing errors during development.

  • Error Handling: Incorporates proper error handling mechanisms to enhance the reliability of interactions with the Notion API.


Notion MCP Server

A Model Context Protocol (MCP) server implementation for Notion integration, providing a standardized interface for interacting with Notion's API.

Features

  • List and query Notion databases
  • Create and update pages
  • Search across Notion workspace
  • Full async/await support
  • Type-safe with Pydantic models
  • Proper error handling

Installation

  1. Clone the repository:

    git clone https://github.com/ccabanillas/notion-mcp.git
    cd notion-mcp
    
  2. Create a virtual environment and install dependencies:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    pip install -e .
    
  3. Create a .env file in the project root:

    NOTION_API_KEY=your_notion_integration_token
    

Usage

  1. Test the server:

    python -m notion_mcp
    
  2. Configure the claude_desktop_config.json file:

    "notion-mcp": {
        "command": "/Users/username/Projects/notion-mcp/venv/bin/python3", // Path to your virtual environment
        "args": ["-m", "notion_mcp"],
        "cwd": "/Users/username/Projects/notion-mcp" // Path to your project
    }
    

Development

Project Structure

notion-mcp/
β”œβ”€β”€ src/
β”‚   └── notion_mcp/
β”‚       β”œβ”€β”€ models/
β”‚       β”œβ”€β”€ __main__.py
β”‚       β”œβ”€β”€ client.py
β”‚       └── server.py
β”œβ”€β”€ .env
β”œβ”€β”€ .gitignore
β”œβ”€β”€ pyproject.toml
└── README.md

Running Tests

pytest

Configuration

To set up the server, obtain a Notion integration token:

  1. Go to https://www.notion.so/my-integrations
  2. Create a new integration
  3. Copy the integration token
  4. Add it to your .env file

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT License - Use at your own risk