MCP Cron logo

MCP Cron

Community
jolks

MCP server for scheduling and running AI prompts, HTTP/webhook requests, and shell commands

Publisherjolks
Repositorymcp-cron
LanguageGo
Forks
16
Stars
27
Available tools
0
Transport typestdio, streamable-http
Categories
Links
  • Connect tools to AI workflows

    MCP Cron exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    27 stars and 16 forks from the linked repository.

MCP Cron

Model Context Protocol (MCP) server for scheduling and managing tasks through a standardized API. The server provides task scheduling capabilities supporting both shell commands and AI-powered tasks, all accessible via the MCP protocol.

Features

  • Schedule shell command or prompt to AI tasks using cron expressions
  • AI can have access to MCP servers
  • Manage tasks via MCP protocol
  • Task execution with command output capture
  • Task persistence across restarts (SQLite)
  • Multi-instance safe — multiple instances can share the same database without duplicate execution
  • Support multiple isolated instances with different --db-path

Installation

npm (recommended)

bash
npx -y mcp-cron

Claude Code

bash
claude mcp add mcp-cron -- npx -y mcp-cron

Cursor / Claude Desktop

json
{
  "mcpServers": {
    "mcp-cron": {
      "command": "npx",
      "args": ["-y", "mcp-cron", "--transport", "stdio"]
    }
  }
}

Recommended Configuration

A more complete setup with AI provider, model selection, and sleep prevention:

json
{
  "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"
      }
    }
  }
}

Using LiteLLM

To route AI tasks through a LiteLLM proxy:

json
{
  "mcpServers": {
    "mcp-cron": {
      "command": "npx",
      "args": [
        "-y", "mcp-cron",
        "--transport", "stdio",
        "--prevent-sleep",
        "--ai-base-url", "https://litellm.yourcompany.com",
        "--ai-model", "claude-sonnet-4-5-20250929"
      ],
      "env": {
        "MCP_CRON_AI_API_KEY": "sk-your-litellm-key"
      }
    }
  }
}

The --ai-model value should match a model name in your LiteLLM proxy config. LiteLLM exposes an OpenAI-compatible API, so --ai-provider can be omitted (defaults to openai). When a custom base URL is set, mcp-cron automatically uses the Chat Completions API instead of the Responses API. The Responses API is only used for direct OpenAI (api.openai.com) and Azure OpenAI (*.openai.azure.com) endpoints.

See Command Line Arguments and Environment Variables for all available options.

Building from Source

Prerequisites

  • Go 1.24.0 or higher
bash
# Clone the repository
git clone https://github.com/jolks/mcp-cron.git
cd mcp-cron

# Build the application as mcp-cron binary
go build -o mcp-cron cmd/mcp-cron/main.go

Usage

The server supports two transport modes:

  • HTTP (Streamable HTTP): Default HTTP-based transport for browser and network clients
  • stdio: Standard input/output transport for direct piping and inter-process communication
ClientConfig File Location
Cursor~/.cursor/mcp.json
Claude Desktop (Mac)~/Library/Application Support/Claude/claude_desktop_config.json
Claude Desktop (Windows)%APPDATA%\Claude\claude_desktop_config.json

HTTP (Streamable HTTP)

bash
# Start the server with Streamable HTTP transport (default mode)
# Default to localhost:8080
./mcp-cron

# Start with custom address and port
./mcp-cron --address 127.0.0.1 --port 9090

Config file example

json
{
  "mcpServers": {
    "mcp-cron": {
      "url": "http://localhost:8080"
    }
  }
}

stdio

The stdio transport is particularly useful for:

  • Direct piping to/from other processes
  • Integration with CLI tools
  • Testing in environments without HTTP
  • Docker container integration

Upon starting Cursor IDE and Claude Desktop, it will automatically start the server

Config file example

json
{
  "mcpServers": {
    "mcp-cron": {
      "command": "<path to where mcp-cron binary is located>/mcp-cron",
      "args": ["--transport", "stdio"]
    }
  }
}

Command Line Arguments

The following command line arguments are supported:

ArgumentDescriptionDefault
--addressThe address to bind the server tolocalhost
--portThe port to bind the server to8080
--transportTransport mode: http or stdiohttp
--log-levelLogging level: debug, info, warn, error, fatalinfo
--log-fileLog file pathstdout
--versionShow version information and exitfalse
--ai-providerAI provider: openai or anthropicopenai
--ai-base-urlCustom base URL for OpenAI-compatible endpoints (e.g. Ollama, vLLM, Groq, LiteLLM)Not set
--ai-modelAI model to use for AI tasksgpt-4o
--ai-max-iterationsMaximum iterations for tool-enabled AI tasks20
--mcp-config-pathPath to MCP configuration file~/.cursor/mcp.json
--db-pathPath to SQLite database for result history~/.mcp-cron/results.db
--prevent-sleepPrevent system from sleeping while mcp-cron is running (macOS and Windows)false
--poll-intervalHow often to check for due tasks1s

Environment Variables

The following environment variables are supported:

Environment VariableDescriptionDefault
MCP_CRON_SERVER_ADDRESSThe address to bind the server tolocalhost
MCP_CRON_SERVER_PORTThe port to bind the server to8080
MCP_CRON_SERVER_TRANSPORTTransport mode: http or stdiohttp
MCP_CRON_SERVER_NAMEDeprecated — ignored; the server name is fixed to ensure self-reference detection works correctly-
MCP_CRON_SERVER_VERSIONDeprecated — ignored; version is set at build time via ldflags-
MCP_CRON_SCHEDULER_DEFAULT_TIMEOUTDefault timeout for task execution10m
MCP_CRON_LOGGING_LEVELLogging level: debug, info, warn, error, fatalinfo
MCP_CRON_LOGGING_FILELog file pathstdout
MCP_CRON_AI_PROVIDERAI provider: openai or anthropicopenai
MCP_CRON_AI_BASE_URLCustom base URL for OpenAI-compatible endpoints (e.g. Ollama, vLLM, Groq, LiteLLM)Not set
MCP_CRON_AI_API_KEYGeneric fallback API key (used when provider-specific key is not set)Not set
OPENAI_API_KEYOpenAI API key for AI tasksNot set
ANTHROPIC_API_KEYAnthropic API key for AI tasksNot set
MCP_CRON_ENABLE_OPENAI_TESTSEnable OpenAI integration testsfalse
MCP_CRON_AI_MODELLLM model to use for AI tasksgpt-4o
MCP_CRON_AI_MAX_TOOL_ITERATIONSMaximum iterations for tool-enabled tasks20
MCP_CRON_MCP_CONFIG_FILE_PATHPath to MCP configuration file~/.cursor/mcp.json
MCP_CRON_STORE_DB_PATHPath to SQLite database for result history~/.mcp-cron/results.db
MCP_CRON_PREVENT_SLEEPPrevent system from sleeping while mcp-cron is running (macOS and Windows)false
MCP_CRON_POLL_INTERVALHow often to check for due tasks (Go duration format)1s

Sleep Prevention

On laptops, the system may go to sleep and prevent scheduled tasks from running on time. Use the --prevent-sleep flag to keep the system awake while mcp-cron is running:

bash
mcp-cron --prevent-sleep --transport stdio

Or via environment variable:

bash
MCP_CRON_PREVENT_SLEEP=true mcp-cron --transport stdio
PlatformMechanismNotes
macOScaffeinatePrevents idle sleep; automatically cleans up on exit
WindowsSetThreadExecutionStatePrevents idle sleep; automatically cleans up on exit
LinuxNot supportedLinux servers typically do not auto-sleep

Note: This prevents idle sleep only. It does not prevent sleep from closing the laptop lid or pressing the power button.

Logging

When running with the default HTTP transport, logs are output to the console.

When running with stdio transport, logs are redirected to a mcp-cron.log log file to prevent interference with the JSON-RPC protocol:

  • Log file location: Same location as mcp-cron binary.
  • Task outputs, execution details, and server diagnostics are written to this file.
  • The stdout/stderr streams are kept clean for protocol messages only.

Available MCP Tools

The server exposes several tools through the MCP protocol:

  1. list_tasks - Lists all tasks (scheduled and on-demand)
  2. get_task - Gets a specific task by ID
  3. add_task - Adds a new shell command task (provide schedule for recurring, or omit for on-demand)
  4. add_ai_task - Adds a new AI (LLM) task with a prompt (provide schedule for recurring, or omit for on-demand)
  5. add_http_task - Adds a new HTTP (webhook) task that issues an HTTP request to a url (provide schedule for recurring, or omit for on-demand)
  6. update_task - Updates an existing task
  7. remove_task - Removes a task by ID
  8. run_task - Executes a task by ID, waits for completion, and returns the result (for on-demand tasks or ad-hoc runs of scheduled tasks)
  9. enable_task - Enables a task so it runs on its schedule or can be triggered via run_task
  10. disable_task - Disables a task so it stops running and cannot be triggered
  11. get_task_result - Gets execution results for a task (latest by default, or recent history with limit)
  12. query_task_result - Runs a read-only SQL query against the database (SELECT only, capped at 1000 rows)

Task Format

Tasks have the following structure:

json
{
  "id": "task_a3f7b2c9e1d04f68",
  "name": "Example Task",
  "schedule": "0 */5 * * * *",
  "command": "echo 'Task executed!'",
  "prompt": "Analyze yesterday's sales data and provide a summary",
  "type": "shell_command",
  "description": "An example task that runs every 5 minutes",
  "enabled": true,
  "lastRun": "2025-01-01T12:00:00Z",
  "nextRun": "2025-01-01T12:05:00Z",
  "status": "completed",
  "createdAt": "2025-01-01T00:00:00Z",
  "updatedAt": "2025-01-01T12:00:00Z"
}

The type field can be shell_command (default), AI, or http. The fields that apply depend on the type:

  • shell_command — command: the shell command to execute.
  • AI — prompt: what the AI should do.
  • http — url (required), method (defaults to POST), headers (JSON object of string→string), and body (request body string). Created via add_http_task.

For HTTP tasks, the result row reuses the existing columns:

Result fieldMeaning for HTTP tasks
exit_codeHTTP status code (0 if no response was received)
outputResponse body preview (capped at 8 KiB, suffixed ... (truncated))
errorTransport error, build-request error, or non-2xx status: N <reason>
durationRound-trip latency
urlThe request URL

This keeps query_task_result queries uniform — e.g. SELECT COUNT(*) FROM results WHERE task_id='x' AND exit_code >= 200 AND exit_code < 300 counts successful HTTP calls.

Scheduled vs on-demand tasks:

  • Scheduled: Provide a schedule (cron expression) — the task runs automatically on that schedule.
  • On-demand: Omit schedule — the task sits idle until triggered via run_task.

run_task also works on scheduled tasks for ad-hoc execution outside their normal schedule. After execution, scheduled tasks resume their normal schedule; on-demand tasks return to idle.

Task Status

The tasks can have the following status values:

  • pending - Task has not been run yet
  • running - Task is currently running
  • completed - Task has successfully completed
  • failed - Task has failed during execution
  • disabled - Task is disabled and won't run on schedule

Cron Expression Format

Cron expressions are required for scheduled tasks and omitted for on-demand tasks. The scheduler uses the github.com/robfig/cron/v3 library for parsing. The format includes seconds:

┌───────────── second (0 - 59) (Optional)
│ ┌───────────── minute (0 - 59)
│ │ ┌───────────── hour (0 - 23)
│ │ │ ┌───────────── day of the month (1 - 31)
│ │ │ │ ┌───────────── month (1 - 12)
│ │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday)
│ │ │ │ │ │
│ │ │ │ │ │
* * * * * *

Examples:

  • 0 */5 * * * * - Every 5 minutes (at 0 seconds)
  • 0 0 * * * * - Every hour
  • 0 0 0 * * * - Every day at midnight
  • 0 0 12 * * MON-FRI - Every weekday at noon

Development

Building

bash
go build -o mcp-cron cmd/mcp-cron/main.go

Testing

See docs/testing.md for the full testing guide, including integration tests and AI task tests.

Acknowledgments

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "jolks-mcp-cron": {
      "command": "",
      "args": []
    }
  }
}

Use MCP Cron MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once MCP Cron is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add MCP Cron as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the MCP Cron MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "jolks-mcp-cron": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-cron"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the MCP Cron MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the MCP Cron MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use MCP Cron to help me with this task?
MCP Cron
Sure. I read it.
Here is what I found using MCP Cron.

Option 2: Add an MCP server URL

Use this when MCP Cron is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter your server URL in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste your server URL into the Server URL field.
  2. Enter a connection name for MCP Cron.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the MCP Cron connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the MCP Cron tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the MCP Cron tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use MCP Cron to help me with this task?
MCP Cron
Sure. I read it.
Here is what I found using MCP Cron.

Frequently asked questions

What is the MCP Cron MCP server used for?

MCP Cron is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use MCP Cron MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use MCP Cron with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use MCP Cron MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With MCP Cron connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect MCP Cron MCP to TypingMind?

MCP Cron can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does MCP Cron MCP provide in TypingMind?

MCP Cron exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use MCP Cron MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If MCP Cron requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇