基于 Go 语言实现的模型上下文协议(MCP)服务器,通过 SSH 提供远程 Shell 执行功能。
Config is the same across clients — only the file and path differ.
{
"mcpServers": {
"linux-mcp-server-go": {
"command": "<see-readme>",
"args": []
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
No automated test available for this server. Check the GitHub README for setup instructions.
Five weighted categories — click any category to see the underlying evidence.
No known CVEs.
No package registry to scan.
Click any tool to inspect its schema.
Be the first to review
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Others in devops
MCP server for using the GitLab API
Enhanced MCP server for GitLab: group projects listing and activity tracking
Yunxiao MCP Server provides AI assistants with the ability to interact with the Yunxiao platform. It provides a set of tools that interact with Yunxiao's API, allowing AI assistants to manage Codeup repository, Project, Pipeline, Packages etc.
MCP server for Komodo - manage Docker containers, servers, stacks, and deployments via AI
MCP Security Weekly
Get CVE alerts and security updates for Linux Mcp Server Go and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
基于 Go 语言实现的模型上下文协议(MCP)服务器,通过 SSH 提供远程 Shell 执行功能。
通过 SSH 连接在远程机器上执行 Shell 命令。
参数:
machine_ip (string): 目标机器的 IP 地址path (string): 远程机器上的工作目录路径shell (string): 要执行的 Shell 命令使用示例:
{
"tool": "execute_shell",
"arguments": {
"machine_ip": "192.168.1.100",
"path": "/home/user",
"shell": "ls -la"
}
}
在服务器二进制文件同目录下创建 hosts.json 文件来配置 SSH 连接:
[
{
"ip": "192.168.1.100",
"user": "root",
"password": "your_password",
"port": 22
},
{
"ip": "192.168.1.101",
"user": "admin",
"password": "admin_password",
"port": 2222
}
]
配置字段:
ip: 远程机器的 IP 地址或主机名user: SSH 用户名password: SSH 密码(明文)port: SSH 端口(默认:22)git clone <repository-url>
cd linux-mcp-server-go
make deps
make build
构建所有支持的平台:
make build-all
构建特定平台:
make build-linux-amd64 # Linux 64位
make build-darwin-arm64 # macOS Apple Silicon
make build-windows-amd64 # Windows 64位
以 stdio 模式运行服务器,用于直接与 MCP 客户端通信:
./build/linux-mcp-server
在指定端口以 HTTP 模式运行服务器:
./build/linux-mcp-server -http :8080
或使用 Makefile:
make run-http
配置你的 MCP 客户端使用此服务器。Claude Desktop 配置示例:
{
"mcpServers": {
"linux-mcp-server": {
"command": "/path/to/linux-mcp-server",
"args": []
}
}
}
make help # 显示所有可用目标
make build # 为当前平台构建
make test # 运行测试
make fmt # 格式化代码
make vet # 运行 go vet
make lint # 运行 golangci-lint(需要安装 golangci-lint)
make clean # 清理构建目录
.
├── main.go # 主服务器实现
├── hosts.json # SSH 主机配置
├── go.mod # Go 模块定义
├── go.sum # Go 模块校验和
├── Makefile # 构建自动化
└── README.md # 本文件
⚠️ 重要安全注意事项:
密码存储: 此实现将 SSH 密码以明文形式存储在 hosts.json 文件中。生产环境建议:
网络安全: 确保 SSH 连接在安全网络上进行
访问控制: 使用适当的文件权限限制对 hosts.json 文件的访问:
chmod 600 hosts.json
此项目使用 MIT 许可证 - 详情请参阅 LICENSE 文件。
make fmt 和 make vethosts.json 文件存在于二进制文件同目录下hosts.json 中的凭据通过设置环境变量启用调试日志:
MCP_DEBUG=1 ./build/linux-mcp-server