Tokencost Mcp Server

by ankit-aglawe

379 downloads
Not rated
GitHub

About

An MCP (Model Context Protocol) server that provides real-time LLM token pricing data for 60+ AI models across 15 providers.

Details

Author
ankit-aglawe
Downloads
379
Categories
Developer Tools, AI, Other

- Real-time pricing for 60+ models across 15 providers
- Dedicated MCP tools for pricing queries and comparisons
- Cost estimation for given input/output token counts
- Filtered search for cheapest models by context length
- Up-to-date pricing tracked by the TokenCost team
- Free and open-source deployment via npx

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Tokencost Mcp Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install by adding the server to your MCP config with npx -y tokencost-mcp-server as the command, or clone the repository and run from source. Use tools like tokencost_get_model_pricing, tokencost_compare_models, tokencost_estimate_cost, tokencost_find_cheapest, tokencost_list_models, and tokencost_list_providers.

tokencost_get_model_pricing

Get pricing details for a specific LLM model. Args: - model (string): Model ID or name to look up (e.g., "gpt-5", "claude-sonnet-4.6", "gemini-3-pro") Returns: Model pricing details including input/output costs per 1M tokens, context window, and max output. Returns an error message if the model is not found, with suggestions for similar models. Examples: - "gpt-5" → GPT-5 pricing from OpenAI - "claude-opus-4.6" → Claude Opus 4.6 pricing from Anthropic - "gemini" → First matching Gemini model

tokencost_compare_models

Compare pricing across multiple LLM models side by side. Args: - models (string[]): Array of model IDs or names to compare (2-10 models) Returns: Side-by-side comparison table with input/output costs, context windows, and relative cost differences. Examples: - ["gpt-5", "claude-sonnet-4.6"] → Compare OpenAI vs Anthropic pricing - ["gpt-5-mini", "gemini-3-flash", "claude-haiku-4.5"] → Compare budget models

tokencost_estimate_cost

Calculate the cost for a specific number of input and output tokens with a given model. Args: - model (string): Model ID or name - input_tokens (number): Number of input tokens (0 to 100B) - output_tokens (number): Number of output tokens (0 to 100B) Returns: Cost breakdown with input cost, output cost, and total cost in USD. Examples: - model="gpt-5", input_tokens=1000, output_tokens=500 → Cost for a typical API call - model="claude-sonnet-4.6", input_tokens=100000, output_tokens=4000 → Cost for a long context call

tokencost_find_cheapest

Find the cheapest LLM models, optionally filtered by provider or minimum context window. Args: - provider (string, optional): Filter by provider (e.g., "OpenAI", "Anthropic", "Google") - min_context (number, optional): Minimum context window size in tokens - sort_by (string, optional): Sort by "input", "output", or "combined" cost (default: "combined") - limit (number, optional): Number of results to return (default: 10, max: 30) Returns: Ranked list of cheapest models with pricing details. Examples: - {} → Top 10 cheapest models overall - { provider: "OpenAI" } → Cheapest OpenAI models - { min_context: 200000, sort_by: "input" } → Cheapest 200K+ context models by input price

tokencost_list_models

List all available LLM models with pricing data, optionally filtered by provider. Args: - provider (string, optional): Filter by provider (e.g., "OpenAI", "Anthropic", "Google") Returns: List of all models with IDs, names, and providers. Use model IDs with other tools. Examples: - {} → All 60+ models - { provider: "Anthropic" } → All Anthropic Claude models

tokencost_list_providers

List all LLM providers with model counts and pricing ranges. Returns: All providers with the number of models and pricing range for each.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

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

McpServers

{
    "tokencost": {
        "command": "npx",
        "args": [
            "-y",
            "tokencost-mcp-server"
        ]
    }
}

TokenCost MCP Server

An MCP (Model Context Protocol) server that provides real-time LLM token pricing data for 60+ AI models across 15 providers.

Query, compare, and estimate costs for models from OpenAI, Anthropic, Google, Meta, xAI, Mistral, DeepSeek, and more — directly from your AI assistant.

Built by TokenCost — the free LLM token cost calculator.

<a href="https://glama.ai/mcp/servers/ankit-aglawe/tokencost-mcp-server">
tokencost-mcp-server MCP server
</a>

Tools

| Tool | Description |
|------|-------------|
| tokencost_get_model_pricing | Get pricing for a specific model |
| tokencost_compare_models | Side-by-side pricing comparison |
| tokencost_estimate_cost | Calculate cost for given token counts |
| tokencost_find_cheapest | Find cheapest models with filters |
| tokencost_list_models | List all available models |
| tokencost_list_providers | List all providers with pricing ranges |

Quick Start

Claude Desktop / Cursor / Windsurf

Add to your MCP config:

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

From Source

git clone https://github.com/ankit-aglawe/tokencost-mcp-server
cd tokencost-mcp-server
npm install
npm run build
npm start

Example Usage

"How much would it cost to process 1M input tokens with GPT-5?"

→ Uses tokencost_estimate_cost with model="gpt-5", input_tokens=1000000, output_tokens=0

"Compare Claude Sonnet 4.6 vs GPT-5 vs Gemini 3 Pro pricing"

→ Uses tokencost_compare_models with ["claude-sonnet-4.6", "gpt-5", "gemini-3-pro"]

"What's the cheapest model with at least 200K context?"

→ Uses tokencost_find_cheapest with min_context=200000

Supported Providers

OpenAI, Anthropic, Google, xAI, Meta, Mistral, DeepSeek, Alibaba (Qwen), Amazon (Nova), NVIDIA, Cohere, Perplexity, Moonshot (Kimi), Zhipu (GLM), MiniMax

Pricing Data

Pricing is kept accurate and up to date by the TokenCost team. We track official provider announcements and update pricing as soon as changes are published — new models, price cuts, and deprecations are reflected within days.

If you notice outdated pricing or a missing model, open an issue and we'll get it updated.

License

MIT

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.