Notion集成
STDIO实现AI助手与Notion API交互的服务器
实现AI助手与Notion API交互的服务器
Notion MCP Server is a Model Context Protocol (MCP) server implementation that enables AI assistants to interact with Notion's API. This production-ready server provides a complete set of tools and endpoints for reading, creating, and modifying Notion content through natural language interactions.
🚧 Active Development: Database support is now available! Comments and user management tools have been added. If you find this project useful, please consider giving it a star - it helps me know that this work is valuable to the community and motivates further development.
Obtain a Notion API Key
Enable Integration for Your Pages
Choose Your Integration Method
Ask Your AI Assistant to Interact with Notion
.cursor/mcp.json
file in your project directory:{ "mcpServers": { "notion-mcp-server": { "command": "env NOTION_TOKEN=YOUR_KEY NOTION_PAGE_ID=YOUR_PAGE_ID npx", "args": ["-y", "notion-mcp-server"] } } }
YOUR_KEY
and YOUR_PAGE_ID
with your actual Notion API key and page IDenv NOTION_TOKEN=YOUR_KEY NOTION_PAGE_ID=YOUR_PAGE_ID npx -y notion-mcp-server
YOUR_KEY
and YOUR_PAGE_ID
with your actual Notion API key and page IDmcp.json
file in your configuration directory:{ "mcpServers": { "notion-mcp-server": { "command": "npx", "args": ["-y", "notion-mcp-server"], "env": { "NOTION_TOKEN": "YOUR_KEY", "NOTION_PAGE_ID": "YOUR_PAGE_ID" } } } }
YOUR_KEY
and YOUR_PAGE_ID
with your actual Notion API key and page IDThe server provides the following consolidated tools for interacting with Notion:
notion_pages
A comprehensive tool for page operations including:
Example operations:
{ "payload": { "action": "create_page", // One of: "create_page", "archive_page", "restore_page", "search_pages", "update_page_properties" "params": { // Parameters specific to the chosen action } } }
notion_blocks
A complete toolkit for block operations including:
Example operations:
{ "payload": { "action": "append_block_children", // One of: "append_block_children", "retrieve_block", "retrieve_block_children", "update_block", "delete_block", "batch_append_block_children", "batch_update_blocks", "batch_delete_blocks", "batch_mixed_operations" "params": { // Parameters specific to the chosen action } } }
notion_database
A powerful tool for database interactions including:
Example operations:
{ "payload": { "action": "create_database", // One of: "create_database", "query_database", "update_database" "params": { // Parameters specific to the chosen action } } }
notion_comments
A tool for managing comments on Notion content:
Example operations:
{ "payload": { "action": "get_comments", // One of: "get_comments", "add_page_comment", "add_discussion_comment" "params": { // Parameters specific to the chosen action } } }
notion_users
A tool for accessing user information:
Example operations:
{ "payload": { "action": "list_users", // One of: "list_users", "get_user", "get_bot_user" "params": { // Parameters specific to the chosen action } } }
The server currently does not expose any resources, focusing instead on tool-based operations.
Clone the Repository
git clone https://github.com/awkoy/notion-mcp-server.git
cd notion-mcp-server
Install Dependencies
npm install
Set Up Environment Variables
.env
file with:
NOTION_TOKEN=your_notion_api_key
NOTION_PAGE_ID=your_notion_page_id
Build the Project
npm run build
Run the Inspector
npm run inspector
Common Issues
Getting Help
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.