token-gate-mcp

v0.1.3
io.github.AbduljabbarBXR/token-gate-mcp Checked 3 days ago Published 2 months ago

Token and context budget for AI agents.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

context.log

Record a token spend event into the session ledger. Call this after a read, a tool call, or a model turn so the budget report stays truthful.

ParameterTypeDescription
tokens *integerTokens consumed
charsintegerCharacters read or produced
kindstringWhat kind of work consumed the tokens
notestringWhat was spent on

context.report

Return the current session token spend: totals, spend by kind, budget, and remaining budget.

context.estimate

Estimate the token cost of reading a file before reading it, and compare it with cheaper alternatives such as a graph query. Use this before a large read to protect the budget.

ParameterTypeDescription
path *stringPath to the file that would be read
alternativeCostintegerEstimated token cost of the cheaper alternative, for example a graph query

context.limit

Set or read the token budget for the session. With maxTokens set, stores the budget; without, returns the current budget and remaining tokens.

ParameterTypeDescription
maxTokensintegerBudget in tokens. Omit to read the current budget.

context.check

Check whether the session has gone over its token budget. Returns a boolean the agent can gate on before continuing.