Retrieve only the relevant code for a codebase question, within a token budget.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Retrieve only the relevant source code for a question β instead of the model reading whole files β so an LLM answers codebase questions on a small, focused slice of context. Less input = fewer tokens, lower cost, faster answers.
Works three ways from one install: an MCP server, a CLI, and a Python library β plus a Claude Code plugin that injects context automatically.
π Full command reference β docs/HANDBOOK.md
mcp-name: io.github.likhithreddy/fittok
graphify β parses the repo with tree-sitter into a knowledge graph of functions / classes / methods (Python, JS, JSX, TS, TSX, Java, Go, Rust). Supports multi-language call/import/reference edges.
slurp β scores every node against the question using a 4-signal hybrid:
Signals are fused via Reciprocal Rank Fusion (RRF) β rank-based, no score calibration issues. Nodes are selected via round-robin directory interleaving (guarantees facet coverage on multi-aspect queries β one node from each code area before any gets a second) with a per-node token cap (25% of budget, so large components don't crowd out smaller functions). A relevance cliff (semantic OR BM25 OR summary-BM25 threshold) excludes noise.
readable output β returns the actual source code of selected nodes, plus a codebase map (table of contents with docstrings, inspired by Karpathy's LLM Wiki / Google's OKF) so the model can route follow-up calls precisely. The model answers directly from it β no file reads needed.
As you edit, a file watcher (auto-started on first query) updates the graph
incrementally β only changed files are re-parsed and merged, and only
changed functions re-embed. Graphs and embeddings are cached on disk
(~/.cache/fittok). Set FITTOK_AUTOWATCH=false to disable the watcher, in
which case an edit triggers a full re-parse on the next query.
fittok ranks code against your question using a 4-signal hybrid (semantic + BM25 + structural + PageRank, fused via RRF) with round-robin directory diversity β so multi-facet questions surface code from multiple areas (UI, server, database) instead of clustering in one dominant area. It's most accurate with focused, specific questions β ideally one concern each, and naming the function/component/route when you can. Multi-facet questions are supported via decomposition (the tool description tells the model to call once per aspect) and the codebase map (a table of contents prepended to every response).
runSandboxQuery execute and isolate a SQL query?" β surfaces the exact function + its isolation code.Rule of thumb: one concern per question (or 2β3 facets max). For "explain the whole feature," split it into a few focused questions instead of one mega-query.
content.json file, where the entire markdown collapses to ONE physical JSON line (newlines escaped) β and its Read tool truncates any line at ~2,000 characters. So an output over ~7 KB is effectively chopped to ~2,000 chars regardless of total size; the model can't see most of the code and falls back to reading source files directly. This is Copilot's delivery layer, not fittok β every MCP server hits this wall. By default (0.10.0+) fittok returns all relevant code uncapped, which is correct for clients that deliver inline but will be truncated by Copilot. Two workarounds:
FITTOK_MAX_BUDGET=1200 in your MCP server's env:
REVOKE/DENY), neither semantic nor BM25 can bridge it. The codebase map (file names + docstrings) and round-robin diversity help; naming the function/file routes the model to it.reset_graph.cl100k_base, so real usage drifts ~10β20% vs Claude's tokenizer (only matters when you opt into a FITTOK_MAX_BUDGET cap).fittok ships as an MCP server, a CLI, and a Python library. It uses
torch for embeddings, so a Python runtime must be present. Pick one runtime
below, then follow the section for your client.
Every config below launches fittok as
uvx fittok. If you chose Python orpipx, swap that forpython -m fittokorpipx run fittokrespectively.
A. uv β recommended (no Python needed on the machine)
Launch command: uvx fittok β uv provisions its own Python + all deps in
isolation. One static binary, so it's deployable org-wide via MDM/Intune/winget.
B. Python 3.10+ (already on the machine)
Launch command: python -m fittok (Windows: py -m fittok).
Managed Linux may reject
pip installwith PEP 668 ("externally-managed-environment") β use option A to avoid it.
C. pipx β isolated, no global install
Launch command: pipx run fittok.
Restart Claude Code β /mcp β confirm fittok is connected, then ask
codebase questions normally.
Or paste into .vscode/mcp.json (workspace) or your user mcp.json:
Then in Copilot Chat: Agent mode β enable fittok's tools (Configure Tools).
To make fittok fire on every codebase question β without naming it β and stop your client from re-reading files fittok already returned (which would discard the savings), add this one line to your client's instructions file:
"For any codebase question, call fittok first and answer from its output β don't re-read files it already returned code from."
The first half triggers fittok; the second keeps the client from opening the same files afterward. They reinforce each other β one shapes strategy (use fittok), the other stops the double-read. For a stronger, more explicit block:
For any codebase question ("how does X work", "where is Y"):
- Call the fittok MCP tool first, once.
- Answer directly from its
optimized_contextβ it is the real, authoritative source for that question.- Do NOT read or grep the files fittok already returned code from. That discards the token savings fittok exists to provide.
For the strongest effect, put it in your user-global instructions so it applies to every repo, not just one:
| Client | Instructions file |
|---|---|
| Claude Code | CLAUDE.md (repo) or ~/.claude/CLAUDE.md (user-global) |
| GitHub Copilot | .github/copilot-instructions.md or Copilot user instructions |
| Cursor | .cursor/rules/*.mdc (or .cursorrules) |
| Windsurf | .windsurfrules |
fittok also bakes this rule into every response (an "answer from this, don't re-read" line above the code), so it works even without the snippet above β the snippet just makes it the client's default across all questions.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/fittok)<a href="https://allmcps.com/mcp/fittok"><img src="https://allmcps.com/api/badge/fittok?style=directory" alt="Fittok on AllMCPs" /></a>