#!/bin/bash # Start LangMem MCP Server # This script starts the MCP server for Claude Code integration echo "🚀 Starting LangMem MCP Server..." # Check if virtual environment exists if [ ! -d "venv" ]; then echo "📦 Creating virtual environment..." python3 -m venv venv fi # Activate virtual environment echo "🔄 Activating virtual environment..." source venv/bin/activate # Install MCP requirements echo "📥 Installing MCP requirements..." pip install -r src/mcp/requirements.txt # Check if LangMem API is running echo "🔍 Checking LangMem API health..." if curl -s -f http://localhost:8765/health > /dev/null; then echo "✅ LangMem API is healthy" else echo "❌ LangMem API is not running!" echo "💡 Start the LangMem API first: ./start-dev.sh" exit 1 fi # Set environment variables export LANGMEM_API_URL="http://localhost:8765" export LANGMEM_API_KEY="langmem_api_key_2025" # Start MCP server echo "🏃 Starting MCP server..." echo "🔗 Connect from Claude Code using:" echo " Server command: python /home/klas/langmem-project/src/mcp/server.py" echo " Working directory: /home/klas/langmem-project" echo "" echo "📖 Available tools:" echo " - store_memory: Store memories with AI relationship extraction" echo " - search_memories: Search memories with hybrid vector + graph search" echo " - retrieve_memories: Retrieve relevant memories for conversation context" echo " - get_user_memories: Get all memories for a specific user" echo " - delete_memory: Delete a specific memory" echo " - health_check: Check LangMem system health" echo "" echo "🌐 Available resources:" echo " - langmem://memories: Memory storage resource" echo " - langmem://search: Search capabilities resource" echo " - langmem://relationships: AI relationships resource" echo " - langmem://health: System health resource" echo "" echo "Press Ctrl+C to stop the server..." echo "" python src/mcp/server.py