fix sed command #4
  
    
      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: MCP Version Compatibility Testing | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| schedule: | |
| # Run weekly to catch new MCP versions | |
| - cron: '0 0 * * 0' | |
| workflow_dispatch: | |
| jobs: | |
| discover-versions: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| mcp-versions: ${{ steps.get-versions.outputs.versions }} | |
| steps: | |
| - name: Get available MCP versions | |
| id: get-versions | |
| run: | | |
| # Get all available versions from PyPI | |
| versions=$(pip index versions mcp 2>/dev/null | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | sort -V) | |
| # Filter to versions >= 1.0.0 and get only latest patch version for each minor | |
| declare -A latest_minor | |
| for version in $versions; do | |
| major=$(echo $version | cut -d. -f1) | |
| minor=$(echo $version | cut -d. -f2) | |
| # Include if major >= 1 | |
| if [ "$major" -ge 1 ]; then | |
| minor_key="$major.$minor" | |
| latest_minor[$minor_key]="$version" | |
| fi | |
| done | |
| # Create JSON array from latest versions | |
| filtered_versions=() | |
| for version in "${latest_minor[@]}"; do | |
| filtered_versions+=("\"$version\"") | |
| done | |
| json_array="[$(IFS=,; echo "${filtered_versions[*]}")]" | |
| echo "Found MCP versions: $json_array" | |
| echo "versions=$json_array" >> $GITHUB_OUTPUT | |
| test-compatibility: | |
| runs-on: ubuntu-latest | |
| needs: discover-versions | |
| strategy: | |
| matrix: | |
| mcp-version: ${{ fromJson(needs.discover-versions.outputs.mcp-versions) }} | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Update pyproject.toml with MCP ${{ matrix.mcp-version }} | |
| run: | | |
| # Replace the whole quoted string, preserving the trailing comma | |
| sed -i -E 's/"mcp==[^"]+"/"mcp==${{ matrix.mcp-version }}"/' pyproject.toml | |
| - name: Install dependencies with MCP ${{ matrix.mcp-version }} | |
| run: | | |
| uv sync --extra dev | |
| - name: Run full test suite with MCP ${{ matrix.mcp-version }} | |
| run: | | |
| echo "Running full test suite with MCP version ${{ matrix.mcp-version }}" | |
| uv run pytest tests/ -v | |
| report-compatibility: | |
| runs-on: ubuntu-latest | |
| needs: [discover-versions, test-compatibility] | |
| if: always() | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create compatibility report | |
| run: | | |
| echo "# MCP Version Compatibility Report" > compatibility-report.md | |
| echo "" >> compatibility-report.md | |
| echo "This report shows the compatibility status of MCPCat with different MCP versions." >> compatibility-report.md | |
| echo "" >> compatibility-report.md | |
| echo "Generated on: $(date)" >> compatibility-report.md | |
| echo "" >> compatibility-report.md | |
| echo "## Tested Versions" >> compatibility-report.md | |
| echo "MCP versions tested: ${{ needs.discover-versions.outputs.mcp-versions }}" >> compatibility-report.md | |
| echo "Python version: 3.12" >> compatibility-report.md | |
| echo "" >> compatibility-report.md | |
| echo "## Test Coverage" >> compatibility-report.md | |
| echo "- FastMCP server compatibility" >> compatibility-report.md | |
| echo "- Low-level Server compatibility" >> compatibility-report.md | |
| echo "- Both implementations tested with is_compatible_server function" >> compatibility-report.md | |
| echo "" >> compatibility-report.md | |
| echo "See the GitHub Actions run for detailed results." >> compatibility-report.md | |
| - name: Upload compatibility report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mcp-compatibility-report | |
| path: compatibility-report.md |