MCP Token Analyzer

A powerful CLI tool to analyze token usage and cost impact of MCP servers

Understand exactly how many tokens your MCP servers add to every API call. Get cost estimates across major AI providers and optimize your context window usage.

View on GitHub

Quick Start

# Use the standalone script python3 mcp-analyze.py npx shadcn-ui-mcp-server

Key Features

Token Analysis

Analyze any MCP server supporting stdio transport. Get detailed token breakdown by tools, resources, and prompts.

Cost Estimation

Cost estimates for OpenAI, Anthropic, Google, and other providers per API call.

Rich Terminal UI

Beautiful formatted tables and colors. Export to JSON for further analysis.

Pure Python

Works on Linux, macOS, and Windows. No Node.js required.

Why Analyze MCP Token Overhead?

Every MCP server adds tokens to your context. Understanding this overhead helps you make informed decisions about cost and context management.

Optimize MCP Configurations

Identify high-token tools that you might want to exclude from your MCP setup to reduce context overhead.

Budget Planning

Estimate API costs before deploying MCP servers in production. Know the per-request token overhead upfront.

Server Comparison

Compare token overhead across different MCP servers to choose the most efficient option for your use case.

Context Management

Understand how much of your context window MCP consumes, leaving room for actual conversation.

How It Works

1

Connect to Your MCP Server

Enter your MCP server command (like npx shadcn-ui-mcp-server) or SSE URL for remote servers.

2

Analyze Tools, Resources & Prompts

The analyzer connects to your server via stdio and fetches all exposed capabilities, then counts tokens for each item.

3

View Token Counts & Cost Estimates

See total tokens, per-category breakdown, and cost impact across GPT-4o, Claude, and Gemini models.

4

Optimize Your Configuration

Use the detailed breakdown to identify high-token items and decide which tools to include or exclude.

Built With

Language

Pure Python

Transport

MCP stdio protocol

Platforms

Linux, macOS, Windows

Ready to Analyze Your MCP Servers?

Install with pip or clone the repository to get started.