From b3959a6344083c562d075500124f2bbb92f97dac Mon Sep 17 00:00:00 2001 From: Bryan Honof Date: Sun, 27 Jul 2025 01:44:06 +0200 Subject: [PATCH 01/10] python3Packages.mcp: 1.9.4 -> 1.12.2 I also had to disable some failing tests that I didn't mananage to catch in a reproducible manner. They tend to happen when the system I'm running nixpkgs-review on is under some load, but they don't happen all that often when building the package in isolation. Co-authored-by: Joshua Peek --- .../python-modules/mcp/default.nix | 67 ++++++++++++++----- 1 file changed, 49 insertions(+), 18 deletions(-) diff --git a/pkgs/development/python-modules/mcp/default.nix b/pkgs/development/python-modules/mcp/default.nix index 5ad4d0b7b956..a88d5286a4d4 100644 --- a/pkgs/development/python-modules/mcp/default.nix +++ b/pkgs/development/python-modules/mcp/default.nix @@ -11,6 +11,7 @@ anyio, httpx, httpx-sse, + jsonschema, pydantic, pydantic-settings, python-multipart, @@ -28,6 +29,7 @@ websockets, # tests + dirty-equals, inline-snapshot, pytest-asyncio, pytest-examples, @@ -38,20 +40,31 @@ buildPythonPackage rec { pname = "mcp"; - version = "1.9.4"; + version = "1.12.2"; pyproject = true; src = fetchFromGitHub { owner = "modelcontextprotocol"; repo = "python-sdk"; tag = "v${version}"; - hash = "sha256-VXbu/wHbXGS+cISJVUgCVEpTmZc0VfckNRoMj3GDi/A="; + hash = "sha256-K3S+2Z4yuo8eAOo8gDhrI8OOfV6ADH4dAb1h8PqYntc="; }; postPatch = '' substituteInPlace pyproject.toml \ --replace-fail ', "uv-dynamic-versioning"' "" \ --replace-fail 'dynamic = ["version"]' 'version = "${version}"' + '' + + lib.optionalString stdenv.buildPlatform.isDarwin '' + # time.sleep(0.1) feels a bit optimistic and it has been flaky whilst + # testing this on macOS under load. + substituteInPlace \ + "tests/client/test_stdio.py" \ + "tests/server/fastmcp/test_integration.py" \ + "tests/shared/test_ws.py" \ + "tests/shared/test_sse.py" \ + "tests/shared/test_streamable_http.py" \ + --replace-fail "time.sleep(0.1)" "time.sleep(1)" ''; build-system = [ hatchling ]; @@ -64,6 +77,7 @@ buildPythonPackage rec { anyio httpx httpx-sse + jsonschema pydantic pydantic-settings python-multipart @@ -88,6 +102,7 @@ buildPythonPackage rec { pythonImportsCheck = [ "mcp" ]; nativeCheckInputs = [ + dirty-equals inline-snapshot pytest-asyncio pytest-examples @@ -97,29 +112,45 @@ buildPythonPackage rec { ] ++ lib.flatten (lib.attrValues optional-dependencies); - pytestFlags = [ - "-Wignore::pydantic.warnings.PydanticDeprecatedSince211" - ]; - disabledTests = [ # attempts to run the package manager uv "test_command_execution" - # performance-dependent test + # ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) + "test_lifespan_cleanup_executed" + + # AssertionError: Child process should be writing + "test_basic_child_process_cleanup" + + # AssertionError: parent process should be writing + "test_nested_process_tree" + + # AssertionError: Child should be writing + "test_early_parent_exit" + + # pytest.PytestUnraisableExceptionWarning: Exception ignored in: <_io.FileIO ... + "test_list_tools_returns_all_tools" + + # AssertionError: Server startup marker not created + "test_stdin_close_triggers_cleanup" + + # pytest.PytestUnraisableExceptionWarning: Exception ignored in: Date: Sun, 27 Jul 2025 19:44:02 +0200 Subject: [PATCH 02/10] python3Packages.mcp: add bryanhonof as maintainer --- pkgs/development/python-modules/mcp/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/mcp/default.nix b/pkgs/development/python-modules/mcp/default.nix index a88d5286a4d4..82e3584482c8 100644 --- a/pkgs/development/python-modules/mcp/default.nix +++ b/pkgs/development/python-modules/mcp/default.nix @@ -160,6 +160,9 @@ buildPythonPackage rec { description = "Official Python SDK for Model Context Protocol servers and clients"; homepage = "https://github.com/modelcontextprotocol/python-sdk"; license = lib.licenses.mit; - maintainers = with lib.maintainers; [ josh ]; + maintainers = with lib.maintainers; [ + bryanhonof + josh + ]; }; } From 4a32f944c9a37d144d741d6b164283143ac08d0e Mon Sep 17 00:00:00 2001 From: Bryan Honof Date: Sun, 27 Jul 2025 20:08:08 +0200 Subject: [PATCH 03/10] python3Packages.fastmcp: 2.8.0 -> 2.10.6 --- .../python-modules/fastmcp/default.nix | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/fastmcp/default.nix b/pkgs/development/python-modules/fastmcp/default.nix index 8f3da4a17d58..c87ef6e3e938 100644 --- a/pkgs/development/python-modules/fastmcp/default.nix +++ b/pkgs/development/python-modules/fastmcp/default.nix @@ -10,31 +10,35 @@ # dependencies authlib, + cyclopts, exceptiongroup, httpx, mcp, openapi-pydantic, + pydantic, + pyperclip, python-dotenv, rich, - typer, # tests dirty-equals, + email-validator, fastapi, + pytest-asyncio, pytest-httpx, pytestCheckHook, }: buildPythonPackage rec { pname = "fastmcp"; - version = "2.8.0"; + version = "2.10.6"; pyproject = true; src = fetchFromGitHub { owner = "jlowin"; repo = "fastmcp"; tag = "v${version}"; - hash = "sha256-FleJkqdUIhGsV+DVYv/Nf5IORntH/aFq9abKn2r/6Is="; + hash = "sha256-Wxugk2ocuur710WZLG7xph2R/n02Y9BvH7Lf4BuEMYs="; }; postPatch = '' @@ -49,28 +53,51 @@ buildPythonPackage rec { dependencies = [ authlib + cyclopts exceptiongroup httpx mcp openapi-pydantic + pyperclip python-dotenv rich - typer ]; pythonImportsCheck = [ "fastmcp" ]; nativeCheckInputs = [ dirty-equals + email-validator fastapi + pydantic + pytest-asyncio pytest-httpx pytestCheckHook writableTmpDirAsHomeHook - ]; + ] + ++ pydantic.optional-dependencies.email; disabledTests = [ # AssertionError: assert 'INFO' == 'DEBUG' "test_temporary_settings" + + # RuntimeError: Client failed to connect: Connection close + "test_keep_alive_maintains_session_across_multiple_calls" + "test_keep_alive_false_starts_new_session_across_multiple_calls" + "test_keep_alive_starts_new_session_if_manually_closed" + "test_keep_alive_maintains_session_if_reentered" + "test_close_session_and_try_to_use_client_raises_error" + + # RuntimeError: Client failed to connect: Timed out while waiting for response + "test_timeout" + "test_timeout_tool_call_overrides_client_timeout_even_if_lower" + + # assert 0 == 2 + "test_multi_client" + + # fastmcp.exceptions.ToolError: Unknown tool + "test_multi_client_with_logging" + "test_multi_client_with_elicitation" ]; disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [ From 54999b7afdcc0c73d332328161939fc3a75f2e24 Mon Sep 17 00:00:00 2001 From: Bryan Honof Date: Sun, 27 Jul 2025 20:17:59 +0200 Subject: [PATCH 04/10] python3Packages.fastapi-mcp: 0.3.4 -> 0.3.7 --- pkgs/development/python-modules/fastapi-mcp/default.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/fastapi-mcp/default.nix b/pkgs/development/python-modules/fastapi-mcp/default.nix index 2d6e76197162..0767727a927b 100644 --- a/pkgs/development/python-modules/fastapi-mcp/default.nix +++ b/pkgs/development/python-modules/fastapi-mcp/default.nix @@ -27,14 +27,14 @@ buildPythonPackage rec { pname = "fastapi-mcp"; - version = "0.3.4"; + version = "0.3.7"; pyproject = true; src = fetchFromGitHub { owner = "tadata-org"; repo = "fastapi_mcp"; tag = "v${version}"; - hash = "sha256-t6p/jXQjbhUmIlwoqszRj3GGSrLS0Gcoh1BtizNaw8o="; + hash = "sha256-WQ+Y/TM5fz0lHjCKvEuYGY6hzxo2ePcgRnq7piNC+KQ="; }; build-system = [ @@ -64,6 +64,11 @@ buildPythonPackage rec { pytestCheckHook ]; + disabledTestPaths = [ + # Flaky, would try to allocate a port on Darwin + "tests/test_sse_real_transport.py" + ]; + __darwinAllowLocalNetworking = true; meta = { From 03597ee0cfff9e883d06b175bf273276ce2713f2 Mon Sep 17 00:00:00 2001 From: Bryan Honof Date: Sun, 27 Jul 2025 02:30:19 +0200 Subject: [PATCH 05/10] python3Packages.openai-agents: 0.0.13 -> 0.2.3 Got rid of nix-update-script, since it didn't seem to be doing anything? --- .../python-modules/openai-agents/default.nix | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/pkgs/development/python-modules/openai-agents/default.nix b/pkgs/development/python-modules/openai-agents/default.nix index 2babf44d6a9d..a4de7640d1bb 100644 --- a/pkgs/development/python-modules/openai-agents/default.nix +++ b/pkgs/development/python-modules/openai-agents/default.nix @@ -1,6 +1,5 @@ { lib, - nix-update-script, buildPythonPackage, fetchPypi, hatchling, @@ -15,20 +14,15 @@ buildPythonPackage rec { pname = "openai-agents"; - version = "0.0.13"; + version = "0.2.3"; pyproject = true; src = fetchPypi { inherit version; pname = "openai_agents"; - hash = "sha256-a4AxXnXAa1MCxfKtui+eo4RflGFdrtRwa/uHF0D1YaU="; + hash = "sha256-ldStGUxcDPGkADjLcB7ujs2q92mNh7sT48LFz/gMS00="; }; - # OpenAI 1.76.0 seems to not build currently - postPatch = '' - substituteInPlace pyproject.toml --replace-fail "openai>=1.76.0" "openai" - ''; - build-system = [ hatchling ]; @@ -47,8 +41,6 @@ buildPythonPackage rec { "agents" ]; - passthru.updateScript = nix-update-script { }; - meta = { changelog = "https://github.com/openai/openai-agents-python/releases/tag/${version}"; homepage = "https://github.com/openai/openai-agents-python"; From ba7193239912b4dd091586f0df2de4542790fb88 Mon Sep 17 00:00:00 2001 From: Bryan Honof Date: Mon, 28 Jul 2025 16:56:12 +0200 Subject: [PATCH 06/10] python3Packages.gradio: 5.38.0 -> 5.38.2 --- pkgs/development/python-modules/gradio/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/gradio/default.nix b/pkgs/development/python-modules/gradio/default.nix index faafbae3e653..02fcfec7ce3e 100644 --- a/pkgs/development/python-modules/gradio/default.nix +++ b/pkgs/development/python-modules/gradio/default.nix @@ -75,20 +75,20 @@ buildPythonPackage rec { pname = "gradio"; - version = "5.38.0"; + version = "5.38.2"; pyproject = true; src = fetchFromGitHub { owner = "gradio-app"; repo = "gradio"; tag = "gradio@${version}"; - hash = "sha256-NbVRbwqHUSwyG+v+cDKCrVtzjj6ThxGRfO+xjqXOy5I="; + hash = "sha256-zKAH/tbF1S+LIi1i+BuKBUWDSI0+Ii5FhsZ3sQaFtto="; }; pnpmDeps = pnpm_9.fetchDeps { inherit pname version src; fetcherVersion = 1; - hash = "sha256-E6dBajJoKzaJF67KRrSB/LNAyLDmT78mCmTar5G6P6g="; + hash = "sha256-sIEsolHffX3cpAJU79w+ndRY4vvmWLxp2efTryv+j38="; }; pythonRelaxDeps = [ From 3a5dafdc823c222e3fdad5754024fd7b826ec97f Mon Sep 17 00:00:00 2001 From: Bryan Honof Date: Mon, 28 Jul 2025 17:42:52 +0200 Subject: [PATCH 07/10] oterm: allow newer versions of fastmcp dependency We package a newer version of fastmcp already, but upstream seems to be limiting it to 2.9. --- pkgs/by-name/ot/oterm/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/ot/oterm/package.nix b/pkgs/by-name/ot/oterm/package.nix index 60575cd030e0..ff09474e8a53 100644 --- a/pkgs/by-name/ot/oterm/package.nix +++ b/pkgs/by-name/ot/oterm/package.nix @@ -29,6 +29,7 @@ python3Packages.buildPythonApplication rec { "pydantic" "textual" "typer" + "fastmcp" ]; build-system = with python3Packages; [ hatchling ]; From 4b94c42cad95c977d14f930fd03a3c14a6569fec Mon Sep 17 00:00:00 2001 From: Bryan Honof Date: Tue, 29 Jul 2025 01:06:23 +0200 Subject: [PATCH 08/10] mcp-proxy: disable tests that are failing These started popping up when bumping the python3Packages.mcp version. --- pkgs/by-name/mc/mcp-proxy/package.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/by-name/mc/mcp-proxy/package.nix b/pkgs/by-name/mc/mcp-proxy/package.nix index 7b66f756bfac..cea0fd0bd6fe 100644 --- a/pkgs/by-name/mc/mcp-proxy/package.nix +++ b/pkgs/by-name/mc/mcp-proxy/package.nix @@ -28,6 +28,18 @@ python3Packages.buildPythonApplication rec { pytest-asyncio ]; + disabledTests = [ + # AssertionError: expected call not found. + # Expected: mock(PromptReference(type='ref/prompt', name='name'), CompletionArgument(name='name', value='value')) + # Actual: mock(PromptReference(type='ref/prompt', name='name'), CompletionArgument(name='name', value='value'), None) + "test_call_tool[server-AsyncMock]" + "test_call_tool[proxy-AsyncMock]" + "test_complete[server-AsyncMock]" + "test_complete[proxy-AsyncMock]" + ]; + + __darwinAllowLocalNetworking = true; + meta = { description = "MCP server which proxies other MCP servers from stdio to SSE or from SSE to stdio"; homepage = "https://github.com/sparfenyuk/mcp-proxy"; From 231f9dfbe0d55311a13b9adc0c7c7120cdd5cd53 Mon Sep 17 00:00:00 2001 From: Bryan Honof Date: Tue, 29 Jul 2025 01:52:38 +0200 Subject: [PATCH 09/10] python3Packages.smolagents: disable failing tests --- pkgs/development/python-modules/smolagents/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/development/python-modules/smolagents/default.nix b/pkgs/development/python-modules/smolagents/default.nix index 1a1d4f3e90e2..ad177f998e12 100644 --- a/pkgs/development/python-modules/smolagents/default.nix +++ b/pkgs/development/python-modules/smolagents/default.nix @@ -141,6 +141,11 @@ buildPythonPackage rec { pythonImportsCheck = [ "smolagents" ]; + disabledTestPaths = [ + # ImportError: cannot import name 'require_soundfile' from 'transformers.testing_utils' + "tests/test_types.py" + ]; + disabledTests = [ # Missing dependencies "test_cleanup" From 7f41f985d980dbd9bed0b57de67eb3885bcc77a4 Mon Sep 17 00:00:00 2001 From: Bryan Honof Date: Thu, 31 Jul 2025 23:47:52 +0200 Subject: [PATCH 10/10] home-assistant: ignore Pydantic deprecation warnigns for mcp package We bumped the python3Packages.mcp package, and were able to remove this set of flags due to the Pydantic library also being updated. However, since home-assistant still seems to be using 1.5.0, and overriding it here, these flags are still needed in this particular case. --- pkgs/servers/home-assistant/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index 07f5c52d45f7..6d91fdd0b4ae 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -147,6 +147,10 @@ let tag = "v${version}"; hash = "sha256-Z2NN6k4mD6NixDON1MUOELpBZW9JvMvFErcCbFPdg2o="; }; + pytestFlagsArray = [ + "-W" + "ignore::pydantic.warnings.PydanticDeprecatedSince211" + ]; }); notifications-android-tv = super.notifications-android-tv.overridePythonAttrs (oldAttrs: rec {