fix: update cmcp command syntax for MCP server compile methods #35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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..." | |
| # Longer wait time for services | |
| sleep 60 | |
| # Show running containers | |
| docker ps | |
| - name: Verify container readiness | |
| run: | | |
| echo "Checking Docker container status..." | |
| docker ps | |
| # Check if all containers are running | |
| if ! docker ps | grep -q api; then | |
| echo "ERROR: API container is not running!" | |
| echo "Building container logs:" | |
| docker compose logs --tail=100 api | |
| exit 1 | |
| fi | |
| if ! docker ps | grep -q mcp-server; then | |
| echo "ERROR: MCP server container is not running!" | |
| docker compose logs --tail=100 mcp-server | |
| exit 1 | |
| fi | |
| if ! docker ps | grep -q mcp-proxy; then | |
| echo "ERROR: MCP proxy container is not running!" | |
| docker compose logs --tail=100 mcp-proxy | |
| exit 1 | |
| fi | |
| echo "All required 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 | |
| run: | | |
| pip install cmcp | |
| - name: Test FastAPI endpoints with better error handling | |
| 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. Debug information:" | |
| 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. Debug information:" | |
| docker ps | |
| docker logs $(docker ps -q --filter name=api) | |
| exit 1 | |
| fi | |
| 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 http://localhost:3000 tools/call rust-compiler compile | |
| 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 http://localhost:3000 tools/call rust-compiler compileAndFix | |
| - 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" |