Token Enhancer

io.github.xelektronPublished by GitHub account xelektronv0.2.1Updated Oct 24, 2026

Cuts AI web-fetching costs up to 99.9% by stripping page junk before it reaches your LLM.

VerifiedSTDIODesktop onlyWeb Search & ScrapingDeveloper Tools

Overview

AI-generated overview

Lets an assistant fetch web pages as clean text, stripping HTML noise and caching results to cut token usage.

What you can do
Token Enhancer runs locally as an MCP server and exposes three tools: fetch_clean retrieves a URL and returns cleaned text with HTML, JSON and script noise removed; fetch_clean_batch does the same for several URLs at once; refine_prompt optionally trims filler words from a prompt while showing both versions. It caches fetched results so repeat requests are fast. The README reports reductions such as 704,760 tokens to 2,625 tokens for a Yahoo Finance page.
When to use it
Useful when an assistant regularly reads web pages and raw HTML is eating the context window or driving up cost. It fits agents that fetch articles, finance pages, news sites or repository pages and only need the readable text.
Requirements
Python 3.10+ installed locally; the package is installed from PyPI as xelektron-token-enhancer and started as a local MCP server process. No API keys, LLM or GPU are needed. Internet access is required for fetching pages. On some Linux hosts an SSL CA bundle path may need to be set via the REQUESTS_CA_BUNDLE environment variable.
Before you install
The server fetches arbitrary URLs on the assistant's behalf, so page content enters the model context and requests originate from the user's machine. It caches fetched pages locally. The optional prompt refiner rewrites prompt text, though it shows both versions for review. The README suggests setting REQUESTS_CA_BUNDLE on Linux, which changes certificate verification behavior.

Installation

In SourceWeft

  1. Open Token Enhancer in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

Token Enhancer

A local proxy that strips web pages down to clean text before they enter your AI agent's context window.

One fetch of Yahoo Finance: 704,760 tokens → 2,625 tokens. 99.6% reduction.

No API key. No LLM. No GPU. Just Python.

The Problem

AI agents waste most of their token budget loading raw HTML pages into context. A single Yahoo Finance page is 704K tokens of navigation bars, ads, scripts, and junk. Your agent pays for all of it before any reasoning happens.

The Solution

Token Enhancer sits between your agent and the web. It fetches the page, strips the noise, caches the result, and returns only clean data.

SourceRaw TokensAfter ProxyReduction
Yahoo Finance (AAPL)704,7602,62599.6%
Wikipedia article154,44019,47987.4%
Hacker News8,66285990.1%
GitHub repo page171,2346,97695.9%

Install

bash
pip install xelektron-token-enhancer

Quick Start (from source)

git clone https://github.com/xelektron/token-enhancer.gitcd token-enhancerchmod +x install.sh./install.shsource .venv/bin/activatepython3 test_all.py --live

Usage

As a standalone proxy

source .venv/bin/activatepython3 proxy.py

Then in another terminal:

curl -s http://localhost:8080/fetch \  -H "content-type: application/json" \  -d '{"url": "https://finance.yahoo.com/quote/AAPL/"}' \  | python3 -m json.tool

As an MCP Server (Claude Desktop, Cursor, OpenClaw)

This is the plug and play option. Your AI agent discovers the tools automatically and uses them on its own.

bash
pip install xelektron-token-enhancer

Claude Desktop: Add to your config file

Mac: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

json
{  "mcpServers": {    "token-enhancer": {      "command": "python3",      "args": ["-m", "mcp_server"],      "env": {        "REQUESTS_CA_BUNDLE": "/etc/ssl/certs/ca-certificates.crt"      }    }  }}

On Linux hosts where SSL verification fails, the env block above overrides the default CA bundle. Remove it on macOS/Windows.

Cursor: Add to .cursor/mcp.json in your project:

json
{  "mcpServers": {    "token-enhancer": {      "command": "python3",      "args": ["-m", "mcp_server"]    }  }}

Once connected, your agent gets three tools:

fetch_clean fetches any URL and returns clean text (86 to 99% smaller)

fetch_clean_batch fetches multiple URLs at once

refine_prompt optional prompt cleanup, shows both versions so you decide

As a LangChain Tool

python
from langchain.tools import toolimport requests
@tooldef fetch_clean(url: str) -> str:    """Fetch a URL and return clean text with HTML noise removed."""    r = requests.post("http://localhost:8080/fetch", json={"url": url})    return r.json()["content"]

Add fetch_clean to your agent's tool list. Start python3 proxy.py first.

Features

Data Proxy (Layer 2) Fetches any URL, strips HTML/JSON noise, returns clean text. Caches results so repeat fetches are instant. Handles HTML, JSON, and plain text.

Prompt Refiner (Layer 1, opt in) Strips filler words and hedging while protecting tickers, dates, money values, negations, and conversation references. You see both versions and choose.

MCP Server Plug into Claude Desktop, Cursor, OpenClaw, or any MCP client. Agent discovers the tools and uses them automatically.

API Endpoints (proxy mode)

EndpointMethodDescription
/fetchPOSTFetch URL, strip noise, return clean data
/fetch/batchPOSTFetch multiple URLs at once
/refinePOSTOpt in prompt refinement
/statsGETSession statistics

Run Tests

python3 test_all.py           # Layer 1 only (offline)python3 test_all.py --live    # Layer 1 + Layer 2 (needs internet)

Roadmap

  • Layer 1: Prompt refiner
  • Layer 2: Data proxy with caching
  • MCP server integration
  • LangChain tool example
  • Browser fallback (Playwright) for bot blocked sites
  • Authenticated session management
  • Layer 3: Output/history compression
  • CLI tool
  • Dashboard UI

Requirements

Python 3.10+. No API keys. No GPU.

License

MIT

Source: README.md at commit 7291cfe

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v0.2.1LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts