name: MCP STDIO Protocol Validation on: pull_request: branches: [ main, master ] workflow_dispatch: # Allow manual triggering jobs: validate-stdio: name: Validate STDIO MCP Server runs-on: ubuntu-latest strategy: matrix: protocol-version: ["2025-03-26"] # Just test the latest version in MVP steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e . pip install pytest pytest-html - name: Run MCP STDIO Compliance Tests id: stdio-test run: | mkdir -p reports # Run compliance tests with the STDIO server python -m mcp_testing.scripts.compliance_report \ --server-command "python ref_stdio_server/stdio_server_${{ matrix.protocol-version }}.py" \ --protocol-version ${{ matrix.protocol-version }} \ --output-dir reports \ --test-timeout 30 \ --tools-timeout 15 - name: Upload test reports uses: actions/upload-artifact@v4 with: name: mcp-stdio-reports path: reports/ retention-days: 14 - name: Post summary to PR if: github.event_name == 'pull_request' uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const fs = require('fs'); try { const reportFiles = fs.readdirSync('reports'); const jsonReportFile = reportFiles.find(file => file.endsWith('.json')); let summary = "## MCP STDIO Validation Results\n\n"; if (jsonReportFile) { const reportData = JSON.parse(fs.readFileSync(`reports/${jsonReportFile}`, 'utf8')); summary += `- Protocol Version: ${reportData.protocol_version || 'Unknown'}\n`; summary += `- Success Rate: ${reportData.success_rate || 'Unknown'}\n`; summary += `- Tests Run: ${reportData.total_tests || 0}\n`; // Add failed tests if any const failedTests = (reportData.test_cases || []).filter(tc => tc.status === 'failed'); if (failedTests.length > 0) { summary += `\n### Failed Tests (${failedTests.length}):\n\n`; failedTests.forEach(test => { summary += `- ${test.name}: ${test.error_message || 'No error message'}\n`; }); } } else { summary += "No test report found.\n"; } github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: summary }); } catch (error) { console.error('Error creating PR comment:', error); github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: "## MCP STDIO Validation\n\nError generating test results summary. Check the workflow logs for details." }); }