内容
ar-mcp
[한국어](README_KO.md)
用于管理家庭实验室基础设施的模型上下文协议(MCP)服务器。通过 84 种工具提供对 **Proxmox VE**、**Kubernetes** 和 **OPNsense** 的统一 AI 辅助控制。
## 功能
| 模块 | 工具 | 功能 |
|--------|-------|--------------|
| **Proxmox VE** | 34 | 虚拟机,LXC 容器,Ceph,存储,任务,监控(RRD) |
| **Kubernetes** | 17 | Pod,部署,服务,命名空间,节点,事件,缩放 |
| **OPNsense** | 33 | 防火墙,NAT,DNS,DHCP,WireGuard VPN,HAProxy,服务 |
## 快速入门
### 前提条件
- Go 1.23+
- 访问至少一个:Proxmox VE,Kubernetes 集群,OPNsense
### 安装
```bash
go install github.com/agurrrrr/nagar-mcp/cmd/nagar-mcp@latest
```
或从源代码构建:
```bash
git clone https://github.com/agurrrrr/nagar-mcp.git
cd nagar-mcp
go build -o nagar-mcp ./cmd/nagar-mcp/
```
### 配置
```bash
cp config.example.yaml config.yaml
# 使用您的凭证编辑 config.yaml
```
每个模块都是可选的空一个部分以禁用它。
### 运行
```bash
# 标准输入/输出模式(默认,用于 MCP 客户端,如 Claude)
./nagar-mcp -config config.yaml
# HTTP 模式
./nagar-mcp -config config.yaml http
```
## 配置
### Proxmox VE
在 Proxmox 中创建 API 令牌:数据中心 > 权限 > API 令牌。
```yaml
proxmox:
url: "https://your-proxmox-host:8006/api2/json"
token_id: "user@pam!token-name"
secret: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
insecure_tls: false
```
环境变量覆盖:`PVE_URL`,`PVE_TOKEN_ID`,`PVE_SECRET`,`PVE_INSECURE_TLS`
### Kubernetes
```yaml
kubernetes:
kubeconfig: "~/.kube/config"
context: "" # 留空以使用当前上下文
```
环境变量覆盖:`KUBECONFIG`,`KUBE_CONTEXT`
### OPNsense
在 OPNsense 中创建 API 密钥:系统 > 访问 > 用户 >(您的用户)> API 密钥。
```yaml
opnsense:
url: "https://your-opnsense-host"
api_key: "your-api-key"
api_secret: "your-api-secret"
insecure_tls: false
```
环境变量覆盖:`OPS_URL`,`OPS_API_KEY`,`OPS_API_SECRET`,`OPS_INSECURE_TLS`
## Claude 桌面集成
将以下内容添加到您的 Claude 桌面配置中(`~/.claude/settings.json`):
```json
{
"mcpServers": {
"nagar-mcp": {
"command": "nagar-mcp",
"args": ["-config", "/path/to/config.yaml"]
}
}
}
```
## 工具参考
<details>
<summary><strong>Proxmox VE(34 种工具)</strong></summary>
**节点**:`pve_list_nodes`,`_node_status`
**虚拟机`pve_list_v,`pve_vm_status`,`pve_vm_config`,`_vm_start`pve_vm_stop`,`pve_vm_shutdown`,_vm_reboot`,`pve_vm_snapshot_list`,`pve_vm_snapshot_create`
**LXC 容器**:`pve_list_lxc`,`pve_lxc_status`,`pve_lxc_config`,`pve_lxc_start`,`pve_lxc_stop`,`pve_lxc_shutdown`,`pve_lxc_reboot`
**集群和存储**:`pve_cluster_resources`,`pve_cluster_status`,`pve_list_storage`,`pve_storage_content`
**Ceph**:`pve_ceph_status`,`pve_list_ceph_osd`,`pve_list_ceph_pool`,`pve_list_ceph,`pve_list_ceph_mds`,`pve_list_ceph_fs`
**监控(RRD)**:`pve_node_rrd`,`pve_vm_rrd`,`pve_lxc_rrd`pve_storage_rrd任务**:`p_status`,`pve_task_log`
</details>
<details>
<summary><strong>Kubernetes(17 种工具)</strong></summary>
**集群**:`k8s_cluster_info`,`k8s_list_namespaces`,`k8s_list_nodes`,`k8s_node_status`
**Pod**:`k8s_list_pods`,`k8s_pod_status`,`k8s_pod_logs`
**部署**:`k8s_list_deployments`,`k8s_deployment_status`
**服务**:`k8s_list_services`,`k8s_service_status`
**事件**:`k8s_list_events`
**操作**:`k8s_scale_deployment`,`k8s_restart_deployment`,`k8s_delete_pod`,`k8s_cordon_node`,`k8s_uncordon_node`
</details>
<details>
<summary><strong>OPNsense(33 种工具)</strong></summary>
**系统**:`ops_firmware_status`,`ops_system_status`
**防火墙**:`ops_list_firewall_rules`,`ops_get_firewall_rule`,`ops_add_firewall_rule`,`ops_toggle_firewall_rule`,`ops_delete_firewall_rule`
**NAT / 端口转发**:`ops_list_nat_rules`,`ops_get_nat_rule`,`ops_add_nat_rule`,`ops_update_nat_rule`,`ops_delete_nat_rule`,`ops_toggle_nat_rule`
**DNS(Unbound)**:`ops_list_dns_overrides`,`ops_add_dns_override`,`ops_delete_dns_override`,`ops_dns_stats`
**DHCP**:`ops_list_dhcp_leases`
**WireGuard VPN**:`ops_wg_list_instances`,`ops_wg_add_instance`,`ops_wg_list_peers`,`ops_wg_add_peer`,`ops_wg_delete_peer`
**HAProxy**:`ops_ha_list_servers`,`ops_ha_add_server`,`ops_ha_list_backends`,`ops_ha_add_backend`,`ops_ha_list_frontends`,`ops_ha_statistics`,`ops_ha_config_test`
**服务**:`ops_list_services`,`ops_service_action`,`ops_apply_changes`
</details>
## 许可证
MIT 许可证 - 参见 [LICENSE](LICENSE) 了解详情。
---
> **“我已赐予他神的灵,有智慧,有理解,有知识和各样的技艺,能创造金银青铜的艺术品”**
>
> *- 出埃及记 31:3-4(NIV)*