Skip to main content
Glama

Cacti MCP is a Python adapter that exposes the abilities of the Cacti MCP plugin as MCP tools over stdio. The plugin already serves MCP over HTTP directly, so use that when your client can connect to a remote server. This adapter is for clients that only speak stdio. It uses the official Python MCP SDK and translates tool calls into the plugin's HTTPS API (abilities contract v2, served under /v1/ paths, bearer token only). Cacti owns authentication, authorization, validation, and execution.

Status: in development, before 1.0. Version 0.1.0 supports read-only device inventory and installation versions through the companion Cacti MCP plugin. There is no tagged release yet. Doctor diagnostics and repairs are future work.

What it exposes

Operation

MCP tool supplied by the Cacti MCP plugin

List the devices the token owner may see

cacti-list-devices

Read one permitted device

cacti-get-device

Read Cacti, plugin, and API versions

cacti-get-system-info

Names, descriptions, and input schemas come from Cacti's permission-filtered discovery response. Additional permitted read-only providers can be discovered without adding Python tool handlers.

MCP client --stdio--> cacti-mcp --HTTPS--> Cacti MCP plugin
                                           |-- Cacti permissions
                                           |-- ability providers
                                           `-- execution audit

Related MCP server: qca-agent-mcp

Use cases

Connect an MCP client to list the Cacti devices its dedicated user may see, look up one permitted device, or retrieve installation versions when the user has the required administrative realm. Names and input schemas come from the plugin's discovery response, so the adapter does not duplicate each provider. See the plugin's ability registration rules for the registration model and current limits.

Code and test map

Behavior

Implementation

Test evidence in this repository

HTTPS validation, bounds, bearer-only auth, and v2 paging

client.py

test_client.py

MCP discovery, calls, and permission changes

server.py

test_stdio.py

Command-line help, version, and missing configuration

server.py, main.py

test_cli.py

The subprocess test uses a real SDK client and server with a fixture HTTP endpoint. It does not require or replace a live Cacti integration check.

How it stays safe

  • Uses the official mcp Python SDK for initialization, tool discovery, calls, and stdio framing.

  • Exposes only abilities whose annotations are exactly read-only, non-destructive, and idempotent. Schemas and names come from Cacti; the adapter contains no SQL, device credentials, or repair commands.

  • Sends only the bearer token: no cookies, no CSRF step. The plugin rechecks token validity and permissions on every request.

  • Uses verified HTTPS, never stores cookies, refuses redirects, and ignores proxy environment variables. HTTP requires --allow-loopback-http and a literal loopback address or localhost.

  • Bounds API calls to 35 seconds overall, 5 seconds to connect, 30 seconds of network inactivity, and approximately 1 MB per response (1,100,000 bytes). Request bodies are limited to 16,384 bytes. Calls are serialized per client session.

  • Checks tool arguments against the input schema from the last discovery before sending them, and executes only ids from that verified catalog. A mismatch, or a malformed schema from the server, comes back as a tool error, not a crash.

  • Does not retry execution automatically. Tool errors carry only the HTTP status, the AIP-193 status, and the ErrorInfo reason; never server message text, response bodies, or credentials. Stdout is reserved for MCP messages.

The SDK version is pinned by uv.lock (mcp>=2.3,<3 in pyproject.toml). This adapter uses its 2.x low-level server with the stdio transport; it does not implement a remote MCP HTTP endpoint, OAuth, resources, prompts, subscriptions, or background tasks.

See the API contract and implementation plan.

Installation and command line

Requires Python 3.12 or later and uv. From a checkout of this repository:

uv sync --locked
uv run --locked cacti-mcp --help

Install and enable the PHP plugin, grant its realm to a dedicated Cacti user, and create a personal access token for that user (format cmcp_pat_ followed by 64 lowercase hex digits) in the plugin's console, on its My MCP Tokens page, or with its tokens.php command. The user's existing Cacti realms and device permissions still apply.

Provide the token through your secret manager as CACTI_MCP_TOKEN; never add it to source control or command arguments. Set the endpoint separately. It must be an HTTPS URL that ends in /plugins/mcp/api.php, with no credentials, query, or fragment:

export CACTI_MCP_ENDPOINT=https://cacti.example.com/cacti/plugins/mcp/api.php
uv run --locked cacti-mcp

--endpoint URL sets the endpoint instead of CACTI_MCP_ENDPOINT. --allow-loopback-http permits plain HTTP to localhost, 127.0.0.1, or ::1 for local testing, and --version prints the version. Without both the endpoint and CACTI_MCP_TOKEN, the command exits with a usage error.

The process waits for MCP messages on stdin. An MCP client normally launches it. For clients accepting the common mcpServers configuration format:

{
  "mcpServers": {
    "cacti": {
      "command": "uv",
      "args": ["run", "--locked", "--directory", "/absolute/path/cacti-mcp", "cacti-mcp"]
    }
  }
}

Configure the client to pass CACTI_MCP_ENDPOINT and CACTI_MCP_TOKEN to the subprocess through its environment or secret facility. Environment inheritance depends on the client. There is no token command-line flag.

The separately installable Python distribution supplies the cacti-mcp console command. No PyPI publication is required to run the checkout. The PHP plugin has no Python dependency.

Releases

The distribution version is recorded in pyproject.toml. Until tagged releases are available, use a source checkout or the python-distributions artifact from a successful CI run. The artifact contains a wheel and source archive. The installed package supplies both the cacti-mcp command and python -m cacti_mcp; it does not contain the PHP plugin.

Development and tests

uv sync --locked
uv run --locked ruff check .
uv run --locked ruff format --check .
uv run --locked pytest
uv build

Tests cover HTTP validation, credential isolation, bearer-only requests, paging, error redaction, and an actual SDK client/server subprocess exchange against a fixture HTTP server. They do not require a live Cacti installation.

The repository uses src/cacti_mcp/, pytest, Ruff, uv, and Hatchling. CI tests Python 3.12, 3.13, and 3.14. A separate packaging job builds the wheel and source archive, installs the wheel outside the checkout, and smoke-tests both entry points. Distributions and test results are workflow artifacts.

Contributing

Pull requests go to develop. Keep the adapter compatible with Python 3.12, follow the existing Ruff configuration and src/cacti_mcp/ package layout, and keep stdout reserved for MCP messages. Add tests for changed transport or tool behavior, run the checks above, and sign off commits with git commit -s. Coordinate API changes with the Cacti MCP plugin and update docs/api.md.

License

Copyright (C) 2026 Thomas Vincent. Released under the GNU General Public License, version 2 or later. See LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Exposes a verified tool registry (calculator, sandboxed file read, web fetch) over MCP stdio, enabling any MCP-capable client to reuse the same tools from the inspectable ReAct loop.
      3
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Exposes eight QCA (quantum calibration) tools via a standards-based MCP stdio server for MCP-compatible agents to interact with backend status, experiments, schemas, parameters, dry-runs, history, and arrays.
      1
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables MCP clients to discover and invoke Agnara capabilities over stdio, with schema-projected tools and fail-closed authorization.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables local stdio MCP clients to list, get, plan, and probe registered devices and their connection endpoints from a private inventory, while keeping credential references rather than secrets in agent responses.
      4
      MIT