Notion MCP Server
A Model Context Protocol (MCP) server that provides seamless integration with Notion. This server enables Language Models to interact with your Notion workspace through standardized tools for searching, reading, creating, and updating pages and databases.
๐ Key Features
Page Operations
- ๐ Search through your Notion workspace
- ๐ Create new pages with rich markdown content
- ๐ Read page content with clean formatting
- ๐ Update existing pages
- ๐ฌ Add and retrieve comments
- ๐งฑ Block-level operations (update, delete)
Enhanced Markdown Support
- Multiple heading levels (H1-H3)
- Code blocks with language support
- Interactive todo items with checkbox states
- Blockquotes with multi-line support
- Horizontal dividers
- Images with captions
- Nested bullet points
Database Operations
- Create and manage databases
- Add and update database items
- Query with filters and sorting
- Support for various property types:
- Title, Rich text, Number
- Select, Multi-select
- Date, Checkbox
- And more!
๐ Getting Started
Prerequisites
- Node.js (v16 or higher)
- Notion API key
- MCP-compatible client (e.g., Claude Desktop)
Installation
- Clone the repository:
1git clone https://github.com/v-3/notion-server.git 2cd notion-server
- Install dependencies:
1npm install
- Set up your environment:
1# Create .env file 2echo "NOTION_API_KEY=your_notion_api_key_here" > .env 3 4# Or export directly 5export NOTION_API_KEY=your_notion_api_key_here
- Build the server:
1npm run build
๐ง Configuration
Claude Desktop Setup
- Update your Claude Desktop configuration (
claude_desktop_config.json
):
1{ 2 "mcpServers": { 3 "notion": { 4 "command": "node", 5 "args": ["/absolute/path/to/notion-server/build/index.js"], 6 "env": { 7 "NOTION_API_KEY": "your_notion_api_key_here" 8 } 9 } 10 } 11}
- Restart Claude Desktop to apply changes
๐ ๏ธ Available Tools
Page Operations
1// Search pages 2{ 3 query: string // Search query 4} 5 6// Read page 7{ 8 pageId: string // ID of the page to read 9} 10 11// Create page 12{ 13 title?: string, // Page title 14 content?: string, // Page content in markdown 15 parentPageId: string // Parent page ID 16 properties?: object // For database items 17} 18 19// Update page 20{ 21 pageId: string, // Page ID to update 22 content: string, // New content 23 type?: string // Content type 24}
Database Operations
1// Create database 2{ 3 parentPageId: string, 4 title: string, 5 properties: object 6} 7 8// Query database 9{ 10 databaseId: string, 11 filter?: object, 12 sort?: object 13}
๐ Setting Up Notion Access
Creating an Integration
- Visit Notion Integrations
- Click "New integration"
- Configure permissions:
- Content: Read, Update, Insert
- Comments: Read, Create
- User Information: Read
Connecting Pages
- Open your Notion page
- Click "..." menu โ "Connections"
- Add your integration
- Repeat for other pages as needed
๐ Usage Examples
Creating a Page
1const result = await notion.create_page({ 2 parentPageId: "page_id", 3 title: "My Page", 4 content: "# Welcome\nThis is a test page." 5});
Querying a Database
1const result = await notion.query_database({ 2 databaseId: "db_id", 3 filter: { 4 property: "Status", 5 select: { 6 equals: "In Progress" 7 } 8 } 9});
๐ค Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
This project has been significantly improved by sweir1/notion-server, who has made following updates:
- Enhanced markdown support with more block types
- Comprehensive database operations
- Improved error handling and debugging
- Better property handling for database items
- Cleaner page output formatting
To use sweir1's version, you can clone their repository:
1git clone https://github.com/sweir1/notion-server.git