Cursor Notion MCP - Chat Logger
Logs Cursor AI chat interactions to Notion databases for documentation and knowledge management. Captures prompts, responses, context, and timestamps in a structured format for analysis and reference.
README
Cursor Notion MCP - Chat Logger
A Model Context Protocol (MCP) server that logs your Cursor AI chat interactions to Notion for analysis, documentation, and knowledge management.
🌟 Features
- ✅ Automatic Chat Logging: Log Cursor AI conversations to Notion with a single command
- ✅ MCP Protocol: Implements the official Model Context Protocol specification
- ✅ Easy Setup: Simple configuration via environment variables
- ✅ Rich Context: Captures prompt, response, user, context, and timestamp
- ✅ Notion Integration: Stores data in a structured Notion database
- ✅ Privacy First: Self-hosted, no third-party services
📋 Prerequisites
- Python 3.7 or higher
- Cursor IDE (with MCP support)
- Notion account with API access
requestslibrary (pip install requests)
🚀 Quick Start
1. Clone the Repository
git clone https://github.com/Creo-DRB1008/prompt-logger-mcp.git
cd cursor-notion-mcp
2. Install Dependencies
pip install -r requirements.txt
3. Set Up Notion
Create a Notion Integration
- Go to Notion Integrations
- Click "New integration"
- Name it "Cursor Chat Logger"
- Copy the Internal Integration Token (starts with
secret_)
Create a Notion Database
-
Create a new database in Notion
-
Add these properties:
- Prompt (Title) - The user's question
- Response (Text) - The AI's response
- User (Text) - User identifier
- Context (Text) - File/function context
- Timestamp (Date) - When it happened
-
Share the database with your integration:
- Click "Share" on the database
- Invite your integration
-
Get the Database ID from the URL:
https://notion.so/YOUR_WORKSPACE/DATABASE_ID?v=... ^^^^^^^^^^^^
4. Configure Cursor
Edit ~/.cursor/mcp.json (create if it doesn't exist):
{
"mcpServers": {
"notion-chat-logger": {
"command": "python3",
"args": [
"/ABSOLUTE/PATH/TO/cursor-notion-mcp/mcp_notion_server.py"
],
"env": {
"NOTION_API_KEY": "secret_YOUR_NOTION_INTEGRATION_TOKEN",
"NOTION_DATABASE_ID": "YOUR_DATABASE_ID"
}
}
}
}
Important: Replace:
/ABSOLUTE/PATH/TO/with the actual path to this repositorysecret_YOUR_NOTION_INTEGRATION_TOKENwith your Notion integration tokenYOUR_DATABASE_IDwith your Notion database ID
5. Restart Cursor
Quit Cursor completely (⌘Q on Mac, Alt+F4 on Windows/Linux) and reopen it.
6. Verify Installation
# Run the test script
python3 test_mcp_notion.py
You should see:
✅ Initialize response
✅ Found 1 tool(s)
✅ Successfully stored to Notion!
💡 Usage
In Cursor Chat
After having a conversation with Cursor AI, simply say:
Log this conversation to Notion
Or use the tool picker:
- Type
@in the chat - Select
store_chat_log - Fill in the details (or let the AI do it)
Manual Tool Call
You can also invoke the tool explicitly:
@store_chat_log
Prompt: "How do I implement OAuth?"
Response: "Here's how to implement OAuth..."
User: "your.email@example.com"
Context: "auth.py"
🧪 Testing
Quick Verification
./verify_cursor_mcp.sh
Full Test Suite
python3 test_mcp_notion.py
Manual MCP Protocol Test
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | python3 mcp_notion_server.py
📁 Project Structure
cursor-notion-mcp/
├── mcp_notion_server.py # Main MCP server
├── test_mcp_notion.py # Test suite
├── verify_cursor_mcp.sh # Quick verification script
├── requirements.txt # Python dependencies
├── README.md # This file
├── SETUP.md # Detailed setup guide
├── ARCHITECTURE.md # Technical architecture
└── LICENSE # MIT License
🔧 Configuration
Environment Variables
| Variable | Required | Description |
|---|---|---|
NOTION_API_KEY |
Yes | Your Notion integration token |
NOTION_DATABASE_ID |
Yes | Your Notion database ID |
NOTION_VERSION |
No | Notion API version (default: 2022-06-28) |
Notion Database Schema
Your Notion database must have these properties:
| Property | Type | Description |
|---|---|---|
| Prompt | Title | The user's question/prompt |
| Response | Text | The assistant's response |
| User | Text | User identifier (email) |
| Context | Text | File path, function name, etc. |
| Timestamp | Date | When the interaction occurred |
🐛 Troubleshooting
Server Not Showing in Cursor
- Check that
~/.cursor/mcp.jsonis valid JSON - Verify the absolute path to
mcp_notion_server.pyis correct - Restart Cursor completely (quit and reopen)
- Check Cursor logs:
~/Library/Logs/Cursor/(Mac) or%APPDATA%\Cursor\logs\(Windows)
Tool Not Appearing
- Verify the server is listed in Cursor Settings → Features → MCP
- Try typing the full tool name:
@store_chat_log - Check Developer Tools (Help → Toggle Developer Tools) for errors
Notion API Errors
- Verify your
NOTION_API_KEYis correct (starts withsecret_) - Verify your
NOTION_DATABASE_IDis correct (32 characters, hex) - Ensure the integration has access to the database (Share → Invite integration)
- Check that all required properties exist in the database
Python Errors
# Check Python version
python3 --version # Should be 3.7+
# Install dependencies
pip3 install -r requirements.txt
# Test the server directly
python3 mcp_notion_server.py
# Then type: {"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}
🔐 Security
⚠️ Important Security Notes:
- Never commit your Notion API key to version control
- Use environment variables for sensitive data
- Restrict integration permissions in Notion to only the databases you need
- Review logged data regularly to ensure no sensitive information is stored
- Consider encrypting sensitive fields before logging
Recommended: Use .env File
Instead of hardcoding credentials in mcp.json, use a .env file:
# .env
NOTION_API_KEY=secret_YOUR_TOKEN
NOTION_DATABASE_ID=YOUR_DATABASE_ID
Then update mcp.json:
{
"mcpServers": {
"notion-chat-logger": {
"command": "bash",
"args": [
"-c",
"source .env && python3 /path/to/mcp_notion_server.py"
]
}
}
}
📚 Documentation
- Setup Guide - Detailed setup instructions
- Architecture - Technical architecture and design
- MCP Specification - Official MCP docs
- Notion API - Notion API documentation
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Model Context Protocol - For the MCP specification
- Cursor - For the amazing AI-powered IDE
- Notion - For the powerful API and database
📞 Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
🗺️ Roadmap
- [ ] Support for multiple Notion databases
- [ ] Filtering/redaction of sensitive data
- [ ] Export to other formats (CSV, JSON)
- [ ] Web dashboard for viewing logs
- [ ] Automatic tagging and categorization
- [ ] Search and analytics features
Made with ❤️ for the Cursor community
If you find this useful, please ⭐ star the repository!
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。