经 AI Skill Hub 精选评估,tokensave MCP工具 获评「推荐使用」。这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 7.8 分,适合有一定技术背景的用户使用。
tokensave MCP工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
tokensave MCP工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/aovestdipaperino/tokensave
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"tokensave-mcp--": {
"command": "npx",
"args": ["-y", "tokensave"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 tokensave MCP工具 执行以下任务... Claude: [自动调用 tokensave MCP工具 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"tokensave_mcp__": {
"command": "npx",
"args": ["-y", "tokensave"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
<p align="center"> <img src="src/resources/logo.png" alt="TokenSave" width="300"> </p>
<p align="center"><strong>Fewer tokens • Fewer tool calls • 100% local</strong></p>
<p align="center"> <a href="https://crates.io/crates/tokensave"><img src="https://img.shields.io/crates/v/tokensave.svg" alt="crates.io"></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a> <a href="https://www.rust-lang.org/"><img src="https://img.shields.io/badge/Rust-1.70+-orange.svg" alt="Rust"></a> </p>
<p align="center"> <img src="https://img.shields.io/badge/macOS-supported-blue.svg" alt="macOS"> <img src="https://img.shields.io/badge/Linux-supported-blue.svg" alt="Linux"> <img src="https://img.shields.io/badge/Windows-supported-blue.svg" alt="Windows"> <a href="https://hypercommit.com/tokensave"><img src="https://img.shields.io/badge/Hypercommit-DB2475" alt="Hypercommit"></a> </p>
---
| **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 login, validateToken, AuthService. | Know exactly what breaks before you change it. Trace callers, callees, and the full impact radius of any symbol. |
| **48 MCP Tools** | **34 Languages** | **14 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, and 26 more, including Markdown header extraction. Three tiers (lite/medium/full) control binary size. | Claude Code, Codex CLI, Gemini CLI, Kiro, Cursor, OpenCode, Copilot, Cline, Roo Code, Zed, Antigravity, Kilo CLI, Kimi CLI, Mistral Vibe. |
| **Multi-Branch Indexing (opt-in)** | **100% Local** | **Always Fresh** |
| Optional per-branch databases. 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. | Embedded file watcher (when MCP server is running) syncs the index automatically. Multi-agent safe via per-project sync lock. |
| **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 str_replace, atomic multi-replace, AST-rewrite, anchored insert. Auto re-indexes after writes. |
---
Always compiled. The smallest binary for the most popular languages.
| Language | Extensions |
|---|---|
| Rust | .rs |
| Go | .go |
| Java | .java |
| Scala | .scala, .sc |
| TypeScript | .ts, .tsx |
| JavaScript | .js, .jsx |
| Python | .py |
| C | .c, .h |
| C++ | .cpp, .hpp, .cc, .cxx, .hh |
| Kotlin | .kt, .kts |
| C# | .cs |
| Swift | .swift |
| Language | Extensions | Feature flag |
|---|---|---|
| Dart | .dart | lang-dart |
| Pascal | .pas, .pp, .dpr | lang-pascal |
| PHP | .php | lang-php |
| Ruby | .rb | lang-ruby |
| Bash | .sh, .bash | lang-bash |
| Protobuf | .proto | lang-protobuf |
| PowerShell | .ps1, .psm1 | lang-powershell |
| Nix | .nix | lang-nix |
| VB.NET | .vb | lang-vbnet |
Every alternative requires a runtime: Python, Node.js, or both. tokensave ships as a single ~25 MB Rust binary with all 34 tree-sitter grammars bundled. Nothing else to install.
Homebrew (macOS):
brew install aovestdipaperino/tap/tokensave
Scoop (Windows):
scoop bucket add tokensave https://github.com/aovestdipaperino/scoop-bucket
scoop install tokensave
Cargo (any platform):
cargo install tokensave # full (34 languages, default)
cargo install tokensave --features medium # medium (20 languages)
cargo install tokensave --no-default-features # lite (11 languages, smallest binary)
Prebuilt binaries (Linux, Windows, macOS):
Download from the latest release and place the binary in your PATH.
| Platform | Archive |
|---|---|
| macOS (Apple Silicon) | tokensave-vX.Y.Z-aarch64-macos.tar.gz |
| Linux (x86_64) | tokensave-vX.Y.Z-x86_64-linux.tar.gz |
| Linux (ARM64) | tokensave-vX.Y.Z-aarch64-linux.tar.gz |
| Windows (x86_64) | tokensave-vX.Y.Z-x86_64-windows.zip |
cargo build --release # full (34 languages, default)
cargo build --release --features medium # medium (20 languages)
cargo build --release --no-default-features # lite (11 languages)
cargo test # run all tests (requires full)
cargo check --no-default-features # verify lite compiles
cargo clippy --all
tokensave install # auto-detects installed agents
tokensave install --agent antigravity # Google Antigravity (formerly Windsurf)
tokensave install --agent claude # Claude Code
tokensave install --agent cline # Cline
tokensave install --agent codex # OpenAI Codex CLI
tokensave install --agent copilot # GitHub Copilot
tokensave install --agent cursor # Cursor
tokensave install --agent gemini # Gemini CLI
tokensave install --agent kilo # Kilo CLI
tokensave install --agent kiro # AWS Kiro
tokensave install --agent kimi # Moonshot Kimi CLI
tokensave install --agent opencode # OpenCode
tokensave install --agent roo-code # Roo Code
tokensave install --agent vibe # Mistral Vibe
tokensave install --agent zed # Zed
Each agent gets its MCP server registered in the native config format. Claude Code additionally gets a PreToolUse hook (blocks wasteful Explore agents), a UserPromptSubmit hook, a Stop hook, prompt rules in CLAUDE.md, and auto-allowed tool permissions. Kiro gets global MCP config, read-only tokensave auto-approval, AGENTS.md steering, and a tokensave-managed default agent with delegation guardrail hooks plus post-write sync; user-managed Kiro agents are preserved.
All changes are idempotent -- safe to run again after upgrading. After agent setup, you'll be offered a global git post-commit hook.
tokensave can optionally maintain a separate code graph per git branch. When enabled, switching branches never gives you stale results and never re-indexes files you already parsed on another branch. Multi-branch tracking is opt-in -- without it, tokensave uses a single database for all branches.
tokensave branch add # track the current branch
tokensave branch list # see tracked branches and DB sizes
tokensave branch remove <name> # stop tracking a branch
tokensave branch removeall # remove all tracked branches except default
tokensave branch gc # clean up branches deleted from git
tokensave init [path] # Initialize a new project (full index)
tokensave sync [path] # Incremental sync (must be initialized first)
tokensave sync --force [path] # Force a full re-index
tokensave sync --doctor [path] # Sync and list added/modified/removed files
tokensave status [path] # Show statistics + cost summary
tokensave status [path] --json # Show statistics (JSON output)
tokensave status --details # Include node-kind breakdown
tokensave cost [range] # Token cost summary (default: 7d)
tokensave cost --by-model # Cost grouped by model
tokensave cost --by-task # Cost grouped by task category
tokensave cost --export json|csv # Export cost data
tokensave query <search> [path] # Search symbols
tokensave files [--filter dir] [--pattern glob] [--json] # List indexed files
tokensave affected <files...> [--stdin] [--depth N] # Find affected test files
tokensave install [--agent NAME] # Configure agent integration
tokensave reinstall # Refresh settings for all installed agents
tokensave uninstall [--agent NAME] # Remove agent integration
tokensave serve # Start MCP server
tokensave monitor # Live TUI showing MCP calls across all projects
tokensave upgrade # Self-update to latest version
tokensave channel [stable|beta] # Show or switch update channel
tokensave doctor [--agent NAME] # Check installation health
tokensave branch add|list|remove|removeall|gc # Multi-branch management
tokensave current-counter # Show per-project token counter
tokensave reset-counter # Reset per-project token counter
tokensave disable-upload-counter # Opt out of worldwide counter uploads
tokensave enable-upload-counter # Re-enable worldwide counter uploads
---
| Tool | Purpose |
|---|---|
tokensave_diff_context | Semantic context for changed files -- modified symbols, dependencies, affected tests |
tokensave_commit_context | Semantic summary of uncommitted changes for commit message drafting |
tokensave_pr_context | Semantic diff between git refs for pull request descriptions |
tokensave_changelog | Semantic diff between two git refs |
tokensave_test_map | Source-to-test mapping at the symbol level, with uncovered symbol detection |
tokensave is a ground-up Rust rewrite of CodeGraph (Node.js/TypeScript). Both build semantic code graphs for AI coding agents, but they diverge significantly in scope and capabilities.
| **tokensave** | **CodeGraph** | |
|---|---|---|
| **Runtime** | Native binary (Rust) | Node.js 18+ |
| **Install** | brew install, cargo install, scoop install | npx @colbymchenry/codegraph |
| **Languages** | 34 (3 tiers: lite/medium/full) | 19+ |
| **MCP tools** | 48 | 9 |
| **Agent integrations** | 14 (Claude, Codex, Gemini, OpenCode, Cursor, Cline, Copilot, Roo Code, Zed, Antigravity, Kilo, Kiro, Kimi, Vibe) | 1 (Claude Code) |
| **Embedded file watcher** | Yes (in MCP process, multi-agent safe) | No (hook-based sync only) |
| **Multi-branch indexing** | Yes, opt-in (per-branch DBs, cross-branch diff/search) | No |
| **Complexity metrics** | AST-extracted (branches, loops, nesting depth, cyclomatic) | No |
| **Porting tools** | Yes (port_status, port_order) | No |
| **Graph visualizer** | Removed (v4.0.1) | Yes |
| **Semantic search** | Agent-driven keyword expansion (zero-cost) | Local embeddings (nomic-embed-text-v1.5 via ONNX) |
| **MCP resources** | 4 (status, files, overview, branches) | No |
| **MCP annotations** | Yes (readOnlyHint, alwaysLoad) | No |
| **Dead code detection** | Yes | No |
| **Circular dependency detection** | Yes | No |
| **Type hierarchy** | Yes | No |
| **God class / coupling analysis** | Yes | No |
| **Commit / PR context** | Yes | No |
| **Test mapping** | Yes | No |
| **Rename preview** | Yes | No |
| **Token tracking** | Per-call metrics, live TUI monitor, session + lifetime counters | No |
| **Code-health analytics** | Composite score, Gini, dependency depth, DSM, risk-weighted test gaps, session deltas | No |
| **Edit primitives** | 4 atomic writers (str_replace, multi_str_replace, insert_at, ast_grep_rewrite) with auto re-indexing | No |
| **Crash resilience** | Subprocess-isolated extraction; native grammar aborts skip the file, sync continues | No |
| **Self-upgrade** | tokensave upgrade with stable/beta channels | npm update |
| **DB engine** | libsql (SQLite fork, WAL, async) | better-sqlite3 / wa-sqlite (WASM) |
| **Indexing speed** | ~1.2s for 1,782 files | ~4s for 1,782 files |
| **Binary size** | ~25 MB (all grammars bundled) | ~80 MB (node_modules + WASM) |
CodeGraph pioneered the approach and remains a solid choice if you prefer npm tooling and only need Claude Code integration. tokensave extends the concept with deeper analysis, more agents, background sync, multi-branch support, and a native binary with no runtime dependencies.
For detailed comparisons against CodeGraph, Dual-Graph (GrapeRoot), code-review-graph, and OpenWolf, see docs/COMPARABLE-TOOLS.md.
---
Several tools reduce token usage for AI coding agents. Here's why tokensave stands apart.
TokenSave 是一款专为 AI Coding Agents 设计的语义代码智能工具。它旨在通过减少 Token 消耗和 Tool Calls 频率,实现 100% 本地化的代码理解。通过提供精准的语义上下文,TokenSave 能让 AI 开发者在保持极高性能的同时,显著降低 API 调用成本并提升代码生成的准确性。
TokenSave 提供强大的语义搜索与影响分析功能。其 Smart Context Building 技术允许通过单次 Tool Call 返回 Agent 所需的所有信息,包括入口点、相关符号及代码片段。此外,它支持基于语义而非纯文本的搜索(例如搜索 "authentication" 可直接定位到 `login` 或 `AuthService`),并能通过追踪调用链(Callers/Callees)实现精准的影响分析,确保代码变更前即可预知潜在风险。
TokenSave 采用 Rust 编写,以单文件原生二进制形式交付,无需安装 Python、Node.js 等运行时环境。整个程序仅约 25 MB,且内置了 34 种 tree-sitter 语法解析器,实现了真正的零依赖(Zero Dependencies)部署,非常适合追求轻量化和极简环境的开发者。
用户可以通过多种方式安装 TokenSave:macOS 用户可以使用 Homebrew 进行安装;Windows 用户推荐使用 Scoop;对于跨平台开发者,可以通过 Cargo 进行安装。Cargo 支持不同的 Feature 组合:默认安装支持 34 种语言的 Full 版本,也可以通过 `--features medium` 或 `--no-default-features` 安装仅支持 11 种语言的 Lite 版本,以适配不同的资源需求。
TokenSave 支持通过 CLI 进行项目初始化与同步。使用 `tokensave init [path]` 初始化项目并建立完整索引,随后可通过 `tokensave sync [path]` 进行增量同步。如果需要强制重新索引,可以使用 `--force` 参数。此外,`tokensave status` 命令可以帮助开发者实时查看当前项目的索引状态。
TokenSave 提供了便捷的 Agent 配置机制。通过执行 `tokensave install` 命令,系统可以自动检测已安装的 AI Agent。开发者也可以手动指定 Agent 类型进行集成,目前已支持 Claude Code、Cline、GitHub Copilot、OpenAI Codex CLI 以及 Google Antigravity (formerly Windsurf) 等主流工具。此外,TokenSave 还支持可选的 Multi-Branch Indexing 功能,为不同的 Git 分支维护独立的语义代码图谱,避免分支切换时出现过时结果。
TokenSave 的 CLI 提供了完善的分支管理与索引控制接口。通过 `tokensave branch` 系列命令(如 `add`, `list`, `remove`, `gc`),开发者可以高效管理不同 Git 分支的索引数据库。对于项目同步,提供了从增量同步到强制全量索引的完整指令集,确保本地语义数据库与代码库始终保持一致。
TokenSave 深度集成 Git 工作流,提供了一系列语义化工具模块。`tokensave_diff_context` 用于为变更文件提供语义上下文(包括修改的符号、依赖及受影响的测试);`tokensave_commit_context` 能够为未提交的变更生成语义摘要,辅助编写 Commit Message;而 `tokensave_pr_context` 则专门用于生成 PR 的语义 Diff,让 AI 能够理解代码变更的深层逻辑。
在遇到问题时,开发者可以参考 FAQ 进行故障排除。TokenSave 的设计重点在于稳定性与轻量化,通过内置的 `sync --doctor` 命令,开发者可以检查并列出被添加、修改或删除的文件,确保索引过程的透明度与准确性。
tokensave是Rust实现的高质量MCP服务器,40+功能覆盖广泛,Star虽中等但定位专业,适合深度代码智能需求的开发者和AI工具集成。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
AI Skill Hub 点评:tokensave MCP工具 的核心功能完整,质量良好。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | tokensave |
| 原始描述 | 开源MCP工具:The most comprehensive code intelligence MCP server for AI coding agents. 40+ to。⭐115 · Rust |
| Topics | 代码分析MCP协议AI编程Rust实现开源工具 |
| GitHub | https://github.com/aovestdipaperino/tokensave |
| License | MIT |
| 语言 | Rust |
收录时间:2026-05-16 · 更新时间:2026-05-19 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端