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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。