ai-token-counter
Cloudflare Workers MCP server: ai-token-counter
Should I use this
Quality & Safety
Based on automated analysis of tool definitions and protocol compliance.
Context Cost
This is the approximate number of tokens consumed each time the server's tools are loaded into a model's context. Higher counts reduce the attention available for other tasks.
Install
One-Click Install
Add this to your `claude_desktop_config.json` file:
{
"mcpServers": {
"ai-token-counter": {
"url": "https://api.lazy-mac.com/ai-token-counter/mcp"
}
}
}Remote endpoints
https://api.lazy-mac.com/ai-token-counter/mcpstreamable-httpWhat it can do
Tool inventory
Tools (4)
🟢count_tokens(model, text, messages)
Count tokens for a text string or chat messages array for any supported AI model (GPT-4o, Claude, Gemini, Mistral, Llama).
Input Schema
{
"type": "object",
"properties": {
"model": {
"type": "string",
"description": "Model ID, e.g. gpt-4o, claude-sonnet-4. Defaults to gpt-4o."
},
"text": {
"type": "string",
"description": "Plain text to count tokens for."
},
"messages": {
"type": "array",
"description": "Chat messages array in OpenAI/Anthropic format.",
"items": {
"type": "object"
}
}
}
}⚪estimate_cost(model, input_tokens, output_tokens, text, requests_per_day)
Estimate the cost of an AI API call given model and token counts or text. Returns input/output/total cost and optional monthly projection.
Input Schema
{
"type": "object",
"properties": {
"model": {
"type": "string",
"description": "Model ID, e.g. gpt-4o, claude-opus-4, gemini-2.0-flash."
},
"input_tokens": {
"type": "integer",
"description": "Number of input tokens."
},
"output_tokens": {
"type": "integer",
"description": "Number of output tokens."
},
"text": {
"type": "string",
"description": "Text to tokenize for input (if input_tokens not given)."
},
"requests_per_day": {
"type": "number",
"description": "If given, adds daily/monthly/yearly cost projection."
}
},
"required": [
"model"
]
}🟢get_model_pricing(model)
Get input/output pricing per 1M tokens for a specific AI model.
Input Schema
{
"type": "object",
"properties": {
"model": {
"type": "string",
"description": "Model ID, e.g. gpt-4o, claude-haiku-3, llama-3-70b."
}
},
"required": [
"model"
]
}🟢list_models
List all supported AI models with their pricing and context windows.
Input Schema
{
"type": "object",
"properties": {}
}Community
Evidence