Skip to main content

MCP server for Datadog billable usage and cost analysis.

Project description

Datadog Cost Analyze Agent

MCP server for end-to-end Datadog billable usage and cost analysis.

The server exposes one MCP tool:

  • generate_full_cost_report

This tool runs the full workflow in one call:

  1. Fetch billable summary from Datadog
  2. Calculate org-level on-demand and committed allocation
  3. Generate CSV reports
  4. Calculate cost report
  5. Return report content as text in the MCP response

Requirements

  • Python 3.10+
  • Datadog credentials with usage_read permission:
    • DD_API_KEY
    • DD_APP_KEY
    • DD_SITE (optional, defaults to datadoghq.eu)

Install

python3 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt

Publish to PyPI

Package metadata is configured in pyproject.toml. Current package/command names:

  • Package: datadog-cost-analyze-agent-mcp
  • CLI entrypoint: datadog-cost-analyze-mcp

1) Build distribution files

.venv/bin/python -m pip install --upgrade build twine
.venv/bin/python -m build

This creates:

  • dist/*.tar.gz (source distribution)
  • dist/*.whl (wheel)

2) Validate package metadata

.venv/bin/python -m twine check dist/*

3) Upload to TestPyPI (recommended first)

.venv/bin/python -m twine upload --repository testpypi dist/*

4) Upload to PyPI

.venv/bin/python -m twine upload dist/*

5) Verify install from PyPI

python3 -m pip install <your-package-name>

Use API tokens for authentication:

  • TWINE_USERNAME=__token__
  • TWINE_PASSWORD=<pypi-token>

Run with uvx

After publishing to PyPI:

uvx --from datadog-cost-analyze-agent-mcp datadog-cost-analyze-mcp

For local testing before publish:

uvx --from . datadog-cost-analyze-mcp

Run MCP Server

.venv/bin/python mcp_server.py

MCP Tool

generate_full_cost_report

Arguments

  • month (string, required): Month in YYYY-MM format.

Returns

  • ok (boolean): Success status
  • message (string): Execution summary
  • month (string): Month used for the run
  • usage_org_count (number): Organization count in usage payload
  • final_cost_report_text (string): Final cost CSV content
  • detailed_report_text (string): Detailed usage CSV content
  • org_summary_report_text (string): Organization summary CSV content
  • product_summary_report_text (string): Product summary CSV content
  • error (string): Present when ok is false

Generated Files

The workflow also writes default files to .out/:

  • .out/billable_summary.json
  • .out/billable_detailed_report.csv
  • .out/billable_org_summary.csv
  • .out/billable_product_summary.csv
  • .out/datadog_cost_report.csv

Example MCP Client Config

Using uvx (recommended after publish)

{
  "mcpServers": {
    "datadog-cost-analyze": {
      "command": "uvx",
      "args": ["--from", "datadog-cost-analyze-agent-mcp", "datadog-cost-analyze-mcp"],
      "env": {
        "DD_API_KEY": "your_api_key",
        "DD_APP_KEY": "your_app_key",
        "DD_SITE": "datadoghq.eu"
      }
    }
  }
}

Using local Python directly

{
  "mcpServers": {
    "datadog-cost-analyze": {
      "command": "/absolute/path/to/.venv/bin/python",
      "args": ["/absolute/path/to/mcp_server.py"],
      "env": {
        "DD_API_KEY": "your_api_key",
        "DD_APP_KEY": "your_app_key",
        "DD_SITE": "datadoghq.eu"
      }
    }
  }
}

Pricing Source

Cost calculations are based on Datadog pricing:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datadog_cost_analyze_agent_mcp-0.1.1.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datadog_cost_analyze_agent_mcp-0.1.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file datadog_cost_analyze_agent_mcp-0.1.1.tar.gz.

File metadata

File hashes

Hashes for datadog_cost_analyze_agent_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 99850a58fdf2ad2d43930d6f930391432a51768234e28190b3b20736ee3430e2
MD5 52b8618bd9cd846334540cf4309c8bac
BLAKE2b-256 2c367e2041a98c2f63f14f99859cbefcb8bbefe4c9c2a2f46acfcc858188d711

See more details on using hashes here.

File details

Details for the file datadog_cost_analyze_agent_mcp-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for datadog_cost_analyze_agent_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 81f7f1fdc95ffaea1a2ff208e4100ee55344ac4edaff4cbf8bd9a4a30c65eaef
MD5 6e425f8b07cc4baf6009c51f6937da1d
BLAKE2b-256 914b7308234f6785d75b5b5eaf4e6331ee6b283bdf0d9c5e25da2a59324d6fed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page