Repository guide · overview · v2
modelcontextprotocol / python-sdk
“The official Python SDK for Model Context Protocol servers and clients” — as described by its authors
- AI Infrastructure
- Python
- MIT · open-source license
- Original repository
- modelcontextprotocol/python-sdk
- Source platform
- GitHub
- Repository owner / organization
- modelcontextprotocol
- License
- MIT · open-source license
- Analyzed revision
- 77001c96f9507be0f4d009b83210a384a5e08bda
- Last verified
Source checked 2026-11-15: default branch still at the analyzed revision.
modelcontextprotocol/python-sdk: Repository Overview
Terms used on this page
- Entrypoint record
- A file the analyzer marks as a place where execution can start. When it carries a __main__ guard excerpt, the file contains an if __name__ == "__main__": block and the excerpt shows what that block calls; without an excerpt, the file was flagged by its name only.
- Bounded static execution path
- A call chain reconstructed from the source code without running it, stopped after a fixed number of steps. It shows how far the code can be followed on paper, not what happens at run time.
- Unresolved boundary
- Where a static path stops because the next call goes into an external library or cannot be resolved without running the code. It marks the edge of this analysis, not a defect in the repository.
- Static relations
- Calls and imports found in the source. "External or unresolved" relations point outside the analyzed files.
- Module role
- The analyzer's label for a file, inferred from how many calls go in and out (for example core, entry/orchestration, leaf). It describes a position in the call graph, not the authors' design.
- Test-like files
- Files whose names or locations look like tests. This analysis counts them; it does not run them.
- Observed · inferred · author-claimed · unresolved
- How each statement is supported: read directly from the analyzed files; derived by the analyzer from them; stated by the repository's authors (metadata, README); or not established by this analysis.
- Verified
- Two uses on these pages. In an analyzer record ("verified provenance", "a verified entrypoint") it means the record was read directly from the analyzed files, which these guides call observed; for an entrypoint, the __main__ guard text is present. Since the analyzer fix of 2026-10-04, a file that only has an entrypoint-like name such as cli.py or main.py is recorded as inferred; guides analyzed before that still call such a file verified, and it is still only a guess about how the file is used. It does not mean the code was run or tested. "Last verified" is the date the guide last passed the lab's checks against the analysis record of the stated revision; it is not a review of the repository itself.
A Python repository whose GitHub description calls it the official Python SDK for Model Context Protocol servers and clients. Code is organized into src, tests, examples, docs_src and i18n trees. Static analysis finds many __main__ entrypoints, and it records 47,493 static relations, of which only 6,041 resolve to local targets.
What it is
The repository's GitHub description calls it the official Python SDK for Model Context Protocol (MCP) servers and clients. That is an author claim; this analysis does not check it.
Platform metadata reports:
- Python as the primary language
- an MIT license
- the topics
mcp,mcp-client,mcp-serverandpython - a latest release tagged v2.3.0
Structurally, src/mcp contains separate cli, client and server packages. Each has a __main__ guard. The analyzer inventoried 1726 files across top-level directories such as src, tests, examples, docs_src, docs and i18n.
How it starts
The analyzer reports 178 entrypoints. Among those listed, nine are flagged only by a filename heuristic, including src/mcp/cli/cli.py, src/mcp/server/lowlevel/server.py and src/mcp/server/mcpserver/server.py.
Inside the library, three package guards start things:
- the
src/mcp/cli/__init__.pyguard callsapp() - the
src/mcp/client/__main__.pyguard callscli() src/mcp/server/__main__.pyrunsmainthrough anyio with the trio backend:anyio.run(main, backend="trio")
Under examples/stories, paired client.py and server.py files call helpers such as run_client(main) and run_server_from_args(build_server). They are often placed next to a server_lowlevel.py variant.
The analyzer chose .github/actions/conformance/client.py as its main starting point. Its guard calls main(). The traced paths from there stop right away at unresolved calls such as print, len and sys.exit. Because this file sits in CI tooling, this static core flow says little about how the SDK itself works.
Structure
Top-level file counts are: i18n 664, examples 298, tests 285, docs_src 218, src 140, docs 58, .github 27, scripts 12 and schema 4. The analyzer treats docs, docs_src, src and tests as subsystems.
The static graph has 47,493 edges: 38,302 calls and 9,191 imports. Only 6,041 of these edges resolve to local targets.
The modules with the highest resolved cross-module call degree are all under tests/:
tests/interaction/_connect.py: 177 incoming callstests/interaction/auth/_harness.py: 145 incomingtests/shared/test_dispatcher.py: 117 incomingtests/shared/test_jsonrpc_dispatcher.py: 79 outgoing
This suggests that shared connection and auth fixtures support much of the test suite. It also means the degree ranking does not point at library modules in src.
Notable symbols
In tests/interaction/_connect.py, a Connect class sits beside factories such as connect_in_memory, connect_over_streamable_http and connect_over_sse. These names hint that tests exercise several transports.
tests/interaction/auth/_provider.py defines InMemoryAuthorizationServerProvider. tests/interaction/_requirements.py defines a Requirement class, and tests/interaction/test_coverage.py contains a test named test_every_requirement_is_exercised.
Dependencies and tests
Dependency records come from 18 manifests, mostly per-example pyproject.toml files.
For the root pyproject.toml, the packet records two kinds of entries:
- optional dependencies:
rich,typerandpython-dotenv - development tooling:
pytest,pytest-xdist,pyright,ruff,trio,coverage,inline-snapshotandmkdocstrings
No runtime-scope record for the root package appears, so its core runtime requirements are not established here. The root manifest also has duplicate entries for pillow and blockbuster with different lower bounds.
src/mcp-types/pyproject.toml lists pydantic in two records (>=2.14.0 and >=2.12.0) plus typing-extensions. Examples typically depend on mcp together with click, anyio, httpx2, starlette or uvicorn. Version constraints are recorded as written in the manifests.
The analyzer counts 287 test or test-like files, including JavaScript tests under .github/scripts. The Python suite lives mainly in the 285-file tests/ directory.
Read first
- Start with
README.md,pyproject.tomlandLICENSE, which the analyzer marks as project-level important files. Treat README statements as author claims. - Read the package entry guards in
src/mcp/cli/__init__.py,src/mcp/client/__main__.pyandsrc/mcp/server/__main__.py. - Look at
src/mcp/server/mcpserver/server.pyandsrc/mcp/server/lowlevel/server.py. Both are flagged as entrypoints by filename heuristic only. - Open a tutorial such as
docs_src/client/tutorial001_client.py, which is marked important as a likely entrypoint. - Read
tests/interaction/_connect.py, the most-called test helper, to see how tests connect clients and servers.
Limits of this analysis
- The analysis is static only. Reflection, dynamic imports, runtime dependency injection, framework wiring and dynamic dispatch are not resolved, so code selected at runtime is not traced.
- 41,452 of the 47,493 static relations remain external or unresolved.
- Dependency parsing covers requirements files, package.json and pyproject.toml. setup.py, setup.cfg, Pipfile and lock files are not parsed.
- Install, run and build inference is partial. No installation command was checked and nothing was executed.
- Large files, minified bundles and vendored directories are inventoried but not parsed. Relation extraction is capped per file and per repository.
- One analyzer teaching claim says no bounded execution path exists, yet the packet contains traced paths. Treat analyzer summaries with care.
What this analysis could not establish
The writing model's own notes on the analysis record. Identifiers such as lim_3, exec_* or claim_… name records of that analysis; the claims table cites the same records.
- The packet contains no runtime-scope dependency records for the root pyproject.toml, so the core runtime requirements of the main package are unknown; the dependency list is marked partial.
- One of the analyzer's teaching claims says no bounded execution path exists, while the packet lists traced execution-path records and reports 658 bounded paths.
- The analyzer's chosen main starting point is a CI conformance client, not library code, so its core flow does not describe the SDK's internal behaviour.
- The module degree ranking only covers test modules; the call structure inside src/mcp is not characterized by the packet.
- The dependency name 'httpx2' is reported as written in example manifests; whether it is intended or a recording artifact is not established.
- Only some of the 178 reported entrypoints are listed in the packet, so the full entrypoint set is not visible here.
Claims and evidence — 35 claims, 35 supported by an independent verifier
Every statement above is a claim that cites grounding IDs from the analysis. IDs are internal to the analysis run; the columns show what each claim rests on and how strong that ground is.
Every substantive statement above is a claim bound to grounding IDs of the analyzed revision. Global grounding IDs are namespaced by the analysis run.
| Claim | Epistemic status | Verifier | Grounding (global IDs) |
|---|---|---|---|
| c1 The GitHub description presents the repository as the official Python SDK for Model Context Protocol servers and clients. | author_claimed | supported | analysis_f7d9a9f9559ef565:meta_description |
| c2 Platform metadata lists Python as primary language, an MIT license, topics mcp, mcp-client, mcp-server and python, and a latest release tagged v2.3.0. | observed | supported | analysis_f7d9a9f9559ef565:meta_primary_language, analysis_f7d9a9f9559ef565:meta_license, analysis_f7d9a9f9559ef565:meta_topics, analysis_f7d9a9f9559ef565:meta_latest_release |
| c3 The analyzer inventoried 1726 files across top-level directories including src, tests, examples, docs_src, docs and i18n. | inferred | supported | analysis_f7d9a9f9559ef565:summary_repository |
| c4 src/mcp/cli/__init__.py, src/mcp/client/__main__.py and src/mcp/server/__main__.py each contain a __main__ execution guard. | observed | supported | analysis_f7d9a9f9559ef565:py_entry_d9208a18098d, analysis_f7d9a9f9559ef565:py_entry_b9466646417f, analysis_f7d9a9f9559ef565:py_entry_f9a552a95482 |
| c5 The analyzer's architecture reconstruction reports 178 entrypoints in the repository. | inferred | supported | analysis_f7d9a9f9559ef565:claim_f35a48536d91, analysis_f7d9a9f9559ef565:architecture_reconstruction |
| c6 Some entrypoints, including src/mcp/cli/cli.py, src/mcp/server/lowlevel/server.py and src/mcp/server/mcpserver/server.py, are detected only by a filename heuristic. | inferred | supported | analysis_f7d9a9f9559ef565:entry_166, analysis_f7d9a9f9559ef565:entry_169, analysis_f7d9a9f9559ef565:entry_170 |
| c7 The CLI package guard calls app(), the client package guard calls cli(), and the server package guard calls anyio.run(main, backend="trio"). | observed | supported | analysis_f7d9a9f9559ef565:py_entry_d9208a18098d, analysis_f7d9a9f9559ef565:py_entry_b9466646417f, analysis_f7d9a9f9559ef565:py_entry_f9a552a95482 |
| c8 Files under examples/stories call run_client(main) or run_server_from_args(build_server) in their guards, and server_lowlevel.py variants exist. | observed | supported | analysis_f7d9a9f9559ef565:py_entry_5a0eebfe2abe, analysis_f7d9a9f9559ef565:py_entry_b93c5a9e94d4, analysis_f7d9a9f9559ef565:py_entry_b234a8aa3a3b |
| c9 The analyzer names .github/actions/conformance/client.py as the main starting place, and its guard calls main(). | inferred | supported | analysis_f7d9a9f9559ef565:summary_repository, analysis_f7d9a9f9559ef565:py_entry_7ed4238a8b5b |
| c10 Traced paths from the conformance client's main end immediately at unresolved calls such as print, len and sys.exit, so they reveal little about SDK internals. | inferred | supported | analysis_f7d9a9f9559ef565:exec_fad222196619, analysis_f7d9a9f9559ef565:exec_f72d6b612163, analysis_f7d9a9f9559ef565:exec_e615ffc0aac8 |
| c11 Top-level file counts are i18n 664, examples 298, tests 285, docs_src 218, src 140, docs 58, .github 27, scripts 12, schema 4. | inferred | supported | analysis_f7d9a9f9559ef565:summary_repository |
| c12 The analyzer records docs, docs_src, src and tests as subsystem directories. | observed | supported | analysis_f7d9a9f9559ef565:subsys_1, analysis_f7d9a9f9559ef565:subsys_2, analysis_f7d9a9f9559ef565:subsys_3, analysis_f7d9a9f9559ef565:subsys_4 |
| c13 The static graph holds 47,493 relations: 38,302 calls and 9,191 imports, with 6,041 resolved locally. | observed | supported | analysis_f7d9a9f9559ef565:relation_counts |
| c14 The highest resolved cross-module call degrees belong to test modules: _connect.py (177 in), auth/_harness.py (145 in), test_dispatcher.py (117 in), test_jsonrpc_dispatcher.py (79 out). | inferred | supported | analysis_f7d9a9f9559ef565:role_263, analysis_f7d9a9f9559ef565:role_267, analysis_f7d9a9f9559ef565:role_309, analysis_f7d9a9f9559ef565:role_310 |
| c15 The degree ranking suggests shared connection and auth fixtures support much of the test suite and does not highlight library modules in src. | inferred | supported | analysis_f7d9a9f9559ef565:role_263, analysis_f7d9a9f9559ef565:role_267, analysis_f7d9a9f9559ef565:role_309, analysis_f7d9a9f9559ef565:role_310 |
| c16 tests/interaction/_connect.py defines Connect plus connect_in_memory, connect_over_streamable_http and connect_over_sse, hinting at tests across several transports. | inferred | supported | analysis_f7d9a9f9559ef565:py_class_07e65be2dfad, analysis_f7d9a9f9559ef565:py_func_b92227bacd2e, analysis_f7d9a9f9559ef565:py_func_8f72ecdab61c, analysis_f7d9a9f9559ef565:py_func_aba9d88934fe |
| c17 InMemoryAuthorizationServerProvider and a Requirement class are defined in test helpers, and test_coverage.py contains test_every_requirement_is_exercised. | observed | supported | analysis_f7d9a9f9559ef565:py_class_c648bad31f94, analysis_f7d9a9f9559ef565:py_class_3c0016ca138c, analysis_f7d9a9f9559ef565:py_func_5d442e95efd7 |
| c18 The repository contains 18 build/dependency manifests, many of them per-example pyproject.toml files. | observed | supported | analysis_f7d9a9f9559ef565:ev_manifest_1, analysis_f7d9a9f9559ef565:dep_1, analysis_f7d9a9f9559ef565:dep_21 |
| c19 The root pyproject.toml records optional rich, typer and python-dotenv, and dev tools including pytest, pytest-xdist, pyright, ruff, trio, coverage, inline-snapshot and mkdocstrings. | observed | supported | analysis_f7d9a9f9559ef565:dep_99, analysis_f7d9a9f9559ef565:dep_100, analysis_f7d9a9f9559ef565:dep_101, analysis_f7d9a9f9559ef565:dep_106, analysis_f7d9a9f9559ef565:dep_110, analysis_f7d9a9f9559ef565:dep_105, analysis_f7d9a9f9559ef565:dep_107, analysis_f7d9a9f9559ef565:dep_108, analysis_f7d9a9f9559ef565:dep_115, analysis_f7d9a9f9559ef565:dep_113, analysis_f7d9a9f9559ef565:dep_124 |
| c20 No runtime-scope dependency record for the root package appears in the packet; the main package's core runtime requirements are not established. | unresolved | supported | analysis_f7d9a9f9559ef565:lim_3a |
| c21 src/mcp-types/pyproject.toml records pydantic twice (>=2.14.0 and >=2.12.0) and typing-extensions >=4.13.0. | observed | supported | analysis_f7d9a9f9559ef565:dep_130, analysis_f7d9a9f9559ef565:dep_131, analysis_f7d9a9f9559ef565:dep_132 |
| c22 Example manifests record mcp with click, anyio, httpx2, starlette or uvicorn; version constraints are recorded as written. | observed | supported | analysis_f7d9a9f9559ef565:dep_22, analysis_f7d9a9f9559ef565:dep_23, analysis_f7d9a9f9559ef565:dep_24, analysis_f7d9a9f9559ef565:dep_25, analysis_f7d9a9f9559ef565:dep_26, analysis_f7d9a9f9559ef565:dep_27, analysis_f7d9a9f9559ef565:dep_31, analysis_f7d9a9f9559ef565:dep_32, analysis_f7d9a9f9559ef565:dep_33, analysis_f7d9a9f9559ef565:dep_34, analysis_f7d9a9f9559ef565:dep_38, analysis_f7d9a9f9559ef565:dep_63, analysis_f7d9a9f9559ef565:dep_64, analysis_f7d9a9f9559ef565:dep_65, analysis_f7d9a9f9559ef565:dep_66, analysis_f7d9a9f9559ef565:dep_67, analysis_f7d9a9f9559ef565:dep_68, analysis_f7d9a9f9559ef565:lim_3a |
| c23 The root pyproject.toml has two pillow records and two blockbuster records with different lower bounds. | observed | supported | analysis_f7d9a9f9559ef565:dep_116, analysis_f7d9a9f9559ef565:dep_117, analysis_f7d9a9f9559ef565:dep_121, analysis_f7d9a9f9559ef565:dep_122 |
| c24 There are 287 test or test-like files, including JavaScript tests in .github/scripts; the 285-file tests directory holds most of them. | inferred | supported | analysis_f7d9a9f9559ef565:ev_tests_1, analysis_f7d9a9f9559ef565:summary_repository |
| c25 README.md, pyproject.toml and LICENSE are marked as project-level important files; README-derived content stays author_claimed. | observed | supported | analysis_f7d9a9f9559ef565:important_1, analysis_f7d9a9f9559ef565:important_2, analysis_f7d9a9f9559ef565:important_3, analysis_f7d9a9f9559ef565:lim_4a |
| c26 The cli, client and server packages under src/mcp each have a __main__ guard worth reading early. | observed | supported | analysis_f7d9a9f9559ef565:py_entry_d9208a18098d, analysis_f7d9a9f9559ef565:py_entry_b9466646417f, analysis_f7d9a9f9559ef565:py_entry_f9a552a95482 |
| c27 src/mcp/server/mcpserver/server.py and src/mcp/server/lowlevel/server.py are flagged as likely entrypoints by filename heuristic only. | inferred | supported | analysis_f7d9a9f9559ef565:entry_170, analysis_f7d9a9f9559ef565:entry_169 |
| c28 docs_src/client/tutorial001_client.py is marked important because it is likely an entrypoint. | observed | supported | analysis_f7d9a9f9559ef565:important_7 |
| c29 tests/interaction/_connect.py, with the highest incoming call count and a Connect class, is a useful view of how tests connect clients and servers. | inferred | supported | analysis_f7d9a9f9559ef565:role_263, analysis_f7d9a9f9559ef565:py_class_07e65be2dfad |
| c30 The analysis is static only; reflection, runtime dependency injection, dynamic imports, framework wiring and dynamic dispatch are not resolved. | observed | supported | analysis_f7d9a9f9559ef565:lim_1 |
| c31 41,452 of 47,493 static relations remain external or unresolved. | observed | supported | analysis_f7d9a9f9559ef565:relation_counts |
| c32 Dependency records come from requirements files, package.json and pyproject.toml; setup.py, setup.cfg, Pipfile and lock files are not parsed. | observed | supported | analysis_f7d9a9f9559ef565:lim_3a |
| c33 Install, run and build inference is partial, installation commands are not verified, and the analysis is static only. | observed | supported | analysis_f7d9a9f9559ef565:lim_2, analysis_f7d9a9f9559ef565:lim_1 |
| c34 Files over 400 kB, minified bundles and vendored directories are inventoried but not parsed; relation extraction is capped per file and per repository. | observed | supported | analysis_f7d9a9f9559ef565:lim_6 |
| c35 An analyzer teaching claim states no bounded execution path is available, which conflicts with the traced execution paths present in the packet. | inferred | supported | analysis_f7d9a9f9559ef565:claim_4d30ade3e21e, analysis_f7d9a9f9559ef565:exec_fad222196619 |
Sources, rights and disclosure · attribution-license-templates/v0.1
Rights notice. Original repository hosted on GitHub. Repository source code, documentation, names, media, and related project materials remain subject to the rights of their respective authors, contributors, and other rights holders and to applicable repository license terms.
Platform notice. GitHub is the source hosting platform for the linked repository. GitHub and related marks are trademarks of GitHub, Inc. EVEMISS Technology is not affiliated with or endorsed by GitHub unless explicitly stated otherwise.
How this page is produced. This page was produced using revision-aware repository analysis and AI-assisted editorial tooling. Technical claims are tied to the analyzed repository revision and may be revalidated when the source repository changes.
AI-assisted analysis. Reviewed by EVEMISS Technology through human–AI collaborative review. · Report a rights concern · All repository guides