Token导航 LogoToken导航TokenDH.com
cllm MCP logo
开发工具stdio官方级别未说明来源级核验

cllm MCP

MCP Server

用于从bash调用MCP服务器的CLI工具,通过将工具调用卸载到命令行来减少LLM令牌使用,支持批处理操作的守护进程模式。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
命令行工具配置管理PythonClaudeClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

cmd-llm

提供方

cmd-llm

最后核验

2026/5/17 20:21

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uv run cllm-mcp --help

详细介绍

cllm-mcp

用于从bash调用MCP(模型上下文协议)服务器的CLI工具。通过将工具调用卸载到命令行,使用守护进程模式进行批处理操作,减少LLM令牌的使用。

主要特点:

  • 从bash直接调用MCP工具(消除80-95%的上下文开销)
  • Daemon模式,批处理操作加速10-60倍
  • CLLM式层次结构的配置管理
  • 零外部依赖(仅限Python stdlib)

建筑

┌─────────────────┐
│   LLM / Agent   │
└────────┬────────┘
         │ calls bash script
         ▼
┌─────────────────┐
│  cllm-mcp CLI   │
│   (command)     │
└────────┬────────┘
         │ invokes
         ▼
┌─────────────────┐
│   MCP Client    │ ◄─── Core Implementation
└────────┬────────┘
         │ JSON-RPC over stdio
         ▼
┌─────────────────┐
│   MCP Server    │ (filesystem, github, etc.)
└─────────────────┘

快速开始

基本用法

# List tools
cllm-mcp list-tools "npx -y @modelcontextprotocol/server-filesystem /tmp"

# Call a tool
cllm-mcp call-tool "npx -y @modelcontextprotocol/server-filesystem /tmp" \
  read_file '{"path": "/tmp/test.txt"}'

# Interactive REPL
cllm-mcp interactive "npx -y @modelcontextprotocol/server-filesystem /tmp"

# Daemon mode (for batch operations)
cllm-mcp daemon start
cllm-mcp call-tool filesystem read_file '{"path": "/tmp/file.txt"}'
cllm-mcp daemon stop

智能守护程序检测

命令在运行时自动检测和使用守护进程,并优雅地回退到直接模式。

配置

在中配置服务器 .cllm/mcp-config.json:

cllm-mcp config list       # List configured servers
cllm-mcp config validate   # Validate configuration
cllm-mcp config show       # Display full configuration

安装

# Clone and install
git clone 
cd cllm-mcp
uv sync

# Run via uv or from installed location
uv run cllm-mcp --help
# or
cllm-mcp --help

用法示例

直接服务器调用

# List tools
cllm-mcp list-tools "npx -y @modelcontextprotocol/server-filesystem /tmp"

# Call a tool
cllm-mcp call-tool "npx -y @modelcontextprotocol/server-filesystem /tmp" \
  read_file '{"path": "/tmp/test.txt"}'

基于配置(推荐)

创建 .cllm/mcp-config.json:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
      "autoStart": true
    },
    "github": {
      "command": "npx",
      "args": ["@modelcontextprotocol/server-github"],
      "env": {"GITHUB_TOKEN": "${GITHUB_TOKEN}"},
      "autoStart": true
    }
  }
}

然后按名称引用:

cllm-mcp list-tools filesystem
cllm-mcp call-tool filesystem read_file '{"path": "/tmp/test.txt"}'
cllm-mcp interactive filesystem

使用Daemon进行批处理操作

cllm-mcp daemon start

# Multiple operations run fast (10-60x speedup)
for i in {1..100}; do
  cllm-mcp call-tool filesystem read_file '{"path": "/tmp/file'$i'.txt"}'
done

cllm-mcp daemon stop

与LLM集成

LLM可以将MCP操作委托给bash,将上下文减少80-95%。系统提示示例:

You have access to MCP servers via bash commands:

cllm-mcp list-tools          # List available tools
cllm-mcp call-tool     # Execute tool with JSON args

Example:
cllm-mcp call-tool filesystem read_file '{"path": "/tmp/file.txt"}'
cllm-mcp call-tool github create_issue '{"owner": "user", "repo": "repo", "title": "..."}'

All results are returned as JSON.

通用MCP服务器

要配置的常用服务器:

  • 文件系统: npx -y @modelcontextprotocol/server-filesystem /tmp
  • GitHub: npx @modelcontextprotocol/server-github (要求 GITHUB_TOKEN)
  • SQLite: npx @modelcontextprotocol/server-sqlite /path/to/db.sqlite
  • 勇敢的搜寻: npx @modelcontextprotocol/server-brave-search (要求 BRAVE_API_KEY)
  • 时间: uvx mcp-server-time

使用 cllm-mcp list-tools 查看可用工具。

配置

存储于 .cllm/mcp-config.json (按顺序搜索: --config arg → CLLM_MCP_CONFIG env → ./mcp-config.json./.cllm/mcp-config.json~/.cllm/mcp-config.json).

架构:

{
  "mcpServers": {
    "server_name": {
      "command": "npx",
      "args": ["@modelcontextprotocol/server-name", "arg1"],
      "env": {"API_KEY": "value"},
      "autoStart": true,
      "optional": false
    }
  }
}
  • 命令 (必填):可执行(例如。, npx, python, uvx)
  • 参数 (必需):命令参数为数组
  • 环境:环境变量
  • 自动启动:守护进程启动时自动启动
  • 可选的:如果服务器发生故障,不要让守护进程失败

高级用法

错误处理

返回退出代码 0 关于成功, 1 在向stderr发送消息时出错:

if ! output=$(cllm-mcp call-tool filesystem read_file '{"path": "/tmp/file.txt"}' 2>&1); then
  echo "Error: $output" >&2
  exit 1
fi

使用jq进行处理

使用JSON处理的链操作:

# List files and process each
cllm-mcp daemon start
cllm-mcp call-tool filesystem list_directory '{"path": "/tmp"}' \
  | jq -r '.contents[].name' \
  | while read file; do
    cllm-mcp call-tool filesystem read_file "{\"path\": \"/tmp/$file\"}"
  done
cllm-mcp daemon stop

守护程序模式

Daemon使服务器保持运行 10-60倍加速 批量操作。自动检测:无需标记。

cllm-mcp daemon start              # Start once
cllm-mcp call-tool fs read_file '{...'  # Auto-detects daemon
cllm-mcp daemon stop               # Stop when done

管理层:

cllm-mcp daemon start              # Start background daemon
cllm-mcp daemon start --foreground  # Start in foreground (debug)
cllm-mcp daemon status             # Check if running
cllm-mcp daemon restart            # Restart
cllm-mcp daemon stop               # Stop

配置:

  • 服务器与 autoStart: true 自动初始化
  • 使用 optional: true 忽略该服务器的启动失败
  • 自定义插座: cllm-mcp daemon start --socket /path/to/socket

项目结构

cllm_mcp/
├── main.py              # Command dispatcher
├── client.py            # Client implementation
├── config.py            # Configuration management
├── daemon.py            # Daemon commands
├── daemon_server.py     # Daemon server
├── daemon_lifecycle.py   # Daemon lifecycle
├── daemon_utils.py      # Daemon utilities
├── json_rpc_client.py   # JSON-RPC communication
├── socket_utils.py      # Socket utilities
└── env_expansion.py     # Environment variable expansion

docs/
├── decisions/           # Architecture Decision Records (ADR 0001-0008)
├── MIGRATION.md         # Legacy command migration guide
└── testing/             # Test documentation

tests/                   # Comprehensive test suite (100+ tests)
examples/                # Example scripts

测试

uv run pytest              # All tests
uv run pytest -m unit      # Fast unit tests
uv run pytest -m daemon    # Daemon tests
uv run pytest --cov        # With coverage

贡献

  1. 分叉存储库
  2. 创建要素分支
  3. 为您的更改添加测试
  4. 确保测试通过
  5. 提交拉取请求

贡献.md 了解详情。

体系结构决策

docs/decisions/ 对于ADR:

  • ADR-0001:Vibe决策格式
  • ADR-0002: uv 包管理器
  • ADR-0003:统一的守护进程/客户端命令
  • ADR-0004:CLLM样式配置
  • ADR-0005:自动初始化服务器
  • ADR-0006:工具调用示例
  • ADR-0007:现代化的入口点
  • ADR-0008:环境变量支持

资源

______________________________________________________________________

许可证:MIT 状态:积极维护 python: 3.7+

目录标签

目录标签

命令行工具配置管理PythonClaude本地部署MCP协议LLM优化批处理操作

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP