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.
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
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
The MCP server provides pricing data with multiple pricing models:
You can filter EC2 instances based on:
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.
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"
}
}
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.
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.
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.
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"
]
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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