mukundakatta avatar

Agentfit

mukundakatta/agentfit-mcp

Wraps the agentfit JavaScript library as an MCP server so Claude and other clients can estimate token counts and truncate chat histories on the fly. Exposes three tools: count_tokens for quick estimation across OpenAI, Anthropic, Google, and Llama tokenizer families; fit_messages to drop messages from a history until it fits a budget, with strategies like drop-oldest or drop-middle and options to preserve system prompts or the last N turns; and list_estimators to see what's available. Useful when you need to ask your assistant "trim this transcript to 8k tokens" or check token usage mid-conversation without leaving your editor. Runs via npx with zero dependencies, works over stdio with any MCP client.

GitHub stars
1
tools
3
transport
STDIO
last updated
Apr 27, 2026

Tools

3 tools

Public tool metadata for what this MCP can expose to an agent.

count_tokensestimate tokens in a string or chat-message array, with per-model estimator families (openai, anthropic, google, llama, default).

estimate tokens in a string or chat-message array, with per-model estimator families (openai, anthropic, google, llama, default).

No parameter schema in public metadata yet.

fit_messagesdrop messages from a chat history until under a `maxTokens` budget.

drop messages from a chat history until under a `maxTokens` budget.

No parameter schema in public metadata yet.

list_estimatorslist the built-in estimator families.

list the built-in estimator families.

No parameter schema in public metadata yet.

Sponsors

Readme

agentfit-mcp

MCP server for @mukundakatta/agentfit. Lets Claude Desktop, Cursor, Cline, Windsurf, Zed, or any other MCP client estimate token counts and fit a chat history into a model's context budget on demand.

npx -y @mukundakatta/agentfit-mcp

Three tools:

  • count_tokens — estimate tokens in a string or chat-message array, with per-model estimator families (openai, anthropic, google, llama, default).
  • fit_messages — drop messages from a chat history until under a maxTokens budget. Supports drop-oldest, drop-middle, and priority strategies; honors preserveSystem, preserveFirstN, preserveLastN.
  • list_estimators — list the built-in estimator families.

Add to your client

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "agentfit": {
      "command": "npx",
      "args": ["-y", "@mukundakatta/agentfit-mcp"]
    }
  }
}

Cursor

~/.cursor/mcp.json:


View the full README on GitHub

Details

Repository
github.com/mukundakatta/agentfit-mcp
Website
github.com/MukundaKatta/agentfit-mcp
Category
Communication & Messaging
Package
@mukundakatta/agentfit-mcp
Transport
STDIO
Registry
MCP registry, active

More from mukundakatta

Related Communication & Messaging MCP servers

View all
1orbiads avatarOrbiAds — Google Ad Managerorbiads/orbiads-gam-mcpAutomate Google Ad Manager: campaigns, line items, creatives, inventory, reporting — 51 tools.1stars
2rahuljava2807 avatarClaude Bridge Mcprahuljava2807/claude-code-bridge-mcpPipes Claude Code session output into Claude Chat — no more copy-paste between tools0stars
3topher66 avatarDroidbartopher66/droidbar-mcpThe first bar for AI. Visit, chat with SERVO the bartender, and tip in tokens.1stars
4ivanantigravity-lgtm avatarPerplexity Polza Mcp Serverivanantigravity-lgtm/perplexity-polza-mcp-serverPerplexity MCP server backed by the Polza.ai chat completions API.1stars
5kjgueye avatarNetintel Mcpkjgueye/netintel-mcpMCP server for NetIntel — DNS, SSL, WHOIS, email security, OSINT via x402 micropayments1stars
6mailpace avatarMailPacemailpace/mailpace-mcpSend transactional email and manage MailPace domains from MCP clients.1stars