mirror of
https://github.com/LearningCircuit/local-deep-research.git
synced 2026-06-15 19:46:56 +03:00
ci: Add MCP server tests workflow (#1506)
* ci: Add MCP server tests workflow Add dedicated CI workflow for testing the MCP (Model Context Protocol) server implementation. This workflow: - Runs on changes to MCP-related files - Verifies MCP module loads correctly - Tests discovery tools (list_strategies, list_search_engines, get_configuration) - Runs full MCP unit test suite with mocks - Tests MCP strategy (ReAct pattern) implementation - Verifies server startup behavior The tests use mocks to avoid requiring an LLM backend, making them fast and reliable in CI environments. Prepares CI infrastructure for PR #1366 (MCP server feature). * refactor: Move MCP smoke tests to external script Address review feedback from djpetti: - Extract MCP module loading test to scripts/mcp_smoke_test.sh - Extract MCP server startup test to the same script - Update workflow to call the external script - Add script path to workflow triggers * ci: skip MCP tests when server module not implemented The MCP server module (src/local_deep_research/mcp/server.py) is in a separate feature branch. This change makes the MCP test workflow skip gracefully when the module doesn't exist, with a clear notice. Tests will automatically run once the MCP feature branch is merged.
This commit is contained in:
43
scripts/mcp_smoke_test.sh
Executable file
43
scripts/mcp_smoke_test.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
# MCP Server Smoke Test
|
||||
# Verifies that the MCP server module loads correctly and basic tools work
|
||||
|
||||
set -e
|
||||
|
||||
echo "=== MCP Server Smoke Test ==="
|
||||
echo ""
|
||||
|
||||
# Test 1: Verify MCP module loads
|
||||
echo "1. Testing MCP module loading..."
|
||||
python -c "
|
||||
from local_deep_research.mcp.server import mcp, list_strategies, get_configuration
|
||||
print(' MCP server module loaded successfully')
|
||||
print(f' Server name: {mcp.name}')
|
||||
|
||||
# Test discovery tools
|
||||
result = list_strategies()
|
||||
assert result['status'] == 'success', f'list_strategies failed: {result}'
|
||||
print(f' list_strategies: {len(result[\"strategies\"])} strategies available')
|
||||
|
||||
config = get_configuration()
|
||||
assert config['status'] == 'success', f'get_configuration failed: {config}'
|
||||
print(' get_configuration: works correctly')
|
||||
"
|
||||
echo " PASSED"
|
||||
echo ""
|
||||
|
||||
# Test 2: Verify MCP server startup
|
||||
echo "2. Testing MCP server startup..."
|
||||
timeout 5 python -m local_deep_research.mcp 2>&1 || {
|
||||
exit_code=$?
|
||||
if [ $exit_code -eq 124 ]; then
|
||||
echo " Server started correctly (timed out waiting for STDIO input as expected)"
|
||||
echo " PASSED"
|
||||
else
|
||||
echo " FAILED: MCP server failed to start with exit code $exit_code"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo ""
|
||||
echo "=== All MCP smoke tests passed ==="
|
||||
Reference in New Issue
Block a user