Get the FREE Ultimate OpenClaw Setup Guide →

mcp-cron

MCP server for scheduling and running shell commands and AI prompts

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio jolks-mcp-cron npx -y mcp-cron --transport stdio

How to use

MCP Cron is a server that lets you schedule and manage tasks via the MCP protocol. It supports two kinds of tasks: shell commands and AI-powered prompts. You can set up tasks using cron expressions and run them on a schedule, with the results captured for later inspection. AI tasks can interact with MCP servers and run through your preferred AI provider (OpenAI or Anthropic) or via a LiteLLM proxy if configured. The server persists task history in SQLite and is designed to be safe for multi-instance deployments, sharing a database without duplicating work across instances. To get started, run the MCP Cron server via MCP transport (stdio in the recommended config) and connect to it with MCP clients like Cursor or Claude Desktop using the provided configuration examples. You can customize AI providers, models, and sleep prevention flags to fit your environment.

The server exposes a set of command-line options and environment variables to configure transport, networking, AI settings, and persistence. Typical usage involves creating an MCP configuration file that defines an MCP server named mcp-cron with the npx-based invocation and stdio transport, then starting the server so your MCP clients can schedule tasks and query results. For AI-enabled tasks, ensure your API keys or proxy URLs are configured via environment variables (for example, ANTHROPIC_API_KEY or OpenAI-related keys) and that the AI model you select is available in your provider or proxy configuration.

How to install

Prerequisites:

  • Node.js (for npm/npx usage) or a Go toolchain if building from source as described below
  • Internet access to install and run npm packages or to build Go binaries

Option 1: Install and run via npm (recommended)

  1. Ensure Node.js is installed on your system.
  2. Start the MCP Cron server using npx: npx -y mcp-cron

Option 2: Claude/Cursor setup examples (config via MCP file)

  1. Create an MCP config JSON like the following to route through npx mcp-cron in stdio mode: { "mcpServers": { "mcp-cron": { "command": "npx", "args": ["-y", "mcp-cron", "--transport", "stdio"] } } }

Option 3: Recommended full MCP config with AI provider settings

  1. Create or update your MCP config to include the following for mcp-cron: { "mcpServers": { "mcp-cron": { "command": "npx", "args": [ "-y", "mcp-cron", "--transport", "stdio", "--prevent-sleep", "--ai-provider", "anthropic", "--ai-model", "claude-sonnet-4-5-20250929" ], "env": { "ANTHROPIC_API_KEY": "your-api-key" } } } }

Option 4: Building from source (Go)

  1. Prerequisites: Go 1.24.0 or higher

  2. Clone and build: git clone https://github.com/jolks/mcp-cron.git cd mcp-cron go build -o mcp-cron cmd/mcp-cron/main.go

  3. Run the binary directly (example): ./mcp-cron --transport stdio

Note: The repository README includes additional examples for configuring AI proxies (LiteLLM) and detailed command-line arguments. Adjust paths, providers, and keys as needed for your environment.

Additional notes

Tips and common considerations:

  • The MCP Cron server stores task results in an SQLite database. You can customize the database path with the --db-path flag or MCP_CRON_STORE_DB_PATH env var.
  • To support multiple isolated instances, you can run separate mcp-cron processes with different --db-path values to avoid cross-instance conflicts.
  • If you’re using AI tasks, ensure your API keys are securely managed (environment variables like OPENAI_API_KEY or ANTHROPIC_API_KEY) or use a proxy like LiteLLM with the appropriate base URL and model name.
  • The sleep-prevention feature is configurable via --prevent-sleep or MCP_CRON_PREVENT_SLEEP. This helps keep scheduled tasks running on laptops or systems prone to idle sleep.
  • Logs behavior differs by transport: SSE mode logs to the console, while stdio mode logs to a file named mcp-cron.log to avoid interfering with JSON-RPC traffic.
  • The server supports both shell command execution and AI-based task scheduling; ensure your tasks’ outputs are properly captured and persisted for auditing or debugging.

Related MCP Servers

Sponsor this space

Reach thousands of developers