Skip to main content
Glama

save-token

Language: English | Tiếng Việt

Zero-dependency universal token-saving MCP server, CLI-first playbook, browser tight-scoping ladder, and 0-LLM cross-session handoff for AI coding & research agents.

Works across Antigravity, Claude Code, Codex, DeepSeek Harness (dsh), Cursor, Gemini CLI, and any stdio MCP host using built-in Node.js >= 22.5 (node:sqlite, node:vm, node:child_process) with 0 npm runtime dependencies.


Supported Platforms

Platform

Config / Skill Targets

Install Command

Auto-detect (Recommended)

Detects installed harnesses + installs ~/.save-token & ~/.agents/skills/save-token

node install.mjs

Antigravity

~/.gemini/config/plugins/save-token (plugin.json, mcp_config.json, skills/, rules/)

node install.mjs --target antigravity

Claude Code

~/.claude.json (mcpServers.save-token) + ~/.claude/skills/save-token (or .claude-plugin/plugin.json + .mcp.json directly)

node install.mjs --target claude

Codex

~/.codex/config.toml ([mcp_servers.save-token]) + ~/.agents/skills/save-token

node install.mjs --target codex

DeepSeek Harness (dsh)

~/.agents/skills/save-token + ~/.dsh/save-token.cordis.yml + ~/.dsh/save-token.AGENTS.md

node install.mjs --target dsh

Cursor

~/.cursor/mcp.json + ~/.agents/skills/save-token

node install.mjs --target cursor

Gemini CLI

~/.gemini/settings.json + ~/.agents/skills/save-token

node install.mjs --target gemini-cli

All platforms

Installs every target above without clobbering existing config keys

node install.mjs --target all

Options: Add --dry-run to preview changes, --skip-browser to skip installing agent-browser, or --uninstall --target <name> to cleanly remove save-token entries without touching your other MCP servers.


Related MCP server: hypercontext

6 MCP Tools

  1. save_token_exec: Persistent JS REPL (state across turns, await $`...`.compact() RTK-style log compactor, tools.fetchText(url) clean web/JSON reader, tools.detectClis(), tools.saveMemory/loadMemory, tools.glob/grep/readMany/edit/batchReplace) with automatic SQLite FTS5 BM25 + Trigram indexing and structural JSON truncation.

  2. save_token_poll: Monitor, wait for, or kill background commands spawned by tools.spawnBg(cmd) with optional .compact and FTS5 intent.

  3. save_token_search: Query indexed outputs across current and previous sessions.

  4. save_token_handoff: Zero-LLM session handoff builder that persists selected state keys into kv_memory and writes a compact .md snapshot (also extracts prompts/files/errors when given a transcriptPath or Antigravity conversationId, including Voice Mode utterances).

  5. save_token_resume: 3-layer progressive disclosure resume (() list -> ({ handoffId: "latest" }) summary + keys -> save_token_search / tools.loadMemory).

  6. save_token_stats: Reports real rawProcessed vs returnedToContext bytes, % saved, state, kv_memory, FTS5 sources, and jobs.


Quick Start

git clone https://github.com/rikkurea-boop/save-token.git
cd save-token
npm test                  # Runs 14 MCP E2E tests + cross-platform installer tests
node install.mjs          # Auto-detects & configures your installed agent harnesses

DeepSeek Harness (dsh) Extra Step

install.mjs --target dsh installs the skill to ~/.agents/skills/save-token (loaded automatically by @deepseek-ai/dsh-skill-filesystem) and writes ~/.dsh/save-token.cordis.yml. Copy the - id: mcp-save-token block into your cordis.yml plugins: list (see adapters/dsh-cordis.yml).

Default Browser CLI (agent-browser)

node install.mjs automatically installs agent-browser globally (npm install -g agent-browser) if it is not already on your PATH, enabling zero-screenshot browser automation (snapshot -i accessibility tree with @e1 refs, react, network, webmcp). Pass --skip-browser if you only want the MCP server and skills.


Requirements & Verification

  • Node.js >= 22.5.0 (Node 24+ recommended; uses built-in node:sqlite).

  • Zero external npm runtime dependencies.

  • Verified on Windows 11 and macOS Apple Silicon (arm64): npm test (server/test-save-token.mjs + server/test-installer.mjs).

Author & License

Available Tools

6 tools
save_token_execB

Universal token-saving JS REPL across code, data, docs, static web, and CLIs: persists state across turns, runs await $`...`.compact(), tools.fetchText(url), tools.compactOutput(), tools.detectClis(), tools.saveMemory/loadMemory, tools.*, and indexes large output into SQLite FTS5+Trigram.

Inputs: code (required), cwd, mode, intent, +3 more.

save_token_handoffA

Build a zero-LLM session handoff snapshot: optionally extracts prompts/touched files/errors from a transcript, persists chosen state keys into SQLite kv_memory, and writes a compact .md file for starting a fresh chat.

Inputs: title (required), goal, project, maxChars, +6 more.

save_token_pollB

Check, wait for, or kill background jobs started via tools.spawnBg(cmd) with optional RTK compaction (compact) and FTS5 intent filtering.

Inputs: jobId (required), kill, intent, waitMs, +2 more.

save_token_resumeA

3-layer progressive disclosure resume from previous sessions: omit handoffId for a compact list; pass 'latest' or <id> for summary, memoryKeys, and indexedSources.

Inputs: handoffId.

save_token_statsB

Report real byte/token savings (rawProcessed vs returnedToContext), active state keys, persisted kv_memory, FTS5 sources, handoffs, and background jobs.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 6 tools

    Disambiguation4/5

    Each tool has a largely distinct role: exec runs code, search queries indexed data, poll manages background jobs, handoff creates a session snapshot, resume reloads one, and stats reports metrics. There is some conceptual overlap between exec's indexing/output handling and search, but the descriptions make the intended division clear enough.

    Naming Consistency4/5

    All tools use the same `save_token_` prefix and snake_case convention, making the set easy to scan. The suffixes are mostly verbs or clear action nouns, with `handoff` and `stats` being noun-like but still consistent within the server's vocabulary.

    Tool Count5/5

    Six tools is well-scoped for a token-saving/session-continuity server. Each tool covers a distinct lifecycle stage: execution, search, background polling, handoff, resume, and reporting.

    Completeness4/5

    The surface covers the main token-saving workflow: run/compact, index/search, background jobs, session handoff, resume, and stats. Minor gaps exist around explicit cleanup or deletion of persisted memory/indexed sources, but agents can likely work around this through exec.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Enables AI coding agents and local LLMs to store and recall project memory, compact verbose logs, look up code symbols, create and rewind workspace snapshots, detect risky commands and loops, pack context optimally, and draft tokens through MCP tools.
      10
      2
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables agents to accomplish multi-step work by writing a single sandboxed JavaScript program that drives shell, filesystem, HTTP, and every tool of any configured MCP server, returning only a small summary instead of raw JSON. This collapses dozens of advertised tool schemas into one tool, cutting per-request context by roughly 26× while keeping disabled upstream servers reachable.
      1
      64 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables coding agents to reach every configured MCP server through just three tools (search, describe, execute) and a sandboxed JavaScript runtime, so a model writes one short program instead of making dozens of tool calls. Runs without network, filesystem, or credential access, returning only the result.
      28 npm
      9
      MIT