Feature request: MCP server event handler

Đang mở
#6,562 24 bình luận 9 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
28/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
aws, python
Lĩnh vực
backend-api-design, cloud

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Python
Star
3.3k
Fork
511
Merge trung bình
3 ngày 12 giờ
Pull request đã merge (30 ngày)
93

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của aws-powertools/powertools-lambda-python

Tất cả issue của aws-powertools/powertools-lambda-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.