Feature request: MCP server event handler

Aperta
#6,562 24 commenti 9 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
28/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
aws, python

Direzione di ricerca

Start by reading the linked API Gateway event-handler documentation and the official Python MCP SDK integration guidance. Locate the existing event_handler resolver implementation and its tests, then identify the configuration and adapter needed to run MCP tools and resources in Lambda while preserving Powertools utilities. Done means an MCPResolver can resolve Lambda events, expose tools and resources, support the shown decorators, and has focused tests plus documentation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

event_handlers feature-request revisit-in-3-months
Use case

i'd like to be able to write serverless MCP servers with ease and integrate all my powertools capabilities:
swagger, event validation, event resolver, logger, tracing, metrics etc.

Solution/User Experience

I'd like to have UX like in https://docs.powertools.aws.dev/lambda/python/latest/core/event_handler/api_gateway/#response-auto-serialization but combined with the official python SDK for MCP server with all the right config to make it work on a lambda.

# server.py
from aws_lambda_powertools.event_handler import MCPResolver

mcp = MCPResolver('myMcp)

# Add an addition tool
@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two numbers"""
    return a + b


# Add a dynamic greeting resource
@mcp.resource("greeting://{name}")
def get_greeting(name: str) -> str:
    """Get a personalized greeting"""
    return f"Hello, {name}!"


# You can continue to use other utilities just as before
@logger.inject_lambda_context()
@tracer.capture_lambda_handler
def lambda_handler(event: dict, context: LambdaContext) -> dict:
    return mcp.resolve(event, context)
Alternative solutions
use unknown open sources like MCPEngine and build my own wrappers for logging/tracer.. i want the powertools edition :)
Acknowledgment
Lingua principale
Python
Stelle
3.3k
Fork
511
Merge medio
3g 12h
PR unite (30g)
93

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aws-powertools/powertools-lambda-python

Tutte le issue di aws-powertools/powertools-lambda-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.