A Model Context Protocol (MCP) service for executing system commands asynchronously
Project description
runcmd-mcp
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服务器:
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.3.tar.gz
(6.3 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.3.tar.gz.
File metadata
- Download URL: runcmd_mcp-0.1.3.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fab86af745f48b986201b8b8edf4ec418ce51215be2d5b43470c326c858a4686
|
|
| MD5 |
7bac651309cbba0b623e4583024185bc
|
|
| BLAKE2b-256 |
8becc941fbae74d610f48d0a62e5cc4f84445f68b0eea3709296f371f87dfd5c
|
File details
Details for the file runcmd_mcp-0.1.3-py3-none-any.whl.
File metadata
- Download URL: runcmd_mcp-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.0 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 |
fc110f157cd351279a54282e07d0ad6bef60bf5394f90f46293dfbdef2ad08ee
|
|
| MD5 |
7d51f4343ffee21ed70250cedf7ae6cf
|
|
| BLAKE2b-256 |
4175e8b6fccac588c30d6df327223e5e54e9791b9a941cbd91894052f11541cc
|