AgentCost MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add agentcost -- npx -y agentcost-mcp
README.md

Cost awareness for AI agents.

⚡ AgentCost MCP Server

Cost awareness for AI agents. Know what you're spending before the invoice hits.

An MCP server that gives AI agents real-time access to model pricing, cost estimation, budget management, and model comparison across 20+ models from 7 providers.

Built by an agent. For agents.


The Problem

AI agents are flying blind on costs. They:

  • Pick models without knowing the price
  • Run tasks without budget awareness
  • Generate surprise bills at end of month
  • Use expensive models for simple tasks

AgentCost gives agents the tools to understand and optimize their own spending — in real time, before making the call.

6 Tools

Tool What it does
estimate_cost Predict cost for a model + token count before making the API call
compare_models Compare costs across models — get cheapest, best-value, and best-quality picks
check_budget Verify if usage fits a daily/weekly budget, get smart switch suggestions when it doesn't
find_cheapest Find the cheapest model for a specific task type (coding, reasoning, writing, classification)
list_models Browse all 20+ models across 7 providers with input/output pricing
get_model Deep-dive on a specific model with reference cost calculations

Quick Start

With Claude Desktop / Claude Code

Add to your MCP config:

{
  "mcpServers": {
    "agentcost": {
      "command": "npx",
      "args": ["-y", "agentcost-mcp"]
    }
  }
}

With any MCP client

npx agentcost-mcp  # Runs on stdio

Install globally

npm install -g agentcost-mcp
agentcost-mcp

Example: Agent Self-Optimization

Agent: "I need to process 50 customer emails."

→ estimate_cost("anthropic/claude-sonnet-4", 2000, 500)
→ $0.0135/email, $0.675 total

Agent: "Is there something cheaper for classification?"

→ compare_models(2000, 500, task="classification", min_quality=70)
→ "GPT-4.1 Nano: $0.0006/email. 98% cheaper. Quality: 75/100."

Agent: "I'll use Nano for classification, Sonnet for complex replies."

That's the idea. Agents making informed cost decisions autonomously.

Models (March 2026)

Provider Models
Anthropic Claude Opus 4, Sonnet 4, Haiku 3.5
OpenAI GPT-5.2, GPT-5.2 Codex, GPT-4.1, GPT-4.1 Mini, GPT-4.1 Nano, o3, o4-mini
Google Gemini 2.5 Pro, Gemini 2.5 Flash, Gemini 3 Pro (Preview)
DeepSeek V3, R1
xAI Grok 4
Mistral Mistral Large, Codestral

Prices sourced from official provider pages. Open an issue if something's outdated.

Why MCP?

MCP (Model Context Protocol) is the emerging standard for giving AI agents access to tools and data. Any agent framework that supports MCP — Claude, OpenClaw, Cursor, Windsurf, and more — can use AgentCost without custom integration.

One server. Every agent. Real-time cost data.

Part of the Agent Labs Ecosystem

AgentCost is built by One Agent Labs — tools built BY agents, FOR agents.

  • AgentCost MCP — Cost awareness (this repo)
  • AgentMRR — Marketplace where agents discover and ship products

Contributing

PRs welcome. Especially:

  • New model pricing data
  • Additional provider support
  • Cost optimization algorithms
  • Better task-type matching

License

MIT — use it, fork it, ship it.

Tools (6)

estimate_costPredict cost for a model and token count before making an API call.
compare_modelsCompare costs across models to find cheapest, best-value, or best-quality options.
check_budgetVerify if usage fits a daily or weekly budget and get switch suggestions.
find_cheapestFind the cheapest model for a specific task type.
list_modelsBrowse all 20+ models across 7 providers with pricing data.
get_modelDeep-dive on a specific model with reference cost calculations.

Configuration

claude_desktop_config.json
{"mcpServers": {"agentcost": {"command": "npx", "args": ["-y", "agentcost-mcp"]}}}

Try it

Estimate the cost of processing 5,000 tokens of input and 1,000 tokens of output using Claude 3.5 Sonnet.
Find the cheapest model available for a coding task that maintains at least 80% quality.
Check if my current usage is within my $10 daily budget and suggest cheaper alternatives if I am over.
List all available Gemini models and their current pricing.

Frequently Asked Questions

What are the key features of AgentCost?

Real-time cost estimation for AI model API calls. Budget management with smart model-switching suggestions. Cross-provider model comparison for 20+ models. Task-specific model recommendations based on cost and quality. Deep-dive pricing reference for individual AI models.

What can I use AgentCost for?

Preventing surprise billing for autonomous AI agents. Optimizing model selection for high-volume batch processing tasks. Comparing cost-efficiency between different AI providers like Anthropic, OpenAI, and Google. Setting and monitoring daily or weekly AI spending limits.

How do I install AgentCost?

Install AgentCost by running: npx -y agentcost-mcp

What MCP clients work with AgentCost?

AgentCost works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep AgentCost docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare