MCP server for interacting with AWS Managed Prometheus
Project description
Prometheus MCP Server
The Prometheus MCP Server provides a robust interface for interacting with AWS Managed Prometheus, enabling users to execute PromQL queries, list metrics, and retrieve server information with AWS SigV4 authentication support.
This MCP server is designed to be fully compatible with Amazon Q developer CLI, allowing seamless integration of Prometheus monitoring capabilities into your Amazon Q workflows. You can load the server directly into Amazon Q to leverage its powerful querying and metric analysis features through the familiar Q interface.
Features
- Execute instant PromQL queries against AWS Managed Prometheus
- Execute range queries with start time, end time, and step interval
- List all available metrics in your Prometheus instance
- Get server configuration information
- AWS SigV4 authentication for secure access
- Automatic retries with exponential backoff
Installation
| Cursor | VS Code |
|---|---|
Prerequisites
- Python 3.10 or higher
- AWS credentials configured with appropriate permissions
- AWS Managed Prometheus workspace
Configuration
The server is configured through the Amazon Q MCP configuration file as shown in the Usage section below.
Usage with Amazon Q
Here are some ways you can work with MCP across AWS, and we'll be adding support to more products including Amazon Q Developer CLI soon:
- Create a configuration file:
mkdir -p ~/.aws/amazonq/
- Add the following to
~/.aws/amazonq/mcp.json:
Basic Configuration
{
"mcpServers": {
"prometheus": {
"command": "uvx",
"args": [
"awslabs.prometheus-mcp-server@latest"
],
"env": {
"FASTMCP_LOG_LEVEL": "DEBUG"
}
}
}
}
Windows Installation
For Windows users, the MCP server configuration format is slightly different:
{
"mcpServers": {
"awslabs.prometheus-mcp-server": {
"disabled": false,
"timeout": 60,
"type": "stdio",
"command": "uv",
"args": [
"tool",
"run",
"--from",
"awslabs.prometheus-mcp-server@latest",
"awslabs.prometheus-mcp-server.exe"
],
"env": {
"FASTMCP_LOG_LEVEL": "ERROR",
"AWS_PROFILE": "your-aws-profile",
"AWS_REGION": "us-east-1"
}
}
}
}
Configuration with Optional Arguments
{
"mcpServers": {
"prometheus": {
"command": "uvx",
"args": [
"awslabs.prometheus-mcp-server@latest",
"--url",
"https://aps-workspaces.<AWS Region>.amazonaws.com/workspaces/ws-<Workspace ID>",
"--region",
"<Your AWS Region>",
"--profile",
"<Your CLI Profile>"
],
"env": {
"FASTMCP_LOG_LEVEL": "DEBUG"
}
}
}
}
- In Amazon Q, you can now use the Prometheus MCP server to query your metrics.
Available Tools
-
GetAvailableWorkspaces
- List all available Prometheus workspaces in the specified region
- Parameters: region (optional)
- Returns: List of workspaces with IDs, aliases, and status
-
ExecuteQuery
- Execute instant PromQL queries against Prometheus
- Parameters: workspace_id (required), query (required), time (optional), region (optional)
-
ExecuteRangeQuery
- Execute PromQL queries over a time range
- Parameters: workspace_id (required), query, start time, end time, step interval, region (optional)
-
ListMetrics
- Retrieve all available metric names from Prometheus
- Parameters: workspace_id (required), region (optional)
- Returns: Sorted list of metric names
-
GetServerInfo
- Retrieve server configuration details
- Parameters: workspace_id (required), region (optional)
- Returns: URL, region, profile, and service information
Example Queries
# Get available workspaces
workspaces = await get_available_workspaces()
for ws in workspaces['workspaces']:
print(f"ID: {ws['workspace_id']}, Alias: {ws['alias']}, Status: {ws['status']}")
# Execute an instant query
result = await execute_query(
workspace_id="ws-12345678-abcd-1234-efgh-123456789012",
query="up"
)
# Execute a range query
data = await execute_range_query(
workspace_id="ws-12345678-abcd-1234-efgh-123456789012",
query="rate(node_cpu_seconds_total[5m])",
start="2023-01-01T00:00:00Z",
end="2023-01-01T01:00:00Z",
step="1m"
)
# List available metrics
metrics = await list_metrics(
workspace_id="ws-12345678-abcd-1234-efgh-123456789012"
)
# Get server information
info = await get_server_info(
workspace_id="ws-12345678-abcd-1234-efgh-123456789012"
)
Troubleshooting
Common issues and solutions:
-
AWS Credentials Not Found
- Check ~/.aws/credentials
- Set AWS_PROFILE environment variable
- Verify IAM permissions
-
Connection Errors
- Verify Prometheus URL is correct
- Check network connectivity
- Ensure AWS VPC access is configured correctly
-
Authentication Failures
- Verify AWS credentials are current
- Check system clock synchronization
- Ensure correct AWS region is specified
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file awslabs_prometheus_mcp_server-0.2.8.tar.gz.
File metadata
- Download URL: awslabs_prometheus_mcp_server-0.2.8.tar.gz
- Upload date:
- Size: 112.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e737ac19bdf19b92c46b39bd1df74b02e0ba45a186f7321d88143b12939bceb
|
|
| MD5 |
dc53a02dd09e99c617512af4ce453ad6
|
|
| BLAKE2b-256 |
0979f48e42f10a574847cfc7e7a39a6a23b1b0d1e3fea1ae8003e9165f7e3784
|
Provenance
The following attestation bundles were made for awslabs_prometheus_mcp_server-0.2.8.tar.gz:
Publisher:
release.yml on awslabs/mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
awslabs_prometheus_mcp_server-0.2.8.tar.gz -
Subject digest:
2e737ac19bdf19b92c46b39bd1df74b02e0ba45a186f7321d88143b12939bceb - Sigstore transparency entry: 760636757
- Sigstore integration time:
-
Permalink:
awslabs/mcp@b9285f738decde5882800b52bdafd0d7917af735 -
Branch / Tag:
refs/tags/2025.12.20251211225414 - Owner: https://github.com/awslabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b9285f738decde5882800b52bdafd0d7917af735 -
Trigger Event:
push
-
Statement type:
File details
Details for the file awslabs_prometheus_mcp_server-0.2.8-py3-none-any.whl.
File metadata
- Download URL: awslabs_prometheus_mcp_server-0.2.8-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cebbcd037168a59765f7556a1b6c7d27cd917a0ee5cb22c691f7ca2ff641ec94
|
|
| MD5 |
7aea8233f19e90bc857a9d46a450004a
|
|
| BLAKE2b-256 |
2c9f587f294eae080d32cf552065e80672dadae982310fd5f7a66ec73a458bb4
|
Provenance
The following attestation bundles were made for awslabs_prometheus_mcp_server-0.2.8-py3-none-any.whl:
Publisher:
release.yml on awslabs/mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
awslabs_prometheus_mcp_server-0.2.8-py3-none-any.whl -
Subject digest:
cebbcd037168a59765f7556a1b6c7d27cd917a0ee5cb22c691f7ca2ff641ec94 - Sigstore transparency entry: 760636758
- Sigstore integration time:
-
Permalink:
awslabs/mcp@b9285f738decde5882800b52bdafd0d7917af735 -
Branch / Tag:
refs/tags/2025.12.20251211225414 - Owner: https://github.com/awslabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b9285f738decde5882800b52bdafd0d7917af735 -
Trigger Event:
push
-
Statement type: