diff --git a/.github/workflows/_test-unit-base.yml b/.github/workflows/_test-unit-base.yml index 617b09a8075..db668536625 100644 --- a/.github/workflows/_test-unit-base.yml +++ b/.github/workflows/_test-unit-base.yml @@ -63,6 +63,11 @@ on: description: "Unique name for the coverage artifact (must be unique per run)" required: true type: string + legacy-mcp-peer: + description: "Install the isolated SDK1 peer for MCP compatibility tests" + required: false + type: boolean + default: false permissions: contents: read @@ -130,6 +135,14 @@ jobs: .github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router --extra saml uv run --no-sync python -c 'import os, sys; print(sys.version); assert f"{sys.version_info.major}.{sys.version_info.minor}" == os.environ["UV_PYTHON"]' + - name: Install the unchanged SDK1 peer + if: steps.changes.outputs.decision != 'skip' && inputs.legacy-mcp-peer + timeout-minutes: 3 + run: | + uv venv --python "${UV_PYTHON}" .venv-mcp-peer + uv pip install --python .venv-mcp-peer 'mcp==1.28.1' 'langchain-mcp-adapters==0.2.1' + echo "MCP_TEST_PEER_PYTHON=$GITHUB_WORKSPACE/.venv-mcp-peer/bin/python" >> "$GITHUB_ENV" + - name: Cache Prisma binaries if: steps.changes.outputs.decision != 'skip' timeout-minutes: 3 diff --git a/.github/workflows/test-mcp.yml b/.github/workflows/test-mcp.yml deleted file mode 100644 index 9d6b0194df9..00000000000 --- a/.github/workflows/test-mcp.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: LiteLLM MCP Tests (folder - tests/mcp_tests) - -on: - pull_request: - branches: - - main - - litellm_internal_staging - - litellm_oss_staging - - "litellm_**" - -permissions: - contents: read - pull-requests: read - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} - -jobs: - test: - runs-on: ubuntu-latest - timeout-minutes: 25 - - steps: - - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - with: - persist-credentials: false - - - name: Detect relevant changes - id: changes - uses: ./.github/actions/detect-changes - - - name: Thank You Message - run: | - echo "### 🙏 Thank you for contributing to LiteLLM!" >> $GITHUB_STEP_SUMMARY - echo "Your PR is being tested now. We appreciate your help in making LiteLLM better!" >> $GITHUB_STEP_SUMMARY - - - name: Set up Python - if: steps.changes.outputs.decision != 'skip' - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - with: - python-version: "3.12" - - - name: Set up uv - if: steps.changes.outputs.decision != 'skip' - uses: ./.github/actions/setup-uv-with-retries - with: - version: "0.10.9" - - - name: Cache the Rust build - if: steps.changes.outputs.decision != 'skip' - uses: ./.github/actions/cache-cargo-build - - - name: Install dependencies - if: steps.changes.outputs.decision != 'skip' - run: | - uv lock --check - .github/scripts/uv_sync_with_retries.sh --frozen --group proxy-dev --extra proxy --extra semantic-router - - - name: Install the unchanged SDK1 peer - if: steps.changes.outputs.decision != 'skip' - run: | - uv venv --python 3.12 .venv-mcp-peer - uv pip install --python .venv-mcp-peer 'mcp==1.28.1' 'langchain-mcp-adapters==0.2.1' - echo "MCP_TEST_PEER_PYTHON=$GITHUB_WORKSPACE/.venv-mcp-peer/bin/python" >> "$GITHUB_ENV" - - - name: Run MCP tests - if: steps.changes.outputs.decision != 'skip' - run: | - uv run --no-sync pytest tests/mcp_tests -x -vv -n 4 --cov=./litellm --cov=./enterprise/litellm_enterprise --cov-report=xml --durations=5 diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index a32b5ebb2a8..55c342caf00 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -49,6 +49,14 @@ jobs: fail-fast: false matrix: include: + - shard: mcp-integration + artifact-name: mcp-integration + test-path: "tests/mcp_tests" + workers: 2 + reruns: 0 + timeout-minutes: 20 + job-timeout-minutes: 65 + - shard: core-utils artifact-name: core-utils test-path: "tests/test_litellm/litellm_core_utils" @@ -254,3 +262,4 @@ jobs: timeout-minutes: ${{ matrix.timeout-minutes }} job-timeout-minutes: ${{ matrix.job-timeout-minutes }} artifact-name: ${{ matrix.artifact-name }} + legacy-mcp-peer: ${{ matrix.shard == 'mcp-integration' }} diff --git a/litellm/experimental_mcp_client/Readme.md b/litellm/experimental_mcp_client/Readme.md index 14e37dda6de..0c7b0aa76b9 100644 --- a/litellm/experimental_mcp_client/Readme.md +++ b/litellm/experimental_mcp_client/Readme.md @@ -12,4 +12,6 @@ Code sharing the gateway's Python environment must support SDK2. Its Python API Upgrade SDK1-dependent libraries before installing them alongside `litellm[mcp]` or `litellm[proxy]`, or keep those clients in a separate environment and connect over the network. For example, `langchain-mcp-adapters==0.2.1` uses SDK1 Python APIs and is tested as a separate legacy client, not as a shared SDK2 dependency +The shared unit-test workflow runs the MCP integration suite once, with SDK2 in the gateway environment and an isolated SDK1 peer. Keep the SDK1 list/call compatibility test while SDK1 clients are supported; remove it when that support is explicitly retired and the client migration is documented + See the official [SDK migration guide](https://py.sdk.modelcontextprotocol.io/migration/) for Python API changes