Skip to main content
Glama
sigitp-git

Amazon Managed Prometheus MCP Server

by sigitp-git

Amazon Managed Prometheus MCP Server

An MCP (Model Context Protocol) server that provides access to Amazon Managed Prometheus workspaces using the FastMCP SDK and uv for fast Python package management.

Features

  • List Amazon Managed Prometheus workspaces

  • Get workspace details and configuration

  • Query metrics from Prometheus workspaces

  • Execute PromQL queries

  • Get workspace status and metadata

  • Fast dependency management with uv

Related MCP server: Prometheus MCP Server

Prerequisites

  1. Install uv (if not already installed):

    # On macOS and Linux
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
    # On Windows
    powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
    
    # Or with pip
    pip install uv
  2. AWS Credentials: Configure AWS credentials (one of the following):

    • AWS CLI: aws configure

    • Environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION

    • IAM roles (if running on EC2)

Installation

Quick Start with uv

# Clone or navigate to the project directory
cd prometheus-mcp-server

# Create virtual environment and install dependencies
uv sync

# Activate the virtual environment
source .venv/bin/activate  # On Unix/macOS
# or
.venv\Scripts\activate     # On Windows

# Run the server
uv run prometheus-mcp-server

Development Installation

# Install with development dependencies
uv sync --extra dev

# Install with test dependencies
uv sync --extra test

# Install all optional dependencies
uv sync --all-extras

Alternative Installation Methods

# Install in editable mode
uv pip install -e .

# Install from PyPI (when published)
uv pip install prometheus-mcp-server

# Install specific version
uv pip install prometheus-mcp-server==0.1.0

Usage

Running the MCP Server

# Using uv run (recommended)
uv run prometheus-mcp-server

# Or after activating virtual environment
prometheus-mcp-server

# Run with specific region
AWS_REGION=us-west-2 uv run prometheus-mcp-server

Testing the Server

# Run all tests
uv run pytest

# Run tests with coverage
uv run pytest --cov=prometheus_mcp_server

# Run integration tests
uv run python test_demo.py

# Run simple server test
uv run python src/prometheus_mcp_server/simple_server.py

Development Commands

# Format code
uv run black src/ tests/
uv run isort src/ tests/

# Lint code
uv run ruff check src/ tests/

# Type checking
uv run mypy src/

# Run all quality checks
uv run black --check src/ tests/
uv run isort --check-only src/ tests/
uv run ruff check src/ tests/
uv run mypy src/
uv run pytest

Required AWS Permissions

The server requires the following AWS permissions:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "aps:ListWorkspaces",
                "aps:DescribeWorkspace",
                "aps:QueryMetrics"
            ],
            "Resource": "*"
        }
    ]
}

Available Tools

  • list_workspaces: List all Amazon Managed Prometheus workspaces

  • get_workspace: Get detailed information about a specific workspace

  • query_metrics: Execute PromQL queries against a workspace

  • get_workspace_status: Get the current status of a workspace

Configuration

Environment Variables

# AWS Configuration
export AWS_REGION=us-east-1
export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key

# Optional: Enable debug logging
export LOG_LEVEL=DEBUG

MCP Client Configuration

Example configuration for MCP clients:

{
  "mcpServers": {
    "prometheus": {
      "command": "uv",
      "args": [
        "run", 
        "--directory", 
        "/path/to/prometheus-mcp-server",
        "prometheus-mcp-server"
      ],
      "env": {
        "AWS_REGION": "us-east-1"
      }
    }
  }
}

Development with uv

Adding Dependencies

# Add runtime dependency
uv add boto3

# Add development dependency
uv add --dev pytest

# Add optional dependency
uv add --optional test pytest-mock

Managing Python Versions

# Use specific Python version
uv python install 3.11
uv sync --python 3.11

# List available Python versions
uv python list

Virtual Environment Management

# Create virtual environment
uv venv

# Activate virtual environment
source .venv/bin/activate

# Deactivate
deactivate

# Remove virtual environment
rm -rf .venv

Project Structure

prometheus-mcp-server/
├── src/prometheus_mcp_server/
│   ├── __init__.py          # Package initialization
│   ├── main.py              # Main MCP server with FastMCP tools
│   ├── auth.py              # AWS SigV4 authentication utilities
│   ├── client.py            # Enhanced client with authentication
│   └── simple_server.py     # Simple test server
├── tests/
│   ├── test_prometheus_server.py  # Original unit tests
│   └── test_simple_server.py      # Simple server tests
├── examples/
│   ├── example_usage.py     # Usage examples
│   └── mcp_config.json      # MCP client configuration
├── pyproject.toml           # Project configuration with uv support
├── .python-version          # Python version specification
├── README.md                # This file
├── test_demo.py            # Comprehensive test demonstration
└── TEST_RESULTS.md         # Test results documentation

Performance Benefits with uv

  • Fast Installation: Up to 10-100x faster than pip

  • Reliable Resolution: Better dependency resolution

  • Disk Efficient: Shared package cache

  • Reproducible Builds: Lock file ensures consistency

  • Cross-Platform: Works on Windows, macOS, and Linux

Troubleshooting

Common Issues

  1. FastMCP not found:

    # Install FastMCP from GitHub
    uv add git+https://github.com/jlowin/fastmcp.git
  2. AWS Credentials Error:

    # Configure AWS credentials
    aws configure
    # or set environment variables
    export AWS_ACCESS_KEY_ID=your_key
    export AWS_SECRET_ACCESS_KEY=your_secret
  3. Permission Denied:

    • Ensure IAM user/role has required AMP permissions

    • Check AWS region configuration

Debug Mode

# Enable verbose logging
LOG_LEVEL=DEBUG uv run prometheus-mcp-server

# Run with AWS debug
AWS_DEBUG=1 uv run prometheus-mcp-server

Contributing

  1. Fork the repository

  2. Create a feature branch: git checkout -b feature-name

  3. Install development dependencies: uv sync --extra dev

  4. Make your changes

  5. Run tests: uv run pytest

  6. Run quality checks: uv run black src/ && uv run ruff check src/

  7. Commit your changes: git commit -am 'Add feature'

  8. Push to the branch: git push origin feature-name

  9. Create a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

v0.1.0

  • Initial release

  • Basic workspace listing and querying

  • AWS authentication support

  • Multi-region support

  • uv package management integration

Available Tools

4 tools
get_workspaceC

Get detailed information about a specific Amazon Managed Prometheus workspace.

Args: workspace_id: The ID of the workspace to retrieve region: AWS region where the workspace is located (default: us-east-1)

Returns: JSON string containing workspace details

ParametersJSON Schema
NameRequiredDescriptionDefault
regionNous-east-1
workspace_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves workspace details but doesn't disclose critical behavioral traits such as required permissions, rate limits, error handling, or whether it's a read-only operation (though implied by 'Get'). This leaves significant gaps for an AI agent to understand how to invoke it safely and effectively.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and appropriately sized. It front-loads the purpose in the first sentence, followed by clear sections for Args and Returns. Each sentence earns its place by adding value, with no redundant or verbose language.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 parameters, no annotations, but with an output schema), the description is partially complete. It covers the purpose and parameters adequately, and the output schema handles return values, so the description doesn't need to explain those. However, it lacks behavioral context (e.g., permissions, errors) that would be helpful for safe invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful semantics for both parameters: 'workspace_id' is explained as 'The ID of the workspace to retrieve,' and 'region' as 'AWS region where the workspace is located (default: us-east-1).' This compensates for the 0% schema description coverage by providing clear, actionable context beyond the schema's basic titles and types.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get detailed information about a specific Amazon Managed Prometheus workspace.' It uses a specific verb ('Get') and resource ('workspace'), but doesn't explicitly distinguish it from sibling tools like 'get_workspace_status' or 'list_workspaces', which likely provide different types of workspace information.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_workspace_status' (which might provide status vs. detailed info) or 'list_workspaces' (which might list multiple vs. get one), nor does it specify prerequisites or exclusions for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_workspace_statusB

Get the current status of an Amazon Managed Prometheus workspace.

Args: workspace_id: The ID of the workspace region: AWS region where the workspace is located (default: us-east-1)

Returns: JSON string containing workspace status information

ParametersJSON Schema
NameRequiredDescriptionDefault
regionNous-east-1
workspace_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions the return format ('JSON string') but lacks critical behavioral details like authentication requirements, rate limits, error handling, or whether it's a read-only operation. The description doesn't contradict annotations, but it's insufficient for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, starting with the core purpose. The 'Args' and 'Returns' sections are structured clearly, but the 'Returns' section could be more concise (e.g., 'JSON with workspace status'). Overall, it's efficient with minimal waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, 0% schema coverage, and an output schema present, the description is moderately complete. It covers purpose and parameters adequately but lacks behavioral context (e.g., auth, errors). The output schema reduces the need to explain return values, but more guidance on usage and transparency would improve completeness for this read operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds meaningful semantics for both parameters: 'workspace_id' is explained as 'The ID of the workspace', and 'region' as 'AWS region where the workspace is located (default: us-east-1)'. This clarifies beyond the schema's basic titles, though it doesn't detail format constraints (e.g., region codes).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('current status of an Amazon Managed Prometheus workspace'). It distinguishes from siblings like 'get_workspace' (likely returns different workspace details) and 'list_workspaces' (returns multiple workspaces). However, it doesn't explicitly differentiate from 'query_metrics', which might overlap in context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_workspace' or 'list_workspaces'. It lacks context such as prerequisites (e.g., needing workspace ID) or exclusions (e.g., not for querying metrics). Usage is implied through parameter descriptions but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_workspacesA

List all Amazon Managed Prometheus workspaces in the specified region.

Args: region: AWS region to query (default: us-east-1)

Returns: JSON string containing list of workspaces with their details

ParametersJSON Schema
NameRequiredDescriptionDefault
regionNous-east-1

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the basic operation (listing workspaces) and return format (JSON string), but doesn't mention important behavioral aspects like pagination, rate limits, authentication requirements, error handling, or whether the operation is read-only (though implied by 'list'). Some useful context is missing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly structured and concise with zero waste. It opens with the core purpose, then provides clear Args and Returns sections. Every sentence earns its place by delivering essential information without redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (single parameter, no nested objects) and the presence of an output schema, the description is reasonably complete. It covers the basic operation, parameter semantics, and return format. However, for a tool with no annotations, it could benefit from more behavioral context about authentication, limits, or error scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage and only one parameter, the description adds significant value by explaining the region parameter's purpose ('AWS region to query') and providing the default value ('us-east-1'). This compensates well for the lack of schema descriptions, though it doesn't elaborate on region format constraints or valid values.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('List all Amazon Managed Prometheus workspaces') and resource ('workspaces in the specified region'), distinguishing it from siblings like get_workspace (singular retrieval) and query_metrics (different operation). It uses precise language that leaves no ambiguity about what the tool does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by specifying the region parameter, but doesn't explicitly state when to use this tool versus alternatives like get_workspace or get_workspace_status. No guidance is provided about prerequisites, error conditions, or specific scenarios where this tool is preferred over others.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

query_metricsA

Execute a PromQL query against an Amazon Managed Prometheus workspace.

Args: workspace_id: The ID of the workspace to query query: PromQL query string region: AWS region where the workspace is located (default: us-east-1) start_time: Start time for range queries (RFC3339 format) end_time: End time for range queries (RFC3339 format) step: Query resolution step for range queries (e.g., "15s", "1m")

Returns: JSON string containing query results or preparation details

ParametersJSON Schema
NameRequiredDescriptionDefault
end_timeNo
queryYes
regionNous-east-1
start_timeNo
stepNo
workspace_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool executes queries and returns JSON results, but lacks details on error handling, rate limits, authentication requirements, or whether it's read-only or mutating. The description doesn't contradict annotations (none exist), but provides only basic operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement followed by organized parameter and return sections. Every sentence adds value, though the parameter explanations could be slightly more concise. It's appropriately sized for a 6-parameter tool with technical details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (6 parameters, technical query execution) and the presence of an output schema (which handles return values), the description is reasonably complete. It covers the core purpose and parameters well, though it lacks usage context and some behavioral details. The output schema reduces the need to describe return format in the description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It provides clear explanations for all 6 parameters, including format details (RFC3339 for times, examples like '15s' for step), defaults (region: us-east-1), and context (range queries for start/end/step). This adds substantial value beyond the bare schema, though it doesn't fully explain parameter interactions or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Execute a PromQL query against an Amazon Managed Prometheus workspace.' It specifies the exact action (execute), technology (PromQL), and target resource (Amazon Managed Prometheus workspace), which distinguishes it from sibling tools that focus on workspace management rather than query execution.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. While it's clear this is for querying metrics, there's no mention of when to use it over other query methods or tools, nor any prerequisites or constraints beyond the parameters listed. This leaves the agent without context for tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A3.5/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: list_workspaces enumerates all workspaces, get_workspace retrieves detailed information, get_workspace_status checks status, and query_metrics executes PromQL queries. There is no overlap or ambiguity between these functions.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with snake_case: list_workspaces, get_workspace, get_workspace_status, and query_metrics. The naming is predictable and readable throughout.

Tool Count4/5

Four tools is reasonable for a focused Prometheus monitoring server, covering core operations like listing, retrieving, checking status, and querying. It might be slightly thin for full CRUD operations, but it aligns well with the server's purpose.

Completeness3/5

The tools cover read and query operations effectively, but there are notable gaps in write operations (e.g., create, update, or delete workspaces). This limits agents to monitoring and querying without management capabilities, which could be a constraint for full lifecycle workflows.

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Provides access to Prometheus metrics and queries through standardized Model Context Protocol interfaces, allowing AI assistants to execute PromQL queries and analyze metrics data.
    6
    513
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A tool that enables access to Prometheus metrics data through a Model Context Protocol server, allowing interaction with monitoring data using natural language.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A tool that lets users access Prometheus metrics data through a Model Context Protocol server, supporting authentication options for secure data retrieval.
    1
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Provides seamless integration between AI assistants and Prometheus, enabling natural language interactions with your monitoring infrastructure. This server allows for effortless querying, discovery, and analysis of metrics.
    10
    4,823
    27
    MIT

Appeared in Searches

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sigitp-git/prometheus-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server