loading…
Search for a command to run...
loading…
A standalone scheduling service providing cron-like job capabilities through the Model Context Protocol. It allows users to manage and execute scheduled tasks i
A standalone scheduling service providing cron-like job capabilities through the Model Context Protocol. It allows users to manage and execute scheduled tasks in OpenCode using natural language commands.
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.
┌─────────────────────────────────────────────────────────────┐
│ OpenCode CLI │
│ │ │
│ ┌───────────────┴───────────────┐ │
│ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ MCP Client │ │ Skill │ │
│ │ (14 tools) │ │ (mcp-cron) │ │
│ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
│ stdio
▼
┌─────────────────────────────────────────────────────────────┐
│ MCP Cron Server │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ CronScheduler │ │
│ │ ┌─────────────┐ ┌─────────┐ ┌──────────────┐ │ │
│ │ │ Repository │ │ Timer │ │ Executor │ │ │
│ │ │ (SQLite) │ │(setTimeout)│ │(subprocess) │ │ │
│ │ │ +LogBuffer │ └─────────┘ └──────────────┘ │ │
│ │ └─────────────┘ │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
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 calculation
type CronSchedule =
| { kind: 'at'; atMs: number } // One-time task
| { kind: 'every'; everyMs: number; anchorMs?: number } // Interval task
| { kind: 'cron'; expr: string; tz?: string }; // Cron expression
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
};
type ExecutionStatus =
| 'pending' // Waiting to execute
| 'running' // Currently executing
| 'success' // Executed successfully
| 'failed' // Execution failed
| 'waiting_for_approval' // Waiting for approval
| 'paused' // Paused
| 'cancelled'; // Cancelled
database.ts)SQLite database management.
Features:
~/.local/share/mcp-cron/cron.dbrepository.ts)Data access layer.
Features:
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): string
scheduler.ts)Main scheduler.
Features:
executor.ts)Job execution engine.
Features:
| Tool | Description |
|---|---|
cron_add |
Add a new scheduled job |
cron_list |
List all jobs |
cron_get |
Get job details |
cron_update |
Update a job |
cron_remove |
Delete a job |
cron_run |
Execute a job immediately |
cron_status |
Get scheduler status |
cron_get_approvals |
Get pending approvals |
cron_approve |
Approve execution |
cron_reject |
Reject execution |
cron_get_logs |
Get execution logs |
cron_get_stats |
Get system statistics |
cron_get_history |
Get execution history |
cron_list_executions |
List executions with pagination |
cd ~/Documents/opencode-mcp-cron
npm install
npm run build
Add to OpenCode configuration:
{
"mcp": {
"cron": {
"type": "local",
"command": ["node", "/path/to/dist/index.js"],
"enabled": true
}
}
}
| Expression | Description |
|---|---|
0 8 * * * |
Every day at 8:00 AM |
0 9 * * 1-5 |
Weekdays at 9:00 AM |
0 18 * * 1-5 |
Weekdays at 6:00 PM |
0 */2 * * * |
Every 2 hours |
0 0 * * * |
Daily at midnight |
~/.local/share/mcp-cron/cron.dblogs table| Variable | Description | Default |
|---|---|---|
OPENCODE_COMMAND |
opencode command path | opencode |
MCP_CRON_DB_PATH |
Database path | ~/.local/share/mcp-cron/cron.db |
opencode run "use cron_status tool to check scheduler status"
opencode run "use cron_list tool to list all jobs"
opencode run "use cron_get_logs tool to view logs"
node ~/Documents/opencode-mcp-cron/dist/index.js
Last updated: 2026-03-10
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"mcp-cron-server": {
"command": "npx",
"args": []
}
}
}