Skip to content

Refactor Docker config #40

Refactor Docker config

Refactor Docker config #40

Workflow file for this run

name: Test MCP Server
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
env:
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
LLM_API_BASE: https://coder.gaia.domains/v1
LLM_MODEL: Qwen2.5-Coder-32B-Instruct-Q5_K_M
LLM_EMBED_MODEL: nomic-embed
LLM_EMBED_SIZE: 768
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Install jq
run: sudo apt-get install -y jq
- name: Run docker compose
uses: hoverkraft-tech/[email protected]
with:
compose-file: ./docker-compose.yml
up-flags: "-d --build"
- name: Wait for services to be ready
run: |
echo "Waiting for services to be ready..."
sleep 60
docker ps
- name: Verify container readiness
run: |
echo "Checking Docker container status..."
docker ps
for container in api mcp-server mcp-proxy; do
if ! docker ps | grep -q "$container"; then
echo "ERROR: $container is not running!"
docker compose logs --tail=100 "$container"
exit 1
fi
done
echo "All containers are running."
echo "API container logs:"
docker logs $(docker ps -q --filter name=api)
echo "Waiting 30 more seconds for services to stabilize..."
sleep 30
- name: Install cmcp client (latest version)
run: |
pip install --upgrade cmcp
echo "cmcp version:"
cmcp --version
echo "cmcp help output:"
cmcp --help
- name: Check MCP proxy port binding
run: |
echo "Checking if anything is listening on port 3000..."
sudo lsof -i :3000 || echo "Nothing found on port 3000"
curl --fail --silent http://localhost:3000/tools/list || echo "Port 3000 not responding"
- name: Test FastAPI endpoints
run: |
echo "Testing FastAPI /mcp/compile endpoint..."
RESPONSE=$(curl -s -S -f -X POST http://localhost:8000/mcp/compile \
-H "Content-Type: application/json" \
-d '{
"code": "[filename: Cargo.toml]\n[package]\nname = \"hello_world\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[dependencies]\n\n[filename: src/main.rs]\nfn main() {\n println!(\"Hello, World!\");\n}"
}' || echo "CURL_FAILED")
if [ "$RESPONSE" = "CURL_FAILED" ]; then
echo "Failed to connect to FastAPI service"
docker ps
docker logs $(docker ps -q --filter name=api)
exit 1
fi
echo "$RESPONSE" | jq || echo "$RESPONSE"
echo "Testing FastAPI /mcp/compile-and-fix endpoint..."
RESPONSE=$(curl -s -S -f -X POST http://localhost:8000/mcp/compile-and-fix \
-H "Content-Type: application/json" \
-d '{
"code": "[filename: Cargo.toml]\n[package]\nname = \"hello_world\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[dependencies]\n\n[filename: src/main.rs]\nfn main() {\n println!(\"Hello, World!\" // Missing closing parenthesis\n}",
"description": "A simple hello world program",
"max_attempts": 3
}' || echo "CURL_FAILED")
if [ "$RESPONSE" = "CURL_FAILED" ]; then
echo "Failed to connect to FastAPI service"
docker ps
docker logs $(docker ps -q --filter name=api)
exit 1
fi
echo "$RESPONSE" | jq || echo "$RESPONSE"
- name: Test MCP Server with cmcp client
run: |
echo "Testing MCP server compile method..."
echo '{
"code": "[filename: Cargo.toml]\n[package]\nname = \"hello_world\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[dependencies]\n\n[filename: src/main.rs]\nfn main() {\n println!(\"Hello, World!\");\n}"
}' | cmcp tools/call http://localhost:3000 rust-compiler compile || {
echo "MCP compile test failed"
exit 1
}
echo "Testing MCP server compileAndFix method..."
echo '{
"code": "[filename: Cargo.toml]\n[package]\nname = \"hello_world\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[dependencies]\n\n[filename: src/main.rs]\nfn main() {\n println!(\"Hello, World!\" // Missing closing parenthesis\n}",
"description": "A simple hello world program",
"max_attempts": 3
}' | cmcp tools/call http://localhost:3000 rust-compiler compileAndFix || {
echo "MCP compileAndFix test failed"
exit 1
}
- name: Check Docker logs on failure
if: failure()
run: |
echo "Checking Docker logs for troubleshooting..."
docker compose logs || echo "Failed to get logs"
- name: Check MCP proxy logs
run: |
echo "MCP proxy logs:"
docker logs $(docker ps -a -q --filter name=mcp-proxy) || echo "Failed to get MCP proxy logs"