MCP Scheduler is a versatile task automation system that allows you to schedule and run different types of tasks including shell commands, API calls, AI content generation, and desktop notifications. Built on the Model Context Protocol (MCP), it integrates easily with AI assistants and provides comprehensive scheduling control through cron expressions.
# For Mac/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# For Windows (PowerShell)
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
After installing uv, restart your terminal to ensure the command is available.
# Clone the repository
git clone https://github.com/yourusername/mcp-scheduler.git
cd mcp-scheduler
# Create and activate a virtual environment with uv
uv venv
source .venv/bin/activate # On Unix/MacOS
# or
.venv\Scripts\activate # On Windows
# Install dependencies with uv
uv pip install -r requirements.txt
# Clone the repository
git clone https://github.com/yourusername/mcp-scheduler.git
cd mcp-scheduler
# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate # On Unix/MacOS
# or
.venv\Scripts\activate # On Windows
# Install dependencies
pip install -r requirements.txt
# Activate the virtual environment first
source .venv/bin/activate # On Unix/MacOS
# or
.venv\Scripts\activate # On Windows
# Run with default settings (stdio transport)
uv run main.py
# Run with AWS Q integration (recommended for Amazon Q users)
uv run start_with_aws_q.py
# Run with debug mode for detailed logging
uv run main.py --debug
# Run with custom configuration file
uv run main.py --config /path/to/config.json
To use MCP Scheduler with Amazon Q:
# Start the scheduler with AWS Q integration
uv run start_with_aws_q.py
This will automatically register the scheduler with Amazon Q, allowing you to create and manage tasks through natural language commands.
Example commands:
To use your MCP Scheduler with Claude Desktop:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": [
{
"type": "stdio",
"name": "MCP Scheduler",
"command": "python",
"args": ["/path/to/your/mcp-scheduler/main.py"]
}
]
}
--address Server address (default: localhost)
--port Server port (default: 8080)
--transport Transport mode (stdio or sse) (default: stdio)
--log-level Logging level (default: INFO)
--log-file Log file path (default: mcp_scheduler.log)
--db-path SQLite database path (default: scheduler.db)
--config Path to JSON configuration file
--ai-model AI model to use for AI tasks (default: gpt-4o)
--version Show version and exit
--debug Enable debug mode with full traceback
--fix-json Enable JSON fixing for malformed messages
You can use a JSON configuration file instead of command-line arguments:
{
"server": {
"name": "mcp-scheduler",
"version": "0.1.0",
"address": "localhost",
"port": 8080,
"transport": "stdio"
},
"database": {
"path": "scheduler.db"
},
"logging": {
"level": "INFO",
"file": "mcp_scheduler.log"
},
"scheduler": {
"check_interval": 5,
"execution_timeout": 300
},
"ai": {
"model": "gpt-4o",
"use_aws_q_model": true,
"openai_api_key": "your-api-key" // Only needed if not using AWS Q model
}
}
MCP Scheduler is an application-level task scheduler, not a system-level scheduler:
MCP Scheduler uses standard cron expressions for scheduling. Examples:
0 0 * * *
- Daily at midnight0 */2 * * *
- Every 2 hours0 9-17 * * 1-5
- Every hour from 9 AM to 5 PM, Monday to Friday0 0 1 * *
- At midnight on the first day of each month0 0 * * 0
- At midnight every SundayUse natural language to create and manage tasks:
Creating a command task:
Create a scheduled task to backup my database to /backups directory every night at 10:30
Creating an API call task:
Set up a task to fetch weather data every 6 hours
Creating an AI task:
Generate a sales data summary report every Monday at 9AM
Creating a reminder task:
Remind me about team meetings every Tuesday and Thursday at 9:30 AM
Listing all tasks:
Show all scheduled tasks
Running a task immediately:
Run the backup task now
import asyncio
from mcp.client import StdioClient
async def main():
# Start MCP Scheduler as a subprocess
process_args = ["uv", "run", "/path/to/scheduler-mcp/main.py"]
async with StdioClient.create_subprocess(process_args) as client:
# Get server info
server_info = await client.call("get_server_info")
print(f"Connected to {server_info['name']} version {server_info['version']}")
# List all tasks
tasks = await client.call("list_tasks")
print(f"There are {len(tasks)} tasks")
# Add a command task
cmd_task = await client.call(
"add_command_task",
{
"name": "System Status Check",
"schedule": "*/30 * * * *", # Every 30 minutes
"command": "vmstat > /tmp/vmstat_$(date +%Y%m%d_%H%M).log",
"description": "Log system status",
"do_only_once": False
}
)
print(f"Created command task: {cmd_task['id']}")
# Run a task immediately
run_result = await client.call(
"run_task_now",
{"task_id": cmd_task['id']}
)
print(f"Task execution result: {run_result['execution']['status']}")
if __name__ == "__main__":
asyncio.run(main())
The scheduler can be configured using environment variables:
MCP_SCHEDULER_NAME
: Server name (default: mcp-scheduler)MCP_SCHEDULER_VERSION
: Server version (default: 0.1.0)MCP_SCHEDULER_ADDRESS
: Server address (default: localhost)MCP_SCHEDULER_PORT
: Server port (default: 8080)MCP_SCHEDULER_TRANSPORT
: Transport mode (default: stdio)MCP_SCHEDULER_LOG_LEVEL
: Logging level (default: INFO)MCP_SCHEDULER_LOG_FILE
: Log file pathMCP_SCHEDULER_DB_PATH
: Database path (default: scheduler.db)MCP_SCHEDULER_CHECK_INTERVAL
: How often to check for tasks (default: 5 seconds)MCP_SCHEDULER_EXECUTION_TIMEOUT
: Task execution timeout (default: 300 seconds)MCP_SCHEDULER_AI_MODEL
: OpenAI model for AI tasks (default: gpt-4o)MCP_SCHEDULER_USE_AWS_Q_MODEL
: Use AWS Q model for AI tasks (default: false)OPENAI_API_KEY
: API key for OpenAI tasks (not needed when using AWS Q model)To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "q-scheduler" '{"command":"python","args":["main.py"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"q-scheduler": {
"command": "python",
"args": [
"main.py"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"q-scheduler": {
"command": "python",
"args": [
"main.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect