- Complete fact-based memory API with mem0-inspired approach - Individual fact extraction and deduplication - ADD/UPDATE/DELETE memory actions - Precision search with 0.86+ similarity scores - MCP server for Claude Code integration - Neo4j graph relationships and PostgreSQL vector storage - Comprehensive documentation with architecture and API docs - Matrix communication integration - Production-ready Docker setup with Ollama and Supabase 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
79 lines
2.8 KiB
Python
79 lines
2.8 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test MCP server implementation
|
|
"""
|
|
|
|
import asyncio
|
|
import json
|
|
import sys
|
|
import subprocess
|
|
import time
|
|
import signal
|
|
|
|
async def test_mcp_server_startup():
|
|
"""Test MCP server startup"""
|
|
print("🚀 Testing MCP server startup...")
|
|
|
|
# Test if LangMem API is running
|
|
try:
|
|
import httpx
|
|
async with httpx.AsyncClient() as client:
|
|
response = await client.get("http://localhost:8765/health", timeout=5.0)
|
|
if response.status_code == 200:
|
|
print("✅ LangMem API is running")
|
|
else:
|
|
print("❌ LangMem API is not healthy")
|
|
return False
|
|
except Exception as e:
|
|
print(f"❌ LangMem API is not accessible: {e}")
|
|
return False
|
|
|
|
# Test MCP server imports
|
|
try:
|
|
sys.path.insert(0, '/home/klas/langmem-project/src/mcp')
|
|
from server import LangMemMCPServer
|
|
print("✅ MCP server imports successfully")
|
|
except Exception as e:
|
|
print(f"❌ MCP server import failed: {e}")
|
|
return False
|
|
|
|
# Test MCP server initialization
|
|
try:
|
|
server = LangMemMCPServer()
|
|
print("✅ MCP server initializes successfully")
|
|
return True
|
|
except Exception as e:
|
|
print(f"❌ MCP server initialization failed: {e}")
|
|
return False
|
|
|
|
async def main():
|
|
"""Main function"""
|
|
print("🧪 Testing LangMem MCP Server...")
|
|
|
|
success = await test_mcp_server_startup()
|
|
|
|
if success:
|
|
print("\n🎉 MCP server tests passed!")
|
|
print("\n📋 Integration instructions:")
|
|
print("1. Add MCP server to Claude Code configuration:")
|
|
print(" - Copy mcp_config.json to your Claude Code settings")
|
|
print(" - Or add manually in Claude Code settings")
|
|
print("\n2. Start the MCP server:")
|
|
print(" ./start-mcp-server.sh")
|
|
print("\n3. Available tools in Claude Code:")
|
|
print(" - store_memory: Store memories with AI relationship extraction")
|
|
print(" - search_memories: Search memories with hybrid vector + graph search")
|
|
print(" - retrieve_memories: Retrieve relevant memories for conversation context")
|
|
print(" - get_user_memories: Get all memories for a specific user")
|
|
print(" - delete_memory: Delete a specific memory")
|
|
print(" - health_check: Check LangMem system health")
|
|
print("\n4. Available resources:")
|
|
print(" - langmem://memories: Memory storage resource")
|
|
print(" - langmem://search: Search capabilities resource")
|
|
print(" - langmem://relationships: AI relationships resource")
|
|
print(" - langmem://health: System health resource")
|
|
else:
|
|
print("\n❌ MCP server tests failed!")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main()) |