Labsco
yubingjiaocn logo

MCP Server Automation CLI

from yubingjiaocn

A command-line tool to automate the deployment of MCP servers to AWS ECS.

πŸ”₯πŸ”₯βœ“ VerifiedFreeQuick setup

Migration Notice

This repo has been migrated to aws-samples. New repo path is https://github.com/aws-samples/sample-mcp-server-automation . This repo is archived.

MCP Server Automation CLI

A powerful CLI tool that automates the process of transforming Model Context Protocol (MCP) stdio servers into Docker images deployed on AWS ECS using mcp-proxy. This tool bridges the gap between local MCP servers and remote HTTP-based deployments.

πŸš€ Features

  • πŸ”„ Automatic Build: Fetch MCP servers from GitHub, build Docker images, and push to ECR
  • ☁️ One-Click Deploy: Generate CloudFormation templates and deploy complete ECS infrastructure
  • πŸ” Smart Detection: Automatically detect MCP server commands from README files
  • 🐳 Multi-Architecture: Support for Python, Node.js, and hybrid MCP servers
  • πŸ”§ Debug Support: Built-in debug logging for troubleshooting
  • πŸ“ Config Generation: Generate MCP client configurations for Claude Desktop, Cline, etc.

πŸ—οΈ Architecture

Build Process Flow

  1. Repository Analysis: Downloads GitHub repos and detects MCP server configuration from README files
  2. Command Detection: Parses JSON blocks in README files to extract MCP server start commands, prioritizing NPX/uvx over Docker commands
  3. Dockerfile Generation: Uses Jinja2 templates to create multi-stage Docker builds with mcp-proxy CLI integration
  4. Image Building: Creates hybrid Node.js + Python containers with proper dependency management

Deployment Architecture

GitHub Repo β†’ Docker Build β†’ ECR β†’ ECS Fargate ← ALB ← Internet
     ↓              ↓           ↓         ↓        ↓
MCP Server β†’ mcp-proxy + MCP β†’ Image β†’ Service β†’ HTTP/SSE Endpoints

Key Technical Details

  • mcp-proxy Integration: Uses TypeScript/Node.js CLI tool for HTTP transport with debug logging enabled
  • Container Architecture: Multi-stage builds with node:24-bullseye base image, includes netcat for health checks
  • Command Format: mcp-proxy --debug --port 8000 --shell <command> [-- <args>] for proper argument ordering
  • Transport Protocol: Converts MCP stdio to HTTP with /mcp endpoint for Streamable HTTP transport
  • Dynamic Tagging: Images tagged with git commit hash and timestamp (e.g., a1b2c3d4-develop-20231222-143055)
  • Branch Support: Can build from specific git branches, defaults to 'main'
  • Health Checks: Container uses netcat port checking, ALB health checks /mcp endpoint expecting HTTP 400
  • MCP Config Generation: Automatically generates and prints MCP client configuration after deployment
  • Infrastructure: Complete CloudFormation stack with VPC, ALB, ECS Fargate, security groups, and IAM roles

πŸ” AWS Permissions Required

The AWS credentials used must have the following permissions:

ECR Permissions

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ecr:BatchCheckLayerAvailability",
        "ecr:GetDownloadUrlForLayer",
        "ecr:BatchGetImage",
        "ecr:GetAuthorizationToken",
        "ecr:PutImage",
        "ecr:InitiateLayerUpload",
        "ecr:UploadLayerPart",
        "ecr:CompleteLayerUpload"
      ],
      "Resource": "*"
    }
  ]
}

ECS and CloudFormation Permissions

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ecs:*",
        "cloudformation:*",
        "ec2:*",
        "elasticloadbalancing:*",
        "iam:CreateRole",
        "iam:AttachRolePolicy",
        "iam:PassRole",
        "logs:CreateLogGroup",
        "logs:DescribeLogGroups"
      ],
      "Resource": "*"
    }
  ]
}

Security

See CONTRIBUTING for more information.

πŸ†˜ Support

  • Check the troubleshooting section for common issues
  • Review CloudFormation events in AWS Console for deployment issues
  • Use debug mode for detailed logging
  • Open an issue for bugs or feature requests