Token-efficient CLI bridge to any MCP server. Instead of injecting all MCP tool schemas into every LLM turn, agents discover and call tools on demand — saving 96–99% of tokens compared to native MCP injection.
When you add MCP servers to Agent Zero's settings and leave them enabled, the framework injects all tool schemas from every server into the system prompt on every single turn. A typical MCP server exposes 20–50 tools, each with a full JSON schema description.
| Approach | Tokens per turn | Impact |
|---|---|---|
| Native MCP (enabled) | 5,000–20,000 | Pollutes context every turn |
| mcp2cli (disabled + on-demand) | 100–300 | Only what you ask for |
mcp2cli + toon encoding |
60–180 | Maximum efficiency |
The solution: configure your MCP servers in Agent Zero settings but set them to "disabled": true. This keeps their connection details available for mcp2cli to use, without injecting their schemas into context.
- Enable MCP2CLI in Agent Zero → Settings → Agent tab
- Click Initialize to install the
mcp2clibinary- Falls back to
uvx mcp2cliautomatically if pip install fails - No extra steps needed if
uvxis available
- Falls back to
Open Agent Zero → Settings → MCP tab and add your servers. The key is to set "disabled": true on each server so their schemas are not injected into the system prompt, while their connection config remains available to the mcp2cli tool.
Example mcpServers configuration in Agent Zero settings:
{
"mcpServers": {
"gtm": {
"command": "npx",
"args": ["gtm-mcp"],
"env": {
"GTM_CREDENTIALS_FILE": "/path/to/credentials.json",
"GTM_TOKEN_FILE": "/path/to/token.json"
},
"disabled": true
},
"deep-wiki": {
"url": "https://mcp.deepwiki.com/mcp",
"type": "streamable-http",
"disabled": true
}
}
}
⚠️ "disabled": trueis the key setting. It tells Agent Zero to skip native schema injection for that server. Themcp2clitool reads the same config and connects on demand — you get all the functionality with none of the context pollution.
Agents automatically have access to the mcp2cli tool. The plugin injects a skill hint into the system prompt reminding agents to load the mcp2cli skill for detailed usage instructions.
Always follow this 4-step discovery pattern — never assume tool names:
{
"tool_name": "mcp2cli",
"tool_args": {}
}{
"tool_name": "mcp2cli",
"tool_args": {
"server": "gtm",
"action": "list"
}
}Or search by keyword:
{
"tool_name": "mcp2cli",
"tool_args": {
"server": "gtm",
"action": "search",
"search_query": "tag"
}
}{
"tool_name": "mcp2cli",
"tool_args": {
"server": "gtm",
"action": "help",
"tool_name": "list-gtm-tags"
}
}{
"tool_name": "mcp2cli",
"tool_args": {
"server": "gtm",
"action": "call",
"tool_name": "list-gtm-tags",
"params": "{\"account-id\": \"123456\", \"container-id\": \"789\"}"
}
}Connect to any MCP server without pre-configuring it in settings:
{
"tool_name": "mcp2cli",
"tool_args": {
"mcp_url": "https://mcp.deepwiki.com/mcp",
"action": "list"
}
}{
"tool_name": "mcp2cli",
"tool_args": {
"mcp_stdio": "npx some-mcp-server",
"mcp_env": "API_KEY=sk-abc,DEBUG=1",
"action": "list"
}
}| Argument | Type | Description |
|---|---|---|
server |
string | Name of a configured server (from settings). Leave empty to list all servers. |
action |
string | servers | list | search | help | call |
tool_name |
string | Tool to inspect or call (for help / call) |
params |
string | JSON object {"key": "val"} or CLI flags --key val |
search_query |
string | Keyword to filter tools (for search) |
mcp_url |
string | Ad-hoc HTTP/SSE MCP server URL (overrides server) |
mcp_stdio |
string | Ad-hoc stdio command e.g. npx some-mcp-server (overrides server) |
mcp_env |
string | Comma-separated env vars for stdio: KEY=val,KEY2=val2 |
toon |
string | "true" for TOON encoding — 40–60% fewer tokens on large list outputs |
| Type | Config fields | Example |
|---|---|---|
| stdio | command + args + env |
npx gtm-mcp |
| HTTP/SSE | url + type: sse |
https://mcp.example.com/sse |
| Streamable HTTP | url + type: streamable-http |
https://mcp.deepwiki.com/mcp |
- Agent Zero with MCP support
mcp2clibinary (installed via Initialize) oruvx(zero-install fallback)- Node.js (only for stdio servers using
npx)
MIT — see LICENSE