home / mcp / cost management mcp server
Provides unified cost tracking and analysis across AWS, OpenAI, and Anthropic through an MCP server.
Configuration
View docs{
"mcpServers": {
"knishioka-cost-management-mcp": {
"command": "node",
"args": [
"/absolute/path/to/cost-management-mcp/dist/index.js"
],
"env": {
"CACHE_TTL": "3600",
"LOG_LEVEL": "info",
"AWS_REGION": "us-east-1",
"OPENAI_API_KEY": "YOUR_OPENAI_API_KEY",
"ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY",
"AWS_ACCESS_KEY_ID": "YOUR_AWS_ACCESS_KEY",
"AWS_SECRET_ACCESS_KEY": "YOUR_AWS_SECRET_KEY"
}
}
}
}Cost Management MCP is a server that unifies cost data from multiple providers and API services, enabling you to query and analyze spend across AWS, OpenAI, and Anthropic from a single interface. It supports flexible time ranges, caching to reduce API calls, and straightforward integration with Claude Desktop and Claude Code.
You interact with the Cost Management MCP through your MCP client (such as Claude Desktop or Claude Code) after configuring a local or remote MCP server. Start by running the server locally, then connect your MCP client to it to ask questions like “What are my AWS costs for this month?” or “Show me OpenAI usage trends for the last 7 days.” Once connected, you can list configured providers, fetch cost breakdowns by provider or service, and explore cost trends and breakdowns across providers.
To integrate with Claude Desktop, build the project first, then add the MCP server as a runtime option in Claude Desktop’s configuration. The server is started with a Node command and points to the compiled entry at dist/index.js. You can provide credentials via environment variables (for example, AWS keys and API keys for providers) and optionally enable caching for performance.
To integrate with Claude Code, you have two approaches. You can create a project-specific MCP configuration file that lists the server and its environment variables, or configure a global setting in the editor so Claude Code can launch the MCP server when you open your project. In both cases, the MCP server runs as a local process started via Node and the path to the built entry is provided in the configuration.
Prerequisites: you need Node.js 18 or higher and npm or yarn, plus active accounts with the cloud providers you want to monitor.
1. Clone the project.
git clone https://github.com/knishioka/cost-management-mcp.git
cd cost-management-mcp2. Install dependencies.
npm install3. Copy the environment template and adjust credentials.
cp .env.example .env4. Build the project.
npm run build5. Start the development server for local testing.
# Development mode (with hot reload)
npm run dev
# Production mode
npm startConfigure the MCP server in your client to point to the built entry and provide credentials for the providers you use. For Claude Desktop, you specify the absolute path to the built file (dist/index.js) and environment variables such as AWS keys and API keys.
For Claude Code, you can place a project-specific configuration (for example, a .mcp.json file) or configure VS Code settings to load the server. The configuration includes the command to run (node) and the path to the built entry, followed by environment variables like AWS and API keys.
The server supports a range of environment variables to configure credentials and behavior. Common variables include AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, OPENAI_API_KEY, ANTHROPIC_API_KEY, CACHE_TTL, CACHE_TYPE, REDIS_URL, LOG_LEVEL, and MCP_SERVER_PORT.
Caching helps reduce API calls and costs. By default, memory caching is used, but you can switch to Redis caching by setting CACHE_TYPE=redis and providing REDIS_URL. If caching is not configured, the server will function without caching.
Claude Desktop users configure the MCP server to point to the local Node process running dist/index.js, with credentials supplied via environment variables. After restarting Claude Desktop, you can issue natural language questions about your costs.
Claude Code users add an MCP server entry that launches node with the path to dist/index.js and passes the same kinds of credentials via environment variables. You can also opt for a project-wide JSON file or a VS Code setting to keep the configuration readily available as you work.
What are my AWS costs for this month?
Show me OpenAI costs for the last 30 days
Break down my cloud expenses by service
Which providers are currently configured?
Get detailed cost breakdowns for any date range, filter by provider, choose granularity, and view service-level breakdowns.
Check which providers are configured and validate credentials, with a health check across all integrations.
Check remaining credits or prepaid balances (availability may vary by provider).
Get OpenAI usage, including model breakdowns, token usage, and cost optimization guidance.
Get Anthropic usage and costs, model breakdowns, and token-level details with prompt caching.
Analyze AWS costs with service-level breakdowns and optimization tips.
Compare costs across providers with visualizations and insights.
Analyze cost trends over time with configurable granularity and spike detection.
Detailed multidimensional cost breakdown by service, region, date, and tags.
Compare costs between different time periods with absolute and percentage changes.