Skip to main content

Model Context Protocol (MCP) server for ManageEngine OpManager API integration

Project description

OpManager MCP Server

Python 3.10+ License: MIT Tests MCP SDK

A credential-less Model Context Protocol (MCP) server for ManageEngine OpManager REST API integration. This server enables AI assistants like Claude to interact with your OpManager infrastructure through natural language.

โœจ Key Features

  • ๐Ÿ” Credential-less Design: No hardcoded API keys - users provide host and apiKey per request
  • ๐Ÿ”„ SSL Auto-Detection: Port 8061 โ†’ HTTPS, Port 8060 โ†’ HTTP (with manual override)
  • ๐Ÿ“ก 85+ API Endpoints: Full OpManager API coverage for devices, alarms, dashboards, discovery, and more
  • ๐Ÿ›  Dynamic Tool Generation: Automatically generates MCP tools from OpenAPI specification
  • ๐ŸŒ Multiple Transports: Supports stdio (Claude Desktop) and HTTP/SSE (n8n, web clients)
  • ๐Ÿณ Docker Ready: Containerized deployment with Docker and Docker Compose

๐Ÿš€ Quick Start

Installation

# Clone the repository
git clone https://github.com/sachdev27/opmanager-mcp-server.git
cd opmanager-mcp-server

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install the package
pip install -e ".[http]"

Start the HTTP Server

uvicorn opmanager_mcp.http_server:app --host 0.0.0.0 --port 3000

Test a Tool Call

curl -X POST http://localhost:3000/call \
  -H "Content-Type: application/json" \
  -d '{
    "name": "opmanager_get_allDevices",
    "arguments": {
      "host": "opmanager.example.com",
      "apiKey": "your-api-key-here",
      "port": 8061
    }
  }'

๐Ÿ“‹ Configuration

Environment Variables

Create a .env file (optional - for server defaults only):

cp .env.example .env
Variable Description Default
MCP_SERVER_LOG_LEVEL Logging level INFO
ALLOWED_HTTP_METHODS Allowed HTTP methods for tools GET,POST,PUT,DELETE,PATCH
LOCAL_OPENAPI_SPEC_PATH Path to OpenAPI spec bundled openapi.json

Note: OPMANAGER_HOST and OPMANAGER_API_KEY are NOT configured server-side. Users provide these per-request for security.

Getting Your OpManager API Key

  1. Log in to OpManager web console
  2. Navigate to Settings โ†’ REST API
  3. Generate a new API key
  4. Use this key in your tool calls

๐Ÿ”ง Tool Parameters

Every tool accepts these connection parameters:

Parameter Required Description
host โœ… Yes OpManager server hostname
apiKey โœ… Yes API key for authentication
port No Server port (default: 8060)
use_ssl No Force SSL (auto-detected from port)
verify_ssl No Verify SSL certificates (default: true)

SSL Auto-Detection

  • Port 8061: Automatically uses HTTPS
  • Port 8060: Automatically uses HTTP
  • Override with use_ssl: true/false if needed

๐ŸŒ HTTP API Endpoints

Endpoint Method Description
/health GET Health check with tool count
/tools GET List all available tools
/sse GET SSE connection for MCP
/messages POST MCP message handler
/call POST Direct tool invocation

Health Check

curl http://localhost:3000/health
# {"status":"healthy","tool_count":60}

List Tools

curl http://localhost:3000/tools | jq '.tools[].name'

๐Ÿค– n8n Integration

  1. Start the HTTP server on port 3000
  2. In n8n, add an AI Agent node with MCP Client tool
  3. Configure the MCP Client:
    • SSE URL: http://localhost:3000/sse
    • Messages URL: http://localhost:3000/messages

Example System Prompt for n8n

You are an IT operations assistant with access to OpManager for network monitoring.

When using OpManager tools, always include:
- host: "opmanager.company.com"
- apiKey: "your-api-key"
- port: 8061 (for HTTPS)

Available operations:
- List all devices: opmanager_get_allDevices
- Get device details: opmanager_get_device (requires deviceName)
- List alarms: opmanager_get_alarms
- Acknowledge alarm: opmanager_add_alarmNotes

๐Ÿ–ฅ Claude Desktop Integration

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "opmanager": {
      "command": "python",
      "args": ["-m", "opmanager_mcp.main"],
      "cwd": "/path/to/opmanager-mcp-server",
      "env": {
        "LOCAL_OPENAPI_SPEC_PATH": "/path/to/opmanager-mcp-server/openapi.json"
      }
    }
  }
}

Note: With Claude Desktop, you'll tell Claude your OpManager host and API key in conversation, and it will include them in tool calls.

๐Ÿ›  Available Tools (60+ GET operations)

Devices

  • opmanager_get_allDevices - List all monitored devices
  • opmanager_get_device - Get device details by name
  • opmanager_get_deviceAvailability - Device availability history

Alarms

  • opmanager_get_alarms - List alarms with filtering
  • opmanager_get_alarmDetails - Get alarm details
  • opmanager_add_alarmNotes - Add notes/acknowledge alarm

Discovery

  • opmanager_get_discoveryStatus - Check discovery progress
  • opmanager_add_discovery - Start network discovery

Reports & Dashboards

  • opmanager_get_allDashboards - List all dashboards
  • opmanager_get_scheduledReports - List scheduled reports

And more...

Run curl http://localhost:3000/tools to see all available tools.

๐Ÿณ Docker

Build and Run

docker build -t opmanager-mcp-server .
docker run -d -p 3000:3000 --name opmanager-mcp opmanager-mcp-server

Docker Compose

docker-compose up -d

๐Ÿงช Development

Run Tests

# Install dev dependencies
pip install -e ".[dev]"

# Run all tests
pytest

# Run with coverage
pytest --cov=opmanager_mcp --cov-report=term-missing

# Current: 32 tests, 50% coverage

Code Quality

# Format
black opmanager_mcp tests
isort opmanager_mcp tests

# Lint
ruff check opmanager_mcp tests

# Type check
mypy opmanager_mcp

Regenerate OpenAPI Spec

python generate_openapi.py

๐Ÿ“ Project Structure

opmanager-mcp-server/
โ”œโ”€โ”€ opmanager_mcp/
โ”‚   โ”œโ”€โ”€ __init__.py          # Package exports
โ”‚   โ”œโ”€โ”€ api_client.py        # HTTP client for OpManager API
โ”‚   โ”œโ”€โ”€ config.py            # Configuration management
โ”‚   โ”œโ”€โ”€ exceptions.py        # Custom exceptions
โ”‚   โ”œโ”€โ”€ http_server.py       # HTTP/SSE server (Pure ASGI)
โ”‚   โ”œโ”€โ”€ logging_config.py    # Logging configuration
โ”‚   โ”œโ”€โ”€ main.py              # CLI entry point
โ”‚   โ”œโ”€โ”€ server.py            # MCP server implementation
โ”‚   โ””โ”€โ”€ tool_generator.py    # OpenAPI to MCP tool converter
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ conftest.py          # Test fixtures
โ”‚   โ”œโ”€โ”€ test_api_client.py   # API client tests
โ”‚   โ”œโ”€โ”€ test_config.py       # Config tests
โ”‚   โ”œโ”€โ”€ test_http_server.py  # HTTP server tests
โ”‚   โ”œโ”€โ”€ test_server.py       # MCP server tests
โ”‚   โ””โ”€โ”€ test_tool_generator.py # Tool generation tests
โ”œโ”€โ”€ openapi.json             # OpManager OpenAPI specification
โ”œโ”€โ”€ pyproject.toml           # Project configuration
โ”œโ”€โ”€ Dockerfile               # Container image
โ”œโ”€โ”€ docker-compose.yml       # Compose configuration
โ””โ”€โ”€ README.md                # This file

๐Ÿ“„ License

MIT License - see LICENSE for details.

๐Ÿ™ Acknowledgments

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

opmanager_mcp_server-1.0.0.tar.gz (70.0 kB view details)

Uploaded Source

Built Distribution

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

opmanager_mcp_server-1.0.0-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file opmanager_mcp_server-1.0.0.tar.gz.

File metadata

  • Download URL: opmanager_mcp_server-1.0.0.tar.gz
  • Upload date:
  • Size: 70.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for opmanager_mcp_server-1.0.0.tar.gz
Algorithm Hash digest
SHA256 113d8b45b683d314a07cdbac7070dcc63e14627c13dc0f1a45a6b589c5b8d986
MD5 bf3d0fa67e3e733ea0f2432ae2c4d7c0
BLAKE2b-256 352dea7fe353b0115d4aa832584a041b8fe56720e281c1569d9de59e61c3b88e

See more details on using hashes here.

File details

Details for the file opmanager_mcp_server-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for opmanager_mcp_server-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e953b786de48325a0f21142fef2fde8b57e3c5e9b80bcdb99804dc7a310147ca
MD5 57709fa2d402b1977cbdf6bc02e3da58
BLAKE2b-256 539375998ece06090ddfbdf50c4e3b7a32e15465148997940c5080031f12c948

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