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 byKUBECOST_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.
Metadata
Release files for ct-kubecost-mcp-server 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ct_kubecost_mcp_server-0.2.0.tar.gz | 104.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ct_kubecost_mcp_server-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 115.7 kB
Release files / ct_kubecost_mcp_server-0.2.0.tar.gz
| Download URL | ct_kubecost_mcp_server-0.2.0.tar.gz |
|---|---|
| Size | 104.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a73dde6bf89e9dde14fc2e0b31a27c99bbdf5ab5d00faec16e108dfe79cc61ab
|
|
BLAKE2b-256 checksum How to use checksums |
0c3ae1e7463c89da647e36e6481d719829764fd28e2fb3bf81e55f2cb83b7ad1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / ct_kubecost_mcp_server-0.2.0-py3-none-any.whl
| Download URL | ct_kubecost_mcp_server-0.2.0-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a5aa11c865d00d3cad5a9e09c57ceed80a0a2e5e4bed058160ba2db6b25c0214
|
|
BLAKE2b-256 checksum How to use checksums |
1b267c1ae3f926effe74525a4be83d526a73051a378ba011986a281fe1898065
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Security for ct-kubecost-mcp-server 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.