Skip to main content
Glama
princeruhulofficial

mcp-agent-cost-optimizer

README.md
# mcp-agent-cost-optimizer

**Exact LLM & AI Agent Cost Calculator + ROI Optimizer** (Model Context Protocol server)

> Give your AI agents (and yourself) high-precision financial math for token costs, multi-step agent runs, model comparisons, and ROI versus human labor. Pure computation — $0 running cost.

[![Available on MCPize](https://mcpize.com/badge/mcp-agent-cost-optimizer)](https://mcpize.com/servers/mcp-agent-cost-optimizer)

## Why this exists

Entrepreneurs and AI builders waste time and money because:

- Spreadsheets break on multi-step agent costs (retries, tool calls, context).
- LLMs give approximate / wrong money numbers.
- Hard to quickly compare "Claude vs GPT-4o vs Gemini for my agent fleet".

This MCP server solves it with deterministic, auditable decimal math.

## Tools

| Tool | What it does |
|------|--------------|
| `calculate_token_cost` | Exact $ for input + output tokens on any model (or custom prices) |
| `estimate_agent_run_cost` | Full agent workflow cost including steps + retry overhead |
| `compare_models` | Rank models by cost for the same workload |
| `calculate_agent_roi` | Monthly/annual savings & ROI of agent vs human |
| `list_supported_models` | See built-in pricing table |

## Quick start (local)

```bash
# Install
pip install -e .

# Run
python -m src.server
# or
mcp-agent-cost-optimizer
```

Add to Claude Desktop / Cursor / any MCP client:

```json
{
  "mcpServers": {
    "agent-cost-optimizer": {
      "command": "python",
      "args": ["-m", "src.server"],
      "cwd": "/path/to/mcp-agent-cost-optimizer"
    }
  }
}
```

## Example usage from an agent

> "Estimate the cost of running a 5-step research agent 500 times a day on Claude 4 Sonnet with 15% retry rate, then compare vs GPT-4o-mini and tell me the ROI if a human analyst costs $60/hour and takes 20 minutes."

The agent will call the tools and return exact numbers with formulas.

## Pricing (MCPize)

- **Free**: 50 calls/day — enough to try
- **Pro**: $19/mo — 500 calls/day + full tools
- **Team**: $49/mo — higher limits

Zero external API cost → excellent margins.

## Built by

Prince Ruhul (princeruhulofficial) — Founder of Prevalid.  
Daily AI Project Builder pipeline.

## License

MIT