UptimeRobot MCP API
A management server for UptimeRobot that enables natural language processing through Model Context Protocol, allowing users to manage monitors, maintenance windows, and reports using conversational commands.
README
UptimeRobot MCP API
API quản lý UptimeRobot với khả năng xử lý ngôn ngữ tự nhiên thông qua Model Context Protocol (MCP).
Tính năng
- Quản lý monitors (tạo, cập nhật, xóa, xem)
- Quản lý maintenance windows
- Tạo báo cáo (uptime, maintenance, performance)
- Xử lý ngôn ngữ tự nhiên thông qua MCP
- Hệ thống phân quyền người dùng
- Cache management
- Context management cho MCP
- Tích hợp với n8n
Yêu cầu
- Python 3.8+
- FastAPI
- UptimeRobot API Key
- Ollama (cho MCP)
- n8n (cho workflow automation)
Cài đặt
- Clone repository:
git clone https://github.com/thichcode/uptimerobot_mcp.git
cd uptimerobot_mcp
- Tạo môi trường ảo và cài đặt dependencies:
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows
pip install -r requirements.txt
- Cấu hình biến môi trường:
cp .env.example .env
# Chỉnh sửa .env với các thông tin cần thiết
Sử dụng
- Khởi động server:
uvicorn app.main:app --reload
- Truy cập API documentation:
http://localhost:8000/docs
Tích hợp với n8n
Cài đặt n8n
- Cài đặt n8n:
npm install n8n -g
- Khởi động n8n:
n8n start
Tạo Workflow
-
Truy cập n8n interface tại
http://localhost:5678 -
Tạo workflow mới và thêm các nodes:
- HTTP Request node để gọi API
- Function node để xử lý dữ liệu
- Schedule Trigger node để tự động hóa
- Email node để gửi thông báo
Ví dụ Workflow
- Tự động tạo maintenance window:
{
"nodes": [
{
"type": "n8n-nodes-base.scheduleTrigger",
"parameters": {
"interval": [
{
"field": "days",
"value": 1
}
]
}
},
{
"type": "n8n-nodes-base.httpRequest",
"parameters": {
"url": "http://localhost:8000/maintenance",
"method": "POST",
"body": {
"start_time": "{{$now}}",
"duration": 3600,
"description": "Bảo trì định kỳ",
"monitors": [123, 456]
}
}
}
]
}
- Tự động tạo báo cáo hàng tuần:
{
"nodes": [
{
"type": "n8n-nodes-base.scheduleTrigger",
"parameters": {
"interval": [
{
"field": "weeks",
"value": 1
}
]
}
},
{
"type": "n8n-nodes-base.httpRequest",
"parameters": {
"url": "http://localhost:8000/reports",
"method": "POST",
"body": {
"type": "uptime",
"start_date": "{{$now.minus(7, 'days')}}",
"end_date": "{{$now}}"
}
}
},
{
"type": "n8n-nodes-base.emailSend",
"parameters": {
"to": "admin@example.com",
"subject": "Báo cáo uptime hàng tuần",
"text": "{{$json}}"
}
}
]
}
- Tự động xử lý sự cố:
{
"nodes": [
{
"type": "n8n-nodes-base.webhook",
"parameters": {
"path": "monitor-alert",
"responseMode": "lastNode"
}
},
{
"type": "n8n-nodes-base.httpRequest",
"parameters": {
"url": "http://localhost:8000/mcp/chat",
"method": "POST",
"body": {
"message": "Phân tích sự cố và đề xuất giải pháp",
"session_id": "{{$json.session_id}}"
}
}
},
{
"type": "n8n-nodes-base.slack",
"parameters": {
"channel": "#alerts",
"text": "{{$json.ai_response.message}}"
}
}
]
}
Các tính năng n8n có thể tích hợp
-
Tự động hóa:
- Tạo maintenance window định kỳ
- Tạo báo cáo tự động
- Xử lý sự cố tự động
-
Thông báo:
- Gửi email báo cáo
- Gửi thông báo Slack/Discord
- Gửi SMS cho sự cố nghiêm trọng
-
Tích hợp với các dịch vụ khác:
- Jira để tạo ticket
- Google Calendar để đồng bộ lịch
- Grafana để hiển thị metrics
API Endpoints
Authentication
POST /auth/register- Đăng ký người dùng mớiPOST /auth/token- Đăng nhập và lấy token
Monitors
GET /monitors- Lấy danh sách monitorsPOST /monitors- Tạo monitor mớiPUT /monitors/{monitor_id}- Cập nhật monitorDELETE /monitors/{monitor_id}- Xóa monitorGET /monitors/{monitor_id}/uptime- Lấy thông tin uptime
Maintenance Windows
POST /maintenance- Tạo maintenance windowGET /maintenance- Lấy danh sách maintenance windowsDELETE /maintenance/{window_id}- Xóa maintenance window
Reports
POST /reports- Tạo báo cáo mớiGET /reports/{report_id}- Lấy thông tin báo cáo
Cache Management
GET /cache/stats- Lấy thống kê cacheDELETE /cache/{cache_name}- Xóa cache
MCP
POST /mcp/chat- Xử lý yêu cầu ngôn ngữ tự nhiênDELETE /mcp/context/{session_id}- Xóa context
Ví dụ sử dụng
Tạo monitor mới
curl -X POST "http://localhost:8000/monitors" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"friendly_name": "Example Website",
"url": "https://example.com",
"type": "1",
"interval": 300
}'
Tạo maintenance window
curl -X POST "http://localhost:8000/maintenance" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"start_time": "2024-03-20T10:00:00Z",
"duration": 3600,
"description": "Bảo trì hệ thống",
"monitors": [123, 456]
}'
Sử dụng MCP
curl -X POST "http://localhost:8000/mcp/chat" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"message": "Tạo maintenance window cho tất cả các monitors có tag production vào ngày mai từ 10h đến 11h",
"session_id": "abc123"
}'
Phân quyền
- ADMIN: Toàn quyền truy cập
- MANAGER: Quản lý monitors và maintenance windows
- VIEWER: Chỉ xem thông tin
Đóng góp
Xem CONTRIBUTING.md để biết thêm chi tiết về cách đóng góp.
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.