Nuke your token usage. Intelligent code indexer with O(1) symbol retrieval, hybrid search, and call graph analysis.
Project description
TokenNuke
Nuke your token usage. Intelligent code indexer MCP server with O(1) symbol retrieval, hybrid search, and call graph analysis.
TokenNuke indexes your codebase using tree-sitter, extracts every function, class, method, constant, and type with byte offsets, then serves them to AI agents via MCP. Instead of reading entire files, agents retrieve exactly the symbols they need — saving 80-95% of tokens.
Features
- O(1) Symbol Retrieval — Byte-offset reads. No file scanning.
- 10 Languages — Python, JavaScript, TypeScript, Go, Rust, Java, C, C++, C#, Ruby
- Hybrid Search — FTS5 keyword search + vector embeddings via Reciprocal Rank Fusion
- Call Graph — Trace "who calls this?" and "what does this call?" with depth traversal
- Incremental Indexing — SHA-256 per file. Only re-indexes what changed.
- Full-Text Search — Search raw file contents (strings, comments, config values)
- No File Limit — SQLite backend, not JSON. Index repos with 100K+ files.
- Dual Transport — stdio (local) or streamable-http (remote)
- Security — Path traversal protection, secret file detection, binary filtering
Install
pip install tokennuke
Quick Start
Claude Code / Claude Desktop
Add to your MCP config (~/.claude.json or claude_desktop_config.json):
{
"mcpServers": {
"tokennuke": {
"command": "tokennuke",
"args": []
}
}
}
CLI
# Start in stdio mode (default)
tokennuke
# Start as HTTP server
tokennuke --transport streamable-http --port 5100
13 MCP Tools
| Tool | Description |
|---|---|
index_folder |
Index a local directory |
index_repo |
Clone and index a Git repo (GitHub/GitLab/Bitbucket) |
list_repos |
List all indexed repositories |
invalidate_cache |
Force full re-index |
file_tree |
Directory tree with file counts |
file_outline |
All symbols in a single file |
repo_outline |
All symbols in repo (summary) |
get_symbol |
Full source of one symbol (O(1) byte seek) |
get_symbols |
Batch get multiple symbols |
search_symbols |
Hybrid FTS5 + vector search |
search_text |
Full-text search in file contents |
get_callees |
What does this function call? |
get_callers |
Who calls this function? |
How It Works
- Index: Tree-sitter parses source files into ASTs. We walk each AST extracting symbols (functions, classes, methods, constants, types) with their exact byte offsets.
- Store: Symbols go into per-repo SQLite databases with FTS5 indexes and sqlite-vec embeddings.
- Search: Hybrid search combines BM25 keyword matching with semantic vector similarity via Reciprocal Rank Fusion.
- Retrieve:
get_symbolseeks to the exact byte offset in the source file and reads only that symbol's bytes. No wasted tokens. - Graph: Call expressions are extracted from function bodies and stored as edges. Callee names are resolved to symbol IDs after indexing.
Token Savings Example
| Method | Tokens | Savings |
|---|---|---|
| Read entire file (500 lines) | ~4,000 | — |
file_outline + get_symbol |
~200-400 | 90-95% |
Development
git clone https://github.com/BigJai/tokennuke
cd tokennuke
pip install -e ".[dev]"
pytest tests/
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tokennuke-0.2.0.tar.gz.
File metadata
- Download URL: tokennuke-0.2.0.tar.gz
- Upload date:
- Size: 39.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
311df18221e34997047a7e85692e65d0477f377876ef970860a206cfb907ebac
|
|
| MD5 |
dbaaf511d7653cceda7463a1d3f6859b
|
|
| BLAKE2b-256 |
979d9114453f2c22a386990d0e3873df200a70f7a35a2e2f52caf2f6ff673e16
|
File details
Details for the file tokennuke-0.2.0-py3-none-any.whl.
File metadata
- Download URL: tokennuke-0.2.0-py3-none-any.whl
- Upload date:
- Size: 31.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9177e954013a45dc41377e21537db7f95ac4b7142db680b47fa59c6ea2f198e1
|
|
| MD5 |
fa281f835be0db2b5984fd711719efdb
|
|
| BLAKE2b-256 |
f96c8f925d1c3b0dfbc33675947b7dd7e997723b0be6c3950be62b518536e12b
|