Provides webhook endpoints for integrating with n8n workflows, enabling automated system checks and monitoring tasks to be triggered from n8n automation workflows
MCP SSE Server Python
Model Context Protocol (MCP) Server với SSE transport được viết bằng Python, tích hợp với n8n instance tại n8n-prod.iconiclogs.com
.
Tính năng
MCP Protocol Implementation: Triển khai đầy đủ MCP protocol với JSON-RPC 2.0
SSE Transport: Server-Sent Events để real-time communication
n8n Integration: Webhook endpoints để tích hợp với n8n workflows
Natural Language Support: Hỗ trợ Tiếng Việt và English cho queries
Async API Calls: Gọi 5 APIs của hệ thống ABC song song với asyncio
Health Monitoring: Health check và Prometheus metrics
Production Ready: Docker support, graceful shutdown, comprehensive logging
Kiến trúc
5 APIs của Hệ thống ABC
GET /api/system/health - Kiểm tra system health
GET /api/users/status - Lấy user status
GET /api/services/list - Danh sách services
POST /api/logs/query - Query logs với timeframe
GET /api/metrics/current - Metrics hiện tại
Cài đặt
🚀 DEMO MODE: Không có API thật? Xem DEMO.md để chạy ngay với Mock API!
Yêu cầu
Python 3.11+
Docker & Docker Compose (optional)
n8n instance tại
n8n-prod.iconiclogs.com
(optional cho demo)API key cho ABC System (hoặc dùng Mock API)
1. Clone và Setup
2. Cấu hình .env
3. Installation Options
Option A: Local Python
Option B: Docker
Option C: Docker only (không compose)
API Endpoints
SSE Endpoint
n8n Webhook
Health Check
Metrics
Information
Sử dụng với MCP Protocol
1. Kết nối SSE
2. Initialize MCP
3. List Tools
4. Call Tool
Natural Language Examples
Tool check_system_abc
hỗ trợ natural language queries:
Tiếng Việt
English
n8n Workflow Setup
1. Tạo Webhook Node trong n8n
2. Trigger từ n8n Schedule
Monitoring
Prometheus Metrics
Server expose các metrics sau:
mcp_requests_total
- Total requestsmcp_request_duration_seconds
- Request durationmcp_sse_connections_active
- Active SSE connectionsmcp_tool_executions_total
- Tool executions
Grafana Dashboard
Nếu dùng docker-compose, Grafana có sẵn tại:
User:
admin
Pass:
admin
Import Prometheus datasource: http://prometheus:9090
Development
Run Tests
Code Formatting
Production Deployment
Docker Compose (Recommended)
Kubernetes
Environment Variables
Variable | Description | Default |
| Server host |
|
| Server port |
|
| Number of workers |
|
| ABC System API URL | Required |
| ABC System API key | Required |
| API timeout (seconds) |
|
| n8n instance URL | Required |
| n8n API key | Optional |
| SSE heartbeat interval |
|
| Max SSE connections |
|
| Logging level |
|
Troubleshooting
1. Connection refused
2. API timeouts
3. SSE không kết nối được
4. n8n webhook không hoạt động
Security Best Practices
API Keys: Luôn dùng environment variables, không commit vào git
CORS: Configure CORS cho production (
allow_origins
trong main.py)Rate Limiting: Implement rate limiting cho webhooks
HTTPS: Dùng HTTPS cho production (reverse proxy như nginx)
Authentication: Thêm authentication cho sensitive endpoints
License
MIT License
Support
Issues: GitHub Issues
Email: support@example.com
Documentation: MCP Protocol Docs
Changelog
v1.0.0 (2024-01-17)
Initial release
MCP protocol support với SSE
n8n integration
5 ABC System APIs
Natural language support (VI/EN)
Prometheus metrics
Docker support
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables real-time system monitoring and automation through MCP protocol with SSE transport, integrating with n8n workflows to check system health, query logs, and retrieve metrics from ABC system APIs. Supports natural language queries in Vietnamese and English for seamless system administration.