Python MCP Server Kit
Python MCP Server Kit
Ein reines Backend-Starterset für sichere, typisierte und testbare Model-Context-Protocol-Server. Es zielt auf das MCP-Protokoll 2026-07-28 über das offizielle Python-SDK v2 ab und verwendet zustandsloses Streamable HTTP für die Bereitstellung.
Funktionen
Typisierte Tools mit strukturierter Pydantic-Ausgabe
Generische Rechner- und deterministische Katalogbeispiele
MCP-Tools, -Ressourcen und -Prompts
Bearer-Token-Grenze und Pro-Tool-Scopes
Anfragegrößen-, Host- und In-Process-Ratenlimits
Korrelations-IDs und strukturierte Anfrage-Logs
Öffentliche Health- und Readiness-Probes
Produktionsnahes Docker-Image ohne Root-Rechte
CI für Linting, Formatierung, Typprüfung, Tests, Image-Build, Secrets und Workflows
Related MCP server: EasyMCP
Architektur
HTTP request
-> SecurityMiddleware (host, size, auth, rate limit, request ID)
-> MCP Streamable HTTP transport
-> typed tool/resource/prompt
-> scope check
-> deterministic domain functionDie Protokollregistrierung befindet sich in src/mcp_server_kit/server.py; wiederverwendbare Domänenlogik bleibt in separaten Modulen. TokenStore ist bewusst eine austauschbare Bereitstellungsgrenze und kein vollständiger Autorisierungsserver.
Schnellstart
Python 3.11+ ist erforderlich.
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -e ".[dev]"
Copy-Item .env.example .env
.\scripts\dev.ps1Der MCP-Endpunkt ist http://127.0.0.1:8000/mcp. Health-Probes sind unter /health und /ready verfügbar. Die nur lokal verfügbaren Demo-Tokens sind:
demo-reader—catalog:readdemo-operator—catalog:read,calculator:use
Führen Sie den MCP Inspector mit npx -y @modelcontextprotocol/inspector aus und setzen Sie einen Authorization: Bearer demo-operator-Header. Eine anmeldefreie Client-Vorlage ist in examples/client.json verfügbar; injizieren Sie MCP_CLIENT_TOKEN lokal.
Befehle
.\scripts\dev.ps1 # development server with reload
.\scripts\check.ps1 # lint, format check, mypy, and tests
docker compose up --buildKonfiguration
Variable | Standard | Zweck |
|
| Lehnt unsichere Demo-Authentifizierung in Produktion ab |
|
| Bindeadresse |
|
|
|
| leer | Geheimer Wert |
| lokale Hosts | Exakt akzeptierte HTTP-Hostnamen |
|
| Maximal deklarierter Request-Body |
|
| Pro Subjekt/Fenster erlaubte Anfragen |
|
| Rate-Limit-Fenster |
|
| Uvicorn-Log-Level |
Committen Sie niemals .env. Siehe Sicherheit und Bereitstellung, bevor Sie eine internetzugängliche Bereitstellung durchführen, und Tools hinzufügen, wenn Sie die Registry erweitern.
Hinweise zur Bereitstellung
Setzen Sie MCP_ENVIRONMENT=production, MCP_AUTH_MODE=bearer, einen über Secrets verwalteten Wert für MCP_BEARER_TOKENS und die exakte öffentliche Host-Allowlist. Beenden Sie TLS an einem vertrauenswürdigen Reverse-Proxy. Ersetzen Sie den Starter-Token-Store durch Ihren OAuth-2.1-Resource-Server-Verifier, wenn Benutzerdelegierung oder Token-Lebenszyklusverwaltung erforderlich ist.
Lizenz
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
A Model Context Protocol server for Wix AI tools
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceEnables developers to create and serve Model Context Protocol servers in TypeScript by declaratively defining tools, resources, resource templates, prompts, and roots with minimal boilerplate. It provides an Express-like API or experimental decorators, with optional context access for logging and progress reporting.5 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables developers to build Model Context Protocol servers in TypeScript with minimal boilerplate, declaring tools, prompts, resources, resource templates, and roots through either an Express-like API or an experimental decorators API that infers types and input schemas automatically. It also provides a context object for logging, progress reporting, and reading resources within tool handlers.5 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables developers to create Model Context Protocol servers in TypeScript with minimal boilerplate through an Express-like API or experimental decorators. It supports defining tools, prompts, resources, resource templates, and roots, with type safety and MCP capabilities like logging and progress reporting.5 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables developers to build Model Context Protocol servers in TypeScript with a simple Express-like API or experimental decorators for defining tools, prompts, resources, resource templates, and roots with minimal boilerplate.5 npmMIT