Token Enhancer MCP Server
io.github.xelektron/token-enhancer
Local proxy that strips web pages to clean text, reducing AI token costs by 86-99.6%.
What is the Token Enhancer MCP server?
Token Enhancer is an MCP server that acts as a local proxy between your AI agent and the web, fetching pages and removing HTML/JSON noise before the content reaches your LLM's context window. It reduces token consumption by 86–99.6% with no API keys, LLM, or GPU required—just Python.
Token Enhancer solves the problem of AI agents wasting token budgets on raw HTML, ads, scripts, and navigation clutter. It sits between your agent and web sources, fetching pages, stripping noise, caching results, and returning only clean text. For example, a Yahoo Finance page drops from 704K tokens to 2.6K tokens (99.6% reduction). Works as a standalone proxy, MCP server for Claude Desktop/Cursor, or LangChain tool.
How to install Token Enhancer
Copy-paste configuration for popular MCP clients.
Tools & capabilities
Tools this server exposes to the agent.
fetch_clean— Fetch any URL and return clean text with HTML/JSON noise removed (86–99% smaller).fetch_clean_batch— Fetch multiple URLs at once and return clean text for each.refine_prompt— Optional prompt cleanup that shows both original and refined versions so you decide which to use.
Use cases
- Reduce token costs when fetching financial data, news, or research pages for AI analysis
- Batch-fetch multiple web sources and get clean text for document summarization or comparison
- Strip noise from Wikipedia, GitHub, or documentation pages before feeding them to your agent
- Cache cleaned web content to avoid re-fetching and re-processing the same pages
- Integrate web fetching into LangChain agents without bloating context with HTML markup
Token Enhancer MCP server FAQ
It's a local proxy that fetches web pages and strips HTML/JSON noise before sending the content to your AI agent. This reduces token consumption by 86–99.6% with no API keys or external services required.
Yes. Token Enhancer is open-source (MIT license) and runs locally on your machine. No API keys, subscriptions, or GPU needed.
Install via pip (pip install xelektron-token-enhancer), then add the MCP server config to your Claude Desktop config file (Mac: ~/Library/Application Support/Claude/claude_desktop_config.json or Windows: %APPDATA%\Claude\claude_desktop_config.json). Restart Claude Desktop and the tools will be available.
Install via pip, then add the MCP server config to .cursor/mcp.json in your project root. Cursor will discover the tools automatically.
No. Token Enhancer runs entirely locally as a Python proxy. It requires no API keys, LLM, or GPU—just Python 3.10+.
Yes. You can run it as a standalone proxy (python3 proxy.py) and call the HTTP endpoints directly, or integrate it as a LangChain tool in your own Python code.
README (reference)
Source of truth, from the repository.
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.
| Source | Raw Tokens | After Proxy | Reduction |
|---|---|---|---|
| Yahoo Finance (AAPL) | 704,760 | 2,625 | 99.6% |
| Wikipedia article | 154,440 | 19,479 | 87.4% |
| Hacker News | 8,662 | 859 | 90.1% |
| GitHub repo page | 171,234 | 6,976 | 95.9% |
Install
pip install xelektron-token-enhancer
Quick Start (from source)
git clone https://github.com/xelektron/token-enhancer.git
cd token-enhancer
chmod +x install.sh
./install.sh
source .venv/bin/activate
python3 test_all.py --live
Usage
As a standalone proxy
source .venv/bin/activate
python3 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.
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
{
"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
envblock above overrides the default CA bundle. Remove it on macOS/Windows.
Cursor: Add to .cursor/mcp.json in your project:
{
"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
from langchain.tools import tool
import requests
@tool
def 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)
| Endpoint | Method | Description |
|---|---|---|
/fetch | POST | Fetch URL, strip noise, return clean data |
/fetch/batch | POST | Fetch multiple URLs at once |
/refine | POST | Opt in prompt refinement |
/stats | GET | Session 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
Related MCP servers

Xenarch — x402 MCP server for AI agent payments. Non-custodial, USDC on Base L2.

xete
End-to-end-encrypted, sovereign inbox for AI agents. The server only ever sees ciphertext.

io.github.xfloukiex-lab/conquerors-haki
Ruthless prioritization: cuts a list to the 1-3 items that actually serve your goal.
The capstone of the Grand Line stack — collect every tool to reveal the One Piece.
Federated local-first search across transcripts, files, knowledge graphs, vectors, and the web for AI agents.
