AWS EC2 Pricing MCP server

Provides real-time AWS EC2 instance pricing data with powerful filtering capabilities for cost optimization and infrastructure planning
Back to servers
Setup instructions
Provider
Trilogy Group
Release date
May 02, 2025
Language
Python
Stats
16 stars

AWS Pricing MCP is a Model Context Protocol (MCP) server that provides EC2 instance pricing data to help you find the most cost-effective AWS instances. It's available as both a traditional server and a serverless Lambda function, offering up-to-date pricing information through a standard JSON-RPC 2.0 interface.

Installation Options

Serverless Lambda Deployment

The Lambda deployment option is recommended for most users as it offers serverless benefits with minimal maintenance:

# Build and deploy using AWS SAM
sam build
sam deploy --guided

# Get the Function URL to access your MCP server
aws cloudformation describe-stacks \
  --stack-name aws-pricing-mcp \
  --query 'Stacks[0].Outputs[?OutputKey==`FunctionUrl`].OutputValue' \
  --output text

Traditional Server Deployment

If you prefer to run the server on your own infrastructure:

# Install dependencies
pip install -r requirements.txt

# Run the server
python src/server.py

Features and Usage

Available Pricing Models

The MCP server provides pricing data with multiple pricing models:

  • On Demand pricing
  • Reserved Instances pricing
  • CloudFix RightSpend optimized pricing

Filtering Options

You can filter EC2 instances based on:

  • AWS Region
  • Platform (Linux, Windows, etc.)
  • Tenancy options
  • Compute specifications (vCPU, RAM)
  • GPU requirements
  • Other instance attributes

Example Usage

The server implements the MCP protocol (JSON-RPC 2.0), so you can make requests to find the best EC2 instance for your needs. Here's a basic example of how to interact with the server:

import requests
import json

# Replace with your actual server URL
server_url = "http://localhost:8000"  # or Lambda Function URL

# Example request to find cheapest instances with specific requirements
payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "aws.pricing.find_instances",
    "params": {
        "min_vcpu": 4,
        "min_memory_gb": 16,
        "region": "us-east-1",
        "platform": "Linux",
        "max_results": 5
    }
}

response = requests.post(server_url, json=payload)
results = response.json()

print(json.dumps(results, indent=2))

This will return the top 5 most cost-effective EC2 instances in the us-east-1 region that meet your minimum requirements of 4 vCPUs and 16GB of RAM for Linux.

Advanced Configuration

Custom Region Settings

You can specify different AWS regions for pricing data:

# Example for EU region
payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "aws.pricing.find_instances",
    "params": {
        "min_vcpu": 2,
        "min_memory_gb": 8,
        "region": "eu-west-1",
        "platform": "Linux"
    }
}

Filtering by Instance Family

If you need specific instance types or families:

# Get only compute-optimized instances
payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "aws.pricing.find_instances",
    "params": {
        "instance_family": "c6g",  # ARM-based compute optimized
        "region": "us-west-2"
    }
}

The server provides dynamic pricing data that's regularly updated from AWS's pricing sources, ensuring you always have access to the latest information for making cost-effective instance selections.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "AWS-EC2-Pricing-MCP" '{"command":"docker","args":["run","--rm","-i","-q","--network","none","ai1st/aws-pricing-mcp"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "AWS EC2 Pricing MCP": {
            "command": "docker",
            "args": [
                "run",
                "--rm",
                "-i",
                "-q",
                "--network",
                "none",
                "ai1st/aws-pricing-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "AWS EC2 Pricing MCP": {
            "command": "docker",
            "args": [
                "run",
                "--rm",
                "-i",
                "-q",
                "--network",
                "none",
                "ai1st/aws-pricing-mcp"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later