Skip to main content

Nautobot MCP

Project description

Nautobot MCP

Nautobot Python License

This Nautobot app integrates the MCP (Model Context Protocol) server with Nautobot, providing AI-ready tools and interfaces for network automation and management.

Overview

Nautobot MCP enables AI assistants or applications to interact with your network data through a standardized protocol. The app runs an MCP server alongside Nautobot that exposes tools which can be used by AI systems.

https://modelcontextprotocol.io/introduction

Installation

1. Install the package

pip install nautobot-mcp

2. Add to INSTALLED_APPS in your Nautobot configuration

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

3. Configuration

Configure the app through Nautobot's configuration system:

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

4. Run nautobot post upgrade

nautobot-server post_upgrade

Custom Tools

You can create your own custom tools by defining Python functions in the directory specified in MCP_CUSTOM_TOOLS_DIR.

Example custom tool:

# 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}"}

The MCP server will automatically discover and register all function-based tools in the specified directory.

Deployment Options

Method 1: Manual Start

You can start the MCP server manually:

nautobot-server start_mcp_server

Method 2: Systemd Service (Recommended for Production)

Create a systemd service file at /etc/systemd/system/nautobot-mcp.service:

[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

Then enable and start the service:

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

Viewing Available Tools

You can view all registered tools in the Nautobot web interface at:

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

This page shows all available tools, their descriptions, module paths, and parameter specifications.

Tools

TODO

  • Add a way to route tool execution to a specific Nautobot worker.
  • Enhance the tool view in the Nautobot web interface to show tool usage statistics.
  • Create a docker container to run the MCP server.
  • Add tests.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nautobot_mcp-0.1.1.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nautobot_mcp-0.1.1-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file nautobot_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: nautobot_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nautobot_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a32ff30c8b1a45c660bd554be24d3f07763dc4726655d3eac4b206df5049abfc
MD5 3fa6d1722e8738ab71c9158a913a2bae
BLAKE2b-256 a3ebe75bdf92026e14452efe0ae047090584fa109a2499904acb84f7b13e0372

See more details on using hashes here.

File details

Details for the file nautobot_mcp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: nautobot_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nautobot_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f8b21982c30e1dee901b7aa2357298d964d21f074b31549a1b5ac0fe0df4a3dc
MD5 7d09f7f40f38dd068364751f1e8d684b
BLAKE2b-256 83a296bf5cc9c7e9cb3598f3d460be975470a99d5978824e5d9c1e3e369ac13c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page