Skip to content

MCP server API

clijson.mcp_server. The tool functions are plain Python and work without the mcp SDK. Setup instructions are on the MCP server page.

mcp_server

Model Context Protocol (MCP) server: let AI assistants and agents parse router output with clijson.

$ pip install "clijson[mcp]"
$ clijson mcp                                   # stdio, for Claude Desktop / Claude Code / Cursor / VS Code
$ clijson mcp --transport http --port 8000      # Streamable HTTP at http://127.0.0.1:8000/mcp

Tools (all read-only, no network access):

parse_output raw show/display output -> structured JSON (+ normalized model) parse_session a whole terminal log with many commands detect_platform which OS produced this output? diff_outputs structural pre/post comparison of two captures list_commands commands with dedicated parsers (filterable) check_pseudowire_redundancy verdict on L2VPN PW redundancy, optionally comparing before/after captures get_model_schema JSON Schema of a normalized model

Resources: clijson://commands (the catalog) and clijson://models/{intent} (JSON Schemas).

The tool functions below are plain Python and are tested without the SDK; :func:build_server wires them into the official mcp SDK (v2 MCPServer, with a fallback to v1 FastMCP).

tool_parse_output

tool_parse_output(
    output: str,
    command: str | None = None,
    platform: str | None = None,
    normalize: bool = True,
    max_records: int = MAX_RECORDS,
) -> dict[str, Any]

Parse the output of one show/display command into structured JSON.

tool_parse_session

tool_parse_session(
    output: str,
    platform: str | None = None,
    normalize: bool = True,
) -> dict[str, Any]

Parse every command found in a terminal session log (prompt + command + output, repeated).

tool_detect_platform

tool_detect_platform(
    output: str, command: str | None = None
) -> dict[str, Any]

Guess which network OS produced some output.

tool_diff_outputs

tool_diff_outputs(
    before: str,
    after: str,
    command: str | None = None,
    platform: str | None = None,
    include_counters: bool = False,
) -> dict[str, Any]

Compare two captures of the same command (e.g. before/after a change) and list what changed.

tool_list_commands

tool_list_commands(
    platform: str | None = None, search: str | None = None
) -> dict[str, Any]

List commands that have dedicated parsers, optionally for one platform or matching some text.

tool_check_pseudowire_redundancy

tool_check_pseudowire_redundancy(
    output: str,
    command: str | None = None,
    platform: str | None = None,
    before: str | None = None,
    require_backup: bool = False,
) -> dict[str, Any]

Check L2VPN pseudowire redundancy: one forwarding PW per service, backups in standby, nothing down.

Give the current capture as output; add the capture taken before a change as before to also get the pre-change verdict and the list of changes (pseudowires matched by neighbor + PW ID).

tool_get_model_schema

tool_get_model_schema(intent: str) -> dict[str, Any]

JSON Schema of a normalized model (e.g. bgp.summary, interfaces.brief, routes).

build_server

build_server(name: str = 'clijson') -> Any

Create the MCP server with every clijson tool and resource registered.

run

run(
    transport: str = "stdio",
    host: str = "127.0.0.1",
    port: int = 8000,
) -> None

Run the server (stdio or http = Streamable HTTP).