Files
t6_mem0_v2/test-n8n-workflow.sh
Claude Code 1998bef6f4 Add MCP HTTP/SSE server and complete n8n integration
Major Changes:
- Implemented MCP HTTP/SSE transport server for n8n and web clients
- Created mcp_server/http_server.py with FastAPI for JSON-RPC 2.0 over HTTP
- Added health check endpoint (/health) for container monitoring
- Refactored mcp-server/ to mcp_server/ (Python module structure)
- Updated Dockerfile.mcp to run HTTP server with health checks

MCP Server Features:
- 7 memory tools exposed via MCP (add, search, get, update, delete)
- HTTP/SSE transport on port 8765 for n8n integration
- stdio transport for Claude Code integration
- JSON-RPC 2.0 protocol implementation
- CORS support for web clients

n8n Integration:
- Successfully tested with AI Agent workflows
- MCP Client Tool configuration documented
- Working webhook endpoint tested and verified
- System prompt optimized for automatic user_id usage

Documentation:
- Created comprehensive Mintlify documentation site
- Added docs/mcp/introduction.mdx - MCP server overview
- Added docs/mcp/installation.mdx - Installation guide
- Added docs/mcp/tools.mdx - Complete tool reference
- Added docs/examples/n8n.mdx - n8n integration guide
- Added docs/examples/claude-code.mdx - Claude Code setup
- Updated README.md with MCP HTTP server info
- Updated roadmap to mark Phase 1 as complete

Bug Fixes:
- Fixed synchronized delete operations across Supabase and Neo4j
- Updated memory_service.py with proper error handling
- Fixed Neo4j connection issues in delete operations

Configuration:
- Added MCP_HOST and MCP_PORT environment variables
- Updated .env.example with MCP server configuration
- Updated docker-compose.yml with MCP container health checks

Testing:
- Added test scripts for MCP HTTP endpoint verification
- Created test workflows in n8n
- Verified all 7 memory tools working correctly
- Tested synchronized operations across both stores

Version: 1.0.0
Status: Phase 1 Complete - Production Ready

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-15 13:56:41 +02:00

55 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# Automated n8n Workflow Testing Script
# Tests mem0 API integration via n8n workflow
set -e
WORKFLOW_ID="y5W8hp1B3FZfocJ0"
API_CONTAINER="172.21.0.14"
echo "=== n8n Workflow Test Script ==="
echo ""
# Step 1: Get latest execution
echo "1. Checking latest workflow execution..."
LATEST_EXEC=$(curl -s "http://localhost:5678/api/v1/executions?workflowId=${WORKFLOW_ID}&limit=1" | jq -r '.data[0]')
EXEC_ID=$(echo "$LATEST_EXEC" | jq -r '.id')
EXEC_STATUS=$(echo "$LATEST_EXEC" | jq -r '.status')
EXEC_TIME=$(echo "$LATEST_EXEC" | jq -r '.startedAt')
echo " Latest Execution: $EXEC_ID"
echo " Status: $EXEC_STATUS"
echo " Started: $EXEC_TIME"
echo ""
# Step 2: If successful, get detailed results
if [ "$EXEC_STATUS" = "success" ]; then
echo "2. ✅ Workflow executed successfully!"
echo ""
echo "3. Fetching execution details..."
# Get execution data (using MCP pattern)
EXEC_DATA=$(curl -s "http://localhost:5678/api/v1/executions/${EXEC_ID}")
# Extract node results
echo ""
echo " Node Results:"
echo " - Health Check: $(echo "$EXEC_DATA" | jq -r '.data.resultData.runData["1. Health Check"][0].data.main[0][0].json.status // "N/A"')"
echo " - Memories Created: $(echo "$EXEC_DATA" | jq -r '.data.resultData.runData["2. Create Memory 1"][0].data.main[0][0].json.memories | length // 0')"
echo " - Test Summary: $(echo "$EXEC_DATA" | jq -r '.data.resultData.runData["Test Summary"][0].data.main[0][0].json.test_status // "N/A"')"
echo ""
echo "✅ All tests passed!"
exit 0
else
echo "2. ❌ Workflow execution failed or not run yet"
echo ""
echo "To run the test:"
echo " 1. Open n8n UI: http://localhost:5678"
echo " 2. Open workflow: Claude: Mem0 API Test Suite"
echo " 3. Click 'Execute Workflow' button"
echo ""
echo "Then run this script again to see results."
exit 1
fi