Skip to main content

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.2.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.

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.2.0.tar.gz (104.2 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.2.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ct_kubecost_mcp_server-0.2.0.tar.gz
  • Upload date:
  • Size: 104.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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.2.0.tar.gz
Algorithm Hash digest
SHA256 a73dde6bf89e9dde14fc2e0b31a27c99bbdf5ab5d00faec16e108dfe79cc61ab
MD5 2a31f6934937ae18321eaaae64d24fc3
BLAKE2b-256 0c3ae1e7463c89da647e36e6481d719829764fd28e2fb3bf81e55f2cb83b7ad1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ct_kubecost_mcp_server-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5aa11c865d00d3cad5a9e09c57ceed80a0a2e5e4bed058160ba2db6b25c0214
MD5 db8c46efaff17e6c2875df7eaa29ad64
BLAKE2b-256 1b267c1ae3f926effe74525a4be83d526a73051a378ba011986a281fe1898065

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Supported by

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