Package Exports
- mcp-cost-tracker
- mcp-cost-tracker/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mcp-cost-tracker) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
MCP Cost Tracker
An open-source MCP server that automatically tracks LLM API call costs, token usage, and generates visual dashboards.
mcp-cost-tracker is a powerful, easy-to-use MCP server designed for developers who want to monitor and control their LLM API spending. It provides a comprehensive suite of tools to track token usage, calculate costs across 50+ models, set budgets, and visualize spending patterns.
![]()
(This is a placeholder image. A real screenshot will be added after the first release.)
✨ Key Features
- Comprehensive Cost Tracking: Automatically calculates costs for 50+ models from major providers including OpenAI, Anthropic, Google, DeepSeek, Mistral, and more.
- 15+ MCP Tools: A rich set of tools for tracking usage, analyzing costs, setting budgets, comparing models, and exporting data.
- Visual Dashboard: Generate a beautiful, interactive HTML dashboard with charts for daily trends, cost breakdowns by model/provider/project, and top expensive requests.
- Budget Management: Set daily, weekly, or monthly budgets with alerts to prevent cost overruns.
- SQLite Persistence: All usage data is stored locally in a SQLite database, ensuring data ownership and enabling historical analysis.
- Easy Integration: Use as a standalone MCP server with any compatible client (like Claude Desktop) or integrate into your existing applications.
- Non-Intrusive: Designed to work without modifying your existing API call logic.
🚀 Getting Started
Installation
npm install -g mcp-cost-trackerRunning the Server
Simply run the command in your terminal:
mcp-cost-trackerThis will start the MCP server, listening on stdio for requests from a compatible client.
Connecting with Claude Desktop
- Open Claude Desktop settings.
- Go to the "MCP Servers" section.
- Click "Add Server" and choose "From Command".
- Enter
mcp-cost-trackeras the command. - Save and enable the server.
Now you can use all the cost tracking tools directly within Claude!
🛠️ MCP Tools
mcp-cost-tracker provides a rich set of tools to manage your LLM costs. Here are some of the key tools available:
| Tool Name | Description |
|---|---|
track_usage |
Record an API call with token counts and automatically calculate its cost. |
get_summary |
Get a summary of total costs, tokens, and request counts, with filters. |
get_cost_by_model |
See a cost breakdown grouped by model to identify top cost drivers. |
get_daily_trend |
View daily cost trends to spot spending patterns. |
set_budget |
Create or update a spending budget with alerts. |
check_budget |
Check the current status of your budgets. |
generate_dashboard |
Generate an interactive HTML dashboard. |
lookup_pricing |
Look up pricing for any supported model. |
estimate_cost |
Estimate the cost of an API call before making it. |
compare_models |
Compare the cost of a workload across different models. |
export_data |
Export usage data to CSV or JSON for external analysis. |
For a full list of tools and their arguments, you can use the tools/list method from your MCP client.
📊 Dashboard
To generate the HTML dashboard, use the generate_dashboard tool:
> generate_dashboardThis will create a dashboard.html file in your ~/.mcp-cost-tracker/ directory. Open this file in your browser to see a detailed visualization of your spending.
⚙️ Configuration
By default, the database is stored at ~/.mcp-cost-tracker/costs.db.
You can specify a custom database path by setting the MCP_COST_TRACKER_DB environment variable:
export MCP_COST_TRACKER_DB=/path/to/your/costs.db
mcp-cost-tracker🤝 Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue to discuss improvements.
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.