Repository avatar
Monitoring
v0.5.1
active

logicmonitor

io.github.ryanmat/logicmonitor

LogicMonitor API integration with 120 tools for alerts, devices, metrics, and SDTs.

Documentation

LogicMonitor MCP Server

PyPI version Python versions Tests License: MIT

Model Context Protocol (MCP) server for LogicMonitor REST API v3 integration. Enables AI assistants to interact with LogicMonitor monitoring data through structured tools.

Works with any MCP-compatible client: Claude Desktop, Claude Code, Cursor, Continue, Cline, and more.

Quick Start

1. Get your LogicMonitor Bearer Token:

  • Log into your LogicMonitor portal
  • Go to SettingsUsers and RolesAPI Tokens
  • Create a new API-only user or add a token to an existing user
  • Copy the Bearer token

2. Configure your MCP client:

For Claude Code (CLI):

claude mcp add logicmonitor \
  -e LM_PORTAL=yourcompany.logicmonitor.com \
  -e LM_BEARER_TOKEN=your-bearer-token \
  -- uvx --from lm-mcp lm-mcp-server

For Claude Desktop, add to your config file (see MCP Client Configuration below).

3. Verify it's working:

claude mcp list

You should see: logicmonitor: uvx --from lm-mcp lm-mcp-server - ✓ Connected

4. Test with a prompt:

"Show me all critical alerts in LogicMonitor"

Features

  • Alert Management: Get alerts, view details, acknowledge alerts, add notes, view alert rules
  • Device Management: Full CRUD - list, create, update, delete devices and device groups
  • Metrics & Data: Query device datasources, instances, and metric data
  • Dashboard Management: List dashboards, view widgets, create dashboards
  • SDT Management: List, create, and delete Scheduled Downtime
  • Collector Management: List and view collector details
  • Website Monitoring: List websites, get synthetic check details and data
  • Resource Management: Get and update device properties
  • Report Management: List, view, and run reports
  • Escalation Management: View escalation chains and recipient groups
  • Ops Management: Get audit logs and manage ops notes
  • User & Role Management: View users, roles, and access groups
  • LogicModules: Query ConfigSources, EventSources, PropertySources, TopologySources
  • Network Discovery: List and execute netscans
  • SNMP Management: Query OID definitions
  • Pagination Support: Handle large result sets with offset-based pagination
  • Security-First: Read-only by default, write operations require explicit opt-in
  • Rate Limit Handling: Automatic retry with exponential backoff and jitter
  • Server Error Recovery: Automatic retry on 5xx server errors

Installation

Via PyPI (Recommended)

# Using uvx (no install needed)
uvx --from lm-mcp lm-mcp-server

# Using pip
pip install lm-mcp

From Source

git clone https://github.com/ryanmat/mcp-server-logicmonitor.git
cd mcp-server-logicmonitor
uv sync

Configuration

Environment Variables

VariableRequiredDefaultDescription
LM_PORTALYes-LogicMonitor portal hostname (e.g., company.logicmonitor.com)
LM_BEARER_TOKENYes-API Bearer token (min 10 characters)
LM_ENABLE_WRITE_OPERATIONSNofalseEnable write operations (create, update, delete resources)
LM_API_VERSIONNo3API version
LM_TIMEOUTNo30Request timeout in seconds (range: 5-300)
LM_MAX_RETRIESNo3Max retries for rate-limited/server error requests (range: 0-10)

Getting a Bearer Token

  1. Log into your LogicMonitor portal
  2. Go to SettingsUsers and RolesAPI Tokens
  3. Create a new API-only user or add a token to an existing user
  4. Copy the Bearer token

MCP Client Configuration

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "logicmonitor": {
      "command": "uvx",
      "args": ["--from", "lm-mcp", "lm-mcp-server"],
      "env": {
        "LM_PORTAL": "yourcompany.logicmonitor.com",
        "LM_BEARER_TOKEN": "your-bearer-token"
      }
    }
  }
}

To enable write operations (acknowledge alerts, create SDTs):

{
  "mcpServers": {
    "logicmonitor": {
      "command": "uvx",
      "args": ["--from", "lm-mcp", "lm-mcp-server"],
      "env": {
        "LM_PORTAL": "yourcompany.logicmonitor.com",
        "LM_BEARER_TOKEN": "your-bearer-token",
        "LM_ENABLE_WRITE_OPERATIONS": "true"
      }
    }
  }
}

Claude Code

claude mcp add logicmonitor \
  -e LM_PORTAL=yourcompany.logicmonitor.com \
  -e LM_BEARER_TOKEN=your-bearer-token \
  -e LM_ENABLE_WRITE_OPERATIONS=true \
  -- uvx --from lm-mcp lm-mcp-server

Note: Remove -e LM_ENABLE_WRITE_OPERATIONS=true if you want read-only access.

Verify the connection:

claude mcp list

To update an existing configuration, remove and re-add:

claude mcp remove logicmonitor
claude mcp add logicmonitor -e LM_PORTAL=... -e LM_BEARER_TOKEN=... -- uvx --from lm-mcp lm-mcp-server

Cursor

Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project):

{
  "mcpServers": {
    "logicmonitor": {
      "command": "uvx",
      "args": ["--from", "lm-mcp", "lm-mcp-server"],
      "env": {
        "LM_PORTAL": "yourcompany.logicmonitor.com",
        "LM_BEARER_TOKEN": "your-bearer-token"
      }
    }
  }
}

Then enable the server in Cursor Settings > MCP.

OpenAI Codex CLI

codex mcp add logicmonitor \
  --env LM_PORTAL=yourcompany.logicmonitor.com \
  --env LM_BEARER_TOKEN=your-bearer-token \
  -- uvx --from lm-mcp lm-mcp-server

Or add directly to ~/.codex/config.toml:

[mcp_servers.logicmonitor]
command = "uvx"
args = ["--from", "lm-mcp", "lm-mcp-server"]

[mcp_servers.logicmonitor.env]
LM_PORTAL = "yourcompany.logicmonitor.com"
LM_BEARER_TOKEN = "your-bearer-token"

Cline (VS Code Extension)

Add to Cline's MCP settings file:

macOS: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

Windows: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json

Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

{
  "mcpServers": {
    "logicmonitor": {
      "command": "uvx",
      "args": ["--from", "lm-mcp", "lm-mcp-server"],
      "env": {
        "LM_PORTAL": "yourcompany.logicmonitor.com",
        "LM_BEARER_TOKEN": "your-bearer-token"
      }
    }
  }
}

GitHub Copilot (VS Code 1.99+)

Add to your VS Code settings (settings.json) or project-level .vscode/mcp.json:

{
  "mcp": {
    "servers": {
      "logicmonitor": {
        "command": "uvx",
        "args": ["--from", "lm-mcp", "lm-mcp-server"],
        "env": {
          "LM_PORTAL": "yourcompany.logicmonitor.com",
          "LM_BEARER_TOKEN": "your-bearer-token"
        }
      }
    }
  }
}

Enable MCP in VS Code settings: "chat.mcp.enabled": true

Gemini CLI

Gemini CLI supports MCP servers. Configure in ~/.gemini/settings.json:

{
  "mcpServers": {
    "logicmonitor": {
      "command": "uvx",
      "args": ["--from", "lm-mcp", "lm-mcp-server"],
      "env": {
        "LM_PORTAL": "yourcompany.logicmonitor.com",
        "LM_BEARER_TOKEN": "your-bearer-token"
      }
    }
  }
}

Other Clients

Aider: Does not currently have native MCP support. Track progress at aider issue #3314.

Continue: Uses similar JSON configuration. See Continue MCP docs.

Enabling Write Operations

For any JSON-based configuration, add LM_ENABLE_WRITE_OPERATIONS to the env section:

"env": {
  "LM_PORTAL": "yourcompany.logicmonitor.com",
  "LM_BEARER_TOKEN": "your-bearer-token",
  "LM_ENABLE_WRITE_OPERATIONS": "true"
}

This enables tools like acknowledge_alert, create_sdt, create_device, etc.

Available Tools

Alert Tools

ToolDescriptionWrite
get_alertsList alerts with optional severity/status filtersNo
get_alert_detailsGet detailed information about a specific alertNo
acknowledge_alertAcknowledge an alert with optional noteYes
add_alert_noteAdd a note to an alertYes

Alert Rule Tools

ToolDescriptionWrite
get_alert_rulesList alert rules with optional name/priority filtersNo
get_alert_ruleGet detailed information about a specific alert ruleNo

Device Tools

ToolDescriptionWrite
get_devicesList devices with optional group/name filtersNo
get_deviceGet detailed information about a specific deviceNo
get_device_groupsList device groupsNo
create_deviceCreate a new deviceYes
update_deviceUpdate an existing deviceYes
delete_deviceDelete a deviceYes
create_device_groupCreate a new device groupYes
delete_device_groupDelete a device groupYes

Metrics Tools

ToolDescriptionWrite
get_device_datasourcesList DataSources applied to a deviceNo
get_device_instancesList instances for a DataSource on a deviceNo
get_device_dataGet metric data for a specific instanceNo
get_graph_dataGet graph data for visualizationNo

Dashboard Tools

ToolDescriptionWrite
get_dashboardsList dashboards with optional filtersNo
get_dashboardGet detailed dashboard informationNo
get_dashboard_widgetsGet widgets for a specific dashboardNo
create_dashboardCreate a new dashboardYes

DataSource Tools

ToolDescriptionWrite
get_datasourcesList all DataSources (LogicModules)No
get_datasourceGet DataSource details with datapoints and graphsNo

SDT Tools

ToolDescriptionWrite
list_sdtsList Scheduled Downtime entriesNo
create_sdtCreate a new SDT for a device or groupYes
delete_sdtDelete an existing SDTYes

Collector Tools

ToolDescriptionWrite
get_collectorsList all collectorsNo
get_collectorGet detailed information about a specific collectorNo
get_collector_groupsList collector groupsNo
get_collector_groupGet detailed collector group infoNo

Website Tools

ToolDescriptionWrite
get_websitesList websites/synthetic checks with optional filtersNo
get_websiteGet detailed information about a specific websiteNo
get_website_groupsList website groupsNo
get_website_dataGet monitoring data for a website checkpointNo

Resource Tools

ToolDescriptionWrite
get_device_propertiesList all properties for a deviceNo
get_device_propertyGet a specific device propertyNo
update_device_propertyUpdate or create a custom device propertyYes

Report Tools

ToolDescriptionWrite
get_reportsList reports with optional filtersNo
get_reportGet detailed information about a specific reportNo
get_report_groupsList report groupsNo
run_reportExecute/run a reportYes

Escalation Tools

ToolDescriptionWrite
get_escalation_chainsList escalation chainsNo
get_escalation_chainGet detailed escalation chain info with destinationsNo
get_recipient_groupsList recipient groupsNo
get_recipient_groupGet detailed recipient group info with membersNo

Ops Tools

ToolDescriptionWrite
get_audit_logsGet audit log entries with optional filtersNo
get_ops_notesList ops notes with optional tag filterNo
get_ops_noteGet detailed information about a specific ops noteNo
add_ops_noteAdd a new ops note with optional tags and scopesYes

User & Role Tools

ToolDescriptionWrite
get_usersList users with optional name filterNo
get_userGet detailed user informationNo
get_rolesList roles with optional name filterNo
get_roleGet detailed role information with privilegesNo

Service Tools

ToolDescriptionWrite
get_servicesList services (LM Service Insight)No
get_serviceGet detailed service informationNo
get_service_groupsList service groupsNo

Netscan Tools

ToolDescriptionWrite
get_netscansList network discovery scansNo
get_netscanGet detailed netscan informationNo
run_netscanExecute a netscan immediatelyYes

ConfigSource Tools

ToolDescriptionWrite
get_configsourcesList ConfigSourcesNo
get_configsourceGet detailed ConfigSource informationNo

EventSource Tools

ToolDescriptionWrite
get_eventsourcesList EventSourcesNo
get_eventsourceGet detailed EventSource informationNo

PropertySource Tools

ToolDescriptionWrite
get_propertysourcesList PropertySourcesNo
get_propertysourceGet detailed PropertySource informationNo

TopologySource Tools

ToolDescriptionWrite
get_topologysourcesList TopologySourcesNo
get_topologysourceGet detailed TopologySource informationNo

Dashboard Group Tools

ToolDescriptionWrite
get_dashboard_groupsList dashboard groupsNo
get_dashboard_groupGet detailed dashboard group informationNo

API Token Tools

ToolDescriptionWrite
get_api_tokensList API tokens for a userNo
get_api_tokenGet detailed API token informationNo

Access Group Tools

ToolDescriptionWrite
get_access_groupsList access groups (RBAC)No
get_access_groupGet detailed access group informationNo

OID Tools

ToolDescriptionWrite
get_oidsList SNMP OIDsNo
get_oidGet detailed OID informationNo

Example Usage

Once configured, you can ask your AI assistant natural language questions. Here are prompts to test different capabilities:

Quick Verification Prompts

Start with these to verify the connection is working:

  • "List the first 5 devices in LogicMonitor"
  • "How many collectors do I have?"
  • "Show me active alerts"

Alert Management

  • "Show me all critical alerts"
  • "What alerts fired in the last hour?"
  • "Get details on alert LMA12345"
  • "Acknowledge alert LMA12345 with note 'Investigating disk issue'"
  • "Add a note to alert LMA67890: 'Escalated to storage team'"
  • "What alert rules route to the Primary On-Call escalation chain?"
  • "Show me alerts for devices in the Production group"

Device Operations

  • "What devices are in the Production group?"
  • "Find all devices with 'web' in the name"
  • "Show me details for device ID 123"
  • "What device groups exist under the root?"
  • "Add device 10.0.0.1 called 'web-server-03' to group ID 5 using collector 2"
  • "Create a device group called 'Staging' under the Production group"
  • "Update the description on device 456 to 'Primary web server'"
  • "Delete device ID 789"

Monitoring & Metrics

  • "What datasources are applied to device 123?"
  • "Show me the instances for datasource 456 on device 123"
  • "Get CPU metrics for the last hour on device 123"
  • "List all collectors and their status"
  • "What devices are using collector 5?"

Dashboards & Visualization

  • "List all dashboards"
  • "Show me dashboards with 'NOC' in the name"
  • "What widgets are on dashboard 123?"
  • "Create a new dashboard called 'API Health'"

Scheduled Downtime (SDT)

  • "List all active SDTs"
  • "What SDTs are coming up in the next 24 hours?"
  • "Create a 2-hour maintenance window for device 123"
  • "Schedule downtime for device group 456 for 1 hour"
  • "Delete SDT abc123"

Website & Synthetic Monitoring

  • "List all website checks"
  • "Show me details for website 123"
  • "What website groups exist?"
  • "Get performance data for website 123"

Properties & Configuration

  • "What properties does device 123 have?"
  • "Show me custom properties for device 456"
  • "Set the 'location' property on device 123 to 'US-West-2'"

Reports

  • "List all reports"
  • "Show reports with 'weekly' in the name"
  • "Get details for report 123"
  • "Run the Daily Alert Summary report"
  • "What reports are scheduled to run?"

Users & Access

  • "List all users"
  • "Show me details for user 123"
  • "What roles exist in the system?"
  • "What permissions does the 'Administrator' role have?"

Escalations & Notifications

  • "Show me all escalation chains"
  • "What are the destinations in escalation chain 123?"
  • "List recipient groups"
  • "Who is in the 'DevOps On-Call' recipient group?"

Operations & Audit

  • "Show me recent audit log entries"
  • "What configuration changes were made in the last 24 hours?"
  • "List ops notes tagged 'maintenance'"
  • "Add an ops note: 'Starting v2.5 deployment' with tag 'deployment'"

LogicModules

  • "List all datasources with 'SNMP' in the name"
  • "Show me ConfigSources that apply to Linux devices"
  • "What EventSources are available?"
  • "List PropertySources"

Advanced Filtering

The server supports LogicMonitor's filter syntax for power users:

  • "Get devices where filter is 'displayName~prod,hostStatus:alive'"
  • "List alerts with filter 'severity>2,cleared:false'"
  • "Find datasources matching 'appliesTo~isWindows()'"

Development

Running Tests

uv run pytest -v

Linting

uv run ruff check src tests
uv run ruff format src tests

Project Structure

src/lm_mcp/
├── __init__.py       # Package exports
├── config.py         # Environment-based configuration
├── exceptions.py     # Exception hierarchy
├── server.py         # MCP server entry point
├── auth/
│   ├── __init__.py   # Auth provider factory
│   └── bearer.py     # Bearer token auth
├── client/
│   ├── __init__.py   # Client exports
│   └── api.py        # Async HTTP client
└── tools/
    ├── __init__.py        # Tool utilities
    ├── access_groups.py   # Access group tools
    ├── alerts.py          # Alert management tools
    ├── alert_rules.py     # Alert rule tools
    ├── api_tokens.py      # API token tools
    ├── collectors.py      # Collector and collector group tools
    ├── configsources.py   # ConfigSource tools
    ├── dashboards.py      # Dashboard tools
    ├── dashboard_groups.py # Dashboard group tools
    ├── datasources.py     # DataSource tools
    ├── devices.py         # Device management tools
    ├── escalations.py     # Escalation chain and recipient tools
    ├── eventsources.py    # EventSource tools
    ├── metrics.py         # Metrics and data tools
    ├── netscans.py        # Netscan tools
    ├── oids.py            # OID tools
    ├── ops.py             # Audit log and ops notes tools
    ├── propertysources.py # PropertySource tools
    ├── reports.py         # Report management tools
    ├── resources.py       # Resource/property management tools
    ├── sdts.py            # SDT management tools
    ├── services.py        # Service tools
    ├── topologysources.py # TopologySource tools
    ├── users.py           # User and role tools
    └── websites.py        # Website/synthetic monitoring tools

Troubleshooting

"Failed to connect" in Claude Code

If claude mcp list shows ✗ Failed to connect, the server is missing environment variables. The -e flags must be included when adding the server:

# Remove the broken config
claude mcp remove logicmonitor

# Re-add with environment variables
claude mcp add logicmonitor \
  -e LM_PORTAL=yourcompany.logicmonitor.com \
  -e LM_BEARER_TOKEN=your-bearer-token \
  -- uvx --from lm-mcp lm-mcp-server

Note: Setting environment variables in your shell or .env file won't work—Claude Code spawns the MCP server as a subprocess with its own environment.

"Write operations are disabled"

Write operations (acknowledge, create SDT, etc.) are disabled by default. Set LM_ENABLE_WRITE_OPERATIONS=true in your environment.

"spawn uvx ENOENT" in Claude Desktop

Claude Desktop can't find uvx. Use the full path:

{
  "command": "/Users/yourname/.local/bin/uvx",
  "args": ["--from", "lm-mcp", "lm-mcp-server"]
}

Find your uvx path with: which uvx

Rate Limit Errors

The server automatically retries rate-limited requests with exponential backoff. If you're consistently hitting limits, reduce request frequency or contact LogicMonitor support.

Authentication Errors

Verify your bearer token is correct and has appropriate permissions. API tokens can be managed in LogicMonitor under SettingsUsers and RolesAPI Tokens.

License

MIT License - see LICENSE file.