linux-mcp-toolkit


Namelinux-mcp-toolkit JSON
Version 1.0.16 PyPI version JSON
download
home_pageNone
SummaryEnhanced Linux MCP Toolkit with Interactive Shell Support
upload_time2025-08-27 20:38:41
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords linux ssh mcp system-administration remote-management interactive-shell
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Linux MCP Toolkit

Linux MCP Toolkit 是一个基于 MCP 协议的增强型 Linux 管理工具包,提供交互式 SSH 会话、系统监控、文件操作等功能。

## 🚀 功能特性

- **交互式 SSH 会话**:持久化的 SSH 连接,支持实时命令执行
- **系统监控**:快速获取系统信息、进程监控、网络状态
- **文件操作**:远程文件读写、目录列表、权限管理
- **服务管理**:systemd 服务控制(启动、停止、重启、状态检查)
- **跨平台支持**:Windows、Linux、macOS 全平台兼容
- **MCP 协议**:基于 Model Context Protocol 的标准接口

## 📦 安装

### 通过 PyPI 安装

```bash
pip install linux-mcp-toolkit
```

### 从源码安装

```bash
git clone https://github.com/linux-mcp/linux-mcp-toolkit.git
cd linux-mcp-toolkit
pip install -e .
```

## 🔧 快速开始

### 基本使用

```python
from linux_mcp_toolkit import ping_host, execute_command, create_interactive_session

# 检查主机连通性
result = ping_host("192.168.1.100")
print(result)

# 执行单个命令
output = execute_command("192.168.1.100", "ls -la /home")
print(output)

# 创建交互式会话
session = create_interactive_session("192.168.1.100", "username", "password")
print(session)
```

### MCP 服务器使用

```bash
# 启动 MCP 服务器
python -m linux_mcp_toolkit
```

## 🛠️ 工具函数

### 网络工具
- `ping_host(host, count=4)`: 检查主机连通性
- `network_info(ip_address)`: 获取网络配置信息

### 系统管理
- `quick_system_info(ip_address)`: 快速系统信息
- `monitor_process(ip_address, process_name)`: 进程监控
- `service_control(ip_address, service, action)`: 服务管理

### 文件操作
- `file_operations(ip_address, operation, path, content=None)`: 文件读写操作

### 交互式会话
- `create_interactive_session(ip_address, username, password, port)`: 创建会话
- `execute_interactive_command(ip_address, command, timeout=30)`: 执行命令
- `send_interactive_input(ip_address, input_text)`: 发送输入
- `get_real_time_output(ip_address, duration=5)`: 获取实时输出
- `list_active_sessions()`: 列出活跃会话
- `close_session(ip_address)`: 关闭会话

## 🔐 认证方式

支持两种认证方式:

1. **密码认证**:使用用户名和密码
2. **密钥认证**:使用 SSH 私钥

## 📋 依赖要求

- Python >= 3.8
- paramiko >= 2.7.0 (SSH 客户端)
- mcp >= 1.0.0 (MCP 协议支持)

## 🐛 问题反馈

如果遇到问题,请通过以下方式反馈:

- GitHub Issues: https://github.com/linux-mcp/linux-mcp-toolkit/issues
- 邮件联系: contact@linuxmcp.com

## 📄 许可证

MIT License - 详见 LICENSE 文件

## 🤝 贡献

欢迎提交 Issue 和 Pull Request!

## 🎯 版本历史

- v1.0.0: 初始版本,包含基本功能
  - 交互式 SSH 会话
  - 系统监控工具
  - 文件操作功能
  - 服务管理工具

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "linux-mcp-toolkit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "linux, ssh, mcp, system-administration, remote-management, interactive-shell",
    "author": null,
    "author_email": "Linux MCP Toolkit Team <contact@linuxmcp.com>",
    "download_url": "https://files.pythonhosted.org/packages/ae/93/8a67127c7695e5c2b34cd7a2fedcd3ac927dfcbb4b72cd0c2cd15c16282a/linux_mcp_toolkit-1.0.16.tar.gz",
    "platform": null,
    "description": "# Linux MCP Toolkit\r\n\r\nLinux MCP Toolkit \u662f\u4e00\u4e2a\u57fa\u4e8e MCP \u534f\u8bae\u7684\u589e\u5f3a\u578b Linux \u7ba1\u7406\u5de5\u5177\u5305\uff0c\u63d0\u4f9b\u4ea4\u4e92\u5f0f SSH \u4f1a\u8bdd\u3001\u7cfb\u7edf\u76d1\u63a7\u3001\u6587\u4ef6\u64cd\u4f5c\u7b49\u529f\u80fd\u3002\r\n\r\n## \ud83d\ude80 \u529f\u80fd\u7279\u6027\r\n\r\n- **\u4ea4\u4e92\u5f0f SSH \u4f1a\u8bdd**\uff1a\u6301\u4e45\u5316\u7684 SSH \u8fde\u63a5\uff0c\u652f\u6301\u5b9e\u65f6\u547d\u4ee4\u6267\u884c\r\n- **\u7cfb\u7edf\u76d1\u63a7**\uff1a\u5feb\u901f\u83b7\u53d6\u7cfb\u7edf\u4fe1\u606f\u3001\u8fdb\u7a0b\u76d1\u63a7\u3001\u7f51\u7edc\u72b6\u6001\r\n- **\u6587\u4ef6\u64cd\u4f5c**\uff1a\u8fdc\u7a0b\u6587\u4ef6\u8bfb\u5199\u3001\u76ee\u5f55\u5217\u8868\u3001\u6743\u9650\u7ba1\u7406\r\n- **\u670d\u52a1\u7ba1\u7406**\uff1asystemd \u670d\u52a1\u63a7\u5236\uff08\u542f\u52a8\u3001\u505c\u6b62\u3001\u91cd\u542f\u3001\u72b6\u6001\u68c0\u67e5\uff09\r\n- **\u8de8\u5e73\u53f0\u652f\u6301**\uff1aWindows\u3001Linux\u3001macOS \u5168\u5e73\u53f0\u517c\u5bb9\r\n- **MCP \u534f\u8bae**\uff1a\u57fa\u4e8e Model Context Protocol \u7684\u6807\u51c6\u63a5\u53e3\r\n\r\n## \ud83d\udce6 \u5b89\u88c5\r\n\r\n### \u901a\u8fc7 PyPI \u5b89\u88c5\r\n\r\n```bash\r\npip install linux-mcp-toolkit\r\n```\r\n\r\n### \u4ece\u6e90\u7801\u5b89\u88c5\r\n\r\n```bash\r\ngit clone https://github.com/linux-mcp/linux-mcp-toolkit.git\r\ncd linux-mcp-toolkit\r\npip install -e .\r\n```\r\n\r\n## \ud83d\udd27 \u5feb\u901f\u5f00\u59cb\r\n\r\n### \u57fa\u672c\u4f7f\u7528\r\n\r\n```python\r\nfrom linux_mcp_toolkit import ping_host, execute_command, create_interactive_session\r\n\r\n# \u68c0\u67e5\u4e3b\u673a\u8fde\u901a\u6027\r\nresult = ping_host(\"192.168.1.100\")\r\nprint(result)\r\n\r\n# \u6267\u884c\u5355\u4e2a\u547d\u4ee4\r\noutput = execute_command(\"192.168.1.100\", \"ls -la /home\")\r\nprint(output)\r\n\r\n# \u521b\u5efa\u4ea4\u4e92\u5f0f\u4f1a\u8bdd\r\nsession = create_interactive_session(\"192.168.1.100\", \"username\", \"password\")\r\nprint(session)\r\n```\r\n\r\n### MCP \u670d\u52a1\u5668\u4f7f\u7528\r\n\r\n```bash\r\n# \u542f\u52a8 MCP \u670d\u52a1\u5668\r\npython -m linux_mcp_toolkit\r\n```\r\n\r\n## \ud83d\udee0\ufe0f \u5de5\u5177\u51fd\u6570\r\n\r\n### \u7f51\u7edc\u5de5\u5177\r\n- `ping_host(host, count=4)`: \u68c0\u67e5\u4e3b\u673a\u8fde\u901a\u6027\r\n- `network_info(ip_address)`: \u83b7\u53d6\u7f51\u7edc\u914d\u7f6e\u4fe1\u606f\r\n\r\n### \u7cfb\u7edf\u7ba1\u7406\r\n- `quick_system_info(ip_address)`: \u5feb\u901f\u7cfb\u7edf\u4fe1\u606f\r\n- `monitor_process(ip_address, process_name)`: \u8fdb\u7a0b\u76d1\u63a7\r\n- `service_control(ip_address, service, action)`: \u670d\u52a1\u7ba1\u7406\r\n\r\n### \u6587\u4ef6\u64cd\u4f5c\r\n- `file_operations(ip_address, operation, path, content=None)`: \u6587\u4ef6\u8bfb\u5199\u64cd\u4f5c\r\n\r\n### \u4ea4\u4e92\u5f0f\u4f1a\u8bdd\r\n- `create_interactive_session(ip_address, username, password, port)`: \u521b\u5efa\u4f1a\u8bdd\r\n- `execute_interactive_command(ip_address, command, timeout=30)`: \u6267\u884c\u547d\u4ee4\r\n- `send_interactive_input(ip_address, input_text)`: \u53d1\u9001\u8f93\u5165\r\n- `get_real_time_output(ip_address, duration=5)`: \u83b7\u53d6\u5b9e\u65f6\u8f93\u51fa\r\n- `list_active_sessions()`: \u5217\u51fa\u6d3b\u8dc3\u4f1a\u8bdd\r\n- `close_session(ip_address)`: \u5173\u95ed\u4f1a\u8bdd\r\n\r\n## \ud83d\udd10 \u8ba4\u8bc1\u65b9\u5f0f\r\n\r\n\u652f\u6301\u4e24\u79cd\u8ba4\u8bc1\u65b9\u5f0f\uff1a\r\n\r\n1. **\u5bc6\u7801\u8ba4\u8bc1**\uff1a\u4f7f\u7528\u7528\u6237\u540d\u548c\u5bc6\u7801\r\n2. **\u5bc6\u94a5\u8ba4\u8bc1**\uff1a\u4f7f\u7528 SSH \u79c1\u94a5\r\n\r\n## \ud83d\udccb \u4f9d\u8d56\u8981\u6c42\r\n\r\n- Python >= 3.8\r\n- paramiko >= 2.7.0 (SSH \u5ba2\u6237\u7aef)\r\n- mcp >= 1.0.0 (MCP \u534f\u8bae\u652f\u6301)\r\n\r\n## \ud83d\udc1b \u95ee\u9898\u53cd\u9988\r\n\r\n\u5982\u679c\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u53cd\u9988\uff1a\r\n\r\n- GitHub Issues: https://github.com/linux-mcp/linux-mcp-toolkit/issues\r\n- \u90ae\u4ef6\u8054\u7cfb: contact@linuxmcp.com\r\n\r\n## \ud83d\udcc4 \u8bb8\u53ef\u8bc1\r\n\r\nMIT License - \u8be6\u89c1 LICENSE \u6587\u4ef6\r\n\r\n## \ud83e\udd1d \u8d21\u732e\r\n\r\n\u6b22\u8fce\u63d0\u4ea4 Issue \u548c Pull Request\uff01\r\n\r\n## \ud83c\udfaf \u7248\u672c\u5386\u53f2\r\n\r\n- v1.0.0: \u521d\u59cb\u7248\u672c\uff0c\u5305\u542b\u57fa\u672c\u529f\u80fd\r\n  - \u4ea4\u4e92\u5f0f SSH \u4f1a\u8bdd\r\n  - \u7cfb\u7edf\u76d1\u63a7\u5de5\u5177\r\n  - \u6587\u4ef6\u64cd\u4f5c\u529f\u80fd\r\n  - \u670d\u52a1\u7ba1\u7406\u5de5\u5177\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Enhanced Linux MCP Toolkit with Interactive Shell Support",
    "version": "1.0.16",
    "project_urls": {
        "Bug Reports": "https://github.com/linux-mcp/linux-mcp-toolkit/issues",
        "Documentation": "https://linux-mcp-toolkit.readthedocs.io",
        "Homepage": "https://github.com/linux-mcp/linux-mcp-toolkit",
        "Source": "https://github.com/linux-mcp/linux-mcp-toolkit"
    },
    "split_keywords": [
        "linux",
        " ssh",
        " mcp",
        " system-administration",
        " remote-management",
        " interactive-shell"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1ed5921924ee7a0424ed9146a3021b7dde4e731a2d1b754adf23d0dea503ebdb",
                "md5": "f819bd4cbdab92e794520ef0c9c1ad02",
                "sha256": "f506e7e7fce8559660537d347012a1929dba94e4d19b5a8197b01148c70fd2a5"
            },
            "downloads": -1,
            "filename": "linux_mcp_toolkit-1.0.16-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f819bd4cbdab92e794520ef0c9c1ad02",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9182,
            "upload_time": "2025-08-27T20:38:40",
            "upload_time_iso_8601": "2025-08-27T20:38:40.444644Z",
            "url": "https://files.pythonhosted.org/packages/1e/d5/921924ee7a0424ed9146a3021b7dde4e731a2d1b754adf23d0dea503ebdb/linux_mcp_toolkit-1.0.16-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ae938a67127c7695e5c2b34cd7a2fedcd3ac927dfcbb4b72cd0c2cd15c16282a",
                "md5": "b3d9518379d31b8dfc6168082a3083aa",
                "sha256": "bd23294a649da9b5c36a7ff53551d93d0eee37d1f85379b20f6337581bddb045"
            },
            "downloads": -1,
            "filename": "linux_mcp_toolkit-1.0.16.tar.gz",
            "has_sig": false,
            "md5_digest": "b3d9518379d31b8dfc6168082a3083aa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 10799,
            "upload_time": "2025-08-27T20:38:41",
            "upload_time_iso_8601": "2025-08-27T20:38:41.699179Z",
            "url": "https://files.pythonhosted.org/packages/ae/93/8a67127c7695e5c2b34cd7a2fedcd3ac927dfcbb4b72cd0c2cd15c16282a/linux_mcp_toolkit-1.0.16.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-27 20:38:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "linux-mcp",
    "github_project": "linux-mcp-toolkit",
    "github_not_found": true,
    "lcname": "linux-mcp-toolkit"
}
        
Elapsed time: 1.83590s