{"id":4341,"library":"awslabs-aws-api-mcp-server","title":"AWS Model Context Protocol (MCP) Server","description":"The AWS API Model Context Protocol (MCP) Server provides a Python implementation of the gRPC-based Model Context Protocol. It allows an external client to provide API models and context to the server, assisting in API construction. It is currently at version 1.3.29 and receives regular updates, primarily for patch and minor feature releases.","status":"active","version":"1.3.29","language":"en","source_language":"en","source_url":"https://github.com/awslabs/aws-api-model-context-protocol-server-python","tags":["aws","api","server","protocol","grpc","protobuf","model-context"],"install":[{"cmd":"pip install awslabs-aws-api-mcp-server","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core dependency for gRPC communication.","package":"grpcio","optional":false},{"reason":"Used for protocol buffer serialization.","package":"protobuf","optional":false},{"reason":"AWS SDK for Python, potentially used for interacting with other AWS services or loading models.","package":"boto3","optional":false},{"reason":"Used for data validation and parsing.","package":"pydantic","optional":false},{"reason":"Used for JSON schema validation.","package":"jsonschema","optional":false}],"imports":[{"symbol":"McpServer","correct":"from mcp.server import McpServer"},{"note":"The core servicer class is directly under `mcp.service`, not `mcp.server.service`.","wrong":"from mcp.server.service import ModelContextServiceServicer","symbol":"ModelContextServiceServicer","correct":"from mcp.service import ModelContextServiceServicer"},{"note":"Generated protobuf messages are nested under `mcp.server.models`.","wrong":"from mcp.models.mcp_pb2 import AddContextRequest","symbol":"AddContextRequest","correct":"from mcp.server.models.mcp_pb2 import AddContextRequest"}],"quickstart":{"code":"import asyncio\nfrom concurrent import futures\nimport grpc\n\nfrom mcp.server import McpServer\nfrom mcp.service import ModelContextServiceServicer\nfrom mcp.server.models.mcp_pb2_grpc import add_ModelContextServiceServicer_to_server\nfrom mcp.server.models.mcp_pb2 import AddContextRequest, AddContextResponse\n\nclass MyMcpService(ModelContextServiceServicer):\n    \"\"\"Example implementation of the ModelContextServiceServicer.\"\"\"\n    async def AddContext(self, request: AddContextRequest, context: grpc.aio.ServicerContext) -> AddContextResponse:\n        print(f\"Received AddContext request for model: {request.model_name}\")\n        # Implement actual context logic here\n        return AddContextResponse(success=True, message=\"Context added successfully\")\n\n    async def GetContext(self, request, context):\n        # Implement GetContext logic\n        return super().GetContext(request, context)\n\nasync def serve():\n    server = grpc.aio.server(futures.ThreadPoolExecutor(max_workers=10))\n    add_ModelContextServiceServicer_to_server(MyMcpService(), server)\n    server.add_insecure_port('[::]:50051')\n    print('Starting MCP server on port 50051')\n    await server.start()\n    await server.wait_for_termination()\n\nif __name__ == '__main__':\n    asyncio.run(serve())","lang":"python","description":"This quickstart demonstrates how to set up a basic MCP server using `awslabs-aws-api-mcp-server`. It implements a custom `ModelContextServiceServicer` and starts an asynchronous gRPC server. In a real application, you would implement the `AddContext` and `GetContext` methods to handle actual model context operations."},"warnings":[{"fix":"All service methods (e.g., `AddContext`, `GetContext`) overridden from `ModelContextServiceServicer` should be defined with `async def` and use `await` for any asynchronous operations.","message":"The server runs as an asynchronous gRPC service. Ensure your custom `ModelContextServiceServicer` implementations are also `async def` functions and correctly handle asynchronous operations. Blocking calls within these methods can degrade performance.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always review the changelog for breaking changes when upgrading to new major versions. Re-generating client stubs based on the updated `.proto` definition and updating your `ModelContextServiceServicer` implementation might be necessary.","message":"Major changes to the underlying Model Context Protocol definition (e.g., in `mcp.proto`) could introduce breaking changes to the gRPC service interface. While `awslabs` strives for backward compatibility, new major versions of the library might reflect such protocol updates.","severity":"breaking","affected_versions":"Potentially future major versions (e.x., 2.0.0+)"},{"fix":"Design a proper data store (e.g., database, S3) and logic within your `ModelContextServiceServicer` to persist and retrieve model context. Consider concurrency and consistency requirements.","message":"Correctly loading and managing API models and context is crucial for the server's function. The example provides a basic `AddContext`, but production implementations will require robust storage and retrieval mechanisms for the models and their associated context.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use a virtual environment to isolate project dependencies. If encountering issues, check `pip freeze` for `grpcio` and `protobuf` versions and align them with what `awslabs-aws-api-mcp-server` expects or is known to work with.","message":"The library relies on specific versions of `grpcio` and `protobuf`. Incompatibility issues can arise if other projects in your environment use different or conflicting versions of these dependencies.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}