Kumala3/Notion-MCP-Server
3.2
If you are the rightful owner of Notion-MCP-Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Notion MCP Server for ChatGPT is a Model Context Protocol server that integrates Notion with ChatGPT, providing controlled access to specific Notion pages.
Tools
2
Resources
0
Prompts
0
Notion MCP Server for ChatGPT
A Model Context Protocol (MCP) server that connects your Notion account with ChatGPT, allowing controlled access to specific Notion pages.
Features
- 🔒 Page-specific access control - Only grant access to specific Notion pages
- 🔍 Search functionality - Search across your authorized Notion pages
- 📄 Fetch full content - Retrieve complete page content including blocks
- 🔐 OAuth support - Secure authentication with Notion
- 🚀 FastMCP powered - Built with FastMCP for easy deployment
Architecture
This MCP server implements two required tools:
-
search- Search across authorized Notion pages- Returns:
{results: [{id, title, url}]}
- Returns:
-
fetch- Retrieve full content of a specific page- Returns:
{id, title, text, url, metadata}
- Returns:
Setup
Prerequisites
- Python 3.8+
- Notion account
- Notion Integration (API key)
Installation
- Clone this repository:
git clone <your-repo-url>
cd ChatGPT\ Notion\ MCP\ Server
- Install dependencies:
pip install -r requirements.txt
- Create a
.envfile with your configuration:
NOTION_API_KEY=your_notion_api_key
ALLOWED_PAGE_IDS=page_id_1,page_id_2,page_id_3
PORT=8000
Getting Your Notion API Key
- Go to https://www.notion.so/my-integrations
- Click "New integration"
- Give it a name (e.g., "ChatGPT MCP Server")
- Copy the "Internal Integration Token"
- Share specific pages with your integration:
- Open each page you want to grant access to
- Click "Share" → "Invite" → Select your integration
Getting Page IDs
- Open a Notion page in your browser
- The URL will look like:
https://www.notion.so/Page-Title-32charPageID - Copy the 32-character ID at the end
- Add multiple page IDs to
ALLOWED_PAGE_IDS(comma-separated)
Running the Server
Local Development
python server.py
The server will start on http://localhost:8000
Deploy to Replit
- Import this repository to Replit
- Add environment variables in Replit Secrets
- Run the project
Connecting to ChatGPT
Via ChatGPT Settings
- Open ChatGPT Settings → Connectors
- Add a new MCP server
- Enter your server URL (e.g.,
https://your-server.repl.co/sse/) - Add the
searchandfetchtools
Via API (Deep Research)
curl https://api.openai.com/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "o4-mini-deep-research",
"input": [...],
"tools": [
{
"type": "mcp",
"server_label": "notion",
"server_url": "https://your-server.com/sse/",
"allowed_tools": ["search", "fetch"],
"require_approval": "never"
}
]
}'
Security Considerations
- ⚠️ Only add page IDs for pages you want ChatGPT to access
- 🔒 Keep your
NOTION_API_KEYsecret - 🛡️ Review the OpenAI MCP Security Guidelines
- ✅ Use HTTPS in production
- 🔐 Consider implementing OAuth for multi-user scenarios
Testing
Test your server locally:
# Search test
curl http://localhost:8000/test-search?query=test
# Fetch test
curl http://localhost:8000/test-fetch?page_id=YOUR_PAGE_ID
Troubleshooting
"Page not found" error
- Ensure the page is shared with your integration
- Verify the page ID is in
ALLOWED_PAGE_IDS
"Unauthorized" error
- Check your
NOTION_API_KEYis correct - Verify the integration has access to the pages
Connection issues
- Ensure your server is publicly accessible
- Check firewall settings
- Verify HTTPS is enabled (required for production)