1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 hatchling,
8 tomli,
9
10 # dependencies
11 fastapi,
12 httpx,
13 mcp,
14 pydantic,
15 pydantic-settings,
16 requests,
17 rich,
18 typer,
19 uvicorn,
20
21 # tests
22 coverage,
23 pytest-asyncio_0,
24 pytest-cov-stub,
25 pytestCheckHook,
26}:
27
28buildPythonPackage rec {
29 pname = "fastapi-mcp";
30 version = "0.4.0";
31 pyproject = true;
32
33 src = fetchFromGitHub {
34 owner = "tadata-org";
35 repo = "fastapi_mcp";
36 tag = "v${version}";
37 hash = "sha256-TCmM5n6BF3CWEuGVSZnUL2rTYitKtn4vSCkiQvKFLKw=";
38 };
39
40 build-system = [
41 hatchling
42 tomli
43 ];
44
45 dependencies = [
46 fastapi
47 httpx
48 mcp
49 pydantic
50 pydantic-settings
51 requests
52 rich
53 tomli
54 typer
55 uvicorn
56 ];
57
58 pythonImportsCheck = [ "fastapi_mcp" ];
59
60 nativeCheckInputs = [
61 coverage
62 pytest-asyncio_0
63 pytest-cov-stub
64 pytestCheckHook
65 ];
66
67 disabledTestPaths = [
68 # Flaky, would try to allocate a port on Darwin
69 "tests/test_sse_real_transport.py"
70 ];
71
72 __darwinAllowLocalNetworking = true;
73
74 meta = {
75 description = "Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth";
76 homepage = "https://github.com/tadata-org/fastapi_mcp";
77 changelog = "https://github.com/tadata-org/fastapi_mcp/blob/${src.tag}/CHANGELOG.md";
78 license = lib.licenses.mit;
79 maintainers = with lib.maintainers; [ GaetanLepage ];
80 };
81}