This is a major refactoring of the MCP Server to support multiple providers through a YAML-based configuration system with factory pattern implementation. ## Key Changes ### Architecture Improvements - Modular configuration system with YAML-based settings - Factory pattern for LLM, Embedder, and Database providers - Support for multiple database backends (Neo4j, FalkorDB, KuzuDB) - Clean separation of concerns with dedicated service modules ### Provider Support - **LLM**: OpenAI, Anthropic, Gemini, Groq - **Embedders**: OpenAI, Voyage, Gemini, Anthropic, Sentence Transformers - **Databases**: Neo4j, FalkorDB, KuzuDB (new default) - Azure OpenAI support with AD authentication ### Configuration - YAML configuration with environment variable expansion - CLI argument overrides for runtime configuration - Multiple pre-configured Docker Compose setups - Proper boolean handling in environment variables ### Testing & CI - Comprehensive test suite with unit and integration tests - GitHub Actions workflows for linting and testing - Multi-database testing support ### Docker Support - Updated Docker images with multi-stage builds - Database-specific docker-compose configurations - Persistent volume support for all databases ### Bug Fixes - Fixed KuzuDB connectivity checks - Corrected Docker command paths - Improved error handling and logging - Fixed boolean environment variable expansion Co-authored-by: Claude <noreply@anthropic.com>
83 lines
2.7 KiB
Python
83 lines
2.7 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Simple test to verify MCP server works with stdio transport.
|
|
"""
|
|
|
|
import asyncio
|
|
import os
|
|
|
|
from mcp import ClientSession, StdioServerParameters
|
|
from mcp.client.stdio import stdio_client
|
|
|
|
|
|
async def test_stdio():
|
|
"""Test basic MCP server functionality with stdio transport."""
|
|
print('🚀 Testing MCP Server with stdio transport')
|
|
print('=' * 50)
|
|
|
|
# Configure server parameters
|
|
server_params = StdioServerParameters(
|
|
command='uv',
|
|
args=['run', 'main.py', '--transport', 'stdio'],
|
|
env={
|
|
'NEO4J_URI': os.environ.get('NEO4J_URI', 'bolt://localhost:7687'),
|
|
'NEO4J_USER': os.environ.get('NEO4J_USER', 'neo4j'),
|
|
'NEO4J_PASSWORD': os.environ.get('NEO4J_PASSWORD', 'graphiti'),
|
|
'OPENAI_API_KEY': os.environ.get('OPENAI_API_KEY', 'dummy'),
|
|
},
|
|
)
|
|
|
|
try:
|
|
async with stdio_client(server_params) as (read, write): # noqa: SIM117
|
|
async with ClientSession(read, write) as session:
|
|
print('✅ Connected to server')
|
|
|
|
# Wait for server initialization
|
|
await asyncio.sleep(1)
|
|
|
|
# List tools
|
|
print('\n📋 Listing available tools...')
|
|
tools = await session.list_tools()
|
|
print(f' Found {len(tools.tools)} tools:')
|
|
for tool in tools.tools[:5]:
|
|
print(f' - {tool.name}')
|
|
|
|
# Test add_memory
|
|
print('\n📝 Testing add_memory...')
|
|
result = await session.call_tool(
|
|
'add_memory',
|
|
{
|
|
'name': 'Test Episode',
|
|
'episode_body': 'Simple test episode',
|
|
'group_id': 'test_group',
|
|
'source': 'text',
|
|
},
|
|
)
|
|
|
|
if result.content:
|
|
print(f' ✅ Memory added: {result.content[0].text[:100]}')
|
|
|
|
# Test search
|
|
print('\n🔍 Testing search_memory_nodes...')
|
|
result = await session.call_tool(
|
|
'search_memory_nodes',
|
|
{'query': 'test', 'group_ids': ['test_group'], 'limit': 5},
|
|
)
|
|
|
|
if result.content:
|
|
print(f' ✅ Search completed: {result.content[0].text[:100]}')
|
|
|
|
print('\n✅ All tests completed successfully!')
|
|
return True
|
|
|
|
except Exception as e:
|
|
print(f'\n❌ Test failed: {e}')
|
|
import traceback
|
|
|
|
traceback.print_exc()
|
|
return False
|
|
|
|
|
|
if __name__ == '__main__':
|
|
success = asyncio.run(test_stdio())
|
|
exit(0 if success else 1)
|