loading…
Search for a command to run...
loading…
A comprehensive Model Context Protocol (MCP) server for Notion integration with enhanced functionality, robust error handling, production-ready feature.
A comprehensive Model Context Protocol (MCP) server for Notion integration with enhanced functionality, robust error handling, production-ready feature.
Trust Score This project explores the concept of long-term memory in AI agents and demonstrates how to build sophisticated agentic memory systems using various approaches and tools. Now featuring complete Notion workspace integration and MCP (Model Context Protocol) implementation!
Feel free to ⭐️ the repo if it helps you understand long-term memory for agents!
⚠️ Note: Please use Python 3.11 as Python 3.12 may cause compatibility issues with some dependencies.
# Create virtual environment
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
# Install dependencies
pip install -r requirements.txt
# Setup SQLite DB
python src/prepare_sqldb.py
# Setup Vector DB
python src/prepare_vectordb.py
# Verify databases
python src/check_sqldb.py
python src/check_vectordb.py
# Required
export OPENAI_API_KEY="your_openai_api_key"
export NOTION_TOKEN="your_notion_integration_token"
# Optional
export NOTION_API_KEY="your_notion_integration_token" # Alternative to NOTION_TOKEN
# Terminal version with full Notion integration
python src/chat_in_terminal.py
# Gradio UI version
python src/chat_in_ui.py
# Test Notion integration
python test_notion_integration.py
# Test MCP functionality
python test_notion_mcp.py
basic_chatbot_v1.py)chatbot_agentic_v2.py)chatbot_agentic_v3.py) - ⭐ MAIN VERSION┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
│ User Interface │───▶│ Chatbot Agentic V3 │───▶│ External Systems │
│ (Terminal/UI) │ │ (Main Controller) │ │ (Notion, DB, etc) │
└─────────────────────┘ └─────────────────────┘ └─────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ Core Components │
│ ┌─────────────┐ ┌─────────────────┐ │
│ │ OpenAI │ │ Notion │ │
│ │ Agent │ │ ServerV2 │ │
│ └─────────────┘ └─────────────────┘ │
│ ┌─────────────┐ ┌─────────────────┐ │
│ │ Memory │ │ Vector DB │ │
│ │ Systems │ │ (Embeddings) │ │
│ └─────────────┘ └─────────────────┘ │
│ ┌─────────────┐ ┌─────────────────┐ │
│ │ MCP │ │ SQL Database │ │
│ │ Protocol │ │ (Structured) │ │
│ └─────────────┘ └─────────────────┘ │
└─────────────────────────────────────────┘
src/
├── chat_in_terminal.py # Enhanced terminal chatbot
├── chat_in_ui.py # Gradio UI version
├── prepare_sqldb.py # Creates SQLite DB
├── prepare_vectordb.py # Creates Vector DB
├── check_sqldb.py # Checks SQLite DB contents
├── check_vectordb.py # Checks Vector DB contents
├── notion_mcp_server/ # 🆕 Complete Notion MCP Server
│ ├── core_operations.py # Basic Notion operations
│ ├── analytics_operations.py # Workspace analytics
│ ├── bulk_operations.py # Bulk operations
│ ├── update_operations.py # Content updates
│ ├── notion_utils.py # Utility functions
│ ├── api_serverV2.py # HTTP API server
│ ├── serverV2.py # MCP server implementation
│ ├── test_server.py # 🆕 48KB comprehensive test suite
│ └── README.md # 🆕 Complete MCP Server V2.1 documentation
└── utils/
├── basic_chatbot_v1.py # Basic chatbot implementation
├── chatbot_agentic_v2.py # Agentic chatbot v2
├── chatbot_agentic_v3.py # 🆕 Main enhanced chatbot (LATEST)
├── mcp_client_manager.py # 🆕 MCP client management
├── chat_history_manager.py
├── vector_db_manager.py
├── user_manager.py
├── prepare_system_prompt.py
├── search_manager.py
├── sql_manager.py
├── config.py
└── utils.py
# Testing Files
├── test_notion_integration.py # 🆕 Notion integration tests
├── test_notion_mcp.py # 🆕 MCP functionality tests
├── test_chatbot_integration.py # 🆕 Chatbot integration tests
└── [other test files...]
# Documentation
├── HOW_MCP_TOOLS_WORK.md # 🆕 MCP implementation guide
├── NOTION_INTEGRATION_README.md # 🆕 Notion integration docs
├── MCP_IMPLEMENTATION_COMPARISON.md # 🆕 Implementation comparison
├── MCP_NOTION_README.md # 🆕 MCP Notion setup guide
├── PRODUCTION_CONFIG.md # 🆕 Production deployment
└── README.md # This file
# Additional Directories
langgraph/ # LangGraph implementations
letta/ # Letta memory system
docker/ # 🆕 Docker deployment
config/ # Configuration files
data/ # Database storage
LLM Default Behavior

Concept of Memory

Basic Chatbot Schema

Agentic_Chatbot_v2 Schema

Agentic_Chatbot_v3 Schema (Old Version)

Longterm Memory with Graph DB and Vector DB using LangGraph

Longterm Memory (Semantic, Episodical, and Procedural) with LangGraph

Old Project Structure

Feel free to contribute by:
This project is open source
🎉 This is a complete AI agent system with production-ready Notion integration, advanced memory management, and MCP protocol implementation!
Add this to claude_desktop_config.json and restart Claude Desktop.
{
"mcpServers": {
"ankitmalik84-notion-mcp-server": {
"command": "npx",
"args": []
}
}
}