mcp-task-runner

mcp-task-runner

An MCP server that lets an AI assistant run and schedule shell tasks safely with allow/deny lists and timeout enforcement.

Category
Visit Server

README

mcp-task-runner

Python License: MIT Tests

An MCP server that lets an AI assistant run and schedule shell tasks safely. Every command is checked against an allow-list + deny-list before execution, runs with shell=False (no shell injection), and is killed if it exceeds a timeout.

┌────────────┐  register_task / run_task  ┌────────────────────┐
│ MCP Client │ ─────────────────────────▶ │  task-runner        │
│ (assistant)│ ◀───────────────────────── │  (FastMCP)          │
└────────────┘   stdout / rc / status     └─────────┬──────────┘
                                                    │
                       ┌────────────────────────────┼──────────────────────┐
                       ▼                            ▼                      ▼
                 ┌──────────────┐          ┌──────────────┐        ┌──────────────┐
                 │  security    │ ─pass─▶ │   runner     │ ─────▶ │   schedule   │
                 │ allow/deny   │         │ subprocess   │        │ 30s/5m/1h..  │
                 └──────────────┘         │ + timeout    │        └──────────────┘
                                          └──────────────┘

Why this exists

Giving an LLM the ability to run shell commands is powerful but dangerous. mcp-task-runner adds a policy layer: only vetted binaries run, shell metacharacters can't inject, and nothing runs forever. The assistant gets a controlled "remote hands" without a foot-gun.

Safety model

Control Mechanism
Binary allow-list Only known-safe binaries (echo, python, git, pytest…) may run
Deny-list rm, sudo, dd, curl, … are always blocked
No shell Executed as an argv list with shell=False
Timeout Wall-clock cap kills runaway processes
Fail-fast Bad commands rejected at registration time

Features

  • Register named tasks once, run them by name
  • Per-task result history (last(), history)
  • Schedule expressions: 30s, 5m, 2h, 1d
  • 100% offline-testable core (execution is injectable)

Install

pip install -r requirements.txt

Use as an MCP server

python -m mcp_task_runner.server

Tools:

  • register_task(name, command) — validate + store a task
  • run_task_by_name(name, timeout?) — execute, return stdout/rc
  • parse_schedule(expr) — validate 5m/1h/…

Use the engine directly

from mcp_task_runner.runner import TaskRunner

runner = TaskRunner()
runner.register("ping_gw", "ping -n 1 8.8.8.8")   # rejects unknown binary
runner.register("build", "python -m pytest")     # ok
res = runner.run("build")
print(res.ok, res.stdout)

Verified invariants

  • rm -rf /, sudo ls, curl … ⇒ rejected before execution
  • injected echo ok ; rm -rf / ⇒ rejected (denylist token)
  • unknown binary ⇒ rejected
  • next_fire(None) fires immediately; afterwards last + interval

Project layout

mcp-task-runner/
├── mcp_task_runner/
│   ├── __init__.py
│   ├── security.py    # allow/deny validation
│   ├── runner.py      # safe subprocess execution + registry
│   ├── schedule.py    # interval / cron-like parsing
│   └── server.py      # MCP/FastMCP adapter
├── tests/test_runner.py
├── conftest.py
├── requirements.txt
├── README.md
├── LICENSE
└── .gitignore

License

MIT © wzx11223344

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured