The Context Problem with MCP Clients
Most MCP clients load all servers and tools into context at startup. With 10 servers each having 10 tools, the model starts with 100 tools loaded even if not needed. This wastes tokens, causes context rot, and lowers accuracy. Tool calls and results also consume context, often leading to running out of context after a few interactions. The MCP specification says nothing about context management; it is up to implementations.
Why CLI Tools Avoid Context Waste
Coding agents never load all CLI tools and docs upfront. Models already know common Linux tools from training data. They discover new tools progressively by calling –help. CLI tools run as code in a sandbox, and results can be saved to files rather than loaded into context. Shell has been around for over 50 years, so models have seen massive amounts of shell code in training. Shell is the most universal programming language for both humans and agents.
MCPC: A CLI Client for MCP
Curn proposed combining MCP and CLI: wrap MCP servers with a CLI interface so agents use a single bash tool. Apify built MCPC, an open-source universal CLI client for MCP. It supports the full MCP protocol, including tools, resources, prompts, and async tasks. MCPC is lightweight, has no LLM dependency, and outputs JSON for code mode. It handles authentication via OS keyring and supports sessions and authentication profiles.
Demo: Sessions, Authentication, and Progressive Discovery
Curn demonstrated creating a session to a local file system MCP server with 14 tools. He then logged into a remote Apify MCP server using MCPC login, which opened a browser and saved credentials securely. He called tools with text output and JSON output. Using the grab command, he searched for tools containing “find” across sessions, enabling progressive discovery. The model can pipe results and explore tools without loading everything upfront.
Code Mode with JSON and Asynchronous Tasks
Curn showed Claude composing two Apify tools via MCPC with –json. The generated shell script calls MCPC to search the web, extract a Twitter handle, and fetch the latest tweet. This script runs without consuming tokens. MCPC also supports async tasks: calling a long-running tool with –task, detaching, and listing tasks. This allows agents to handle long operations without blocking. MCPC supports X42 payments and proxies for credential separation.
Notable Quotes
MCP is a protocol like describing how to access local or remote tools and resources but the way how you use it and expose it to the model well that’s up to the up to the implementation Jan Curn · ▶ Watch (3:46)
the models really know shell well because like shell has been around for more than 50 years now Jan Curn · ▶ Watch (10:54)
I would actually argue shell is the most universal programming language in the world for both like humans and and agents Jan Curn · ▶ Watch (11:44)
MCP clients lag behind the standard like in a big way Jan Curn · ▶ Watch (25:03)
Key Takeaways
- MCP clients waste context by loading all tools upfront; dynamic discovery and code mode reduce token consumption.
- CLI tools avoid context waste because agents discover them progressively and run them as code in sandboxes.
- MCPC wraps MCP servers as CLI commands, enabling agents to use MCP via bash without protocol complexity.
About the Speaker(s)
Jan Curn is the founder and CEO of Apify, the world’s largest marketplace of web data extraction and automation tools, powering AI agents with up-to-date data. He has a lifelong passion for software engineering, which earned him an MSc and a PhD in computer science.