A production-ready Model Context Protocol (MCP) server for OneUptime that provides dynamic tools for all OneUptime models and operations.
- Dynamic Tool Generation: Automatically generates MCP tools for all OneUptime models (Database and Analytics)
- Full CRUD Operations: Supports Create, Read, Update, Delete, List, and Count operations
- Production Ready: Built with proper error handling, logging, and configuration
- Extensible: Automatically supports new models as they are added to OneUptime
- Type Safe: Fully typed with TypeScript
The MCP server automatically generates tools for each OneUptime model with the following operations:
-
oneuptime_create{ModelName}
- Create a new record -
oneuptime_get{ModelName}
- Retrieve a record by ID -
oneuptime_list{ModelName}s
- List records with filtering -
oneuptime_update{ModelName}
- Update a record -
oneuptime_delete{ModelName}
- Delete a record -
oneuptime_count{ModelName}s
- Count records
-
oneuptime_create{ModelName}
- Create analytics data -
oneuptime_list{ModelName}s
- Query analytics data -
oneuptime_count{ModelName}s
- Count analytics records
The server automatically generates tools for all OneUptime models including:
Database Models: Incident, Alert, Monitor, Project, User, Team, StatusPage, and 100+ more Analytics Models: Log, Metric, Span, TelemetryAttribute, ExceptionInstance, MonitorLog
Copy .env.example
to .env
and configure:
# OneUptime API Key (Required)
ONEUPTIME_API_KEY=your_oneuptime_api_key_here
# OneUptime Instance URL (Optional - defaults to https://oneuptime.com)
ONEUPTIME_URL=https://oneuptime.com
- Install dependencies:
npm install
- Configure environment variables:
cp .env.example .env
# Edit .env with your OneUptime configuration
- Build the server:
npm run build
- (Optional) Link for global CLI usage:
npm run link
npm run dev
npm start
{
"name": "oneuptime_listIncidents",
"arguments": {
"query": {"projectId": "your-project-id"},
"limit": 10
}
}
{
"name": "oneuptime_createAlert",
"arguments": {
"data": {
"title": "High CPU Usage",
"description": "CPU usage above 90%",
"projectId": "your-project-id"
}
}
}
{
"name": "oneuptime_getMonitor",
"arguments": {
"id": "monitor-id-here"
}
}
{
"name": "oneuptime_listLogs",
"arguments": {
"query": {
"serviceId": "service-id",
"severity": "error"
},
"limit": 50,
"sort": {"time": -1}
}
}
This server uses a custom MCPLogger
class that ensures all log messages are directed to stderr
instead of stdout
. This is critical for MCP protocol compliance, as stdout
is reserved for JSON-RPC messages.
Fixed Issues:
-
Failed to parse message
warnings caused by log messages going to stdout - Dotenv initialization messages interfering with MCP protocol
- All informational logging now properly directed to stderr
If you encounter parsing warnings, ensure no code is writing to stdout directly - use MCPLogger
instead of console methods.
- DynamicToolGenerator: Automatically discovers and generates tools for all OneUptime models
- OneUptimeApiService: Handles API communication with OneUptime instance
- Type Definitions: Provides type safety and IntelliSense support
- Error Handling: Comprehensive error handling and user-friendly messages
New models are automatically supported! When new models are added to OneUptime:
- Database models added to
Common/Models/DatabaseModels/Index.ts
- Analytics models added to
Common/Models/AnalyticsModels/Index.ts
The MCP server will automatically generate tools for them on the next restart.
npm test
npm run audit
npm run dep-check
Apache-2.0 - See LICENSE file for details.