Introducing MCP CLI: A way to call MCP Servers Efficiently Updated January 2026 for v0.3.0 — New 3-subcommand architecture (info, grep, call), connection pooling daemon, and tool filtering support. The Model Context Protocol (MCP) is an open standard for connecting AI agents to external tools, APIs, and data sources. However, as the ecosystem grows with more powerful MCP servers, developers and agent builders are hitting a scaling bottleneck: context window bloat. mcp-cli is a lightweight CLI that allows dynamic discovery of MCP, reducing token consumption while making tool interactions more efficient for AI coding agents. Key Features: 🪶 Built on Bun, mcp-cli compiles to a single standalone binary. 🔌 Works with both stdio (local) and HTTP (remote) MCP servers. 🔍 Glob-based search across all servers mcp-cli grep "*mail*" -d. 🤖 Designed for AI coding agents (Gemini CLI, Claude Code, etc.). ⚡ Connection pooling with lazy-spawn daemon (60s idle timeout). 🎛️ Tool filtering via allowedTools and disabledTools config. � Server instructions support in output. �💡 Structured error messages with recovery suggestions. The Context Problem Every MCP server comes with tool definitions schemas describing what each tool does, its parameters, types, and descriptions. Traditional MCP integration loads all of these schemas upfront into the agent's context window. Here's what that looks like in practice: Setup Tokens Used 6 MCP servers, 60 tools ~47,000 tokens After dynamic discovery ~400 tokens That is a 99% reduction in MCP-related token usage for this scenario. When working with multiple MCP servers (GitHub, databases, browser automation—tool), definitions quickly consume a third or more of the effective context. This leads to: Reduced effective context length for actual reasoning and code generation. More frequent context compactions interrupting flow. Hard limits on the number of simultaneous MCP servers you can use. Higher API costs due to input token overhead. Dynamic Context Discovery The solution is dynamic context discovery. Instead of loading everything upfront (static context), agents pull in only the information they need, when they need it. mcp-cli implements this pattern for MCP: Step 1: "What servers exist?" → mcp-cli Step 2: "What are the params for tool X?" → mcp-cli info github search_repositories Step 3: Execute → mcp-cli call github search_repositories '{"query": "mcp"}' Most Interactions only use a handful of tools, yet static loading consumes tokens for every tool definition. Dynamic discovery inverts this, you pay only for what you use. Quick start mcp-cli allows dynamic discovery of MCP while making tool interactions more efficient for AI coding agents. 1. Installation Bash # binary install curl -fsSL https://raw.githubusercontent.com/philschmid/mcp-cli/main/install.sh | bash # requires bun install bun install -g https://github.com/philschmid/mcp-cli 2. Create a config file Create mcp_servers.json in your current directory or ~/.config/mcp/: JSON { "mcpServers": { "filesystem": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-filesystem", "." ] }, "deepwiki": { "url": "https://mcp.deepwiki.com/mcp" } } } 3. Discover available tools Bash # List all servers and tools mcp-cli # deepwiki # • read_wiki_structure # • read_wiki_contents # • ask_question # # filesystem # • read_file # • read_text_file # • read_media_file # • read_multiple_files # ... # With descriptions # mcp-cli -d 4. Call a tool Bash # View tool schema first mcp-cli info filesystem read_file # Tool: read_file # Server: filesystem # # Description: # Read the complete contents of a file as text. # # Input Schema: # { # "type": "object", # "properties": { # ... 5. Execute the tool Bash # Call the tool mcp-cli call filesystem read_file '{"path": "./README.md"}' 6. Complex commands MCP CLI allows the model to generate commands that chain multiple tool calls together. Bash # Using a heredoc (no '-' needed with call subcommand) mcp-cli call server tool < # Show server tools mcp-cli info # Get tool schema mcp-cli grep "" # Search tools mcp-cli call # Call tool (stdin auto-detected) mcp-cli call '{}' # Call with JSON args ``` **Both formats work:** `info ` or `info /` Workflow: 1. **Discover**: `mcp-cli info` to see available servers 2. **Inspect**: `mcp-cli info ` to get the schema 3. **Execute**: `mcp-cli call '{}'` with arguments ### Examples ```bash # Call with inline JSON mcp-cli call github search_repositories '{"query": "mcp server"}' # Pipe from stdin (no '-' needed) echo '{"path": "./file"}' | mcp-cli call filesystem read_file # Heredoc for complex JSON mcp-cli call server tool <` | Show tools with parameters | | `mcp-cli info ` | Get tool JSON schema | | `mcp-cli grep ""` | Search tools by name | | `mcp-cli call '{}'` | Call tool with arguments | **Both formats work:** `info ` or `info /` **Add `-d` to include descriptions** (e.g., `mcp-cli info filesystem -d`) ## Workflow 1. **Discover**: `mcp-cli` → see available servers and tools 2. **Explore**: `mcp-cli info ` → see tools with parameters 3. **Inspect**: `mcp-cli info ` → get full JSON input schema 4. **Execute**: `mcp-cli call '{}'` → run with arguments ## Examples ```bash # List all servers and tool names mcp-cli # See all tools with parameters mcp-cli info filesystem # With descriptions (more verbose) mcp-cli info filesystem -d # Get JSON schema for specific tool mcp-cli info filesystem read_file # Call the tool mcp-cli call filesystem read_file '{"path": "./README.md"}' # Search for tools mcp-cli grep "*file*" # Complex JSON with quotes (use heredoc or stdin) mcp-cli call server tool <` | Custom config file path | ## Exit Codes - `0`: Success - `1`: Client error (bad args, missing config) - `2`: Server error (tool failed) - `3`: Network error Conclusion The AI Agent space is moving incredibly fast. mcp-cli tries to solve context tool discovery problem turning it into an iterative, just-in-time process. It allows agents to access a massive ecosystem of shared capabilities without the context bloat of static integration. Whether used within a Skill or as a standalone utility, it ensures your agent spends its tokens on reasoning, not configuration. The project is open source and designed to fit into existing workflows. Give it a try and contribute at github.com/philschmid/mcp-cli. Thanks for reading! If you have any questions or feedback, please let me know on Twitter or LinkedIn.