tokensave
Provides multi-branch indexing capabilities with cross-branch search, diff, and list tools, enabling code graph queries across different git branches without switching checkouts.
Provides semantic code intelligence tools for GitHub Copilot, including automatic MCP server registration to enable code graph queries for smarter context building and reduced token usage.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Why tokensave?
AI coding agents waste tokens exploring codebases. Every grep, glob, and file read costs money. On complex tasks, agents spawn multiple Explore sub-agents that scan hundreds of files just to build context.
tokensave gives agents a pre-indexed semantic knowledge graph. Instead of scanning files, the agent queries the graph and gets instant, structured answers -- the right symbols, their relationships, and source code, in one call.
How It Works
flowchart TB
subgraph agent["AI Coding Agent (Claude Code, Codex, Gemini, Cursor, ...)"]
task["Implement user authentication"]
first["Sub-agent"]
second["Sub-agent"]
task --> first
task --> second
first --- second
end
subgraph server["tokensave MCP Server"]
search["Search: auth"]
callers["Callers: login()"]
context["Context for task"]
db[("libSQL Graph DB<br/>Instant lookups<br/>FTS5 search")]
search --> db
callers --> db
context --> db
end
first --> search
first --> callers
second --> contextWithout tokensave: Agents use grep, glob, and Read to scan files -- many API calls, high token usage.
With tokensave: Agents query the graph via MCP tools -- instant results, local processing, fewer tokens.
Related MCP server: Code Context Engine
Key Features
Smart Context Building | Semantic Search | Impact Analysis |
One tool call returns everything the agent needs -- entry points, related symbols, and code snippets. | Find code by meaning, not just text. Search for "authentication" and find | Know exactly what breaks before you change it. Trace callers, callees, and the full impact radius of any symbol. |
80+ MCP Tools | 50+ Languages | 12+ Agent Integrations |
From call graph traversal to dead code detection, atomic edit primitives, code-health metrics, test mapping, and complexity analysis. | Rust, Go, Java, Python, TypeScript, C, C++, Swift, Svelte, Astro, and 48 more including WGSL/HLSL/Metal shaders, CUDA/HIP, and Markdown. Three tiers (lite/medium/full) control binary size. | Claude Code, Codex CLI, Gemini CLI, Qwen Code, Kiro, Cursor, OpenCode, Copilot, Cline, Roo Code, Zed, Antigravity, Kilo CLI, Kimi CLI, Mistral Vibe, Grok Build, Factory Droid, OMP, Pi, Plank. |
Multi-Branch Indexing | 100% Local | Always Fresh |
Per-branch databases, tracked automatically as you check out branches. Cross-branch diff and search without switching your checkout. | No data leaves your machine. No API keys. No external services. Everything runs on a local libSQL database. | On-demand staleness check on every MCP call (30 s cooldown) plus catch-up sync when the server connects. Multi-agent work is expected to use git worktrees — each agent gets its own checkout and the index diverges are merged by git, not by a file watcher. |
Subprocess-Isolated Extraction | Code-Health Analytics | Atomic Edit Primitives |
A native crash in any tree-sitter grammar (abort, segfault, anything) kills only the worker; the pool respawns it and sync continues. Sync never dies on a malformed file. | Composite health score (0-10000), Gini inequality, file-DAG depth, design-structure matrix, risk-weighted test gaps, and session deltas. | Edit files without regex or shell-quoting hazards: unique-anchor |
Quick Start
1. Install
Choose one installation method:
Platform | Command |
Any platform (Cargo) |
|
macOS (Homebrew) |
|
Windows (Scoop) |
|
You can also download a prebuilt binary and add it to your PATH.
To build unreleased code from the upstream master branch, see
Installing from upstream master.
The default Cargo build includes all supported languages. For a smaller build:
cargo install tokensave --no-default-features --features medium
cargo install tokensave --no-default-features # lite (smallest binary)Prebuilt release archives:
Platform | Archive |
macOS (Apple Silicon) |
|
Linux (x86_64) |
|
Linux (ARM64) |
|
Windows (x86_64) |
|
2. Configure your agent
Run the setup command to auto-detect your installed agents:
tokensave installTo choose an agent, use --agent (for example, codex, claude, or cursor):
tokensave install --agent codexSetup registers the MCP server and the agent's integration for Claude Code, Codex CLI, Gemini CLI, Cursor, Copilot, Kiro, Pi, Zed, and more than a dozen other agents. It also offers global Git hooks to keep initialized projects up to date. You can safely run setup again after upgrading. See Agent Integrations for project-local installs, several agents at once, and what setup writes for each agent.
3. Index your project
cd /path/to/your/project
tokensave initThis creates a .tokensave/ directory with the knowledge graph database. A
repository you create with git init is initialized automatically on its first
commit or agent session (auto_init, on by default). After that,
tokensave sync updates the index incrementally, and a connected agent keeps it fresh automatically. Commands work
from any subdirectory of the project. See
Indexing and Freshness for details.
Documentation
The full documentation lives in docs/guide/ and is
mirrored to the GitHub Wiki.
Topic | What it covers |
Language tiers, self-upgrade and channels, versioning, building from source | |
Supported agents, project-local setup, what install writes | |
Project discovery, index freshness, crash-resilient sync, custom extensions | |
The 80+ tools by category, cross-project queries, MCP resources | |
Per-branch graphs, automatic tracking, branch quality regressions | |
Savings ledger, cost reports, live monitor, memory diagnostics | |
Opt-in latency attribution for database operations, MCP tool phases and indexing | |
Every command at a glance | |
50+ languages and their feature tiers | |
What leaves your machine and how to opt out | |
| |
Retrieval-savings and performance benchmarks | |
tokensave compared with CodeGraph and alternatives |
The long-form User Guide walks through everyday use in more depth. To contribute, see CONTRIBUTING.md.
Origin
This project is a Rust port of the original CodeGraph TypeScript implementation by @colbymchenry. The port maintains the same architecture and MCP tool interface while leveraging Rust for performance and native tree-sitter bindings.
Building
To build from source, see Building from source and CONTRIBUTING.md.
Star History
Sponsors
License
MIT License -- see LICENSE for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Codebase intelligence for AI agents — dead code, blast radius, ownership.
Codebase intelligence for agents: 152 structured artifacts across 21 programs, one call.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceTransforms codebases into a knowledge graph for AI agents, enabling semantic search, impact analysis, and persistent session memory with up to 94% token savings.4 npm15ISC

Code Context Engineofficial
AlicenseNot gradedqualityBmaintenanceIndexes your codebase so AI coding agents can search instead of re-reading files, saving up to 94% of tokens.147 PyPI452MIT- AlicenseNot gradedqualityBmaintenanceSupercharges AI coding agents with a pre-indexed semantic code graph, enabling instant symbol relationships, impact analysis, and context retrieval across 20+ languages.157,892 npm76,148MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI coding agents to efficiently query code context via a symbol graph, reducing token usage by up to 20x.111 npm497-