nixpkgs/pkgs/development/python-modules/fastmcp/default.nix

94 lines
1.9 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
# build-system
hatchling,
# dependencies
authlib,
exceptiongroup,
httpx,
mcp,
openapi-pydantic,
python-dotenv,
rich,
typer,
# tests
dirty-equals,
fastapi,
pytest-httpx,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "fastmcp";
version = "2.7.0";
pyproject = true;
src = fetchFromGitHub {
owner = "jlowin";
repo = "fastmcp";
tag = "v${version}";
hash = "sha256-UQV/hIu96ukpJxUhOux0mos0o6j4kvsFp2NJHa47tbw=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail ', "uv-dynamic-versioning>=0.7.0"' "" \
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
'';
build-system = [
hatchling
];
dependencies = [
authlib
exceptiongroup
httpx
mcp
openapi-pydantic
python-dotenv
rich
typer
];
pythonImportsCheck = [ "fastmcp" ];
nativeCheckInputs = [
dirty-equals
fastapi
pytest-httpx
pytestCheckHook
];
disabledTests = [
# AssertionError: assert 'INFO' == 'DEBUG'
"test_temporary_settings"
];
disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
# RuntimeError: Server failed to start after 10 attempts
"tests/auth/providers/test_bearer.py"
"tests/auth/test_oauth_client.py"
"tests/client/test_openapi.py"
"tests/client/test_sse.py"
"tests/client/test_streamable_http.py"
"tests/server/http/test_http_dependencies.py"
"tests/server/http/test_http_dependencies.py"
];
__darwinAllowLocalNetworking = true;
meta = {
description = "The fast, Pythonic way to build MCP servers and clients";
changelog = "https://github.com/jlowin/fastmcp/releases/tag/v${version}";
homepage = "https://github.com/jlowin/fastmcp";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ GaetanLepage ];
};
}