Skip to main content
Glama
Uptime Kuma MCP Server

Uptime Kuma MCP Server

by oh-my-oops
README.md
# Uptime Kuma MCP Server

Model Context Protocol (MCP) server and CLI tool for Uptime Kuma - Enables AI assistants and bots to interact with Uptime Kuma monitoring system.

## 🌟 Features

- **MCP Server**: Integration with AI assistants (Claude, OpenClaw bot) via Model Context Protocol
- **CLI Tool**: Powerful command-line interface to manage Uptime Kuma
- **Socket.IO Client**: Real-time connection with Uptime Kuma server
- **Full API Coverage**: Complete support for Uptime Kuma features
  - Monitor management (HTTP, ping, port, DNS, etc.)
  - Status page management
  - Incident management
  - Tag and notification management
  - API key management

## šŸ“¦ Installation

### Requirements

- Node.js >= 20.0.0
- Running Uptime Kuma server

### Install from npm (after publishing)

```bash
npm install -g uptime-kuma-mcp
```

### Install from source

```bash
git clone https://github.com/yourusername/uptime-kuma-mcp.git
cd uptime-kuma-mcp
npm install
npm link
```

## šŸš€ Usage

### 1. CLI Tool

#### Initial configuration

```bash
# Configure server URL
uptime-kuma config

# Login
uptime-kuma login -u admin -p your-password

# Or login with token
uptime-kuma login -t your-jwt-token
```

#### Monitor Management

```bash
# List all monitors
uptime-kuma monitor list

# List as JSON
uptime-kuma monitor list --json

# Get monitor details
uptime-kuma monitor get 1

# Add HTTP monitor
uptime-kuma monitor add \
  -n "My Website" \
  -t http \
  -u https://example.com \
  -i 60

# Add port monitor
uptime-kuma monitor add \
  -n "Database" \
  -t port \
  -h db.example.com \
  -p 5432

# Pause monitor
uptime-kuma monitor pause 1

# Resume monitor
uptime-kuma monitor resume 1

# Delete monitor
uptime-kuma monitor delete 1

# View heartbeats (24h)
uptime-kuma monitor heartbeats 1

# View heartbeats (48h)
uptime-kuma monitor heartbeats 1 -p 48
```

#### Status Page Management

```bash
# List status pages
uptime-kuma statuspage list

# Or use alias
uptime-kuma sp list

# Create new status page
uptime-kuma statuspage add \
  -t "Service Status" \
  -s service-status
```

#### Tag Management

```bash
# List tags
uptime-kuma tag list

# Add tag
uptime-kuma tag add -n production

# Add tag with color
uptime-kuma tag add -n critical -c "#ff0000"
```

#### API Key Management

```bash
# List API keys
uptime-kuma apikey list

# Create new API key
uptime-kuma apikey add -n "API Integration"

# Create API key with expiration
uptime-kuma apikey add -n "Temp Key" -e 2025-12-31
```

### 2. MCP Server

#### Configure for Claude Desktop

Add to Claude Desktop config file (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):

```json
{
  "mcpServers": {
    "uptime-kuma": {
      "command": "node",
      "args": ["/path/to/uptime-kuma-mcp/src/index.js"],
      "env": {
        "UPTIME_KUMA_URL": "http://localhost:3001",
        "UPTIME_KUMA_TOKEN": "your-jwt-token"
      }
    }
  }
}
```

#### Or use username/password

```json
{
  "mcpServers": {
    "uptime-kuma": {
      "command": "node",
      "args": ["/path/to/uptime-kuma-mcp/src/index.js"],
      "env": {
        "UPTIME_KUMA_URL": "http://localhost:3001",
        "UPTIME_KUMA_USERNAME": "admin",
        "UPTIME_KUMA_PASSWORD": "your-password"
      }
    }
  }
}
```

#### Using in Claude

After configuration, you can ask Claude:

```
"List all monitors in Uptime Kuma"
"Create a new HTTP monitor for website https://example.com"
"Create a new status page named 'Service Status'"
"View heartbeats of monitor ID 1 for the past 24h"
```

### 3. Integration with OpenClaw Bot

OpenClaw bot can use CLI to automate tasks:

```javascript
import { exec } from 'child_process';
import { promisify } from 'util';

const execAsync = promisify(exec);

// Create monitor automatically
async function createMonitor(name, url) {
  const { stdout } = await execAsync(
    `uptime-kuma monitor add -n "${name}" -t http -u ${url}`
  );
  console.log(stdout);
}

// Check monitor status
async function checkMonitors() {
  const { stdout } = await execAsync(
    'uptime-kuma monitor list --json'
  );
  const monitors = JSON.parse(stdout);
  return monitors;
}

// Usage
await createMonitor('New Website', 'https://newsite.com');
const monitors = await checkMonitors();
console.log(monitors);
```

## šŸ”§ MCP Tools

MCP server provides the following tools:

### Monitor Management

- `monitor_list` - List all monitors
- `monitor_get` - Get monitor details
- `monitor_add` - Add new monitor
- `monitor_edit` - Edit monitor
- `monitor_delete` - Delete monitor
- `monitor_pause` - Pause monitor
- `monitor_resume` - Resume monitor
- `monitor_heartbeats` - Get heartbeat data

### Status Page Management

- `statuspage_list` - List status pages
- `statuspage_add` - Create new status page
- `statuspage_delete` - Delete status page
- `incident_post` - Post incident to status page

### Tag Management

- `tag_list` - List tags
- `tag_add` - Add new tag

### Notification Management

- `notification_list` - List notification endpoints
- `notification_add` - Add notification endpoint
- `notification_test` - Test notification

### API Key Management

- `apikey_list` - List API keys
- `apikey_add` - Create new API key

## šŸ“ Monitor Types

Uptime Kuma supports many monitor types:

- **http/https** - HTTP(s) endpoint monitoring
- **ping** - ICMP ping monitoring
- **port** - TCP port monitoring
- **dns** - DNS resolution monitoring
- **keyword** - HTTP(s) with keyword checking
- **websocket** - WebSocket connection monitoring
- **mqtt** - MQTT broker monitoring
- **postgres** - PostgreSQL database monitoring
- **mysql** - MySQL/MariaDB database monitoring
- **mongodb** - MongoDB database monitoring
- **redis** - Redis server monitoring
- **docker** - Docker container monitoring
- **grpc-keyword** - gRPC service monitoring

## šŸ” Authentication

### JWT Token (Recommended)

```bash
# Login to get token
uptime-kuma login -u admin -p password

# Token will be saved automatically in config
# Or use existing token
uptime-kuma login -t eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
```

### Username/Password

```bash
uptime-kuma login -u admin -p your-password
```

### Environment Variables

```bash
export UPTIME_KUMA_URL="http://localhost:3001"
export UPTIME_KUMA_TOKEN="your-jwt-token"

# Or
export UPTIME_KUMA_USERNAME="admin"
export UPTIME_KUMA_PASSWORD="your-password"
```

## šŸ› ļø Development

### Project structure

```
uptime-kuma-mcp/
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ index.js              # MCP server main file
│   └── uptime-kuma-client.js # Socket.IO client
ā”œā”€ā”€ bin/
│   └── uptime-kuma.js        # CLI tool
ā”œā”€ā”€ skills/
│   ā”œā”€ā”€ SKILL.md              # Skill definition (markdown)
│   └── uptime-kuma.json      # Skill metadata
ā”œā”€ā”€ package.json
└── README.md
```

### Run development mode

```bash
# MCP server
npm run dev

# CLI tool (after npm link)
uptime-kuma --help
```

## šŸ“š Best Practices

1. **Use JWT token** instead of storing username/password when possible
2. **Set reasonable interval** (60-300 seconds) to avoid high server load
3. **Use tags** to organize monitors by environment (production, staging, etc.)
4. **Create status page** for customers to view service status
5. **Setup notifications** to receive alerts when issues occur
6. **Use API keys** with expiration date for external integrations

## šŸ› Troubleshooting

### Connection Failed

```
Error: Failed to connect after maximum attempts
```

**Solution:**
- Check if server URL is correct (including `http://` or `https://`)
- Ensure Uptime Kuma server is running
- Check if firewall/network is blocking connection
- Run `uptime-kuma config` to reconfigure

### Authentication Failed

```
Error: Login failed
```

**Solution:**
- Check if username/password is correct
- If using token, check if token has expired
- Run `uptime-kuma login` to login again
- Check 2FA if enabled

### Monitor Not Working

**Solution:**
- Check if URL/hostname is correct
- Check if port is open (for port monitors)
- Check if interval is reasonable
- View heartbeat history to debug:
  ```bash
  uptime-kuma monitor heartbeats <id>
  ```

## šŸ¤ Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## šŸ“„ License

MIT License - see LICENSE file for details

## šŸ”— Links

- [Uptime Kuma](https://github.com/louislam/uptime-kuma)
- [Model Context Protocol](https://modelcontextprotocol.io/)
- [OpenClaw Bot](https://openclaw.io)

## šŸ’” Examples

### Example 1: Create monitors for multiple websites

```bash
#!/bin/bash

websites=(
  "https://example.com|Example Site"
  "https://api.example.com|API Server"
  "https://blog.example.com|Blog"
)

for site in "${websites[@]}"; do
  IFS='|' read -r url name <<< "$site"
  uptime-kuma monitor add -n "$name" -t http -u "$url" -i 60
done
```

### Example 2: Export all monitors to JSON

```bash
uptime-kuma monitor list --json > monitors.json
```

### Example 3: Create status page with custom configuration

```bash
# Create status page
uptime-kuma statuspage add -t "Production Status" -s production

# Then access at:
# http://your-uptime-kuma-server/status/production
```

### Example 4: Script to auto pause/resume monitors

```bash
#!/bin/bash

# Pause all monitors
for id in $(uptime-kuma monitor list --json | jq -r '.[].id'); do
  uptime-kuma monitor pause $id
done

# Maintenance work here...
sleep 3600

# Resume all monitors
for id in $(uptime-kuma monitor list --json | jq -r '.[].id'); do
  uptime-kuma monitor resume $id
done
```

## šŸŽÆ Use Cases

### 1. Automated Monitoring Setup

Automatically create monitors for all services in infrastructure:

```javascript
const services = [
  { name: 'Web Server', type: 'http', url: 'https://web.example.com' },
  { name: 'API Server', type: 'http', url: 'https://api.example.com' },
  { name: 'Database', type: 'port', hostname: 'db.example.com', port: 5432 },
  { name: 'Redis', type: 'port', hostname: 'redis.example.com', port: 6379 },
];

for (const service of services) {
  // Create monitor using CLI or MCP
}
```

### 2. Status Page for Customers

Create separate status page for each customer:

```bash
uptime-kuma statuspage add -t "Customer A Status" -s customer-a
uptime-kuma statuspage add -t "Customer B Status" -s customer-b
```

### 3. Integration with CI/CD

Auto pause monitors during deploy, resume after completion:

```yaml
# .github/workflows/deploy.yml
- name: Pause monitors
  run: |
    uptime-kuma monitor pause 1
    uptime-kuma monitor pause 2

- name: Deploy application
  run: ./deploy.sh

- name: Resume monitors
  run: |
    uptime-kuma monitor resume 1
    uptime-kuma monitor resume 2
```

## šŸ“ž Support

If you encounter issues or have questions, please:
- Create an issue on GitHub
- Contact via email: support@example.com
- Join Discord: discord.gg/example

TDQS

B3.2/5.0

Scored across 19 tools

Disambiguation5/5

Each tool pairs a distinct resource (monitor, tag, statuspage, notification, apikey, incident) with a distinct action, so an agent can unambiguously map intent to a single tool. The only mild adjacency is monitor_pause/monitor_edit, but the descriptions clearly separate state toggling from field editing.

Naming Consistency5/5

Every tool follows the same resource_action snake_case convention (monitor_list, statuspage_add, apikey_list, incident_post), including a consistent `_list` verb across all collection reads. No mixed casing or stray verb styles anywhere in the set.

Tool Count4/5

Nineteen tools across five resources is slightly heavy but each one maps to a real Uptime Kuma operation rather than filler. The set is just above the ideal 3-15 band, largely because CRUD is duplicated per resource.

Completeness3/5

Monitors have full lifecycle coverage (list/get/add/edit/delete/pause/resume/heartbeats), but tags, notifications, and API keys can only be created and listed with no edit or delete/revoke. Status pages lack an edit operation and there is no way to list, resolve, or delete incidents, leaving several dead ends.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues