2024-09-24 22:04:19 +01:00
|
|
|
[project]
|
2024-11-11 12:31:36 +00:00
|
|
|
name = "mcp"
|
2025-03-13 14:09:18 +01:00
|
|
|
dynamic = ["version"]
|
2024-11-25 14:17:46 +00:00
|
|
|
description = "Model Context Protocol SDK"
|
2024-09-24 22:04:19 +01:00
|
|
|
readme = "README.md"
|
2024-10-02 21:54:00 +01:00
|
|
|
requires-python = ">=3.10"
|
2026-02-04 11:01:33 +00:00
|
|
|
authors = [{ name = "Model Context Protocol a Series of LF Projects, LLC." }]
|
2024-11-11 15:40:11 +00:00
|
|
|
maintainers = [
|
|
|
|
|
{ name = "David Soria Parra", email = "davidsp@anthropic.com" },
|
2026-02-03 17:19:56 +01:00
|
|
|
{ name = "Marcelo Trylesinski", email = "marcelotryle@gmail.com" },
|
|
|
|
|
{ name = "Max Isbey", email = "maxisbey@anthropic.com" },
|
2026-02-11 09:52:07 -05:00
|
|
|
{ name = "Felix Weinberger", email = "fweinberger@anthropic.com" },
|
2024-11-11 15:40:11 +00:00
|
|
|
]
|
|
|
|
|
keywords = ["git", "mcp", "llm", "automation"]
|
|
|
|
|
license = { text = "MIT" }
|
|
|
|
|
classifiers = [
|
|
|
|
|
"Development Status :: 4 - Beta",
|
|
|
|
|
"Intended Audience :: Developers",
|
|
|
|
|
"License :: OSI Approved :: MIT License",
|
|
|
|
|
"Programming Language :: Python :: 3",
|
2024-11-12 12:22:13 +00:00
|
|
|
"Programming Language :: Python :: 3.10",
|
2024-11-25 12:55:38 +00:00
|
|
|
"Programming Language :: Python :: 3.11",
|
|
|
|
|
"Programming Language :: Python :: 3.12",
|
|
|
|
|
"Programming Language :: Python :: 3.13",
|
2026-01-07 17:28:23 +01:00
|
|
|
"Programming Language :: Python :: 3.14",
|
2024-11-11 15:40:11 +00:00
|
|
|
]
|
2024-09-24 22:04:19 +01:00
|
|
|
dependencies = [
|
2026-03-13 14:43:54 +00:00
|
|
|
"anyio>=4.9",
|
2026-03-25 23:29:13 +01:00
|
|
|
"httpx>=0.27.1,<1.0.0",
|
2024-11-19 12:33:23 +00:00
|
|
|
"httpx-sse>=0.4",
|
2026-01-23 15:35:23 +01:00
|
|
|
"pydantic>=2.12.0",
|
2026-01-07 17:28:23 +01:00
|
|
|
"starlette>=0.48.0; python_version >= '3.14'",
|
|
|
|
|
"starlette>=0.27; python_version < '3.14'",
|
2025-05-01 11:42:59 -07:00
|
|
|
"python-multipart>=0.0.9",
|
2026-02-11 09:52:07 -05:00
|
|
|
"sse-starlette>=3.0.0",
|
2025-01-29 20:41:39 -05:00
|
|
|
"pydantic-settings>=2.5.2",
|
2025-08-14 10:40:47 +01:00
|
|
|
"uvicorn>=0.31.1; sys_platform != 'emscripten'",
|
2025-06-26 13:28:15 +01:00
|
|
|
"jsonschema>=4.20.0",
|
2026-01-07 17:28:23 +01:00
|
|
|
"pywin32>=311; sys_platform == 'win32'",
|
2025-10-29 09:48:08 -07:00
|
|
|
"pyjwt[crypto]>=2.10.1",
|
2026-01-22 14:50:39 +01:00
|
|
|
"typing-extensions>=4.13.0",
|
2025-11-13 21:21:15 +01:00
|
|
|
"typing-inspection>=0.4.1",
|
2026-03-31 16:33:33 -04:00
|
|
|
"opentelemetry-api>=1.28.0",
|
2024-12-09 16:16:47 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
[project.optional-dependencies]
|
|
|
|
|
rich = ["rich>=13.9.4"]
|
2025-07-06 09:38:56 +02:00
|
|
|
cli = ["typer>=0.16.0", "python-dotenv>=1.0.0"]
|
2025-03-08 10:52:10 +08:00
|
|
|
ws = ["websockets>=15.0.1"]
|
2024-12-18 15:26:02 +00:00
|
|
|
|
|
|
|
|
[project.scripts]
|
|
|
|
|
mcp = "mcp.cli:app [cli]"
|
2024-12-09 16:16:47 +00:00
|
|
|
|
|
|
|
|
[tool.uv]
|
2025-03-25 13:06:15 +01:00
|
|
|
default-groups = ["dev", "docs"]
|
2025-10-22 15:52:56 +02:00
|
|
|
required-version = ">=0.9.5"
|
2025-03-25 13:06:15 +01:00
|
|
|
|
|
|
|
|
[dependency-groups]
|
|
|
|
|
dev = [
|
2026-01-19 20:53:08 +07:00
|
|
|
# We add mcp[cli,ws] so `uv sync` considers the extras.
|
|
|
|
|
"mcp[cli,ws]",
|
2025-08-14 10:40:47 +01:00
|
|
|
"pyright>=1.1.400",
|
2025-01-03 15:30:49 +00:00
|
|
|
"pytest>=8.3.4",
|
|
|
|
|
"ruff>=0.8.5",
|
2024-12-09 16:16:47 +00:00
|
|
|
"trio>=0.26.2",
|
|
|
|
|
"pytest-flakefinder>=1.1.0",
|
|
|
|
|
"pytest-xdist>=3.6.1",
|
2025-03-14 11:30:57 +00:00
|
|
|
"pytest-examples>=0.0.14",
|
2025-04-29 21:02:09 +01:00
|
|
|
"pytest-pretty>=1.2.0",
|
2025-05-26 13:17:23 +02:00
|
|
|
"inline-snapshot>=0.23.0",
|
2025-07-06 09:38:56 +02:00
|
|
|
"dirty-equals>=0.9.0",
|
2026-01-23 20:00:20 +00:00
|
|
|
"coverage[toml]>=7.10.7,<=7.13",
|
2026-01-07 17:28:23 +01:00
|
|
|
"pillow>=12.0",
|
2026-01-23 20:00:20 +00:00
|
|
|
"strict-no-cover",
|
2026-03-31 16:33:33 -04:00
|
|
|
"logfire>=3.0.0",
|
2024-09-24 22:04:19 +01:00
|
|
|
]
|
2025-03-25 13:06:15 +01:00
|
|
|
docs = [
|
|
|
|
|
"mkdocs>=1.6.1",
|
2026-03-18 13:15:17 -05:00
|
|
|
"mkdocs-gen-files>=0.5.0",
|
2025-03-25 13:06:15 +01:00
|
|
|
"mkdocs-glightbox>=0.4.0",
|
2026-03-18 13:15:17 -05:00
|
|
|
"mkdocs-literate-nav>=0.6.1",
|
2026-02-19 16:12:51 -06:00
|
|
|
"mkdocs-material[imaging]>=9.5.45",
|
2026-01-07 17:28:23 +01:00
|
|
|
"mkdocstrings-python>=2.0.1",
|
2025-03-25 13:06:15 +01:00
|
|
|
]
|
|
|
|
|
|
2024-12-09 16:16:47 +00:00
|
|
|
[build-system]
|
2025-03-13 14:09:18 +01:00
|
|
|
requires = ["hatchling", "uv-dynamic-versioning"]
|
2024-12-09 16:16:47 +00:00
|
|
|
build-backend = "hatchling.build"
|
|
|
|
|
|
2025-03-13 14:09:18 +01:00
|
|
|
[tool.hatch.version]
|
|
|
|
|
source = "uv-dynamic-versioning"
|
|
|
|
|
|
|
|
|
|
[tool.uv-dynamic-versioning]
|
|
|
|
|
vcs = "git"
|
|
|
|
|
style = "pep440"
|
|
|
|
|
bump = true
|
|
|
|
|
|
2024-11-20 16:12:21 +00:00
|
|
|
[project.urls]
|
|
|
|
|
Homepage = "https://modelcontextprotocol.io"
|
|
|
|
|
Repository = "https://github.com/modelcontextprotocol/python-sdk"
|
|
|
|
|
Issues = "https://github.com/modelcontextprotocol/python-sdk/issues"
|
|
|
|
|
|
2024-09-24 22:04:19 +01:00
|
|
|
[tool.hatch.build.targets.wheel]
|
2024-11-11 12:31:36 +00:00
|
|
|
packages = ["src/mcp"]
|
2024-09-24 22:04:19 +01:00
|
|
|
|
|
|
|
|
[tool.pyright]
|
2025-08-11 19:56:37 +02:00
|
|
|
typeCheckingMode = "strict"
|
2026-01-07 17:08:18 +01:00
|
|
|
include = [
|
|
|
|
|
"src/mcp",
|
|
|
|
|
"tests",
|
|
|
|
|
"examples/servers",
|
|
|
|
|
"examples/snippets",
|
|
|
|
|
"examples/clients",
|
|
|
|
|
]
|
2024-10-11 10:53:51 +01:00
|
|
|
venvPath = "."
|
|
|
|
|
venv = ".venv"
|
2025-08-11 19:56:37 +02:00
|
|
|
# The FastAPI style of using decorators in tests gives a `reportUnusedFunction` error.
|
|
|
|
|
# See https://github.com/microsoft/pyright/issues/7771 for more details.
|
|
|
|
|
# TODO(Marcelo): We should remove `reportPrivateUsage = false`. The idea is that we should test the workflow that uses
|
|
|
|
|
# those private functions instead of testing the private functions directly. It makes it easier to maintain the code source
|
|
|
|
|
# and refactor code that is not public.
|
|
|
|
|
executionEnvironments = [
|
2026-01-07 17:08:18 +01:00
|
|
|
{ root = "tests", extraPaths = [
|
|
|
|
|
".",
|
|
|
|
|
], reportUnusedFunction = false, reportPrivateUsage = false },
|
2025-10-17 09:13:39 -07:00
|
|
|
{ root = "examples/servers", reportUnusedFunction = false },
|
2025-08-11 19:56:37 +02:00
|
|
|
]
|
2024-09-24 22:04:19 +01:00
|
|
|
|
2024-10-11 11:31:16 +01:00
|
|
|
[tool.ruff]
|
2024-09-24 22:04:19 +01:00
|
|
|
line-length = 120
|
2024-11-11 12:31:36 +00:00
|
|
|
target-version = "py310"
|
2026-01-29 20:03:01 +00:00
|
|
|
extend-exclude = ["README.md", "README.v2.md"]
|
2024-09-24 22:04:19 +01:00
|
|
|
|
2025-09-05 16:20:14 +02:00
|
|
|
[tool.ruff.lint]
|
|
|
|
|
select = [
|
2026-01-19 14:29:15 +01:00
|
|
|
"C4", # flake8-comprehensions
|
|
|
|
|
"C90", # mccabe
|
|
|
|
|
"D212", # pydocstyle: multi-line docstring summary should start at the first line
|
|
|
|
|
"E", # pycodestyle
|
|
|
|
|
"F", # pyflakes
|
|
|
|
|
"I", # isort
|
|
|
|
|
"PERF", # Perflint
|
|
|
|
|
"UP", # pyupgrade
|
|
|
|
|
"TID251", # https://docs.astral.sh/ruff/rules/banned-api/
|
2025-09-05 16:20:14 +02:00
|
|
|
]
|
2026-02-11 09:52:07 -05:00
|
|
|
ignore = ["PERF203"]
|
2026-01-16 16:10:52 +00:00
|
|
|
|
2026-01-19 14:29:15 +01:00
|
|
|
[tool.ruff.lint.flake8-tidy-imports.banned-api]
|
|
|
|
|
"pydantic.RootModel".msg = "Use `pydantic.TypeAdapter` instead."
|
|
|
|
|
|
|
|
|
|
|
2026-01-16 16:10:52 +00:00
|
|
|
[tool.ruff.lint.mccabe]
|
|
|
|
|
max-complexity = 24 # Default is 10
|
2025-09-05 16:20:14 +02:00
|
|
|
|
2024-10-11 11:31:16 +01:00
|
|
|
[tool.ruff.lint.per-file-ignores]
|
2024-09-24 22:04:19 +01:00
|
|
|
"__init__.py" = ["F401"]
|
2026-01-25 14:45:52 +01:00
|
|
|
"tests/server/mcpserver/test_func_metadata.py" = ["E501"]
|
2025-09-05 16:20:14 +02:00
|
|
|
"tests/shared/test_progress_notifications.py" = ["PLW0603"]
|
|
|
|
|
|
|
|
|
|
[tool.ruff.lint.pylint]
|
|
|
|
|
allow-magic-value-types = ["bytes", "float", "int", "str"]
|
2025-10-17 09:13:39 -07:00
|
|
|
max-args = 23 # Default is 5
|
|
|
|
|
max-branches = 23 # Default is 12
|
|
|
|
|
max-returns = 13 # Default is 6
|
|
|
|
|
max-statements = 102 # Default is 50
|
2024-10-11 11:06:02 +01:00
|
|
|
|
2024-11-12 12:22:13 +00:00
|
|
|
[tool.uv.workspace]
|
2025-10-17 09:13:39 -07:00
|
|
|
members = ["examples/clients/*", "examples/servers/*", "examples/snippets"]
|
2024-11-12 12:22:13 +00:00
|
|
|
|
|
|
|
|
[tool.uv.sources]
|
2025-01-03 21:25:02 +00:00
|
|
|
mcp = { workspace = true }
|
2026-01-23 20:00:20 +00:00
|
|
|
strict-no-cover = { git = "https://github.com/pydantic/strict-no-cover" }
|
2025-03-13 11:59:45 +01:00
|
|
|
|
|
|
|
|
[tool.pytest.ini_options]
|
2025-05-23 21:58:24 +05:45
|
|
|
log_cli = true
|
2025-03-13 11:59:45 +01:00
|
|
|
xfail_strict = true
|
2025-05-23 21:58:24 +05:45
|
|
|
addopts = """
|
|
|
|
|
--color=yes
|
|
|
|
|
--capture=fd
|
2026-02-13 18:25:10 +00:00
|
|
|
-p anyio
|
|
|
|
|
-p examples
|
2025-05-23 21:58:24 +05:45
|
|
|
"""
|
2025-03-13 11:59:45 +01:00
|
|
|
filterwarnings = [
|
|
|
|
|
"error",
|
|
|
|
|
# This should be fixed on Uvicorn's side.
|
|
|
|
|
"ignore::DeprecationWarning:websockets",
|
|
|
|
|
"ignore:websockets.server.WebSocketServerProtocol is deprecated:DeprecationWarning",
|
2025-07-06 09:38:56 +02:00
|
|
|
"ignore:Returning str or bytes.*:DeprecationWarning:mcp.server.lowlevel",
|
2025-07-08 15:04:06 +01:00
|
|
|
# pywin32 internal deprecation warning
|
2025-10-17 09:13:39 -07:00
|
|
|
"ignore:getargs.*The 'u' format is deprecated:DeprecationWarning",
|
2025-03-13 11:59:45 +01:00
|
|
|
]
|
2025-07-10 16:43:49 +08:00
|
|
|
|
|
|
|
|
[tool.markdown.lint]
|
2025-10-17 09:13:39 -07:00
|
|
|
default = true
|
|
|
|
|
MD004 = false # ul-style - Unordered list style
|
|
|
|
|
MD007.indent = 2 # ul-indent - Unordered list indentation
|
|
|
|
|
MD013 = false # line-length - Line length
|
|
|
|
|
MD029 = false # ol-prefix - Ordered list item prefix
|
|
|
|
|
MD033 = false # no-inline-html Inline HTML
|
|
|
|
|
MD041 = false # first-line-heading/first-line-h1
|
|
|
|
|
MD046 = false # indented-code-blocks
|
|
|
|
|
MD059 = false # descriptive-link-text
|
2025-11-11 13:09:32 +00:00
|
|
|
|
2025-08-11 19:56:37 +02:00
|
|
|
# https://coverage.readthedocs.io/en/latest/config.html#run
|
2024-10-11 11:31:16 +01:00
|
|
|
[tool.coverage.run]
|
2025-11-11 13:09:32 +00:00
|
|
|
branch = true
|
2025-09-05 16:20:14 +02:00
|
|
|
patch = ["subprocess"]
|
2025-10-28 21:42:33 +00:00
|
|
|
concurrency = ["multiprocessing", "thread"]
|
2025-07-14 13:57:47 +01:00
|
|
|
source = ["src", "tests"]
|
2025-11-11 13:09:32 +00:00
|
|
|
omit = [
|
2025-07-14 13:57:47 +01:00
|
|
|
"src/mcp/client/__main__.py",
|
|
|
|
|
"src/mcp/server/__main__.py",
|
|
|
|
|
"src/mcp/os/posix/utilities.py",
|
|
|
|
|
"src/mcp/os/win32/utilities.py",
|
2025-11-11 13:09:32 +00:00
|
|
|
]
|
|
|
|
|
|
2025-08-11 19:56:37 +02:00
|
|
|
# https://coverage.readthedocs.io/en/latest/config.html#report
|
2024-10-11 11:31:16 +01:00
|
|
|
[tool.coverage.report]
|
2025-11-11 13:09:32 +00:00
|
|
|
fail_under = 100
|
|
|
|
|
skip_covered = true
|
|
|
|
|
show_missing = true
|
2025-08-11 19:56:37 +02:00
|
|
|
ignore_errors = true
|
2025-11-11 13:09:32 +00:00
|
|
|
precision = 2
|
2026-03-31 12:49:38 -04:00
|
|
|
exclude_also = [
|
2026-01-23 20:00:20 +00:00
|
|
|
"pragma: lax no cover",
|
2025-11-11 13:09:32 +00:00
|
|
|
"@overload",
|
2025-03-13 11:59:45 +01:00
|
|
|
"raise NotImplementedError",
|
2025-11-11 13:09:32 +00:00
|
|
|
]
|
|
|
|
|
|
2025-08-11 19:56:37 +02:00
|
|
|
# https://coverage.readthedocs.io/en/latest/config.html#paths
|
2024-10-11 11:31:16 +01:00
|
|
|
[tool.coverage.paths]
|
2025-11-11 13:09:32 +00:00
|
|
|
source = [
|
|
|
|
|
"src/",
|
2024-11-20 16:12:21 +00:00
|
|
|
"/home/runner/work/python-sdk/python-sdk/src/",
|
|
|
|
|
'D:\a\python-sdk\python-sdk\src',
|
2025-11-11 13:09:32 +00:00
|
|
|
]
|
2026-01-25 14:45:52 +01:00
|
|
|
|
|
|
|
|
[tool.inline-snapshot]
|
|
|
|
|
default-flags = ["disable"]
|
|
|
|
|
format-command = "ruff format --stdin-filename {filename}"
|