Skip to main content
Glama
Boyeep

Python MCP Server Kit

by Boyeep

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: MCP TypeScript SDK

Architektur

HTTP request
  -> SecurityMiddleware (host, size, auth, rate limit, request ID)
  -> MCP Streamable HTTP transport
  -> typed tool/resource/prompt
  -> scope check
  -> deterministic domain function

Die 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.ps1

Der 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-readercatalog:read

  • demo-operatorcatalog: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 --build

Konfiguration

Variable

Standard

Zweck

MCP_ENVIRONMENT

development

Lehnt unsichere Demo-Authentifizierung in Produktion ab

MCP_HOST / MCP_PORT

127.0.0.1 / 8000

Bindeadresse

MCP_AUTH_MODE

demo

demo, bearer oder nur lokal disabled

MCP_BEARER_TOKENS

leer

Geheimer Wert token:scope[,scope];...

MCP_ALLOWED_HOSTS

lokale Hosts

Exakt akzeptierte HTTP-Hostnamen

MCP_MAX_REQUEST_BYTES

1048576

Maximal deklarierter Request-Body

MCP_RATE_LIMIT_REQUESTS

60

Pro Subjekt/Fenster erlaubte Anfragen

MCP_RATE_LIMIT_WINDOW_SECONDS

60

Rate-Limit-Fenster

MCP_LOG_LEVEL

INFO

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

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • A Model Context Protocol server for Wix AI tools

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Boyeep/python-mcp-server-kit'

If you have feedback or need assistance with the MCP directory API, please join our Discord server