Skip to main content
Glama

claw-tsaver

MCP-прокси для экономии токенов для пользователей OpenClaw. Сокращает полезную нагрузку вызовов инструментов на 90%+ за счет «ленивого» (отложенного) развертывания.

Зачем

Вызовы инструментов MCP часто возвращают тысячи токенов HTML или JSON в одном ответе, но модель обычно использует лишь 5% из них. Оставшиеся 95% незаметно расходуют контекстное окно и увеличивают затраты. claw-tsaver располагается между OpenClaw и вашими нижестоящими MCP-серверами, перехватывает слишком большие ответы и предоставляет модели компактный предварительный просмотр + дескриптор для доступа по требованию.

Related MCP server: TokenSaver MCP

Как

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

Реальные измерения

Тест

Исходные токены

Возвращенные токены

Экономия

fetch Wikipedia "Tokenization (data security)"

11 507

104

99,1%

Протестировано на OpenClaw + Claude Sonnet 4.6 + mcp-server-fetch, 25.04.2026. Исходные данные: benchmarks/mvp-day1-fetch.jsonl.

Быстрый старт

1. Предварительные требования

Установите uv (однократная настройка):

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

Установка claw-tsaver не требуется — uvx загрузит и запустит его по запросу.

2. Настройка нижестоящих MCP-серверов

Отредактируйте ~/.claw-tsaver/config.json (первый запуск claw-tsaver-mcp автоматически создаст шаблон):

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

3. Регистрация в OpenClaw

Добавьте этот блок на верхний уровень ~/.openclaw/openclaw.json:

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

Затем перезапустите шлюз OpenClaw: openclaw gateway restart

Панель управления

Опционально: локальный веб-интерфейс для просмотра статистики экономии токенов в реальном времени.

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

Откройте http://localhost:7878 в вашем браузере.

Дорожная карта

  • [x] Модуль A: прокси с ленивым развертыванием (этот релиз)

  • [x] Модуль D: локальная панель управления (этот релиз)

  • [ ] Модуль B: маршрутизация инструментов (автоматическая загрузка только релевантных MCP для каждого шага)

  • [ ] Модуль C: сжатие истории диалогов (атомарные карточки фактов)

Лицензия

MIT — см. файл LICENSE.

Участие в разработке

Приветствуются сообщения об ошибках и PR.

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.

Inputs: handle (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 1 tool

    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
    ResponsivenessNo recent community issues

    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.
      34 PyPI
      MIT
    • A
      license
      A
      quality
      D
      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
      C
      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
      9 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      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