1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 hatchling,
8
9 # dependencies
10 exceptiongroup,
11 httpx,
12 mcp,
13 openapi-pydantic,
14 python-dotenv,
15 rich,
16 typer,
17 websockets,
18
19 # tests
20 dirty-equals,
21 fastapi,
22 pytestCheckHook,
23}:
24
25buildPythonPackage rec {
26 pname = "fastmcp";
27 version = "2.4.0";
28 pyproject = true;
29
30 src = fetchFromGitHub {
31 owner = "jlowin";
32 repo = "fastmcp";
33 tag = "v${version}";
34 hash = "sha256-F4lgMm/84svLZo6SZ7AubsC73s4tffqjJcd9gvA7hGA=";
35 };
36
37 postPatch = ''
38 substituteInPlace pyproject.toml \
39 --replace-fail ', "uv-dynamic-versioning>=0.7.0"' "" \
40 --replace-fail 'dynamic = ["version"]' 'version = "${version}"'
41 '';
42
43 build-system = [
44 hatchling
45 ];
46
47 dependencies = [
48 exceptiongroup
49 httpx
50 mcp
51 openapi-pydantic
52 python-dotenv
53 rich
54 typer
55 websockets
56 ];
57
58 pythonImportsCheck = [ "fastmcp" ];
59
60 nativeCheckInputs = [
61 dirty-equals
62 fastapi
63 pytestCheckHook
64 ];
65
66 meta = {
67 description = "The fast, Pythonic way to build MCP servers and clients";
68 changelog = "https://github.com/jlowin/fastmcp/releases/tag/v${version}";
69 homepage = "https://github.com/jlowin/fastmcp";
70 license = lib.licenses.asl20;
71 maintainers = with lib.maintainers; [ GaetanLepage ];
72 };
73}