From f23109857baae669d573121f8d9dfb016885a0de Mon Sep 17 00:00:00 2001 From: Luis Eduardo Bueso de Barrio Date: Wed, 23 Sep 2026 12:25:32 +0200 Subject: [PATCH] msg --- packages/duckduckgo-mcp-server/package.nix | 17 +++- packages/lib/mcp2.nix | 98 ++++++++++++++++++++++ packages/nextcloud-mcp-server/package.nix | 29 +++++-- 3 files changed, 133 insertions(+), 11 deletions(-) create mode 100644 packages/lib/mcp2.nix diff --git a/packages/duckduckgo-mcp-server/package.nix b/packages/duckduckgo-mcp-server/package.nix index 94f80d5..17c66e8 100644 --- a/packages/duckduckgo-mcp-server/package.nix +++ b/packages/duckduckgo-mcp-server/package.nix @@ -2,18 +2,28 @@ lib, python3Packages, fetchFromGitHub, + fetchurl, }: +let + # Upstream 0.7.0 was ported to the MCP SDK 2.x API + # (`mcp.server.mcpserver.MCPServer`). nixpkgs pins the SDK at 1.x, so use the + # per-package 2.x stack from packages/lib/mcp2.nix. + mcp2 = import ../lib/mcp2.nix { + inherit lib fetchurl; + pythonPackages = python3Packages; + }; +in python3Packages.buildPythonApplication rec { pname = "duckduckgo-mcp-server"; - version = "0.6.1"; + version = "0.7.0"; pyproject = true; src = fetchFromGitHub { owner = "nickclyde"; repo = "duckduckgo-mcp-server"; rev = "v${version}"; - hash = "sha256-X99edQE4317/WEadi/QQnLZHpWCMBW2ipa8am4lfO2Q="; + hash = "sha256-wI6Q4lBZYzU4VORLwGZowv8D5UfhKaMeqBIQ7u6eRxc="; }; build-system = [ python3Packages.hatchling ]; @@ -22,10 +32,11 @@ python3Packages.buildPythonApplication rec { beautifulsoup4 httpx httpcore - mcp + mcp2.mcp ]; doCheck = false; + dontCheckRuntimeDeps = true; pythonImportsCheck = [ "duckduckgo_mcp_server" ]; diff --git a/packages/lib/mcp2.nix b/packages/lib/mcp2.nix new file mode 100644 index 0000000..d1e110d --- /dev/null +++ b/packages/lib/mcp2.nix @@ -0,0 +1,98 @@ +# mcp 2.x Python SDK stack +# +# nixpkgs pins the MCP Python SDK at 1.x, whose server class is +# `mcp.server.fastmcp.FastMCP`. SDK 2.x renamed it to +# `mcp.server.mcpserver.MCPServer` and dropped the old module, so packages that +# upstream has ported to the 2.x API need their own copy of the SDK rather than +# the nixpkgs attribute. Derivations are isolated, so this stack coexists with +# the 1.x packages in the same repository without affecting them. +# +# The three pure-Python wheels below (`mcp-types`, `httpx2`, `httpcore2`) are +# not in nixpkgs; everything else resolves from the pinned nixpkgs. +{ + lib, + pythonPackages, + fetchurl, +}: + +let + ps = pythonPackages; + + mk = { pname, version, url, hash, deps ? [ ] }: + ps.buildPythonPackage { + inherit pname version; + format = "wheel"; + src = fetchurl { inherit url hash; }; + propagatedBuildInputs = deps; + doCheck = false; + # Upstream floors track the latest releases, which routinely sit ahead of + # nixpkgs. The build is pure-Python and import-checked below, so the + # strict floor check is not useful here. + dontCheckRuntimeDeps = true; + pythonImportsCheck = [ (builtins.replaceStrings [ "-" ] [ "_" ] pname) ]; + meta = with lib; { + description = "MCP Python SDK ${version} dependency: ${pname}"; + homepage = "https://github.com/modelcontextprotocol/python-sdk"; + license = licenses.mit; + }; + }; + + mcp-types = mk { + pname = "mcp-types"; + version = "2.1.1"; + url = "https://files.pythonhosted.org/packages/71/d0/242e63c510f4a17381f55b1549a3f94f5687a0595984febd2b6f87a687a0/mcp_types-2.1.1-py3-none-any.whl"; + hash = "sha256-Jvn38D8qVzBxeluY4qt+tkCsNS0FoAzcclwxGGR3gpU="; + deps = with ps; [ pydantic typing-extensions ]; + }; + + httpcore2 = mk { + pname = "httpcore2"; + version = "2.5.0"; + url = "https://files.pythonhosted.org/packages/c9/a1/7564199d1a8728fe737b0a72e5b3f8d92dfe085a74ddf7cdd83bce5f206d/httpcore2-2.5.0-py3-none-any.whl"; + hash = "sha256-XONRiN5GHTHo0AC/uO+L8ixsFlh6IR5Vcd6qXpvfhCo="; + deps = with ps; [ h11 truststore ]; + }; + + httpx2 = mk { + pname = "httpx2"; + version = "2.5.0"; + url = "https://files.pythonhosted.org/packages/31/22/859d8252dad9bc9adee34b52e62cde621ece07b042ccb2ab4da1be46695f/httpx2-2.5.0-py3-none-any.whl"; + hash = "sha256-PS1NnPS2HxofRqlZR8/bR+gMtWovkcYlasj1jkiR30E="; + deps = with ps; [ + anyio + httpcore2 + idna + truststore + ]; + }; +in +{ + inherit mcp-types httpcore2 httpx2; + + mcp = mk { + pname = "mcp"; + version = "2.1.1"; + url = "https://files.pythonhosted.org/packages/50/af/8644cc5fa26a59afd2df2e98eeb19e72926887fa4b7441aba4ff661140db/mcp-2.1.1-py3-none-any.whl"; + hash = "sha256-HGwxxdZHHFjbdq86+K9n9G0R0B8KWQd9CjCMvbPT6RU="; + deps = with ps; [ + anyio + httpx2 + jsonschema + mcp-types + opentelemetry-api + pydantic + pyjwt + python-multipart + sse-starlette + starlette + typing-extensions + typing-inspection + uvicorn + ] ++ (with ps; [ + # mcp[cli] console entry point + python-dotenv + rich + typer + ]); + }; +} diff --git a/packages/nextcloud-mcp-server/package.nix b/packages/nextcloud-mcp-server/package.nix index 26ee6e7..7a1c9f9 100644 --- a/packages/nextcloud-mcp-server/package.nix +++ b/packages/nextcloud-mcp-server/package.nix @@ -3,9 +3,18 @@ python3Packages, fetchFromGitHub, fetchPypi, + fetchurl, }: let + # Upstream >=0.185.0 was ported to the MCP SDK 2.x API + # (`mcp.server.mcpserver.MCPServer`). nixpkgs pins the SDK at 1.x, so use the + # per-package 2.x stack from packages/lib/mcp2.nix. + mcp2 = import ../lib/mcp2.nix { + inherit lib fetchurl; + pythonPackages = python3Packages; + }; + # Helper: buildPythonPackage for a wheel fetched from PyPI # CRITICAL: pname MUST use underscores, not hyphens, for PyPI wheel filenames fetchWheel = { pname, version, hash, propagatedBuildInputs ? [ ], meta ? { } }: @@ -132,23 +141,24 @@ let in python3Packages.buildPythonApplication rec { pname = "nextcloud-mcp-server"; - version = "0.184.0"; + version = "0.195.0"; pyproject = true; src = fetchFromGitHub { owner = "cbcoutinho"; repo = "nextcloud-mcp-server"; rev = "v${version}"; - hash = "sha256-IfICpyuSZRZBwAmZ6onWTT39Gc6oFYzTdtEZqawGZC4="; + hash = "sha256-k8WeVe1ScWN7Lh+trowzn+UVuQBgfgI1Klfz4w5F8do="; }; build-system = [ python3Packages.uv-build ]; dependencies = with python3Packages; [ - mcp httpx pillow icalendar pydantic click pyjwt + mcp2.mcp httpx pillow icalendar pydantic click pyjwt aiosqlite alembic authlib fastembed anthropic boto3 starlette jinja2 markdownify pymupdf pymupdf4llm openai dynaconf sqlalchemy anyio uvicorn cryptography lxml botocore numpy packaging pypdfium2 + olefile openpyxl python-docx python-pptx pythonvcard4 prometheus-client python-json-logger importlib-metadata googleapis-common-protos opentelemetry-api opentelemetry-proto @@ -163,13 +173,10 @@ python3Packages.buildPythonApplication rec { postPatch = '' substituteInPlace pyproject.toml \ --replace-quiet '"uv_build>=0.12.1,<0.13.0"' '"uv_build"' \ - --replace-quiet '" (>=1.29,<1.30)"' '""' \ + --replace-quiet '" (>=2.1,<3)"' '""' \ --replace-quiet '" (>=0.28.1,<0.29.0)"' '""' \ --replace-quiet '" (>=10.3.0,<12.0.0)"' '""' \ - --replace-quiet '" (>=7.2.0,<7.3.0)"' '""' \ - --replace-quiet '" (>=3.0.1,<4.0)"' '""' \ - --replace-quiet '" (>=1.28.2,<2.0.0)"' '""' \ - --replace-quiet '" (>=2.0.0,<3.0.0)"' '""' \ + --replace-quiet '" (>=7.3.0,<7.4.0)"' '""' \ --replace-quiet '">=3.0.1,<4.0"' '""' \ --replace-quiet '">=3.8.0,<4.0"' '""' \ --replace-quiet '">=3.2.13,<4.0"' '""' \ @@ -189,6 +196,12 @@ python3Packages.buildPythonApplication rec { dontCheckRuntimeDeps = true; catchConflicts = false; + pythonImportsCheck = [ + "nextcloud_mcp_server" + "mcp" + "pymupdf" + ]; + meta = with lib; { description = "MCP server for Nextcloud — files, calendar, contacts, notes, deck, talk, sharing"; homepage = "https://github.com/cbcoutinho/nextcloud-mcp-server";