Sponsored by Deepsite.site

Cisco NSO MCP Server

Created By
dbono7118 months ago
A Model Context Protocol (MCP) server implementation for Cisco NSO that enables AI-powered network automation through natural language interactions.
Content

Cisco NSO MCP Server

A Model Context Protocol (MCP) server implementation for Cisco NSO (Network Services Orchestrator) that enables AI-powered network automation through natural language interactions.

Overview

This package provides a standalone MCP server for Cisco NSO, written in Python, that can be installed with pip and run as a command-line tool. It exposes capabilities in Cisco NSO as MCP tools and resources that can be consumed by any MCP-compatible client.

# Install the package
pip install cisco-nso-mcp-server

# Run the server
cisco-nso-mcp-server

What is MCP?

The Model Context Protocol (MCP) is an open protocol that standardizes how AI models interact with external tools and services. MCP enables:

  • Tool Definition: Structured way to define tools that AI models can use
  • Tool Discovery: Mechanism for models to discover available tools
  • Tool Execution: Standardized method for models to call tools and receive results
  • Context Management: Efficient passing of context between tools and models
  • Framework Agnostic: Works across multiple AI frameworks including OpenAI, Anthropic, Google Gemini, and others
  • Interoperability: Provides a common language for AI systems to communicate with external tools

Note on MCP Flexibility

Although the primary use case for MCP is integration with LLMs, MCP and similar tool frameworks (like Smithery) are LLM-agnostic - they're simply APIs with a specific protocol. This means you can:

  • Use them directly in any application without an LLM
  • Let an LLM control them through an integration layer
  • Mix both approaches depending on your specific needs and use cases

This flexibility makes MCP tools valuable beyond just LLM applications, serving as standardized interfaces for various automation needs.

Features

  • Stdio Transport: By default, the server uses stdio transport for process-bound communication
  • SSE Transport: Optionally, the server can use SSE transport for web-bound communication
  • Tool-First Design: Network operations are defined as discrete tools with clear interfaces
  • Asynchronous Processing: All network operations are implemented asynchronously for better performance
  • Structured Responses: Consistent response format with status, data, and metadata sections
  • Environment Resources: Provides contextual information about the NSO environment

Available Tools and Resources

Tools

  • get_device_ned_ids_tool: Retrieves Network Element Driver (NED) IDs from Cisco NSO
  • get_device_platform_tool: Gets platform information for a specific device in Cisco NSO

Resources

  • https://cisco-nso-mcp.resources/environment: Provides a comprehensive summary of the NSO environment:
    • Device count
    • Operating System Distribution
    • Unique Operating System Count
    • Unique Model Count
    • Model Distribution
    • Device Series Distribution

Requirements

  • Python 3.13+
  • Cisco NSO with RESTCONF API enabled
  • Network connectivity to NSO RESTCONF API

Installation

# Install from PyPI
pip install cisco-nso-mcp-server

# Verify installation
which cisco-nso-mcp-server

Usage

Running the Server

# Run with default NSO connection and MCP settings (see Configuration Options below for details)
cisco-nso-mcp-server

# Run with custom NSO connection parameters
cisco-nso-mcp-server --nso-address 192.168.1.100 --nso-port 8888 --nso-username myuser --nso-password mypass

Configuration Options

You can configure the server using command-line arguments or environment variables:

NSO Connection Parameters

Command-line ArgumentEnvironment VariableDefaultDescription
--nso-schemeNSO_SCHEMEhttpNSO connection scheme (http/https)
--nso-addressNSO_ADDRESSlocalhostNSO server address
--nso-portNSO_PORT8080NSO server port
--nso-timeoutNSO_TIMEOUT10Connection timeout in seconds
--nso-usernameNSO_USERNAMEadminNSO username
--nso-passwordNSO_PASSWORDadminNSO password

MCP Server Parameters

Command-line ArgumentEnvironment VariableDefaultDescription
--transportMCP_TRANSPORTstdioMCP transport type (stdio/sse)

SSE Transport Options (only used when --transport=sse)

Command-line ArgumentEnvironment VariableDefaultDescription
--hostMCP_HOST0.0.0.0Host to bind to when using SSE transport
--portMCP_PORT8000Port to bind to when using SSE transport

Environment variables take precedence over default values but are overridden by command-line arguments.

Connecting to the Server

Stdio Transport

For stdio transport, you'll need to spawn the server process and communicate through stdin/stdout:

from mcp import ClientSession, StdioServerParameters
from contextlib import AsyncExitStack

async def connect():
    exit_stack = AsyncExitStack()
    server_params = StdioServerParameters(
        command="cisco-nso-mcp-server",
        args=[],
        env=None
    )
    
    stdio_transport = await exit_stack.enter_async_context(stdio_client(server_params))
    stdio, write = stdio_transport
    session = await exit_stack.enter_async_context(ClientSession(stdio, write))
    await session.initialize()
    
    # Now you can use the session to call tools and read resources
    return session

SSE Transport

For SSE transport, you can connect to the server using a standard HTTP client:

from mcp import ClientSession, SSEServerParameters
from contextlib import AsyncExitStack

async def connect():
    exit_stack = AsyncExitStack()
    server_params = SSEServerParameters(
        url="http://localhost:8000",
        headers={"Authorization": "Bearer YOUR_TOKEN"}
    )
    
    sse_transport = await exit_stack.enter_async_context(sse_client(server_params))
    session = await exit_stack.enter_async_context(ClientSession(sse_transport))
    await session.initialize()
    
    # Now you can use the session to call tools and read resources
    return session

Asynchronous Implementation Details

The MCP server leverages Python's asynchronous programming capabilities to efficiently handle network operations:

  • Async Function Definitions: All tool functions are defined with async def to make them coroutines
  • Non-blocking I/O: Network calls to Cisco NSO are wrapped with asyncio.to_thread() to prevent blocking the event loop
  • Concurrent Processing: Multiple tool calls can be processed simultaneously without waiting for previous operations to complete
  • Error Handling: Asynchronous try/except blocks capture and properly format errors from network operations

License

MIT License

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
DeepChatYour AI Partner on Desktop
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
ChatWiseThe second fastest AI chatbot™
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Playwright McpPlaywright MCP server
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Amap Maps高德地图官方 MCP Server
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
CursorThe AI Code Editor
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
WindsurfThe new purpose-built IDE to harness magic
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Tavily Mcp
Serper MCP ServerA Serper MCP Server