Skip to main content
Glama

claw-tsaver

A token-saving MCP proxy for OpenClaw users. Cuts tool call payloads by 90%+ via lazy expansion.

Why

MCP tool calls often return thousands of tokens of HTML or JSON in a single response — but the model typically uses only 5% of it. The remaining 95% silently burns context window and increases cost. claw-tsaver sits between OpenClaw and your downstream MCP servers, intercepts oversized responses, and hands the model a compact preview + an on-demand handle instead.

Related MCP server: TokenSaver MCP

How

sequenceDiagram
    participant U as OpenClaw (Claude)
    participant C as claw-tsaver proxy
    participant F as fetch / puppeteer / etc.
    U->>C: call_tool("fetch", url)
    C->>F: forward call
    F-->>C: 11,507 tokens of HTML
    Note over C: tiktoken count > threshold
    C->>C: store full content in SQLite
    C-->>U: {preview_head, preview_tail, expand_handle}<br/>(only 104 tokens)
    Note over U: model decides if it needs full text
    U->>C: expand_content(handle)
    C-->>U: full 11,507 tokens

Real measurement

Test

Original tokens

Returned tokens

Saved

fetch Wikipedia "Tokenization (data security)"

11,507

104

99.1%

Tested on OpenClaw + Claude Sonnet 4.6 + mcp-server-fetch, 2026-04-25.
Raw data: benchmarks/mvp-day1-fetch.jsonl.

Quick Start

1. Prerequisites

Install uv (one-time setup):

curl -LsSf https://astral.sh/uv/install.sh | sh

No claw-tsaver install needed — uvx will fetch and run it on demand.

2. Configure downstream MCP servers

Edit ~/.claw-tsaver/config.json (first run of claw-tsaver-mcp will auto-create a template):

{
  "downstream_servers": [
    {"name": "fetch", "command": "uvx", "args": ["mcp-server-fetch"]}
  ],
  "compression_threshold_tokens": 500
}

3. Register with OpenClaw

Add this block at the top level of ~/.openclaw/openclaw.json:

"mcp": {
  "servers": {
    "claw-tsaver": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/Yang1Bai/claw-tsaver",
               "claw-tsaver-mcp"]
    }
  }
}

Then restart OpenClaw gateway: openclaw gateway restart

Dashboard

Optional: a local web UI for real-time token savings stats.

uvx --from git+https://github.com/Yang1Bai/claw-tsaver claw-tsaver-dashboard

Open http://localhost:7878 in your browser.

Roadmap

  • Module A: lazy expansion proxy (this release)

  • Module D: local dashboard (this release)

  • Module B: tool routing (auto-load only relevant MCPs per turn)

  • Module C: conversation history compression (atomic fact cards)

License

MIT — see LICENSE file.

Contributing

Issues and PRs welcome.


🇨🇳 中文说明

什么是 claw-tsaver?

claw-tsaver 是一个为 OpenClaw 用户设计的 MCP 代理,通过懒加载扩展机制将工具调用的 token 消耗削减 90%+

问题背景

MCP 工具调用(如 fetch、puppeteer)经常在单次响应中返回数千个 token 的 HTML 或 JSON,但模型通常只使用其中约 5% 的内容。剩余 95% 悄悄消耗上下文窗口并增加费用。

解决方案

claw-tsaver 作为 OpenClaw 与下游 MCP 服务器之间的代理:

  1. 拦截过大的响应(超过可配置的 token 阈值)

  2. 将完整内容存储到本地 SQLite 数据库

  3. 返回给模型一个紧凑预览 + 按需扩展句柄

  4. 模型需要更多内容时,调用 expand_content 工具按需获取

快速安装

npm install -g claw-tsaver
# 在 OpenClaw 配置中添加为 MCP 服务器

开源协议

MIT License

Available Tools

1 tool
expand_contentA

Retrieve the full content of a previously compressed tool result. Pass the expand_handle returned in the compressed envelope.

ParametersJSON Schema
NameRequiredDescriptionDefault
handleYesThe expand_handle from a compressed result.

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided; description implies a read operation but does not detail any side effects, auth requirements, or handle expiration.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two efficient sentences front-load the purpose with no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter tool with no output schema, the description sufficiently guides usage, though output format is unstated.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds context that the handle comes from a compressed envelope, complementing the schema's parameter description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves the full content of a compressed result, using specific verb and resource.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description instructs to pass the expand_handle from a compressed envelope, implying the usage context, but lacks explicit conditions or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev0.0.1
    • First observedexpand_content

TDQS

A4.1/5.0
Disambiguation5/5

Only one tool exists, so there is no potential for confusion between different tools.

Naming Consistency5/5

With a single tool, there is no naming inconsistency to evaluate; the name 'expand_content' is clear and descriptive.

Tool Count2/5

A single tool for expanding compressed results is very thin; the server likely needs additional tools (e.g., for listing handles) to be useful as an MCP server.

Completeness4/5

The tool covers its stated purpose of retrieving full content, but the server lacks any supporting tools for compression or handle management, leaving a minor gap in the overall surface.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that helps AI agents reduce token usage by converting data to TOON format and stripping comments and unnecessary whitespace from code files.
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    An MCP server that reduces AI API costs by up to 97% through token measurement, compression, caching, and pruning, all without changing prompts.
    10
    1
    Apache 2.0
  • A
    license
    A
    quality
    A
    maintenance
    An MCP server that intelligently filters and compresses tool outputs to reduce context window usage, saving up to 90% of tokens by removing noise such as passing tests and redundant information.
    5
    359
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server that reduces AI agent token usage by up to 90% through intelligent context compression. Enables efficient code exploration, multi-file refactoring, and debugging by providing tools for smart reading, searching, and managing code context.
    4
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Yang1Bai/claw-tsaver'

If you have feedback or need assistance with the MCP directory API, please join our Discord server