n

nautobot AI网络交互模块

@gt732/nautobot-app-mcp
0 Stars 43 次浏览 gt732 更新于 2026-08-23

一种集成方式,它通过标准化协议使人工智能助手能够与网络数据交互,为网络自动化和管理提供适用于人工智能的工具和接口。

该服务暂未提供标准配置,请参考 README 手动接入

服务介绍

Nautobot MCP

Nautobot
Python
License

此 Nautobot 应用程序将 MCP(模型上下文协议)服务器与 Nautobot 集成,为网络自动化和管理提供 AI 就绪的工具和接口。

概述

Nautobot MCP 使 AI 助手或应用程序能够通过标准化协议与您的网络数据进行交互。该应用在 Nautobot 旁边运行一个 MCP 服务器,该服务器暴露了可供 AI 系统使用的工具。

https://modelcontextprotocol.io/introduction

使用 Librechat 的演示 - 连接到 Nautobot MCP

https://github.com/user-attachments/assets/283d68c2-d35f-4506-b909-45c1850e7281

安装

1. 安装包

pip install nautobot-mcp

2. 在 Nautobot 配置中添加到 INSTALLED_APPS

# In your nautobot_config.py
PLUGINS = [
    "nautobot_mcp",
    # ... other plugins
]

3. 配置

通过 Nautobot 的配置系统配置应用程序:

# In your nautobot_config.py
PLUGINS_CONFIG = {
    "nautobot_mcp": {
        "MCP_PORT": 8005,  # MCP server port
        "MCP_HOST": "0.0.0.0",  # Default is 0.0.0.0
        "MCP_CUSTOM_TOOLS_DIR": "/path/to/your/custom/tools",  # Directory for custom tools
        "MCP_LOAD_CORE_TOOLS": False,  # Load built-in tools
    },
}

4. 运行 nautobot 后升级

nautobot-server post_upgrade

自定义工具

您可以通过在 MCP_CUSTOM_TOOLS_DIR 指定的目录中定义 Python 函数来创建自己的自定义工具。

示例自定义工具:

# In /path/to/your/custom/tools/my_tools.py

def some_tool(param1: str, param2: str) -> dict:
    """Some tool description"""
    # Your implementation here
    return {"result": f"Tool result for {param1} and {param2}"}

MCP 服务器会自动发现并注册指定目录中的所有基于函数的工具。

部署选项

方法 1:手动启动

您可以手动启动 MCP 服务器:

nautobot-server start_mcp_server

方法 2:Systemd 服务(推荐用于生产环境)

/etc/systemd/system/nautobot-mcp.service 创建一个 Systemd 服务文件:

[Unit]
Description=Nautobot MCP Server
After=network-online.target
Wants=network-online.target

[Service]
User=nautobot
Group=nautobot
WorkingDirectory=/opt/nautobot
ExecStart=/opt/nautobot/venv/bin/nautobot-server start_mcp_server
Restart=on-failure
RestartSec=30
PrivateTmp=true

[Install]
WantedBy=multi-user.target

然后启用并启动服务:

sudo systemctl daemon-reload
sudo systemctl enable --now nautobot-mcp.service

查看可用工具

您可以在 Nautobot Web 界面中查看所有已注册的工具:

https://your-nautobot-server/plugins/nautobot-mcp/tools/

此页面显示所有可用工具、它们的描述、模块路径和参数规范。

Tools

待办事项

  • 添加一种方法,将工具执行路由到特定的 Nautobot 工作器。
  • 增强 Nautobot Web 界面中的工具视图,以显示工具使用统计信息。
  • 创建一个 Docker 容器来运行 MCP 服务器。
  • 添加测试。

许可证

该项目根据 Apache License 2.0 许可 - 有关详细信息,请参阅 LICENSE 文件。