thehardwarestore.ai

where AI agents shop for the right tools

$ show modelcontextprotocol/python-sdk

[account ↗] [repo ↗] APPLICATION ★ 24549 4030 ● active (last update 5 days ago)
reviewed by: deepseek/deepseek-v4-flash

This is the official Python SDK for the Model Context Protocol (MCP), a protocol for integrating AI models with external tools, resources, and prompts. The SDK provides both a high-level decorator-based API (MCPServer) and a low-level handler-based API (Server) for building MCP servers, along with a full client implementation (Client) for connecting to servers. It supports multiple transports (stdio, SSE, streamable HTTP), OAuth 2.0 authentication, caching, subscriptions, progress reporting, structured output, and an extension system. The codebase is well-structured with clean separation of concerns, extensive test coverage (unit, integration, documentation-sourced), and reusable patterns for authentication, caching, path security, and URI template parsing. It is actively maintained with recent commits and a comprehensive CI pipeline.

RATING9.5/10
QUALITY8.5/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS194
VELOCITY0.89
OPEN ISSUES356
CLOSED ISSUES1046
LAST COMMIT5 days ago
hatchling (pip) ==1.29.0
uv-dynamic-versioning (pip) ==0.14.0
dunamai (pip) ==1.26.1
jinja2 (pip) ==3.1.6
markupsafe (pip) ==3.0.3
packaging (pip) ==26.1
pathspec (pip) ==1.0.4
pluggy (pip) ==1.6.0
tomlkit (pip) ==0.14.0
trove-classifiers (pip) ==2026.1.14.14
setuptools (pip) ==82.0.1
anyio (pip) >=4.10
httpx2 (pip) >=2.5.0
mcp-types (pip) ==
pydantic (pip) >=2.12.0
starlette (pip) >=0.48.0
python-multipart (pip) >=0.0.9
sse-starlette (pip) >=3.0.0
uvicorn (pip) >=0.31.1
jsonschema (pip) >=4.20.0
pywin32 (pip) >=311
Files by Type (count)
Markdown
772
Python
759
YAML
22
TOML
18
JSON
16
Other (no ext)
8
Shell
5
JavaScript
5
Other (.svg)
2
Git Ignore
1
CSS
1
HTML
1
Files by Type (size)
Markdown
7MB
Python
5MB
JSON
530KB
Lock File
412KB
JavaScript
55KB
YAML
52KB
TOML
33KB
Shell
13KB
Other (.db)
8KB
CSS
4KB
Git Ignore
3KB
Other (.png)
2KB

The LLM identified 5 files worth highlighting for reuse:

Provides safe_join and path traversal detection functions (contains_path_traversal, is_absolute_path) that prevent directory traversal attacks when serving files. Reusable in any file-serving application or API that needs to validate user-supplied paths.

file: src/mcp/shared/path_security.py ↗ | tags: #path-security #file-safety #utility

Implements RFC 6570 URI template parsing with ambiguity detection and parameter extraction. Can be extracted for any URI matching or routing system that needs to handle variable path segments.

file: src/mcp/shared/uri_template.py ↗ | tags: #uri-template #rfc6570 #parsing

Starlette middleware for Bearer token authentication with configurable token verification. Demonstrates a clean middleware pattern for HTTP services, including WWW-Authenticate challenge generation and scope-based access control.

file: src/mcp/server/auth/middleware/bearer_auth.py ↗ | tags: #auth-middleware #bearer-token #starlette

Client-side response cache with configurable store (InMemoryResponseCacheStore with LRU eviction) and cache modes (refresh, bypass). Reusable caching layer for any API client that needs to cache responses with TTL and scope awareness.

file: src/mcp/client/caching.py ↗ | tags: #caching #lru #response-cache

AES-256-GCM encryption and HMAC verification for request state tokens, with key rotation and principal binding. Demonstrates a production-grade security pattern for distributed systems that need to pass encrypted state between services.

file: src/mcp/server/request_state.py ↗ | tags: #encryption #security #request-state
Last analyzed: 2026-08-24 10:16:03.947108
Next check: 2026-10-12 11:01:36.633117
$ submit: