Skip to main content

CloudThinker stdio MCP server for KubeCost / OpenCost: reads KUBECOST_* env at startup, auto-connects to the cost API, and serves read-only Kubernetes cost allocation, assets, cloud cost, and efficiency (right-sizing) tools.

Project description

ct-kubecost-mcp-server

A CloudThinker stdio MCP server for KubeCost and OpenCost. It auto-connects from environment variables and serves read-only Kubernetes cost tools, so it drops into CloudThinker's env-injection connection model.

There is no pip-installable upstream MCP to wrap — OpenCost's MCP server is Go, compiled into its cost-model binary (pkg/mcp/server.go). This server authors the tools directly against the KubeCost/OpenCost HTTP cost API, mirroring OpenCost's four query types: allocation, asset, cloudcost, efficiency.

What it does

  • Reads KUBECOST_* env vars at startup and connects to the cost API.
  • Serves read-only tools over stdio.
  • KubeCost serves the API under /model (/model/allocation); bare OpenCost serves it at the root (/allocation). Controlled by KUBECOST_API_PREFIX (default /model).

Run

uvx --from ct-kubecost-mcp-server@0.1.0 ct-kubecost-mcp-server

Environment

Var Required Default Purpose
KUBECOST_URL yes base URL of the KubeCost/OpenCost endpoint
KUBECOST_AUTH_TYPE no none none | bearer | basic
KUBECOST_TOKEN when bearer bearer token (Authorization: Bearer …)
KUBECOST_USERNAME when basic HTTP basic username
KUBECOST_PASSWORD when basic HTTP basic password
KUBECOST_API_PREFIX no /model path prefix; set empty ("") for bare OpenCost
KUBECOST_INSECURE_SKIP_VERIFY no false true → skip TLS verification
LOG_LEVEL no info mapped to FASTMCP_LOG_LEVEL

Tools (read-only)

Tool Purpose API
get_allocation in-cluster cost by namespace/controller/pod (chargeback) GET {prefix}/allocation
get_assets cloud asset cost (nodes, disks, network) GET {prefix}/assets
get_cloud_cost out-of-cluster cloud bill GET {prefix}/cloudCost
get_efficiency right-sizing — requested vs used, estimated wasted cost derived from /allocation
health reachability + auth probe GET {prefix}/allocation?window=1h

Time windows accept KubeCost/OpenCost formats: today, week, month, Nd (e.g. 7d), Nh, or an RFC3339 / unix-timestamp range.

Build

python -m build        # or: hatch build

License

Apache-2.0.

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

ct_kubecost_mcp_server-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

ct_kubecost_mcp_server-0.1.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file ct_kubecost_mcp_server-0.1.0.tar.gz.

File metadata

  • Download URL: ct_kubecost_mcp_server-0.1.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ct_kubecost_mcp_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0de3468c84cbc262a9f4ae7ddf09a3c415d992469b73aa19ed11ada2471c0b85
MD5 7aa95271e1013c37572d0fef4e52a7b6
BLAKE2b-256 cc60adba2ddd9cf3684e5ac0d3e65d2e75ac1a0fdd6f6f22524837218d32abb6

See more details on using hashes here.

File details

Details for the file ct_kubecost_mcp_server-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ct_kubecost_mcp_server-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ct_kubecost_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3440f1ef905877ee574dbde4d46ca12e1c6865c6f6839314c42e3af7a689b7e0
MD5 211ea86fb856cea90d3956253ef8a766
BLAKE2b-256 d11edb34d4645b714b02346dbbe45236488214429ed5e94dde6ec3c000ab36bc

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