
Tokenectomy Razor
io.github.daffa2555由 GitHub 账号 daffa2555 发布v1.1.1更新于 Oct 24, 2026
Autonomous log surgery & secret redaction MCP server for AI coding agents.
概览
本地 MCP 服务器兼 AI 网关,可裁剪错误日志中的框架噪声、脱敏泄露的密钥,并提供代码分析与打补丁工具。
- 可以做什么
- 清理与诊断错误日志:剔除第三方堆栈帧、脱敏凭据并提取相关本地源码上下文
- 静态分析代码,检测资源泄漏、未关闭句柄与语法问题
- 以原子方式应用文件补丁,写入后做语法校验,失败时自动回滚
- 审计日志或提示词中的 token 膨胀、框架噪声与密钥,并给出节省指标
- 用脱敏后的搜索词在 Stack Exchange 上检索错误特征
- 适用场景
- 适合编码助手被冗长的框架堆栈淹没、因崩溃日志耗尽上下文或速率限额,或担心把数据库密码、API 密钥和令牌发给模型服务商的场景。也适合在项目工作区内做快速静态检查与受控的文件修改。
- 运行要求
- 作为本地进程在用户机器上运行,可通过 npx、cargo、预编译二进制或 Docker 启动。可选的网关模式会绑定本地端口并把请求转发给上游模型服务商,这些服务商需要各自的凭据。仅 Stack Exchange 搜索工具需要外网访问。
安装
在 SourceWeft 中
- 打开 控制台中的 Tokenectomy Razor,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Tokenectomy Razor
Fix Claude Code & Cursor Rate Limits: Zero-Latency Local AI Gateway & Context-Surgery MCP Server in Rust
Stop burning 20,000 tokens on node_modules stack traces. Tokenectomy Razor is a sub-millisecond local AI Gateway reverse proxy (127.0.0.1:8080) & companion MCP server written in safe Rust. Excises 41.7%–99.7% framework noise from terminal error logs, redacts leaked DB credentials/JWTs, and caches prompts for free.
[Official MCP Registry] [crates.io] [npm] [OpenSSF Scorecard] [OpenSSF Best Practices] [CI] [License]
Quick Start (10s) • Architecture • The Problem • Before & After • Live Interactive Demo • Benchmarks
⚡ Quick Start (10s)
0. Zero-Config One-Liner Wrapper (wrap)
Run any coding agent or test suite directly behind Tokenectomy's privacy & caching gateway with zero manual environment variable setup:
1. Launch the Standalone AI Gateway (Manual Mode)
💡 Smart Multi-Provider Auto-Routing & Universal LLM Transpiler ON by default! Tokenectomy automatically analyzes request paths and headers. Need to run Claude Code against DeepSeek or Ollama? Tokenectomy transparently transpiles Anthropic
/v1/messagesformat into OpenAI/v1/chat/completionson-the-fly and vice-versa.
2. Connect Your Favorite Agent
Point your coding agent or CLI to the local gateway on 127.0.0.1:8080:
3. Real-Time FinOps & Security Dashboard
Open http://127.0.0.1:8080/dashboard in your browser to observe live token reductions, prompt cache hits, dollar savings, and redacted credentials in real time.
4. Companion MCP Server Setup (Sub-Cortex)
For agents calling deep diagnostic tools (get_error_context, analyze_code, apply_code_patch):
Claude Code CLI
Google Antigravity / Gemini CLI
Cursor Composer (.cursor/mcp.json)
Claude Desktop (claude_desktop_config.json)
5. Terminal Piping & CLI Scrubbing
🛑 The Problem: Why Your AI Hits Rate Limits & Hallucinates
When your app crashes during development (Next.js, Express, FastAPI, Tokio), the runtime dumps hundreds of lines of third-party plumbing from node_modules or site-packages.
When you paste that raw crash dump into Cursor or Claude:
- Eats Your 5-Hour Rate Limit: A single Express/Prisma error can dump 5,000 to 45,000 tokens of third-party library code you never wrote. A few crash loops easily burn your session limit.
- Triggers AI Hallucinations: Claude gets lost in framework internals (
node_modules/express/lib/router/layer.jsorstarlette/routing.py) and tries to edit library files instead of your actual application code. - Leaks Secrets & Credentials: Connection strings with raw database passwords, JWT bearer tokens, and cloud keys embedded in error traces get forwarded to external model servers.
🔍 Before & After Comparison
❌ Without Tokenectomy: AI Hallucinates & Burns Context
What Claude does: Analyzes
load-components.jsandnext-server.js, speculates on Webpack / Next.js internals, and leaks connection credentials to remote inference logs.
✅ With Tokenectomy: Clean Context & Instant Fix
What Claude does: Instantly identifies that line 42 in
checkout.tsattempted to access.tokenon undefined headers. Suggests optional chainingreq.headers.authorization?.tokenimmediately. Credentials redacted before transmission.
🔬 Verifiable Benchmarks
All performance claims are hardware-grounded and independently reproducible on physical hardware (measured on 10-Core Intel Core i5-1235U @ 15W running Arch Linux, Kernel 6.13):
Hardware Dependency Notice: Performance is hardware-dependent; reported throughput represents measured results on the specified test hardware (10-Core Intel Core i5-1235U @ 15W TDP). Throughput scales with higher TDP desktop/server CPUs and faster memory buses. Developers are encouraged to independently audit performance using the reproduction command below.
📋 Click to expand full raw benchmark terminal log ($ cargo test --release)
🛡️ Automated Redaction & Secret Sanitization Benchmark
Evaluated across an internal benchmark test fixture (tests/fixtures/) of 12 polyglot crash traces (Rust, Python, TypeScript, Go, YAML) containing 22 ground-truth credentials and clean negative controls. Evaluated head-to-head against Gitleaks v8.30.1 (default ruleset).
Architectural Note: Gitleaks is designed primarily as a repository commit/diff scanner, not an in-memory runtime trace redactor. Tokenectomy Razor is engineered specifically for runtime stream sanitization and stack trace surgery.
1. Per-Category Precision, Recall & F1-Score
2. Head-to-Head Performance & Architectural Summary
3. Token Reduction & LLM Context Savings (tiktoken cl100k_base)
🔌 Advanced Agent & Gateway Configuration
1. Multi-Provider AI Gateway Options (--proxy)
Tokenectomy's gateway runs locally on 127.0.0.1:8080 with zero manual configuration. In complex development environments or containerized agent topologies, you can customize binding and routing:
Real-Time Metrics & Prometheus Export
Tokenectomy exposes live FinOps and token economics data via JSON:
Returns instant telemetry for rate_limits_mitigated, circuit_breaker_trips, last_latency_ms, current_hourly_tokens, cache_hits, cache_tokens_saved, and estimated_cost_saved_usd.
2. Standalone CLI & Terminal Scrubbing
When debugging or piping terminal test output directly:
🛠️ Exposed MCP Tools
Tokenectomy Razor complies with Glama Grade A Tool Definition Quality Score (TDQS) with explicit parameter boundaries:
🌐 Supported Polyglot Ecosystems
📦 Installation Options
Method 1: Instant via npx (Zero Toolchain Setup)
Method 2: Cargo (crates.io)
Method 3: Precompiled Standalone Binaries
Zero-dependency, standalone release binaries available on GitHub Releases:
- Linux:
x86_64-unknown-linux-gnu,x86_64-unknown-linux-musl,aarch64-unknown-linux-gnu - macOS:
aarch64-apple-darwin(Apple Silicon M1/M2/M3/M4),x86_64-apple-darwin(Intel) - Windows:
x86_64-pc-windows-msvc.exe
Method 4: Multi-Arch Docker Container (GHCR)
⚖️ Edition Comparison
Need Enterprise AST Self-Healing? Explore the Sentinel Tier
🗺️ Roadmap & Milestones
🔒 Security & Invariants
- Local Execution by Default: All stack trace parsing, frame pruning, and secret redaction execute locally on physical hardware.
- Documented Network Egress: In MCP server mode,
search_stack_overflowis the sole tool with outbound network egress (HTTPS toapi.stackexchange.com). The payload is strictly limited to sanitized, redacted error signature text (no code lines, no local paths, zero credentials). In air-gapped environments, use--local-onlyto disable network search entirely. - Deterministic Linear-Time Pattern Matching: All pattern matchers utilize non-backtracking DFA regex engines ($O(N)$ linear time) and Aho-Corasick automaton evaluation.
- Path Traversal Boundary Isolation: File operations are strictly locked within the active workspace root (
CWD). Path traversals (../) and unauthorized symlinks are blocked. - Safe Rust Implementation: Core execution paths enforce safe Rust memory guarantees with bounded stream readers (
.take()) preventing resource exhaustion.
For vulnerability disclosures, please review our Security Policy.
⚖️ Legal & Downstream Fork Disclaimer
Tokenectomy Razor is provided strictly for lawful developer productivity, observability, log surgery, and defensive credential redaction. Any downstream forks, clones, redistributions, or private deployments operate completely independently of the original authors. Tokenectomy Labs and its maintainers assume zero liability for unlawful, malicious, or unauthorized actions committed by third parties using this codebase or derivatives thereof. All downstream operators bear 100% individual responsibility for compliance with local and international cybersecurity laws. See DISCLAIMER.md for full legal terms.
❓ Frequently Asked Questions (FAQ)
How does Tokenectomy Razor prevent Claude Code & Cursor from hitting rate limits?
When tests or terminal builds crash, frameworks like Next.js, Express, Jest, and Django dump thousands of internal stack frames (node_modules, site-packages). Sending raw 5,000-line crash logs consumes 15,000 to 45,000 tokens per prompt, draining your 5-hour session limit in minutes. Tokenectomy Razor intercepts logs and strips 95% of non-actionable framework plumbing, reducing a 40,000-character crash log to under 200 essential tokens in <0.2ms.
How do I stop Cursor from sending node_modules error logs to LLMs?
Run Tokenectomy Razor as a local AI Gateway reverse proxy (npx -y tokenectomy-razor --proxy). In Cursor settings, point your OpenAI Base URL to http://127.0.0.1:8080/v1. Any terminal error output pasted or referenced by Composer will be automatically sanitized, scrubbed, and cached on the fly before reaching model servers.
How does Tokenectomy prevent credential leakage in error logs?
All log surgery and secret redaction execute 100% locally on your machine in memory before outbound transmission. Razor uses deterministic linear-time regex and Aho-Corasick automata to detect and redact PostgreSQL/MongoDB connection URIs, JWT bearer tokens, and cloud API keys with [REDACTED] tokens. Zero cloud egress is required for scrubbing.
🤝 Community & Resources
- 🌐 Official Website
- 📖 Documentation
- 🏗️ System Architecture
- 📋 Changelog
- 🤝 Contributing Guidelines
- 🔒 Security Policy
- ⚖️ Disclaimer & Liability
Tokenectomy Labs • Autonomous M2M Sub-Cortex
Engineered with precision by Daffa (@daffa2555)
Licensed under the MIT License
来源:README.md,提交 29ff8de
工具
0版本历史
1- v1.1.1最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分