A Model Context Protocol (MCP) service for executing system commands asynchronously
Project description
runcmd-mcp
版本: 0.1.4
runcmd-mcp 是一个Model Context Protocol (MCP) 服务,提供异步执行系统命令的功能。
功能特点
- 异步执行: 命令在后台线程中执行,不会阻塞主线程
- 状态查询: 可随时查询命令执行状态和结果
- 超时控制: 支持设置命令执行超时时间
- 资源管理: 自动管理命令执行状态
- MCP兼容: 与MCP协议兼容,可与其他MCP客户端集成
工具说明
run_command
异步执行系统命令,立即返回 token。命令将在后台执行,可通过 query_command_status 查询结果。
参数:
command(string, required): 要执行的命令字符串timeout(integer, optional, default: 30): 超时秒数 (1-3600)working_directory(string, optional): 工作目录(可选,默认为当前目录)
返回:
token(string): 任务 token (GUID 字符串)status(string): 任务状态 ("pending")message(string): 提交状态消息 ("submitted")
query_command_status
查询命令执行状态和结果。返回命令的当前状态、退出码、输出等信息。
参数:
token(string, required): 任务 token (GUID 字符串)
返回:
token(string): 任务 token (GUID 字符串)status(string): 任务状态 ("pending", "running", "completed", "not_found")exit_code(integer, optional): 命令退出码stdout(string, optional): 标准输出stderr(string, optional): 标准错误输出execution_time(number, optional): 执行时间(秒)timeout_occurred(boolean, optional): 是否发生超时
安装和使用
安装:
pip install runcmd-mcp
或者从源码安装:
pip install -e .
MCP 配置
在 MCP 客户端配置中添加:
{
"mcpServers": {
"runcmd-mcp": {
"command": "uvx",
"args": [
"runcmd-mcp"
]
}
}
}
启动MCP服务器:
runcmd-mcp
使用示例
- 调用
run_command提交命令并获取token - 使用
query_command_status查询命令执行状态和结果 - 命令在后台异步执行,不会阻塞主线程
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
runcmd_mcp-0.1.4.tar.gz
(6.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file runcmd_mcp-0.1.4.tar.gz.
File metadata
- Download URL: runcmd_mcp-0.1.4.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6163d1147a26eab4a414c027ae1807ca56111bc745af6c9af9038edb03e3553
|
|
| MD5 |
3cd8ccfb42b8bbe9f40a21b593da69c2
|
|
| BLAKE2b-256 |
10992b9b793a68c45b637b8437502750d37f13635fa9795ac54f982a3986b63e
|
File details
Details for the file runcmd_mcp-0.1.4-py3-none-any.whl.
File metadata
- Download URL: runcmd_mcp-0.1.4-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f4e0291d0b5a707420b39b0cce5210a09079af6a38d8469cc1acf766241e5fc
|
|
| MD5 |
ba79395d1df7fa85f99c1561af47177b
|
|
| BLAKE2b-256 |
235f92ff2c92d45d565196c9208c513d88ae29d97b014ad5d1766cb83994287e
|