Files
t66_langmem/tests/test_mcp_server.py
Docker Config Backup f0db3e5546 Clean and organize project structure
Major reorganization:
- Created scripts/ directory for all utility scripts
- Created config/ directory for configuration files
- Moved all test files to tests/ directory
- Updated all script paths to work with new structure
- Updated README.md with new project structure diagram

New structure:
├── src/          # Source code (API + MCP)
├── scripts/      # Utility scripts (start-*.sh, docs_server.py, etc.)
├── tests/        # All test files and debug utilities
├── config/       # Configuration files (JSON, Caddy config)
├── docs/         # Documentation website
└── logs/         # Log files

All scripts updated to use relative paths from project root.
Documentation updated with new folder structure.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-17 14:11:08 +02:00

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())