1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
{
anyio,
buildPythonPackage,
coreutils,
fetchFromGitHub,
hatchling,
httpx,
httpx-sse,
lib,
pydantic,
pydantic-settings,
pytest-asyncio,
pytest-examples,
pytestCheckHook,
python-dotenv,
rich,
sse-starlette,
starlette,
typer,
uvicorn,
websockets,
}:
buildPythonPackage rec {
pname = "mcp";
version = "1.6.0";
pyproject = true;
src = fetchFromGitHub {
owner = "modelcontextprotocol";
repo = "python-sdk";
tag = "v${version}";
hash = "sha256-APm3x4tcDbp8D2ygW43wFyP0llJ6fXZiINHRYShp9ZY=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail ', "uv-dynamic-versioning"' "" \
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
substituteInPlace tests/client/test_stdio.py \
--replace '/usr/bin/tee' '${lib.getExe' coreutils "tee"}'
'';
build-system = [ hatchling ];
pythonRelaxDeps = [
"pydantic-settings"
];
dependencies = [
anyio
httpx
httpx-sse
pydantic
pydantic-settings
sse-starlette
starlette
uvicorn
];
optional-dependencies = {
cli = [
python-dotenv
typer
];
rich = [
rich
];
ws = [
websockets
];
};
pythonImportsCheck = [ "mcp" ];
nativeCheckInputs = [
pytest-asyncio
pytest-examples
pytestCheckHook
] ++ lib.flatten (lib.attrValues optional-dependencies);
pytestFlagsArray = [
"-W"
"ignore::pydantic.warnings.PydanticDeprecatedSince211"
];
disabledTests = [
# attempts to run the package manager uv
"test_command_execution"
# performance-dependent test
"test_messages_are_executed_concurrently"
];
__darwinAllowLocalNetworking = true;
meta = {
changelog = "https://github.com/modelcontextprotocol/python-sdk/releases/tag/${src.tag}";
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 ];
};
}
|