使用说明
mcpx
将任何MCP服务器转换为shell命令的Nano代理。
mcpx <server> <tool> [ARGS] | jq .
没有守护进程。没有州。每次调用都会启动MCP服务器,执行一个工具,将结果打印到stdout,然后退出。日志和UI转到stderr——stdout对管道是干净的。
安装
uv tool install .
快速开始
# Register a server manually
mcpx add weather --command npx --args -y --args @example/weather-mcp
# Or let the agent figure it out from a URL
mcpx install https://github.com/example/weather-mcp
# List servers
mcpx list
# Browse tools
mcpx weather --help
# Call a tool
mcpx weather get_forecast --city "Berlin"
# JSON output for scripting
mcpx weather get_forecast --city "Berlin" --json
# Debug JSON-RPC traffic
mcpx weather get_forecast --city "Berlin" --debug
# Dry run (show payload only)
mcpx weather get_forecast --city "Berlin" --dry-run
# Remove a server
mcpx remove weather
AI驱动安装
mcpx install 获取一个URL(GitHub、npm、PyPI、mcpservers.org等),获取仓库,找到包名,在注册表上验证它,并注册服务器——所有这些都是通过LLM代理完成的。
mcpx install https://github.com/modelcontextprotocol/servers/tree/main/src/time
# Analyzing https://github.com/... with claude-sonnet-4-20250514...
# Step 1: fetch_url(url='https://github.com/...')
# Step 2: fetch_url(url='https://raw.githubusercontent.com/.../package.json')
# Step 3: search_npm(package_name='@modelcontextprotocol/server-time')
# Step 4: install_server(alias='time', command='npx', ...)
#
# Generated command: mcpx add time --command npx --args -y --args @modelcontextprotocol/server-time
# Proceed? [y/N]: y
# Server time added.
配置LLM模型:
mcpx config-llm --model claude-sonnet-4-20250514
配置
服务器配置存储在 ~/.config/mcpx/config.json:
{
"servers": {
"time": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-time"],
"env": {},
"timeout": 30
}
}
}
环境变量优先级
- 内联
--env KEY=VAL(最高) - 本地
.env在当前目录中 env_file从配置
Env vars被蒙面 --debug 输出。
架构缓存
工具模式缓存在 ~/.config/mcpx/cache/ 具有24小时TTL。使用 --refresh 要强制重新获取:
mcpx --refresh weather --help
