philschmid/mcp-cli
Lighweight CLI to interact with MCP servers
Author:philschmidLicense:MITLanguage:TypeScript64959
Deep Analysis
Lightweight CLI tool that lets AI programming assistants access external tools and APIs through the MCP protocol.
Highly Recommended
Core Features
Minimal dependencies, fast startup, compilable to single binary
JSON output for scripting, supports piping and jq chaining
On-demand schema loading, minimizes token consumption
Supports both stdio and HTTP MCP server types
Technical Implementation
Architecture:Lazy-loading, on-demand connections
Execution Flow:
Key Components:
Bun
MCP Protocol
stdio/HTTP
Highlights
- Lightweight: Minimal dependencies, compilable to single binary
- Token efficient: On-demand schema loading, doesn't occupy context window
- Error friendly: Structured error messages with recovery suggestions
- Concurrency control: Worker pool limits connections, prevents resource exhaustion
Use Cases
- Let Claude Code, Gemini CLI, and other AI assistants access external APIs
- Integrate MCP tool calls in shell scripts
- Quick testing and debugging of MCP servers
- Build AI workflow automation
Limitations
- Requires Bun runtime (or use compiled binary)
- Each call is an independent connection, no session state
- Depends on external MCP server availability
Tech Stack
Bun 1.0+TypeScriptMCP Protocol
README
View on GitHubmcp-cli
一个轻量级的、基于 Bun 的 CLI 工具,用于与 MCP(Model Context Protocol)服务器交互。
特性
- 🪶 轻量级 - 依赖最小化,启动快速
- 📦 单一二进制文件 - 可编译为独立可执行文件
- 🔧 Shell 友好 - JSON 输出便于脚本编写
- 🤖 AI Agent 优化 - 专为 AI 编程助手设计
- 🔌 通用性 - 支持 stdio 和 HTTP 两种 MCP 服务器
- 💡 可操作的错误提示 - 结构化错误信息
快速开始
安装: curl -fsSL https://raw.githubusercontent.com/philschmid/mcp-cli/main/install.sh | bash
使用方法
mcp-cli 列出所有服务器和工具
mcp-cli grep
mcp-cli
mcp-cli
与 AI Agent 配合使用
mcp-cli 专为 AI 编程助手访问 MCP 服务器而设计。
- 按需加载:仅在需要时获取 schema
- Token 高效:最小化上下文开销
- Shell 可组合:可与 jq、管道和脚本链接
架构
CLI 使用懒加载、按需连接策略。服务器连接仅在需要时建立,使用后立即关闭。

