Skip to main content

MCP server instrumentation for Cerberus API monitoring

Project description

cerberus-mcp

MCP (Model Context Protocol) server instrumentation for Cerberus API monitoring.

Drop-in replacement for FastMCP that captures tool, resource, and prompt call metrics and streams them to the Cerberus analytics pipeline.

Installation

pip install cerberus-mcp

Quick Start

Replace FastMCP with CerberusMCP — a single-line change:

from cerberus_mcp import CerberusMCP

mcp = CerberusMCP(
    "my-server",
    cerberus_config={
        "token": "your-api-key",
        "client_id": "your-client-id",
        "ws_url": "wss://your-cerberus-backend:8765",
    }
)

@mcp.tool()
def get_weather(location: str) -> str:
    """Get weather for a location."""
    return f"Sunny in {location}"

@mcp.resource("config://settings")
def get_settings() -> str:
    """Return server settings."""
    return '{"theme": "dark"}'

@mcp.prompt()
def summarize(text: str) -> str:
    """Summarize text."""
    return f"Please summarize: {text}"

All tool calls, resource reads, and prompt invocations are automatically captured with:

  • Execution timing (duration_ms)
  • Sanitized arguments (sensitive values redacted)
  • Error tracking
  • Result summaries
  • MCP client identity (name, version) and session correlation

Events are sent asynchronously via WebSocket to the Cerberus event_ingest backend using the same pipeline as cerberus-django.

Configuration

Key Required Description
token Yes API key for Cerberus authentication
client_id Yes Client identifier for your MCP server
ws_url Yes WebSocket URL of your Cerberus event_ingest server
server_name No Override server name in events (defaults to MCP server name)

Set CERBERUS_DEBUG=true to enable verbose logging.

How It Works

CerberusMCP subclasses FastMCP from the MCP Python SDK and wraps the tool(), resource(), and prompt() decorators. Each handler call is intercepted to capture timing, arguments, results, and errors. Events are queued into a thread-safe queue and sent via a background WebSocket connection — zero impact on your MCP server's response times.

Requirements

  • Python >= 3.10
  • mcp >= 1.0 (MCP Python SDK)
  • websockets >= 12.0
  • A running Cerberus backend (cerberus-int)

License

MIT

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

cerberus_mcp-0.1.4.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

cerberus_mcp-0.1.4-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file cerberus_mcp-0.1.4.tar.gz.

File metadata

  • Download URL: cerberus_mcp-0.1.4.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for cerberus_mcp-0.1.4.tar.gz
Algorithm Hash digest
SHA256 40487072a4640fea574fbcdc82ea3abab7d61c17e88385f418e486cab2dd1419
MD5 8be7e52e7b62c0e4ed35da3e4b390be1
BLAKE2b-256 737938e13c7885095021ef560888382969f6924b14f8dcc52b50fb98311cf78d

See more details on using hashes here.

File details

Details for the file cerberus_mcp-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: cerberus_mcp-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for cerberus_mcp-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f85e84e94c662387bc5c1142ef9dacc4a29e781b331300e5c878431599b1693a
MD5 73a9dea3406e2d5e1945839c6a4a69b1
BLAKE2b-256 b599cf5f927492554486d4ecb582a44a433fdd01a3b38db8ae5ffaf069e6c462

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