Agentβ™₯︎Age
Catalog

io.github.MukundaKatta/agentfit

Official

by MukundaKatta Β· JavaScript

Token-aware message truncation: fit a chat history into your model's context budget.

agentfit MCP Server

This MCP server (io.github.MukundaKatta/agentfit) performs token-aware message truncation by estimating token counts for strings or chat message arrays and then fitting a chat history into a model’s context budget on demand. It provides three tools for token estimation and truncation using per-model estimator families.

πŸ› οΈ Key Features

  • Token-aware truncation to fit chat history into a context budget
  • Token estimation for a string or a chat-message array
  • Per-model estimator families: openai, anthropic, google, llama, default

πŸš€ Use Cases

  • Use with MCP clients (e.g., Claude Desktop, Cursor, Cline, Windsurf, Zed) to estimate tokens
  • Truncate/drop earlier messages until a maxTokens budget is satisfied

⚑ Developer Benefits

  • Tools: count_tokens for token estimates; fit_messages for enforcing maxTokens
  • Model-specific token estimator families to align with different context-window behaviors

⚠️ Limitations

  • Fit behavior depends on the tool’s estimator families and maxTokens setting
  • The provided excerpt does not list additional tool options beyond truncation and counting

Topics

agent-stackagentsaianthropiccontext-windowllmmcpmcp-serveropenaireliabilityzero-dependency