Cronitor CLI includes built-in support for the Model Context Protocol (MCP), enabling integration with AI-powered development tools like Claude Code, Cursor, Cline, Windsurf, and others. Manage cron jobs using natural language directly from your editor or terminal.
- Natural Language Control: Create, update, and manage cron jobs using plain English
- Multi-Instance Support: Connect to multiple Cronitor dashboard instances (dev, staging, prod)
- Full CRUD Operations: Create, read, update, and delete cron jobs
- Job Execution: Run jobs immediately from your editor
- Resource Access: Browse crontabs and jobs as MCP resources
- Secure Authentication: Uses existing Cronitor dashboard credentials
The MCP integration has two components:
-
Dashboard (
cronitor dash) - The web UI that manages cron jobs. This must be running on the server where your cron jobs live. -
MCP Server (
cronitor dash --mcp-instance) - A bridge process that your AI tool spawns locally. It communicates with your AI tool via stdio and connects to the dashboard over HTTP.
┌─────────────────────┐ stdio ┌─────────────────────┐ HTTP ┌─────────────────────┐
│ AI Tool │ ◄─────────────► │ MCP Server │ ◄─────────────► │ Dashboard │
│ (Claude Code, │ │ (cronitor dash │ │ (cronitor dash) │
│ Cursor, etc.) │ │ --mcp-instance) │ │ on your server │
└─────────────────────┘ └─────────────────────┘ └─────────────────────┘
Your machine Your machine Your server
On the machine where your cron jobs run, start the Cronitor dashboard:
# Set credentials for the dashboard
cronitor configure --dash-username USER --dash-password PASS
# Start the dashboard (runs on port 9000 by default)
cronitor dashImportant: The dashboard must be running and accessible for the MCP server to work. For production use, consider running it as a systemd service or in Docker.
Configure your AI tool to spawn the Cronitor MCP server. Most MCP-compatible tools use a JSON configuration file.
Generic MCP configuration:
{
"mcpServers": {
"cronitor": {
"command": "cronitor",
"args": ["dash", "--mcp-instance", "default"]
}
}
}The default instance connects to localhost:9000 using credentials from your Cronitor config file (~/.cronitor/cronitor.json).
Common configuration file locations:
- Claude Code:
~/.claude/mcp.jsonor project.claude/mcp.json - Cursor:
~/.cursor/mcp.jsonor project.cursor/mcp.json - Other tools: Check your tool's MCP documentation
Once configured, you can manage cron jobs with prompts like:
- "Create a database backup job that runs every night at 2 AM"
- "List all cron jobs containing 'backup'"
- "Suspend the cleanup job"
- "Run the backup job now"
Edit ~/.cronitor/cronitor.json to configure dashboard credentials and additional instances:
{
"CRONITOR_DASH_USER": "admin",
"CRONITOR_DASH_PASS": "your-password",
"mcp_instances": {
"production": {
"url": "http://prod-server.example.com:9000",
"username": "prod-admin",
"password": "prod-password"
},
"staging": {
"url": "http://staging-server.example.com:9000",
"username": "staging-admin",
"password": "staging-password"
}
}
}Note: The default instance automatically uses CRONITOR_DASH_USER and CRONITOR_DASH_PASS from your config and connects to localhost:9000. You don't need to configure it explicitly.
To connect to multiple dashboards, configure each as a separate MCP server:
{
"mcpServers": {
"cronitor": {
"command": "cronitor",
"args": ["dash", "--mcp-instance", "default"]
},
"cronitor-prod": {
"command": "cronitor",
"args": ["dash", "--mcp-instance", "production"]
},
"cronitor-staging": {
"command": "cronitor",
"args": ["dash", "--mcp-instance", "staging"]
}
}
}You can override the config file path per-project using an environment variable:
{
"mcpServers": {
"cronitor-project": {
"command": "cronitor",
"args": ["dash", "--mcp-instance", "default"],
"env": {
"CRONITOR_CONFIG": "/path/to/project/cronitor.json"
}
}
}
}Create a new cron job.
Parameters:
name(required): Name of the cron jobcommand(required): Command to executeschedule(required): Cron expression or human-readable schedulecrontab_file: Target crontab file (default: user's personal crontab)monitored: Enable Cronitor monitoring (default: false)run_as_user: User to run the job as (only for system crontabs)
Example prompts:
- "Create a cron job called 'backup-db' that runs '/scripts/backup.sh' every day at 2 AM"
- "Add a job to clean temp files every hour"
List all cron jobs with optional filtering.
Parameters:
filter: Filter by name or command
Example prompts:
- "Show me all cron jobs"
- "List jobs that contain 'backup' in their name"
Update an existing cron job.
Parameters:
key(required): Job key or identifiername: New namecommand: New commandschedule: New schedulesuspended: Suspend/resume the job (boolean)monitored: Enable/disable monitoring (boolean)
Example prompts:
- "Change the backup job to run every 6 hours"
- "Suspend the cleanup job"
Delete a cron job.
Parameters:
key(required): Job key or identifier
Example prompts:
- "Delete the old-backup job"
Execute a cron job immediately.
Parameters:
key(required): Job key or identifier
Example prompts:
- "Run the backup job now"
- "Execute the cleanup script immediately"
Get information about the current Cronitor instance.
Example prompts:
- "Which Cronitor instance am I connected to?"
Access all crontab files in JSON format.
Access all cron jobs in JSON format.
The MCP server understands both cron expressions and natural language schedules:
| Natural Language | Cron Expression |
|---|---|
every minute |
* * * * * |
every hour |
0 * * * * |
every day |
0 0 * * * |
every 15 minutes |
*/15 * * * * |
every day at noon |
0 12 * * * |
every Monday at 10:30 |
30 10 * * 1 |
hourly |
0 * * * * |
daily |
0 0 * * * |
weekly |
0 0 * * 0 |
monthly |
0 0 1 * * |
Since the dashboard runs on your server and the MCP server runs locally, you'll need network access to the dashboard. Here are common patterns:
Create an SSH tunnel to securely access a remote dashboard:
# Create tunnel from local port 9001 to remote port 9000
ssh -L 9001:localhost:9000 user@your-serverThen configure the instance to use the tunneled port:
{
"mcp_instances": {
"remote": {
"url": "http://localhost:9001",
"username": "admin",
"password": "password"
}
}
}Some MCP clients support running commands over SSH directly:
{
"mcpServers": {
"cronitor-remote": {
"command": "ssh",
"args": [
"user@your-server",
"cronitor dash --mcp-instance default"
]
}
}
}This runs the MCP server on the remote machine and pipes stdio over SSH.
The MCP server respects these environment variables:
| Variable | Description |
|---|---|
CRONITOR_CONFIG |
Path to config file |
CRONITOR_MCP_INSTANCE |
Default instance name |
CRONITOR_DASH_USER |
Dashboard username |
CRONITOR_DASH_PASS |
Dashboard password |
# Test MCP server startup with default instance
cronitor dash --mcp-instance default
# Test with specific instance
cronitor dash --mcp-instance production# View current configuration
cronitor configure"No Cronitor instance configured"
- Ensure your config file has the correct instance settings
- Check that the instance name matches what you configured
"Authentication failed (401 Error)"
- For
defaultinstance: EnsureCRONITOR_DASH_USERandCRONITOR_DASH_PASSare set in your config - For other instances: Verify username and password in the
mcp_instancessection - Ensure the dashboard is running and accessible
"Connection refused"
- Check that the dashboard URL is correct
- Verify the dashboard is running:
cronitor dashin another terminal - Check network connectivity and any firewalls
- For remote dashboards, ensure your SSH tunnel is active
"CSRF token validation failed (403 Error)"
- This is usually handled automatically by the MCP server
- If it persists, try restarting the dashboard
- MCP servers run with the permissions of the user executing them
- Dashboard credentials are stored in the config file - protect it with appropriate file permissions
- Use SSH tunnels or VPNs for remote access rather than exposing the dashboard directly
- Consider using separate credentials for different environments
You can configure persistent rules that guide how your AI tool interacts with the MCP server. See MCP_PROMPTS.md for details on:
- Project-specific rules files
- Custom system prompts per instance
- Best practices for different environments
For issues or questions:
- Check the Cronitor documentation
- Review the MCP specification
- Open an issue on the Cronitor CLI GitHub repository