proxmox mcp运行
用Go编写的Proxmox MCP(模型上下文协议)服务器。使用MCP流式HTTP传输通过HTTP将Proxmox VE管理工具暴露给AI代理。
入门指南
先决条件
- 转到1.24+
- Docker(可选)
配置
复制并编辑配置文件:
bind_port: 3001
verbose: true
pve_url: "https://your-proxmox-host:8006"
pve_token_id: "root@pam!mcp"
pve_token: "your-api-token-secret"
mcp_api_key: "your-secret-key-here"
# mcp_stdio: false| 字段 | 描述 |
|---|---|
bind_host | HTTP服务器绑定地址(默认值: 0.0.0.0) |
bind_port | HTTP服务器端口(默认值: 3001) |
pve_url | Proxmox VE API URL |
pve_token_id | API令牌ID(例如。 root@pam!mcp) |
pve_token | API令牌机密 |
mcp_api_key | 用于验证MCP端点请求的API密钥(承载令牌) |
mcp_stdio | 启用stdio传输(默认值: false) |
跑步
go run main.go --config=$PWD/config/config.yaml码头工人
./run-docker.sh
# Or with custom config/port
CONFIG_FILE=/path/to/config.yaml PORT=3001 ./run-docker.shMCP端点
MCP服务器可在 POST /mcp 使用可流式传输的HTTP。
从克劳德代码连接
{
"mcpServers": {
"proxmox": {
"type": "url",
"url": "http://your-host:3001/mcp",
"headers": {
"Authorization": "Bearer your-secret-key-here"
}
}
}
}当 mcp_api_key 已设置,所有请求 /mcp 必须包括 Authorization: Bearer 头球如果未设置密钥,则端点未经身份验证。
可用工具
| 类别 | 工具 |
|---|---|
| 集群 | get_version, get_cluster_status, list_nodes, get_node_status, get_node_network |
| 客人 | list_vms, list_containers, list_cluster_resources, get_guest_config, start_guest, stop_guest, get_next_id, update_guest_config, migrate_guest, resize_guest_disk |
| 创建 | create_vm, create_container, clone_guest, delete_guest, convert_to_template |
| 快照 | list_snapshots, create_snapshot, rollback_snapshot, delete_snapshot |
| 备份 | backup_guest, list_backups, restore_backup |
| 存储 | list_storage, list_templates, list_isos, download_template |
| 任务 | list_tasks, get_task_status, get_task_log |
API
GET /api/v1/ # Default page
GET /api/v1/health # Health check
POST /mcp # MCP streamable HTTP endpoint项目结构
main.go # Entry point
app/ # Application lifecycle, logging, signal handling
server/ # HTTP server, routing, middleware
config/ # Configuration parsing
mcp/ # MCP server, Proxmox client, tool registrations发展
# Build binary
go build -o ./tmp/main.exe .
# Run tests
go test ./...
# Lint
golangci-lint run --fix
# Update vendor after dependency changes
go mod tidy && go mod vendor