Skip to main content Switch to mobile version infralens-mcp 0.4.0 Vendor-neutral platform layer that lets any AI agent discover cloud cost savings and catch reliability issues early, across any cloud, through MCP.
pip install infralens-mcp==0.4.0 Copy PIP instructions
An open-source MCP server that lets any AI agent discover cloud cost savings and catch reliability issues early, across AWS, Azure and Kubernetes. Read-only by design.
Plug clouds in on one side and AI clients on the other: Claude, ChatGPT, Cursor, or a local model through Ollama, all over the open Model Context Protocol. infralens discovers and explains; a human takes the suggested action.
📖 Documentation wiki · Getting started · Connect your AI · Safety model · Real-account results
Every platform team has two opportunities hiding in plain sight:
Cost savings waiting to be captured. Idle instances, unattached volumes, databases with zero connections, unused IPs, old snapshots. Give each one an owner and a one-line action, and the money comes back.
Knowing first. Error rates creep up after a deploy; a disk fills over a week. Spot it early and answer "what changed?" in seconds instead of 40 minutes across consoles.
AI assistants can reason about this, but they can't see your infrastructure. infralens gives them safe, structured, read-only eyes, with one standard that works on every cloud and with every model.
Every discovery has an estimated $/month, an owner (from tags), evidence and a ready-to-run action. Each one is tracked over time (new → open → acknowledged/suppressed → resolved), so the report shows only what changed, and resolved cost savings are counted as savings captured.
Tested on real infrastructure
AWS (real account, us-east-2). Planted 5 resources with demo/sandbox-tofu, then scanned:
After tofu destroy, the next scan reported 5 resolved and $5.25/mo of cost savings captured. The run also found two bugs that simulated data couldn't: CloudShell heartbeats being reported as "likely causes", and misleading timing labels. Both are fixed, with regression tests built from the real events.
Kubernetes (real cluster in every CI run). CI creates a kind cluster, deploys the deliberately broken demo/k8s namespace and scans it using only the read-only RBAC role: 7 of 7 discoveries, no false positives, and the crash loop traced to the rollout that caused it.
An AI client calling the MCP server (simulated AWS account, docker compose up):
The daily discoveries report. Note the likely cause pinned to the deploy that changed DB_POOL_MAX, and the password masked in the log line:
No cloud account needed, one command:
pip install "infralens-mcp[aws,k8s]" infralens scan # built-in demo environment: 10 discoveries, $533/mo of cost savings As a container (multi-arch, non-root, with SBOM):
docker run -p 127.0.0.1:8080:8080 -e INFRALENS_API_TOKEN=change-me ghcr.io/balakrishnagatla/infralens:latest From source: git clone https://github.com/balakrishnagatla/infralens && cd infralens && pip install -e ".[aws]".
Full local demo against a simulated AWS account (Docker only):
docker compose up --build -d # simulated AWS → seeded discoveries → MCP server on localhost:8080 python demo/mcp_client_demo.py http://localhost:8080/mcp change-me-local-demo # talk to it like an AI would docker compose run --rm infralens scan docker compose down # when done Your own infrastructure (read-only):
INFRALENS_PROVIDERS=aws INFRALENS_REGIONS=us-east-1 infralens scan # uses your AWS credentials/profile infralens -p kubernetes scan # uses your current kubeconfig context Connect your AI
Claude Desktop (claude_desktop_config.json):
{ "mcpServers": { "infralens": { "command": "infralens", "args": ["serve"], "env": { "INFRALENS_PROVIDERS": "aws", "AWS_PROFILE": "readonly" } } } } Claude Code:
claude mcp add infralens -- infralens serve # local claude mcp add --transport http infralens https://
"Where can we save money? Group it by team."
"Why is payment-api failing? What changed right before it started?"
"Search the payment-api logs for 'pool exhausted' in the last 30 minutes."
"Suppress the snapshot finding; it's our legal-hold backup."
"How much have we saved since we started using infralens?"
Plus the prompts morning_check and investigate(service).
infralens daily --model anthropic/claude-sonnet-5-5 --github-repo you/ops-reports # or openai/..., ollama/... Scans, asks any LLM (via LiteLLM) for a short triage summary, and publishes the report to a file, a GitHub Issue or Slack. The report still ships if the LLM is unavailable. Schedule it with Lambda + EventBridge (included in the OpenTofu module), GitHub Actions (OIDC, no stored keys) or cron.
AWS: deploy/aws (OpenTofu) creates the MCP server on App Runner (HTTPS + bearer token from Secrets Manager), the daily Lambda + EventBridge Scheduler, an encrypted state bucket and a least-privilege read-only IAM policy (shared module, with an explicit Deny on data reads).
Kubernetes: deploy/kubernetes/rbac.yaml is a read-only ClusterRole (get/list only).
Container: non-root, multi-arch image ghcr.io/balakrishnagatla/infralens (with SBOM and provenance), published on every release.
Agent Guard: review infrastructure PRs
AI agents now open infrastructure pull requests. infralens guard reviews the OpenTofu/Terraform plan before it merges, with stricter rules when an agent wrote the change. Offline, no API keys.
# .github/workflows/agent-guard.yml on: pull_request permissions: { contents: read, pull-requests: write } jobs: guard: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 with: { fetch-depth: 0 } - uses: balakrishnagatla/infralens-agent-guard@v1 with: { working-directory: infra } Rule Level What it catches iam-wildcard, iam-admin block "Action": "*" or AdministratorAccess s3-public block Public access block turned off, public ACLs, Principal: * policies open-ingress block SSH, RDP, database ports or all ports open to 0.0.0.0/0 destroy-stateful, destroy-prod block Destroying or replacing databases, buckets, volumes, or prod-tagged resources iam-service-wildcard, destroy, module-source, provider-lock, cost-increase warn, block for agents s3:* on *, other deletes, changed module or provider sources, cost above the limit missing-owner warn New resources without an owner or team tag A change counts as agent-written when an AI tool opened it, a commit is co-authored by one, the description says so, or it carries the ai-generated label. A maintainer can accept blocking findings with the agent-guard-approved label. Locally: tofu show -json plan.out > plan.json && infralens guard --plan plan.json. Full docs: infralens-agent-guard.
Give each agent or team its own key, so the audit log can tell them apart:
infralens keys create claude-desktop # read-only tools (default scope) infralens keys create sre-team --scope state # can also acknowledge/suppress findings infralens keys list infralens keys revoke claude-desktop The key is shown once; only its SHA-256 hash is stored (~/.infralens/keys.json, or the same JSON in INFRALENS_KEYS for containers). Clients send it as Authorization: Bearer
infralens audit # who called what, newest last infralens audit --actor claude-desktop --since 24h infralens audit --denied # calls refused for lack of scope infralens audit verify # OK: 1,204 records, chain intact. Last hash: 74d9… infralens audit export > audit.jsonl # JSON lines for your SIEM Each record carries the previous record's hash. Editing, deleting or reordering a line breaks the chain at that line. To also catch the newest lines being cut off, keep the last hash from verify somewhere else (a ticket, a daily report) or ship the log to append-only storage.
Read-only. Providers only call describe/list/get APIs, and the shipped IAM policy and RBAC role enforce it. CI proves the Kubernetes role can't delete anything.
Suggest, never apply. Actions are returned as commands for a human to run.
Secrets never reach the AI. Passwords, tokens, keys, JWTs and connection strings are masked in evidence, log results and LLM prompts.
Everything is audited, and you know which agent did it. Every tool call is written to ~/.infralens/audit.jsonl with the key name, the MCP client and its version, and an optional on-behalf-of person. Records are hash-chained, so infralens audit verify catches any edit or deleted line. See Audit log and keys.
Locked-down HTTP. Refuses to start without a key, compares keys in constant time, stores only their hashes, and binds to 127.0.0.1 unless told otherwise.
Supply chain. CodeQL, Bandit, pip-audit and Trivy on every PR; third-party Actions pinned to commit SHAs; Dependabot; protected main. See SECURITY.md.
Teams tune behaviour in infralens.yaml (example) without code changes: idle thresholds, error-spike sensitivity, the "what changed?" window, required tags, tag-based ignore rules (env: sandbox is ignored by default), namespaces, and price overrides.
Adding a cloud means implementing four read-only methods that return standard discoveries:
class GCPProvider(Provider): name = "gcp" def find_cost_savings(self): ... # -> list[Finding] def find_incidents(self): ... # -> list[Finding] def recent_changes(self, since): ... # -> list[Change] def list_resources(self): ... # optional, for ownership gaps See CONTRIBUTING.md and the wiki's Adding a provider page. A GCP provider is a great first PR.
pip install -e ".[aws,k8s,dev]" && pytest -q && ruff check src tests demo Roadmap
AWS, Azure (beta) and Kubernetes providers
MCP over stdio and Streamable HTTP; watch mode; OpenTofu deploy
Tested on a real AWS account and a real Kubernetes cluster
Agent-aware, tamper-evident audit log with named keys (v0.3)
Agent Guard: plan review for AI-written infrastructure PRs (v0.4)
Approved fixes: agent proposes, a person approves in Slack (v0.5)
Cloud exit report: lock-in score and egress cost (v0.6)
Multi-account AWS (assume a read-only role per account)
OAuth 2.1 for the hosted MCP server
Actual costs from Cost Explorer / Azure Cost Management alongside list-price estimates
GCP provider · Kubernetes idle workloads from metrics-server
Costs are on-demand list-price estimates for ranking opportunities, not invoices. MIT licensed.
Released: Nov 30, 2026
Both files in this release have provenance metadata.
View provenance details
MIT View SPDX License List
ai all aws azure dev k8s
ai-agents aws azure finops mcp platform-engineering sre
License OSI Approved :: MIT License
Programming Language Python :: 3
Topic System :: Monitoring
Release files for infralens-mcp 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 1.2 MB
Release files / infralens_mcp-0.4.0.tar.gz
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Release files / infralens_mcp-0.4.0-py3-none-any.whl
Security for infralens-mcp 0.4.0
Both files in this release have been uploaded with provenance metadata.
With provenance infralens_mcp-0.4.0.tar.gz Nov 30, 2026
With provenance infralens_mcp-0.4.0-py3-none-any.whl Nov 30, 2026
Attestation for infralens_mcp-0.4.0.tar.gz
Attestation for infralens_mcp-0.4.0-py3-none-any.whl
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.
Release history Release notifications | RSS feed
Nov 30, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from a8e35ed











