MCP ExplorerExplorer

Ecs Mcp

@neoai-agenton 4 days ago
6 MIT
FreeCommunity
AI Systems
A command-line tool for monitoring AWS ECS metrics using MCP.

Overview

What is Ecs Mcp

AWS ECS MCP Server is a command-line tool designed for monitoring and analyzing metrics from AWS Elastic Container Service (ECS) with the integration of Model Control Protocol (MCP). It facilitates the collection and visualization of various performance metrics to enhance the management of containerized applications in AWS.

Use cases

This tool can be utilized to efficiently retrieve and analyze different aspects of ECS performance, such as cluster details, service and task metrics, container insights, load balancer metrics, and auto-scaling metrics. It is particularly beneficial for DevOps teams and system administrators seeking to optimize container workloads and ensure effective resource utilization.

How to use

To use the AWS ECS MCP Server, you need to run the server with your AWS credentials and region information. After launching, various asynchronous functions can be called to access specific metrics, such as fetching cluster details or service metrics, simply by providing relevant parameters like cluster and service names, as well as time range.

Key features

The key features include the ability to gather detailed information on clusters, services, and tasks within ECS, as well as collect insights on container performance, load balancer activity, and auto-scaling behavior. The integration with OpenAI’s API allows for advanced analysis and insights based on the gathered metrics.

Where to use

This tool is primarily used within cloud-based environments where AWS ECS is employed for container management. It is suitable for development, testing, and production systems, enabling users to monitor and analyze application health and performance in real-time, ultimately supporting better decision-making and system optimization.

Content

AWS ECS MCP Server

A Model Context Protocol (MCP) server for monitoring and analyzing AWS ECS (Elastic Container Service) metrics and services.

Features

  • ECS Service Monitoring: Check service status, health, and deployment information
  • CloudWatch Metrics: Get CPU, memory, and custom metrics for ECS services
  • Load Balancer Integration: Monitor target group health and response times
  • IAM Role Support: Works seamlessly with EC2 instance roles and ECS task roles
  • Intelligent Name Matching: Uses AI to find the correct cluster and service names

Installation

Install directly from GitHub using pipx:

# Install
pipx install git+https://github.com/yourusername/ecs-mcp.git

# Or run without installation
pipx run git+https://github.com/yourusername/ecs-mcp.git

Quick Start

On EC2 with IAM Role (Recommended)

ecs-mcp --openai-api-key "YOUR_OPENAI_API_KEY" --region "YOUR_AWS_REGION"

With Explicit AWS Credentials

ecs-mcp --openai-api-key "YOUR_OPENAI_API_KEY" --access-key "YOUR_AWS_ACCESS_KEY" --secret-access-key "YOUR_AWS_SECRET_KEY" --region "YOUR_AWS_REGION"

Available Tools

The server provides the following tools for AWS ECS analysis:

  1. check_ecs_service_status: Get comprehensive service status including:

    • Running vs desired task count
    • Deployment status
    • Container images
    • Target group health
    • Unhealthy tasks
  2. get_service_metrics: Get CloudWatch metrics for ECS services:

    • CPU utilization
    • Memory utilization
    • Custom metrics
  3. get_ecs_target_group_response_time: Monitor load balancer response times

  4. get_ecs_target_group_request_metrics: Get request count and error metrics

  5. get_ecs_services: List all services in a cluster

IAM Permissions

For EC2 instance role or ECS task role:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ecs:ListClusters",
        "ecs:DescribeClusters",
        "ecs:ListServices",
        "ecs:DescribeServices",
        "ecs:ListTasks",
        "ecs:DescribeTasks",
        "ecs:DescribeTaskDefinition",
        "elasticloadbalancing:DescribeTargetHealth",
        "cloudwatch:GetMetricData",
        "cloudwatch:GetMetricStatistics"
      ],
      "Resource": "*"
    }
  ]
}

Development

For development setup:

git clone https://github.com/yourusername/ecs-mcp.git
cd ecs-mcp
python -m venv ecs-venv
source ecs-venv/bin/activate  # On Windows: ecs-venv\Scripts\activate
pip install -e ".[dev]"

License

MIT License - See LICENSE file for details

Tools

No tools

Comments