Server data from the Official MCP Registry
Intelligent MCP proxy that reduces token usage by exposing only mcp_search and mcp_call.
Intelligent MCP proxy that reduces token usage by exposing only mcp_search and mcp_call.
MCP Proxy Gateway is a well-architected token-reduction proxy with reasonable security posture. Code is clean with proper error handling, configuration validation via Zod, and appropriate authentication support for HTTP upstreams. Primary concerns are: (1) environment variable based secrets management without explicit validation that they're not logged, (2) HTTP server binds to 127.0.0.1 (good, but documented as local-only with no warnings about env var exposure), and (3) file read for config without permissions validation. Permissions align well with proxy purpose (network access for MCP servers, file I/O for config). No malicious patterns detected. Supply chain analysis found 3 known vulnerabilities in dependencies (0 critical, 3 high severity). Package verification found 1 issue.
4 files analyzed · 10 issues found
Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.
This plugin requests these system permissions. Most are normal for its category.
Add this to your MCP configuration file:
{
"mcpServers": {
"io-github-steveweltman-4q-tokenz": {
"args": [
"-y",
"4q-tokenz"
],
"command": "npx"
}
}
}From the project's GitHub README.
A context-aware MCP proxy that reduces token usage by exposing only 2 tools (mcp_search, mcp_call) to LLMs instead of the full catalog.
When you connect multiple MCP servers to an LLM, every tool from every server is listed in the LLM's context window. For a typical workspace with 50-100 tools across multiple MCP servers, that's thousands of tokens of schema documentation on every request.
MCP Proxy Gateway sits between your LLM and your MCP servers, offering:
┌─────────────────────────────────────────────────────────────────┐
│ Your LLM │
│ (sees only: mcp_search, mcp_call, mcp_schema) │
└────────────────────┬────────────────────────────────────────────┘
│
┌───────────▼──────────────┐
│ MCP Proxy Gateway │
│ ┌──────────────────────┐ │
│ │ Tool Registry │ │
│ │ (BM25 + Embeddings) │ │
│ └──────────────────────┘ │
│ ┌──────────────────────┐ │
│ │ Connector Manager │ │
│ │ (Idle timeout reap) │ │
│ └──────────────────────┘ │
└────────────┬─────────────┘
│
┌─────────────┼─────────────┐
│ │ │
▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐
│Google │ │MailerLite│ │Your Svc │
│Gmail │ │ Campaigns│ │ Custom │
│Calendar │ │ │ │ Tools │
│Drive │ │ │ │ │
└─────────┘ └─────────┘ └─────────┘
@xenova/transformers library is pre-installed, but requires the sharp module for best performancegit clone https://github.com/steveweltman/4q-tokens.git
cd 4q-tokens
pnpm install
pnpm build
# Install to ~/.local/bin and configure
./install.sh
npm install @arvoretech/mcp-proxy
Here's a concrete walkthrough to connect Google Workspace (Gmail, Calendar, Drive) to your LLM through the proxy:
You need an MCP server that wraps Google APIs. Options:
@antidrift/mcp-google (recommended) — Supports Gmail, Calendar, Drive, Docs, Sheets
npm install @antidrift/mcp-google
# or
npx @antidrift/mcp-google --help
@modelcontextprotocol/server-gmail — Gmail-only, official MCP server
Build your own — See the MCP spec to wrap your own APIs
token.json:
GOOGLE_CREDENTIAL_FILE=~/Downloads/credentials.json \
npx @antidrift/mcp-google
This opens a browser for you to authorize. Once done, it saves token.json locally.Create ~/.config/4q-tokens/config.json:
{
"upstreams": [
{
"name": "google-workspace",
"transport": "stdio",
"command": "npx",
"args": ["@antidrift/mcp-google"],
"env": {
"GOOGLE_TOKEN_FILE": "~/.local/share/google-mcp/token.json",
"GOOGLE_CONNECTORS": "gmail,calendar,drive"
}
}
],
"searchLimit": 5,
"callItemLimit": 30,
"maxTextLength": 800,
"maxOutputTokens": 10000,
"idleTimeoutMs": 600000
}
mcp-proxy
# Or via systemd if installed:
systemctl --user start mcp-proxy
Configure your LLM to use http://127.0.0.1:9200/mcp as its MCP server. It will see:
mcp_search — find tools by natural languagemcp_call — invoke a toolmcp_schema — see tool detailsExample query:
mcp_search("send an email")
# Returns: google_send_email (Gmail)
mcp_call(ref="google_send_email", args={"to": "user@example.com", "subject": "Hello", "body": "Test"})
export MCP_PROXY_UPSTREAMS='[
{
"name": "google",
"transport": "stdio",
"command": "node",
"args": ["/path/to/google/server.mjs"],
"env": {
"GOOGLE_TOKEN_FILE": "token.json"
}
}
]'
export MCP_PROXY_SINGLETON_PORT=9200
export MCP_PROXY_DASHBOARD_PORT=9100
node dist/index.js
Create ~/.config/4q-tokens/config.json:
{
"upstreams": [
{
"name": "google-workspace",
"transport": "stdio",
"command": "node",
"args": ["/home/user/.antidrift/tools/google/server.mjs"],
"env": {
"GOOGLE_TOKEN_FILE": "token.json",
"GOOGLE_CONNECTORS": "gmail,calendar,drive"
}
},
{
"name": "mailerlite",
"transport": "stdio",
"command": "node",
"args": ["/home/user/.antidrift/tools/mailerlite/server.mjs"],
"env": {
"MAILERLITE_API_KEY": "your-api-key-here"
}
},
{
"name": "external-api",
"transport": "http",
"url": "https://mcp.example.com/",
"auth": {
"apiKey": "API_KEY_ENV_VAR"
}
}
],
"searchLimit": 3,
"callItemLimit": 20,
"maxTextLength": 500,
"maxOutputTokens": 8000,
"idleTimeoutMs": 300000
}
Then run:
node dist/index.js
The proxy will load the config from ~/.config/4q-tokens/config.json if it exists, otherwise fall back to the MCP_PROXY_UPSTREAMS environment variable.
{
"name": "unique-id",
"transport": "stdio" | "http",
// For stdio transport:
"command": "node",
"args": ["path/to/server.mjs"],
"cwd": "/working/dir", // optional
"env": { "KEY": "value" }, // optional
// For http transport:
"url": "https://example.com/mcp",
"auth": {
"apiKey": "ENV_VAR_NAME" // reads from process.env[ENV_VAR_NAME]
}
}
| Option | Default | Description |
|---|---|---|
searchLimit | 3 | Max tools returned by mcp_search |
callItemLimit | 20 | Max items in mcp_call response |
maxTextLength | 500 | Truncate text fields to N chars (detail=false: 500, detail=true: 1500) |
maxOutputTokens | 8000 | Hard cap on response size |
idleTimeoutMs | 300000 | Disconnect upstream servers after N ms of inactivity (0 = disabled) |
Environment variable overrides:
export MCP_PROXY_SEARCH_LIMIT=5
export MCP_PROXY_CALL_ITEM_LIMIT=30
export MCP_PROXY_MAX_TEXT_LENGTH=800
export MCP_PROXY_MAX_OUTPUT_TOKENS=10000
export MCP_PROXY_IDLE_TIMEOUT_MS=600000
node dist/index.js
The proxy connects via stdio to your LLM. Use it with Claude or other MCP clients.
The install script can set this up for you (see below), or manually:
~/.config/systemd/user/mcp-proxy.service:[Unit]
Description=MCP Proxy Gateway
After=network.target
[Service]
Type=simple
ExecStart=%h/.local/bin/mcp-proxy
Restart=on-failure
RestartSec=5s
Environment="PATH=%h/.local/bin:/usr/local/bin:/usr/bin"
[Install]
WantedBy=default.target
systemctl --user daemon-reload
systemctl --user enable mcp-proxy
systemctl --user start mcp-proxy
journalctl --user -u mcp-proxy -f
When MCP_PROXY_SINGLETON_PORT is set, the proxy starts an HTTP transport on that port. This allows multiple clients to connect to a single proxy instance.
export MCP_PROXY_SINGLETON_PORT=9200
node dist/index.js &
# From another process:
curl -X POST http://127.0.0.1:9200/mcp -H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "params": {...}}'
If embeddings fail with "Cannot find module 'sharp'", the proxy automatically falls back to lexical (keyword) search.
To enable semantic search, install the optional sharp module:
npm install sharp
If installation still fails (common on M1/M2 Macs or unusual architectures), the fallback is already in place. See error logs for details.
Check the server logs in the dashboard (port 9100 by default) or daemon logs:
journalctl --user -u mcp-proxy -e
The proxy logs:
The proxy has comprehensive error handling to gracefully degrade on upstream failures:
NO_UPSTREAMSFor unhandled errors, check:
journalctl --user -u mcp-proxy -n 50 # Last 50 lines
When a tool returns null or malformed data, the output shaper handles it gracefully:
[]{value: string}_rawContentIf a tool response looks truncated, retry with detail=true in mcp_call to disable output shaping:
mcp_call(ref="google_send_email", args={...}, detail=true)
The proxy binds to 127.0.0.1 only for security — it's not accessible from the network by default. To access remotely:
127.0.0.1:9200ssh -L 9200:127.0.0.1:9200 user@remote-host
sharp module may fail to build on some systems. The proxy falls back to lexical (BM25) search automatically with no performance lossMCP Proxy Gateway is a fork of @arvoretech/mcp-proxy, originally created by João Augusto and Árvore Educação.
Forked for single-player use with enhancements:
MIT. See LICENSE.
Be the first to review this server!
by Modelcontextprotocol · Developer Tools
Read, search, and manipulate Git repositories programmatically
by Toleno · Developer Tools
Toleno Network MCP Server — Manage your Toleno mining account with Claude AI using natural language.
by mcp-marketplace · Developer Tools
Create, build, and publish Python MCP servers to PyPI — conversationally.