| Crates.io | systeminfo_rust_mcp |
| lib.rs | systeminfo_rust_mcp |
| version | 0.0.1 |
| created_at | 2025-12-17 03:00:08.460784+00 |
| updated_at | 2025-12-17 03:00:08.460784+00 |
| description | A Model Context Protocol (MCP) server for system information retrieval |
| homepage | |
| repository | https://gitee.com/awol20101ex/systeminfo_rust_mcp |
| max_upload_size | |
| id | 1989226 |
| size | 51,436 |
A Model Context Protocol (MCP) server that provides comprehensive system information through stdio line mode communication. Built with Rust and the sysinfo crate for cross-platform compatibility.
git clone <repository-url>
cd systeminfo_rust_mcp
cargo build --release
This will create an optimized binary at target/release/systeminfo_rust_mcp.exe (Windows) or target/release/systeminfo_rust_mcp (Linux/macOS).
cargo build
Creates a debug binary at target/debug/systeminfo_rust_mcp.exe (Windows) or target/debug/systeminfo_rust_mcp (Linux/macOS).
After building, you can use the binary directly:
Windows:
.\target\release\systeminfo_rust_mcp.exe
Linux/macOS:
./target/release/systeminfo_rust_mcp
Add the binary to your system PATH for global access:
Windows:
# Copy to a directory in your PATH
copy target\release\systeminfo_rust_mcp.exe C:\Windows\System32\
Linux/macOS:
# Copy to /usr/local/bin (requires sudo)
sudo cp target/release/systeminfo_rust_mcp /usr/local/bin/
sudo chmod +x /usr/local/bin/systeminfo_rust_mcp
For Trae IDE users, you can install this MCP server directly:
Build the project first:
cargo build --release
Add to Trae MCP configuration:
Create or edit the MCP configuration file in Trae:
%APPDATA%\Trae\User\settings.json~/Library/Application Support/Trae/User/settings.json~/.config/Trae/User/settings.jsonAdd the following configuration:
{
"mcp.servers": {
"systeminfo": {
"command": "path/to/your/systeminfo_rust_mcp.exe",
"args": [],
"env": {}
}
}
}
Replace path/to/your/systeminfo_rust_mcp.exe with the actual path to your built binary.
Restart Trae IDE to load the new MCP server.
If the crate is published to crates.io:
cargo install systeminfo_rust_mcp
The server communicates via stdio using JSON-RPC 2.0 protocol. Send requests as JSON lines (newline-delimited).
cargo run
{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": null}
{"jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": null}
{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "get_system_info", "arguments": {}}}
{"jsonrpc": "2.0", "id": 4, "method": "tools/call", "params": {"name": "get_cpu_info", "arguments": {}}}
{"jsonrpc": "2.0", "id": 5, "method": "tools/call", "params": {"name": "get_disk_info", "arguments": {}}}
{"jsonrpc": "2.0", "id": 6, "method": "tools/call", "params": {"name": "get_network_info", "arguments": {}}}
{"jsonrpc": "2.0", "id": 7, "method": "tools/call", "params": {"name": "get_process_info", "arguments": {}}}
Create a simple test script:
#!/usr/bin/env python3
import json
import subprocess
# Start the server
process = subprocess.Popen(
["cargo", "run"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)
# Send a request
request = json.dumps({
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {"name": "get_system_info", "arguments": {}}
}) + "\n"
process.stdin.write(request)
process.stdin.flush()
# Read response
response = process.stdout.readline()
print("Response:", response)
# Terminate
process.terminate()
| Tool Name | Description |
|---|---|
get_system_info |
Basic system information including hostname, OS, memory, etc. |
get_cpu_info |
Detailed CPU information including usage and frequency |
get_disk_info |
Disk information including space and mount points |
get_network_info |
Network interface information including traffic statistics |
get_process_info |
Top processes information sorted by resource usage |
All tool calls return responses in this format:
{
"jsonrpc": "2.0",
"id": <request_id>,
"result": {
"content": [
{
"type": "text",
"text": "<json_formatted_data>",
"mime_type": "application/json"
}
],
"is_error": false
},
"error": null
}
systeminfo_rust_mcp/
├── Cargo.toml # Project dependencies
├── src/
│ └── main.rs # Main server implementation
└── README.md # This file
serde & serde_json: JSON serializationsysinfo: Cross-platform system informationcargo test
cargo doc --open
This server works on:
sysinfo crate capabilitiesinputSchema field formatcargo build to download dependenciesRun with debug output:
RUST_LOG=debug cargo run
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Copyright 2024 [Your Name or Organization]
git clone <repository-url>
cd systeminfo_rust_mcp
cargo build --release
这将在 target/release/systeminfo_rust_mcp.exe (Windows) 或 target/release/systeminfo_rust_mcp (Linux/macOS) 创建优化的二进制文件。
cargo build
在 target/debug/systeminfo_rust_mcp.exe (Windows) 或 target/debug/systeminfo_rust_mcp (Linux/macOS) 创建调试二进制文件。
构建后,您可以直接使用二进制文件:
Windows:
.\target\release\systeminfo_rust_mcp.exe
Linux/macOS:
./target/release/systeminfo_rust_mcp
将二进制文件添加到系统PATH以实现全局访问:
Windows:
# 复制到PATH中的目录
copy target\release\systeminfo_rust_mcp.exe C:\Windows\System32\
Linux/macOS:
# 复制到/usr/local/bin (需要sudo)
sudo cp target/release/systeminfo_rust_mcp /usr/local/bin/
sudo chmod +x /usr/local/bin/systeminfo_rust_mcp
对于Trae IDE用户,您可以直接安装此MCP服务器:
首先构建项目:
cargo build --release
添加到Trae MCP配置:
在Trae中创建或编辑MCP配置文件:
%APPDATA%\Trae\User\settings.json~/Library/Application Support/Trae/User/settings.json~/.config/Trae/User/settings.json添加以下配置:
{
"mcp.servers": {
"systeminfo": {
"command": "path/to/your/systeminfo_rust_mcp.exe",
"args": [],
"env": {}
}
}
}
将 path/to/your/systeminfo_rust_mcp.exe 替换为您构建的二进制文件的实际路径。
重启Trae IDE 以加载新的MCP服务器。
如果crate发布到crates.io:
cargo install systeminfo_rust_mcp
服务器通过stdio使用JSON-RPC 2.0协议进行通信。以JSON行(换行分隔)的形式发送请求。
cargo run
{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": null}
{"jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": null}
{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "get_system_info", "arguments": {}}}
{"jsonrpc": "2.0", "id": 4, "method": "tools/call", "params": {"name": "get_cpu_info", "arguments": {}}}
{"jsonrpc": "2.0", "id": 5, "method": "tools/call", "params": {"name": "get_disk_info", "arguments": {}}}
{"jsonrpc": "2.0", "id": 6, "method": "tools/call", "params": {"name": "get_network_info", "arguments": {}}}
{"jsonrpc": "2.0", "id": 7, "method": "tools/call", "params": {"name": "get_process_info", "arguments": {}}}
创建简单的测试脚本:
#!/usr/bin/env python3
import json
import subprocess
# 启动服务器
process = subprocess.Popen(
["cargo", "run"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)
# 发送请求
request = json.dumps({
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {"name": "get_system_info", "arguments": {}}
}) + "\n"
process.stdin.write(request)
process.stdin.flush()
# 读取响应
response = process.stdout.readline()
print("响应:", response)
# 终止
process.terminate()
| 工具名称 | 描述 |
|---|---|
get_system_info |
基本系统信息,包括主机名、操作系统、内存等 |
get_cpu_info |
详细的CPU信息,包括使用率和频率 |
get_disk_info |
磁盘信息,包括空间和挂载点 |
get_network_info |
网络接口信息,包括流量统计 |
get_process_info |
按资源使用排序的顶级进程信息 |
所有工具调用都返回以下格式的响应:
{
"jsonrpc": "2.0",
"id": <请求ID>,
"result": {
"content": [
{
"type": "text",
"text": "<JSON格式化的数据>",
"mime_type": "application/json"
}
],
"is_error": false
},
"error": null
}
systeminfo_rust_mcp/
├── Cargo.toml # 项目依赖
├── src/
│ └── main.rs # 主服务器实现
└── README.md # 此文件
serde & serde_json: JSON序列化sysinfo: 跨平台系统信息cargo test
cargo doc --open
此服务器适用于:
sysinfocrate的功能提供有限支持inputSchema字段格式cargo build下载依赖项使用调试输出运行:
RUST_LOG=debug cargo run
本项目采用Apache License 2.0许可证 - 详见 LICENSE 文件。
版权所有 2024 [awol2005ex]