MCP Cron Server MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add mcp-cron -- npx -y @nolan57/opencode-mcp-cron
README.md

A standalone scheduling service providing cron-like job capabilities

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

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 calculation

Type 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 expression

Payload 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';          // Cancelled

Core 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): string

4. 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
cron_add Add a new scheduled job
`

Tools (1)

cron_addAdd a new scheduled job

Configuration

claude_desktop_config.json
{"mcpServers": {"cron": {"command": "npx", "args": ["-y", "@nolan57/opencode-mcp-cron"]}}}

Try it

Schedule a system event to run every day at 8 AM.
Add a one-time task to execute an agent turn in 30 minutes.
Create a cron job that runs every Monday at 9 AM to check for system updates.
List all currently scheduled tasks and their execution status.

Frequently Asked Questions

What are the key features of MCP Cron Server?

Supports one-time, interval, and cron expression scheduling. SQLite persistence with WAL mode for high concurrency. Built-in approval system for manual task execution. Automatic zombie task detection via heartbeat mechanism. Automatic error backoff with configurable retry intervals.

What can I use MCP Cron Server for?

Automating recurring system maintenance tasks via natural language. Scheduling delayed agent actions or notifications. Managing background jobs that require manual approval before execution. Ensuring reliable task execution with automatic retry logic.

How do I install MCP Cron Server?

Install MCP Cron Server by running: npx -y @nolan57/opencode-mcp-cron

What MCP clients work with MCP Cron Server?

MCP Cron Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep MCP Cron Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare