task-queue-mcp
Exposes an agent orchestration task queue as an MCP tool interface, allowing agents to submit, list, get, and update tasks with typed validation.
README
task-queue-mcp
A FastMCP server that exposes the agent orchestration task queue as an MCP tool interface. Agents submit tasks, check status, and record completions through typed, validated tools instead of raw YAML file writes.
Runs as a Docker container on port 8485. Wired globally into ~/.claude.json so all Claude Code agent sessions have access.
Tools
| Tool | Description |
|---|---|
submit_task |
Create a new task with status: submitted |
list_tasks |
List tasks with optional filters; TTL-expired tasks excluded |
get_task |
Retrieve a single task by UUID |
update_task |
Transition status and append a history entry |
submit_task
submit_task(
source_agent="research",
target_agent="claudebox", # agent name or "auto" for dispatcher routing
task_type="build", # build | deploy | fix | research | review | audit | notify
summary="Deploy qmd update",
description="Apply the qmd stack update from build plan...",
risk_level="low", # low | medium | high (default: low)
requires_approval=False, # explicit override of approval gate
priority="normal", # normal | high | urgent (default: normal)
context_refs=["/home/ted/.claude/projects/research/build-plans/qmd/plan.md"],
ttl_days=30,
workflow_mode="semi-auto", # semi-auto | auto (default: semi-auto)
)
# → {"ok": true, "task_id": "<uuid>", "filename": "<timestamp>-<slug>.yml"}
context_refs must be absolute paths. risk_level and priority are validated against allowlists. workflow_mode controls dispatcher behavior: semi-auto (default) queues the task for operator pickup with a Matrix notification, while auto triggers the dispatcher to launch the target agent headlessly. The server generates the UUID, sets created, and initializes alert_state and retry_policy stubs.
list_tasks
list_tasks(
target_agent="claudebox", # optional
source_agent="research", # optional
status="approved,in-progress", # comma-separated, optional
task_type="build", # optional
include_archived=False, # include archive/ subdirectory
limit=20, # max 200
)
# → list of task dicts, sorted by created descending
Tasks past their ttl_days are excluded. The dispatcher is authoritative for TTL archiving, but list_tasks filters them out proactively so agents don't act on stale items.
get_task
get_task(task_id="a7f3d2c1-1234-5678-abcd-000000000000")
# → full task dict, or {"ok": false, "error": "not found"}
Searches the main queue first, then archive/. Requires a full UUID — no prefix matching.
update_task
update_task(
task_id="a7f3d2c1-1234-5678-abcd-000000000000",
status="in-progress", # see transition table below
actor="claudebox",
note="Claimed task, starting build.",
output=None, # written to result.output on completed/failed
)
# → {"ok": true, "task_id": "<uuid>"} or {"ok": false, "error": "..."}
Valid transitions:
| From | To |
|---|---|
approved |
in-progress |
in-progress |
completed |
| Any non-terminal | failed |
Non-terminal: submitted, pending-approval, approved, in-progress.
Terminal: completed, failed.
alert_state and retry_policy are dispatcher-owned — update_task never touches them.
Status Lifecycle
submitted → [pending-approval] → approved → in-progress → completed
↓
failed
The dispatcher owns the submitted → approved/pending-approval transitions. Agents own approved → in-progress → completed (or failed). Approval gating is controlled by agent manifests and the requires_approval field.
Deployment
Docker (production)
services:
task-queue-mcp:
image: task-queue-mcp:latest
container_name: task-queue-mcp
ports:
- "8485:8485"
volumes:
- /home/ted/.claude/task-queue:/task-queue
environment:
- TASK_QUEUE_DIR=/task-queue
- MCP_HOST=0.0.0.0
- MCP_PORT=8485
cap_drop: [ALL]
security_opt: [no-new-privileges:true]
read_only: true
tmpfs: [/tmp]
user: "1000:1000"
restart: unless-stopped
networks:
- claudebox-net
The container mounts only the task-queue directory read-write. The rest of the filesystem is read-only. /tmp is a tmpfs for transient scratch space.
Claude Code settings.json
{
"mcpServers": {
"task-queue-mcp": {
"type": "url",
"url": "http://localhost:8485/mcp"
}
}
}
Environment Variables
| Variable | Default | Description |
|---|---|---|
TASK_QUEUE_DIR |
/task-queue |
Path to the task queue directory inside the container |
MCP_HOST |
0.0.0.0 |
Bind host for the HTTP server |
MCP_PORT |
8485 |
Port for the HTTP server |
Building
docker build -t task-queue-mcp:latest .
Development
pip install -r requirements.txt
# Run tests
pytest
# Run server locally (against a local task-queue directory)
TASK_QUEUE_DIR=/home/ted/.claude/task-queue python -m src.server
The test suite (21 tests) covers all four tools including validation edge cases and adversarial YAML strings. All writes use yaml.dump — never string interpolation — to prevent YAML injection.
Security
Port 8485 is unauthenticated. Access is limited to LAN only — the port is not proxied externally via SWAG and the host firewall blocks external access. The container runs as UID 1000 with cap_drop: ALL and no-new-privileges.
Task File Schema
Tasks are YAML files in ~/.claude/task-queue/, named YYYYMMDD-HHMMSS-<uuid-prefix>.yml. All writes are atomic (write to .tmp, then os.rename()). Per-task file locks via fcntl.flock prevent races between concurrent MCP calls and the dispatcher.
For the full schema and lifecycle documentation, see the homelab-agent component doc.
Related
- homelab-agent — agent orchestration documentation
- task-dispatcher — the dispatcher that routes and gates tasks
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。