Dify Scheduled Task MCP Server
Connects an AI chatbot to Matrix with E2EE support, DM and group chat responses, auto-join on invites, per-user conversation isolation, typing indicators, and delivery of scheduled task results to Matrix DMs or group rooms with optional mentions.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Dify Matrix Bot & Scheduled Task MCP
A lightweight, single-container service built with matrix-nio, FastAPI, APScheduler, and FastMCP (SSE) that connects a Matrix AI Chatbot (with E2EE support) and a Dify Scheduled Task MCP Server to your Dify application.
Features
Dify Scheduled Task MCP Server (SSE)
Exposes an MCP SSE endpoint at
/sse(and/messages/) on the FastAPI server for Dify to connect.Provides 3 MCP tools:
create_scheduled_task: Create a scheduled task with auto-generateduuid,title,cron,content,is_one_time, plus optionaluser_idandroom_id.list_scheduled_tasks: List all scheduled tasks and their next run times.delete_scheduled_task: Delete a scheduled task bytask_uuid.
When a cron trigger fires, the scheduler invokes Dify
/chat-messageswithDIFY_SCHEDULER_INPUTSand routes the response based onuser_idandroom_id:room_idempty &user_idempty → Executes silently (no Matrix message sent).room_idempty &user_idnon-empty → Sends a Direct Message (DM) touser_id.room_idnon-empty &user_idempty → Sends to the group room without@mentioninganyone.room_idnon-empty &user_idnon-empty → Sends to the group room and@mentionsuser_id.
One-time tasks (
is_one_time=true) are automatically removed after execution. All tasks are persisted in SQLite and restored across restarts.
Matrix AI Bot (
matrix-nio)End-to-End Encryption (E2EE): Supports encrypted rooms and encrypted DMs out of the box via
matrix-nio[e2e](vodozemac), persisting cryptographic keys inMATRIX_STORE_PATHand login sessions in SQLite across container restarts.DM & Group Chat Support: Auto-joins rooms on invite (
MATRIX_AUTO_JOIN=true). Responds directly in DMs, and responds in groups when@mentionedor triggered withMATRIX_COMMAND_PREFIX.Per-User Conversation Isolation: Maintains independent Dify
conversation_ids per(room_id, user_id). Users can send/resetor/clearto clear their own context.Typing Indicator Heartbeat: Keeps the Matrix "typing..." indicator alive every
MATRIX_TYPING_INTERVAL_SECONDS(default15s) while waiting for slow Dify responses.Template-Driven
DIFY_INPUTS&$history: Full control over Dify'sinputspayload and whether/how recent group chat history ($history) is passed.
Related MCP server: croncron
Quick Start (Docker)
Copy and edit the environment file:
cp .env.example .envFill in your Matrix credentials,
DIFY_BASE_URL,DIFY_API_KEY, and customizeDIFY_INPUTS/DIFY_SCHEDULER_INPUTSas needed.Start the container:
docker compose up -d --buildVerify service health or open the built-in task dashboard:
curl http://localhost:8000/healthOpen
http://localhost:8000/in your browser to view, create, or delete scheduled tasks.
Customizing Dify inputs
1. Chat Bot Inputs (DIFY_INPUTS)
Configure DIFY_INPUTS as a single-line JSON object using $var or ${var} placeholders and static values. You can customize the JSON keys to match whatever input names your Dify app expects:
DIFY_INPUTS={"user_id":"$user_id","user_name":"$user_name","room_id":"$room_id","source":"matrix","history":"$history"}Variable | Description |
| Sender Matrix MXID (e.g. |
| Sender display name in Matrix |
| Matrix username localpart (e.g. |
| Current Matrix room ID |
| Current Matrix room name |
|
|
|
|
| Chronological transcript of the latest |
2. Scheduler Inputs (DIFY_SCHEDULER_INPUTS)
When a scheduled task triggers, less context is available than in live chat, so a dedicated template DIFY_SCHEDULER_INPUTS is used with $user_id, $user_localpart, $room_id, $task_uuid, and $task_title:
DIFY_SCHEDULER_INPUTS={"user_id":"$user_id","room_id":"$room_id"}If either DIFY_INPUTS or DIFY_SCHEDULER_INPUTS is omitted or empty, {} is sent as inputs.
Across this project,user_id always refers to the Matrix MXID (e.g. @alice:example.org) and user_name refers to the display name. Passing $user_id to Dify ensures Dify passes an unambiguous Matrix ID to create_scheduled_task for reliable DM and @mention delivery.
Connecting Dify to MCP (SSE)
Add an MCP Server in Dify with:
Transport:
SSEURL:
http://<your-host>:8000/sseAuthorization Header (optional): If
MCP_AUTH_TOKENis set in.env, add:Authorization: Bearer <your-MCP_AUTH_TOKEN>
Environment Variables
Variable | Required | Default | Description |
| Yes | - | Matrix homeserver URL |
| Yes | - | Bot MXID (e.g. |
| Cond. | - | Access token (or provide |
| Cond. | - | Password used when |
| No |
| Matrix device ID |
| No |
| Automatically accept room invitations |
| No |
| Enable Matrix End-to-End Encryption ( |
| No |
| Persistent E2EE key store directory ( |
| No |
| Automatically trust room members' devices for seamless E2EE replies |
| No |
| Max recent group messages included in |
| No | - | Optional command prefix to trigger the bot in groups |
| No |
| Typing heartbeat refresh interval |
| No |
| Typing event timeout sent to Matrix server |
| No |
| Dify API base URL |
| Yes | - | Dify App API key |
| No |
| Dify HTTP streaming timeout |
| No |
| Fallback |
| No |
| JSON template for Dify |
| No |
| JSON template for Dify |
| No |
| Standard system & cron scheduler timezone |
| No |
| SQLite database file path ( |
| No |
| FastAPI & MCP server port |
| No | - | Optional Bearer token protecting |
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Schedule tasks for later from your AI agent: reminders, delayed webhooks, recurring jobs.
Manage cron jobs, machines and run history in your norc account from any AI chat.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables managing cron jobs, maintenance windows, and settings through natural language by exposing the Cronmanager REST API as MCP tools for LLM clients like Claude.GPL 3.0
- AlicenseNot gradedqualityDmaintenanceAn MCP server that lets AI agents manage cron jobs through natural language — adding, listing, pausing, removing, running, and viewing logs of scheduled jobs with plain-English schedule parsing, automatic log capture, missed-run detection, and failure alerts.MIT
- FlicenseNot gradedqualityCmaintenanceEnables ChatGPT to schedule future proactive messages and receive queued events into conversations through MCP Apps, without calling the OpenAI API.-
- AlicenseAqualityCmaintenanceEnables MCP-compatible clients to manage cron-job.org cron jobs and folders via natural language, including creating, inspecting, updating, and deleting jobs, and reading execution history.12MIT