server-commands-rtk
MCP server for executing shell commands with automatic RTK token reduction, persistent caching, and execution logging.
README
server-commands-rtk
MCP server with RTK (Rust Token Killer) auto-filtering, persistent caching, and enhanced execution logging for shell commands.
Features
- Auto-RTK: Automatically wraps commands with
rtkfor ~90% token reduction - Persistent Cache: Results cached in
.command-cache.jsonacross sessions - Enhanced Execution Log: Full stdout/stderr in
.execution-log.json(single source of truth for training data) - Configurable Settings: Timeout, buffer size, and log rotation via
rtk-hook.toml - Token Savings: Dramatically reduces LLM token consumption
- Graceful Shutdown: Proper cache flush on SIGTERM/SIGINT
Installation
# Install RTK first (if not already)
curl -LsSf https://ev3lynx.github.io/rtk/install.sh | sh
# Or via npm
npm install -g rtk-cli
# Add to OpenCode config (~/.config/opencode/opencode.jsonc)
{
"mcp": {
"server-commands-rtk": {
"type": "local",
"command": ["node", "/path/to/server-commands-rtk/src/index.js"],
"enabled": true,
"timeout": 60000
}
}
}
# Or set alias in ~/.bashrc so it runs as a standard terminal command.
alias rtk-runner='node /home/ev3lynx/.openclaw/workspace-gh0st/server/server-commands-rtk/src/index.js'
# and run, after alias set
source ~/.bashrc
# after set alias edit config (~/.config/opencode/opencode.jsonc), with set alias
{
"mcp": {
"server-commands-rtk": {
"type": "local",
"command": ["rtk-runner"],
"enabled": true,
"timeout": 60000
}
}
}
Usage
Via MCP Tools
// Auto-RTK (default) - commands wrapped automatically
run_process({command: "ls -la"})
// Bypass auto-RTK for raw output
run_process({command: "ls -la", use_raw: true})
// Get cache statistics
get_cache_stats()
// Clear cache
clear_command_cache()
// List cached commands
cached_commands()
// Get execution log
execution_log({limit: 100})
Token Comparison
| Command | Raw Tokens | RTK Tokens | Savings |
|---|---|---|---|
ls -la |
~25,000 | ~3,000 | 88% |
tree |
~50,000 | ~5,000 | 90% |
git diff |
~15,000 | ~500 | 97% |
npm install |
~5,000 | ~200 | 96% |
Configuration
RTK Hook Config (rtk-hook.toml)
[hook]
auto_wrap = true
exclude = [
"curl",
"wget",
"ssh",
"scp",
]
[rtk]
ultra_compact = false
[commands.ls]
wrapper = "rtk ls"
[execution]
timeout_ms = 60000 # Command timeout in ms
max_buffer_mb = 10 # Max output buffer in MB
max_log_entries = 1000 # Max log entries to keep
Environment Variables
# Optional: custom server directory
export SERVER_DIR="/path/to/server-commands-rtk"
Tools
| Tool | Description |
|---|---|
run_process |
Execute shell command with RTK auto-filtering |
get_cache_stats |
View cache hits/misses |
clear_command_cache |
Clear all cached commands |
cached_commands |
List all cached commands |
execution_log |
Get execution log (includes stdout/stderr for training data) |
Cache Files
.command-cache.json- Persistent command cache.execution-log.json- Execution audit log (last 1000 entries)
Token Savings Example
Session with 115,267 tokens:
- Without RTK: 58% budget used
- With RTK: ~10% budget (~12K tokens)
Expected reduction: ~90%
OpenCode Integration
The MCP is pre-configured for these agents:
- builder-pro
- docker-config
- deploy
- deploy-init
- deploy-prod
- deploy-verify
- deploy-monitor
- deploy-rollback
To enable globally, add server-commands-rtk_run_process: true to any agent's tools.
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.