Optimizing AI Context: Why Replacing MCP with Shell Scripts Saves 22,000 Tokens
These articles are AI-generated summaries. Please check the original sources for full details.
The 22,000 Token Tax: Why I Killed My MCP Server
Benjamin Eckstein discovered that running three Model Context Protocol (MCP) servers consumed 22,000 tokens before a single prompt was entered. This overhead significantly triggers ‘context rot,’ where LLM performance degrades as context length increases, regardless of information relevance.
Why This Matters
Technical abstractions like MCP servers often prioritize ease of setup over resource efficiency, leading to significant context window bloat. In persistent agent systems where sessions can exceed 100,000 tokens, a 10,000-to-22,000 token ‘startup tax’ directly reduces the model’s reasoning quality and capacity for complex work.
The ‘disabledTools’ setting in platforms like Claude Code provides a false sense of optimization. While it prevents the AI from calling a tool, the entire schema is still injected into the context window, meaning users pay the token cost for every registered tool regardless of active status.
Key Insights
- Context rot phenomenon confirms that LLM performance degrades as context length increases, even when relevant data is present (Research confirmed, 2026).
- Individual MCP tools consume approximately 300 tokens per schema, whereas standard skills require only 40 tokens of metadata.
- The Atlassian MCP server registers 33 tools by default, consuming 10,000 tokens even if only six tools are utilized by the developer.
- The ‘disabledTools’ configuration in Claude Code acts as a runtime filter rather than a context optimizer, failing to prevent schema injection.
- Direct shell scripts using curl and jq allow for zero-token startup overhead and better handling of complex API edge cases like Jira custom fields.
Working Examples
A lightweight shell script replacement for the Atlassian MCP server to fetch Jira issue data.
TOKEN=$(jq -r '.personal_token' ~/.config/jira/credentials.json)
BASE_URL=$(jq -r '.base_url' ~/.config/jira/credentials.json)
curl -s -k -H "Authorization: Bearer $TOKEN" \
"$BASE_URL/rest/api/2/issue/PROJ-123"
Jira issue creation using curl, which handles custom fields and project-specific logic more reliably than MCP abstractions.
curl -s -k -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"fields": {
"project": {"key": "PROJ"},
"issuetype": {"name": "Task"},
"summary": "Test ticket",
"components": [{"name": "Frontend"}],
"customfield_12345": [{"value": "Team-A"}]
}}' \
"$BASE_URL/rest/api/2/issue"
Practical Applications
- System: Jira Integration; Use Case: Replacing broad MCP servers with specific shell scripts for Jira operations to eliminate unnecessary tool schemas. Pitfall: Relying on ‘disabledTools’ to save context space, which only prevents execution, not token consumption.
- System: Developer Workstations; Use Case: Using chmod 600 credentials files and local curl calls to reduce supply chain risk associated with un-audited third-party Docker-based MCP images. Pitfall: Over-abstracting simple REST APIs with protocol layers that cannot handle project-specific custom field requirements.
References:
Continue reading
Next article
Debugging the Model Fallback Livelock in AI Agents
Related Content
Transform VS Code Copilot into an Autonomous AI Agent: A Technical Setup Guide
Configure VS Code Copilot as a memory-aware autonomous agent using the February 2026 v1.106 update and Model Context Protocol servers.
Eliminating Silent Data Corruption in MCP Servers via Pydantic Model Validation
David Tappert demonstrates how a single LLM date error propagated into four downstream artifacts, necessitating robust cross-field validation for MCP servers.
Securing MCP Servers: Auditing for Overprivileged Tools and Prompt Injection
The @hailbytes/mcp-security-scanner identifies overprivileged tools and unauthenticated transports in Model Context Protocol (MCP) server configurations.