From 39aa147479be9c9307eec9c1aa8c5c29209376b2 Mon Sep 17 00:00:00 2001 From: Clayton Parnell Date: Tue, 15 Jul 2025 17:37:55 +0000 Subject: [PATCH] Add mcp python sdk package --- .../v2.9/v2.9.0/cpu.additional_packages_env.in | 1 + .../v2.9/v2.9.0/gpu.additional_packages_env.in | 1 + .../v3.4/v3.4.0/cpu.additional_packages_env.in | 1 + .../v3.4/v3.4.0/gpu.additional_packages_env.in | 1 + test/test_artifacts/v2/mcp.test.Dockerfile | 16 ++++++++++++++++ test/test_artifacts/v2/scripts/run_mcp_tests.sh | 9 +++++++++ test/test_artifacts/v3/mcp.test.Dockerfile | 16 ++++++++++++++++ test/test_artifacts/v3/scripts/run_mcp_tests.sh | 9 +++++++++ 8 files changed, 54 insertions(+) create mode 100644 build_artifacts/v2/v2.9/v2.9.0/cpu.additional_packages_env.in create mode 100644 build_artifacts/v2/v2.9/v2.9.0/gpu.additional_packages_env.in create mode 100644 build_artifacts/v3/v3.4/v3.4.0/cpu.additional_packages_env.in create mode 100644 build_artifacts/v3/v3.4/v3.4.0/gpu.additional_packages_env.in create mode 100644 test/test_artifacts/v2/mcp.test.Dockerfile create mode 100644 test/test_artifacts/v2/scripts/run_mcp_tests.sh create mode 100644 test/test_artifacts/v3/mcp.test.Dockerfile create mode 100644 test/test_artifacts/v3/scripts/run_mcp_tests.sh diff --git a/build_artifacts/v2/v2.9/v2.9.0/cpu.additional_packages_env.in b/build_artifacts/v2/v2.9/v2.9.0/cpu.additional_packages_env.in new file mode 100644 index 000000000..28d6a6468 --- /dev/null +++ b/build_artifacts/v2/v2.9/v2.9.0/cpu.additional_packages_env.in @@ -0,0 +1 @@ +conda-forge::mcp diff --git a/build_artifacts/v2/v2.9/v2.9.0/gpu.additional_packages_env.in b/build_artifacts/v2/v2.9/v2.9.0/gpu.additional_packages_env.in new file mode 100644 index 000000000..28d6a6468 --- /dev/null +++ b/build_artifacts/v2/v2.9/v2.9.0/gpu.additional_packages_env.in @@ -0,0 +1 @@ +conda-forge::mcp diff --git a/build_artifacts/v3/v3.4/v3.4.0/cpu.additional_packages_env.in b/build_artifacts/v3/v3.4/v3.4.0/cpu.additional_packages_env.in new file mode 100644 index 000000000..28d6a6468 --- /dev/null +++ b/build_artifacts/v3/v3.4/v3.4.0/cpu.additional_packages_env.in @@ -0,0 +1 @@ +conda-forge::mcp diff --git a/build_artifacts/v3/v3.4/v3.4.0/gpu.additional_packages_env.in b/build_artifacts/v3/v3.4/v3.4.0/gpu.additional_packages_env.in new file mode 100644 index 000000000..28d6a6468 --- /dev/null +++ b/build_artifacts/v3/v3.4/v3.4.0/gpu.additional_packages_env.in @@ -0,0 +1 @@ +conda-forge::mcp diff --git a/test/test_artifacts/v2/mcp.test.Dockerfile b/test/test_artifacts/v2/mcp.test.Dockerfile new file mode 100644 index 000000000..bc41d9814 --- /dev/null +++ b/test/test_artifacts/v2/mcp.test.Dockerfile @@ -0,0 +1,16 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +RUN python -c "import mcp" + +RUN git clone --recursive https://github.com/modelcontextprotocol/python-sdk.git && \ + : +RUN micromamba install --freeze-installed -y pyright pytest uv ruff trio pytest-flakefinder pytest-xdist pytest-pretty inline-snapshot dirty-equals +WORKDIR "python-sdk/" +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_mcp_tests.sh . +RUN chmod +x run_mcp_tests.sh + +# Run tests in run_mcp_tests.sh +CMD ["./run_mcp_tests.sh"] diff --git a/test/test_artifacts/v2/scripts/run_mcp_tests.sh b/test/test_artifacts/v2/scripts/run_mcp_tests.sh new file mode 100644 index 000000000..eb0f8cb0c --- /dev/null +++ b/test/test_artifacts/v2/scripts/run_mcp_tests.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# We need to checkout the version of mcp python-sdk that is installed in the mamba environment. +mcp_version=$(micromamba list | grep ' mcp ' | tr -s ' ' | cut -d ' ' -f 3) + +# Checkout the corresponding mcp python-sdk version +git checkout tags/v$mcp_version + +pytest tests/server tests/issues tests/shared || exit $? \ No newline at end of file diff --git a/test/test_artifacts/v3/mcp.test.Dockerfile b/test/test_artifacts/v3/mcp.test.Dockerfile new file mode 100644 index 000000000..bc41d9814 --- /dev/null +++ b/test/test_artifacts/v3/mcp.test.Dockerfile @@ -0,0 +1,16 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +RUN python -c "import mcp" + +RUN git clone --recursive https://github.com/modelcontextprotocol/python-sdk.git && \ + : +RUN micromamba install --freeze-installed -y pyright pytest uv ruff trio pytest-flakefinder pytest-xdist pytest-pretty inline-snapshot dirty-equals +WORKDIR "python-sdk/" +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_mcp_tests.sh . +RUN chmod +x run_mcp_tests.sh + +# Run tests in run_mcp_tests.sh +CMD ["./run_mcp_tests.sh"] diff --git a/test/test_artifacts/v3/scripts/run_mcp_tests.sh b/test/test_artifacts/v3/scripts/run_mcp_tests.sh new file mode 100644 index 000000000..eb0f8cb0c --- /dev/null +++ b/test/test_artifacts/v3/scripts/run_mcp_tests.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# We need to checkout the version of mcp python-sdk that is installed in the mamba environment. +mcp_version=$(micromamba list | grep ' mcp ' | tr -s ' ' | cut -d ' ' -f 3) + +# Checkout the corresponding mcp python-sdk version +git checkout tags/v$mcp_version + +pytest tests/server tests/issues tests/shared || exit $? \ No newline at end of file