MCP Cron Server
The MCP Cron Server is a scheduling service that manages automated tasks through the Model Context Protocol (MCP), integrating with OpenCode for natural language control.
Core Capabilities:
Create jobs (
cron_add): Schedule tasks as one-time (atMs), interval (everyMs), or cron expression (exprwith optionaltz), with payloads foragentTurnorsystemEventmessages, and options likemaxRetriesanddeleteAfterRunList & query jobs (
cron_list): View all scheduled jobs (including disabled ones) and retrieve details for specific jobsUpdate & remove jobs: Modify existing job configurations or delete them by ID (
cron_remove)Run on demand (
cron_run): Immediately trigger a job, bypassing its scheduleMonitor status (
cron_status): Check scheduler operational status, concurrency, queue info, and system statisticsManage approvals: List jobs awaiting manual approval, then approve or reject their execution
Access execution history: Retrieve detailed execution logs and paginated historical records
Under the hood, jobs benefit from automatic error backoff, concurrency control, zombie task detection, and persistent storage in an SQLite database.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Cron Server schedule a daily weather report for 8 AM every morning"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Cron Server
MCP Cron Server is a standalone scheduling service that provides cron-like job scheduling through the Model Context Protocol (MCP). It integrates with OpenCode, allowing users to manage scheduled tasks using natural language.
Features
Three Schedule Types: One-time (at), Interval (every), Cron Expression
SQLite Persistence: WAL mode for high-concurrency read/write
Approval System: Jobs can require manual approval before execution
Heartbeat Mechanism: Automatic zombie task detection
Execution State Machine: Complete state transitions (pending → running → success/failed/waiting_for_approval/paused/cancelled)
Automatic Error Backoff: 30s → 1m → 5m → 15m → 60m
Concurrency Control: Max 3 concurrent executions
Execution Logs: Buffered logging to avoid blocking
Related MCP server: Schedule Task MCP
Architecture
┌─────────────────────────────────────────────────────────────┐
│ OpenCode CLI │
│ │ │
│ ┌───────────────┴───────────────┐ │
│ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ MCP Client │ │ Skill │ │
│ │ (14 tools) │ │ (mcp-cron) │ │
│ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
│ stdio
▼
┌─────────────────────────────────────────────────────────────┐
│ MCP Cron Server │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ CronScheduler │ │
│ │ ┌─────────────┐ ┌─────────┐ ┌──────────────┐ │ │
│ │ │ Repository │ │ Timer │ │ Executor │ │ │
│ │ │ (SQLite) │ │(setTimeout)│ │(subprocess) │ │ │
│ │ │ +LogBuffer │ └─────────┘ └──────────────┘ │ │
│ │ └─────────────┘ │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘Project Structure
opencode-mcp-cron/
├── package.json # Project configuration
├── tsconfig.json # TypeScript configuration
└── src/
├── index.ts # MCP server entry point
├── types.ts # Type definitions
├── database.ts # SQLite database management
├── repository.ts # Data access layer (with log buffer)
├── scheduler.ts # Scheduler
├── executor.ts # Execution engine
└── schedule.ts # Schedule time calculationType Definitions
Schedule Types
type CronSchedule =
| { kind: 'at'; atMs: number } // One-time task
| { kind: 'every'; everyMs: number; anchorMs?: number } // Interval task
| { kind: 'cron'; expr: string; tz?: string }; // Cron expressionPayload Types
type CronPayload = {
kind: 'agentTurn' | 'systemEvent';
message: string; // Prompt or message content
deliver?: boolean; // Whether to deliver result
channel?: string; // Delivery channel
to?: string; // Delivery target
model?: string; // Model override
};Execution Status
type ExecutionStatus =
| 'pending' // Waiting to execute
| 'running' // Currently executing
| 'success' // Executed successfully
| 'failed' // Execution failed
| 'waiting_for_approval' // Waiting for approval
| 'paused' // Paused
| 'cancelled'; // CancelledCore Components
1. Database (database.ts)
SQLite database management.
Features:
WAL mode for high-concurrency read/write
Automatic schema migration
Prepared statement caching
Location:
~/.local/share/mcp-cron/cron.db
2. Repository (repository.ts)
Data access layer.
Features:
Job/Execution/Log/Approval CRUD
Log buffering (batch writes to avoid blocking)
Atomic state transitions
Prepared statements
3. Schedule (schedule.ts)
Schedule time calculation.
Functions:
// Calculate next execution time
computeNextRunAtMs(schedule: CronSchedule, nowMs: number): number | undefined
// Format time for display
formatNextRun(nextRunAtMs: number | undefined): string4. Scheduler (scheduler.ts)
Main scheduler.
Features:
Dynamic sleep scheduling
Batch rate limiting
State machine driven
Concurrency control
Zombie task detection
5. Executor (executor.ts)
Job execution engine.
Features:
Subprocess execution
Streaming logs
Heartbeat updates
Timeout control
Approval triggering
MCP Tools
Tool | Description |
| Add a new scheduled job |
| List all jobs |
| Get job details |
| Update a job |
| Delete a job |
| Execute a job immediately |
| Get scheduler status |
| Get pending approvals |
| Approve execution |
| Reject execution |
| Get execution logs |
| Get system statistics |
| Get execution history |
| List executions with pagination |
Usage
Build
cd ~/Documents/opencode-mcp-cron
npm install
npm run buildConfiguration
Add to OpenCode configuration:
{
"mcp": {
"cron": {
"type": "local",
"command": ["node", "/path/to/dist/index.js"],
"enabled": true
}
}
}Cron Expression Examples
Expression | Description |
| Every day at 8:00 AM |
| Weekdays at 9:00 AM |
| Weekdays at 6:00 PM |
| Every 2 hours |
| Daily at midnight |
Data Storage
Database:
~/.local/share/mcp-cron/cron.dbLogs: Stored in SQLite
logstable
Environment Variables
Variable | Description | Default |
| opencode command path |
|
| Database path |
|
Troubleshooting
Job Not Executing
Check scheduler status:
opencode run "use cron_status tool to check scheduler status"List jobs:
opencode run "use cron_list tool to list all jobs"Check execution logs:
opencode run "use cron_get_logs tool to view logs"MCP Server Connection Failed
Verify configuration path
Test server manually:
node ~/Documents/opencode-mcp-cron/dist/index.jsLast updated: 2026-03-10
Available Tools
5 toolscron_addC
添加定时任务
Inputs: name (required), schedule (required), payload (required), description, +1 more.
cron_listB
列出所有定时任务
Inputs: includeDisabled.
cron_removeC
删除定时任务
Inputs: jobId (required).
cron_runC
立即执行定时任务
Inputs: jobId (required).
cron_statusC
获取调度器状态
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose with no overlap: add, list, remove, run, and status cover different aspects of cron job management. The descriptions are straightforward and prevent any confusion between tools.
All tool names follow a consistent 'cron_verb' pattern (e.g., cron_add, cron_list), using snake_case throughout. This predictable naming makes it easy to understand and navigate the tool set.
With 5 tools, this server is well-scoped for managing cron jobs, covering essential operations without being overly complex or sparse. Each tool serves a clear and necessary function in the domain.
The tool set provides complete CRUD/lifecycle coverage for cron job management: add, list, remove, run, and status. There are no obvious gaps, allowing agents to handle all typical workflows without dead ends.
Maintenance
Related MCP Connectors
Schedule tasks for later from your AI agent: reminders, delayed webhooks, recurring jobs.
Schedule and manage recurring or one-shot tasks
Reliable scheduling for one-off and recurring webhooks, built for apps and agents.
A cron job monitor your AI agent sets up and can ask why a job failed. Free for up to 200 checks.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA robust task scheduler server built with Model Context Protocol for scheduling and managing various types of automated tasks including shell commands, API calls, AI tasks, and reminders.4MIT
- AlicenseNot gradedqualityDmaintenanceEnables creation and management of scheduled tasks with interval, cron, or one-time triggers. Persists tasks in SQLite and supports MCP sampling to automatically invoke AI agents when schedules trigger.22 npm3MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server for scheduling and executing Claude Code CLI tasks via cron expressions, featuring a web dashboard and webhook support. It enables users to dynamically create custom MCP servers, manage recurring AI jobs, and track execution history with token and cost analytics.24MIT
- AlicenseAqualityAmaintenanceAn MCP server that surfaces scheduled-job state and detects silent failures (exit 0 but no useful output) for cron, systemd timers, and OpenClaw schedulers, enabling AI agents to query job health and overdue status directly.643 PyPIMIT