AW
OfficialCloud

AWS MCP Server Deployment and Optimization

Deploy and optimize AWS with our MCP server suite to maximize performance, reduce costs, and simplify management across all environments.

Quick Install
npx -y @awslabs/mcp

Overview

The AWS MCP Server suite provides open-source implementations of Model Context Protocol (MCP) servers tuned for AWS environments. These servers expose contextual data and tooling to language-model clients (MCP clients) using standardized MCP endpoints so AI-enabled editors, agents, and chat tools can fetch project context, documentation, secrets, or runtime telemetry from trusted hosts.

This guide shows how to deploy MCP servers on AWS (containers, Kubernetes, ECS/EKS, Lambda) and offers practical optimization strategies — connection management, autoscaling, security, and observability — so you can run reliable, cost-efficient MCP hosts for development and production workflows.

Features

  • Lightweight MCP server implementations that integrate with AWS services
  • Multiple transport patterns supported (HTTP/WebSocket-style long-lived connections)
  • Docker-friendly: run locally or in containers (ECS, EKS, Fargate)
  • Config-driven client integration: simple JSON files for popular MCP clients
  • Integrations and examples for common tools (Kiro, Cursor, Cline, Windsurf)
  • Observability guidance: CloudWatch logs/metrics and graceful shutdown patterns
  • Security-first defaults: IAM roles, VPC placement, and Secrets Manager examples

Installation / Configuration

Quick local run using Docker:

# Pull the MCP server image and run on port 8080
docker pull ghcr.io/awslabs/mcp:latest
docker run -d --name mcp-server -p 8080:8080 ghcr.io/awslabs/mcp:latest

Example docker-compose (local development):

version: "3.8"
services:
  mcp:
    image: ghcr.io/awslabs/mcp:latest
    ports:
      - "8080:8080"
    environment:
      - LOG_LEVEL=info
      - AWS_REGION=us-west-2
    restart: unless-stopped

Kubernetes Deployment (minimal):

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mcp-server
spec:
  replicas: 2
  selector:
    matchLabels:
      app: mcp
  template:
    metadata:
      labels:
        app: mcp
    spec:
      containers:
        - name: mcp
          image: ghcr.io/awslabs/mcp:latest
          ports:
            - containerPort: 8080
          env:
            - name: AWS_REGION
              value: us-west-2
---
apiVersion: v1
kind: Service
metadata:
  name: mcp-svc
spec:
  type: LoadBalancer
  ports:
    - port: 80
      targetPort: 8080
  selector:
    app: mcp

Sample client config (e.g., ~/.kiro/settings/mcp.json):

{
  "mcp_host": "https://mcp.example.com",
  "timeout_ms": 60000,
  "auth": {
    "type": "bearer",
    "token_env": "MCP_CLIENT_TOKEN"
  }
}

Available Resources

  • Source and releases: https://github.com/awslabs/mcp
  • Example client configs included in repository for Kiro, Cursor, Cline, Windsurf
  • Lambda handler module: lightweight adapter to invoke MCP logic from AWS Lambda
  • Sample deployments: Docker, docker-compose, Kubernetes manifests in the repo
  • Security guidance and recommended IAM policies (see repo SECURITY.md)

Use Cases

  • Local developer productivity: run a local MCP server that exposes repo docs, recent builds, and local test data to your agentic IDE (e.g., Kiro or Cursor).
  • Centralized org MCP host: deploy a shared MCP server in a secure VPC to provide curated context (internal docs, approved data sources) to distributed clients without exposing raw data.
  • Bedrock / third-party model integrations: use MCP servers to normalize and enrich prompts with up-to-date company context before sending to a model endpoint.
  • Lambda-based adapters: for event-driven workflows, invoke small MCP handlers from Lambda to enrich tasks and return context to remote agents.

Deployment & Optimization Tips

  • Connection model: MCP clients often keep long-lived connections. Use ALB (HTTP/2 or WebSocket) or NLB depending on transport. If using ALB, enable sticky sessions only if required by your client.
  • Autoscaling: scale by active connection count and CPU; configure horizontal autoscaling targets that consider connection lifecycle rather than just request rate.
  • Resource limits: set container CPU/memory limits and graceful termination (SIGTERM + preStop) to allow clients to reconnect without dropped context.
  • Networking & security: place MCP servers in private subnets with a NAT or VPC endpoints for S3/Secrets Manager access. Use IAM roles for tasks/pods and store credentials in Secrets Manager.
  • Observability: emit metrics for connections, active sessions, request latencies, and errors. Ship logs to CloudWatch and create alarms for connection spikes or increased error rates.
  • Cost control: prefer Fargate for low ops overhead; use spot capacity for non-critical dev hosts. Right-size replicas based on connection profiles.

Troubleshooting Checklist

  • 502/503 behind load balancer: check health check path and container health ports.
  • Client reconnect storms after deploys: enable graceful shutdown and connection draining.
  • Authorization errors: verify IAM role and token configuration in client JSON files.

For full reference, examples, and contribution guidelines, see the project repository: https://github.com/awslabs/mcp.