Skip to main content
Glama

token-discipline-mcp

test deps license

Stop your AI coding agent from burning through your usage limits.

A tiny MCP server (one file, zero dependencies) that loads a set of token-saving rules into every session of Claude Code, Claude Desktop, Cursor, or any MCP client.

What it makes your agent do

Rule

Effect

🧭 Main chat is a dispatcher

Plans and delegates; heavy work runs in subagents

β›” Agents checkpoint at ~125k tokens

Commit, write HANDOFF.md, hand off to a fresh agent

πŸ” Grep before reading

Only the needed lines, never re-read files

πŸ‘₯ 1 or 2 agents by default, max 5

Parallel fan-out is what kills a session

πŸ“ Pace huge tasks

Split across sessions instead of hitting the rate limit

Full list: RULES.md.

Related MCP server: mcp-context-condenser

Setup (1 minute)

Needs Node 18+. Nothing to install: npx runs it straight from GitHub.

Claude Code

claude mcp add token-discipline --scope user -- npx -y github:Suhaib5333/token-discipline-mcp

Claude Desktop, Cursor, Windsurf, others

Add this to your MCP config (claude_desktop_config.json, ~/.cursor/mcp.json, ...):

{
  "mcpServers": {
    "token-discipline": {
      "command": "npx",
      "args": ["-y", "github:Suhaib5333/token-discipline-mcp"]
    }
  }
}

Restart the client. Done βœ…

How it works

The rules reach the model 3 ways, so it works whatever your client supports:

Channel

What

Server instructions

Sent automatically on connect

Tool token_rules

The agent can fetch the rules any time

Prompt token-discipline

Load them manually (/mcp__token-discipline__token-discipline in Claude Code)

Use your own rules

Point it at any Markdown file:

claude mcp add token-discipline --scope user -e TOKEN_RULES_FILE=/path/to/my-rules.md -- npx -y github:Suhaib5333/token-discipline-mcp

(JSON config: add "env": { "TOKEN_RULES_FILE": "/path/to/my-rules.md" }.)

Or fork this repo, edit RULES.md, and swap Suhaib5333 for your username in the install command.

Run locally

git clone https://github.com/Suhaib5333/token-discipline-mcp
cd token-discipline-mcp
npm test

Contributing

Ideas for better rules are welcome. Open an issue or a PR (keep it zero-dependency and short). See CONTRIBUTING.md.

License

MIT: use it, fork it, ship it.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables AI coding agents to reduce token usage by condensing source code into AST skeletons, extracting specific symbols, compressing logs, and estimating token budgets.
      4
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables monitoring of running agent loops with token and monetary cost estimation, pruning of verbose thinking chains near limits, and routing sub-tasks between fast/cheap and deep reasoning models. It provides deterministic, MCP-compatible budget optimization for autonomous agents and copilot frameworks.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables coding agents to perform advisory runtime safety checks by inspecting proposed file paths and shell commands, tracking caller budgets, detecting repeated actions, and masking common credentials in output without executing commands or opening target files.
      4
      GPL 3.0