设备访问——网络操作助手
一个独立的AI驱动的CLI客户端,用于通过SSH管理网络设备。所有人工智能工作都使用Anthropic Claude API-无需IDE,无需Claude Desktop,无需外部MCP客户端。
它做什么
您可以在终端中与它聊天。它通过SSH连接到您的网络设备,并使用Claude作为大脑:
- 在设备上运行CLI命令
- 分析命令输出
- 根据您的意图建议适当的命令
- 执行MBSS(最低基线安全标准)合规性检查和强化
快速入门
1.克隆仓库
git clone https://github.com/amity2230/device_access.git
cd device_access2.安装依赖项
uv sync或者使用pip:
pip install fastmcp netmiko pyyaml anthropic python-dotenv3.设置您的Anthropic API密钥
cp .env.example .env编辑 .env:
ANTHROPIC_API_KEY=your-anthropic-api-key-here4.添加您的设备
编辑 devices.yaml:
cpnr-server-01:
host: 192.168.1.10
device_type: linux
username: admin
password: yourpassword
description: "CPNR Server 01"5.跑步
python main.py用法
自然地打字。克劳德会自动调用正确的工具。
You: list all devices
You: run "show ip interface brief" on vIOS-R1
You: check MBSS compliance for cpnr-server-01
You: apply MBSS fixes 1,2,9 on cpnr-server-01
You: run a full MBSS audit on cpnr-server-01类型 quit 或 exit 结束会议。
可用工具
Claude会根据您的请求自动决定何时调用这些:
| 工具 | 它做什么 |
|---|---|
list_devices | 显示库存中的所有设备 |
get_device_info | 获取设备的连接详细信息 |
run_command | 通过SSH在设备上执行CLI命令 |
suggest_commands | AI为给定意图建议命令 |
analyze_output | 命令输出的AI分析 |
mbss_check | 验证特定控制措施的MBSS合规性 |
mbss_apply | 应用MBSS补救(验证→ fix → 验证) |
mbss_audit | 对所有67个控制措施进行全面的MBSS审计 |
项目结构
device_access/
├── main.py # Standalone CLI client — run this
├── device_mcp.py # Tool functions (SSH, MBSS, AI helpers)
├── mbss/
│ ├── mbss_mop.py # MBSS control definitions (67 controls)
│ ├── CPNR_MBSS.htm # MBSS reference document
│ ├── CPNR_MBSS.xlsx # MBSS reference spreadsheet
│ └── cpnr_system_prompt.md
├── devices.yaml # Your device inventory
├── pyproject.toml # Dependencies
├── .env.example # API key template
└── README.md支持的设备类型
遵循Netmiko惯例: cisco_ios, cisco_nxos, cisco_xr, arista_eos, juniper_junos, linux以及更多。
许可证
麻省理工学院
