cheeeaaat's picture
Long Term Memory MCP Server
d317445
Raw
History Blame Contribute Delete
1.44 kB
#!/usr/bin/env python3
"""
Long Term Memory MCP Server & Gradio Demo
A Model Context Protocol server that provides long-term memory capabilities for LLM conversations.
"""
import os
import sys
import threading
import time
import subprocess
from pathlib import Path
# Add the current directory to the Python path
sys.path.insert(0, str(Path(__file__).parent))
from gradio_demo import demo
def run_mcp_server():
"""Run the MCP server in a separate thread."""
try:
# Import and run the MCP server
from mcp_server import main
import asyncio
# Create new event loop for this thread
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
# Run the server
loop.run_until_complete(main())
except Exception as e:
print(f"MCP Server error: {e}")
def main():
"""Main entry point."""
print("🧠 Starting Long Term Memory MCP Server & Demo...")
# Start MCP server in background thread
mcp_thread = threading.Thread(target=run_mcp_server, daemon=True)
mcp_thread.start()
# Give the MCP server a moment to start
time.sleep(2)
print("✅ MCP Server started!")
print("🚀 Launching Gradio demo...")
# Launch Gradio demo
demo.launch(
server_name="0.0.0.0",
server_port=7860,
share=True,
show_error=True
)
if __name__ == "__main__":
main()