Labsco
inansen logo

Hangfire MCP

โ˜… 2

from inansen

MCP server for managing Hangfire background jobs

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

Hangfire MCP Server

A Model Context Protocol (MCP) server for managing Hangfire background jobs directly from VS Code Copilot and other MCP-compatible clients. Monitor job queues, retry failed jobs, manage recurring tasks, and view real-time statistics โ€” all without leaving your editor.

Features

  • Job Management: List, view, retry, delete, and requeue jobs
  • Recurring Jobs: List, view, trigger, pause, and resume recurring jobs
  • Statistics: View server stats, queues, and active servers
  • Auto-Discovery: Automatically finds connection strings from appsettings.json
  • Web Dashboard: Built-in web UI with real-time stats and job management

Connection String Discovery

The server finds connection strings in this priority order:

  1. --connection-string CLI argument
  2. HANGFIRE_CONNECTION_STRING environment variable
  3. Auto-discover from ${workspaceFolder}/**/appsettings*.json
  4. User config at ~/.config/hangfire-mcp/connections.json (Linux/macOS) or %APPDATA%\hangfire-mcp\connections.json (Windows)
  5. Use the configure tool to set it manually

Available Tools

Job Tools

ToolDescription
list_jobsList jobs by state (Enqueued, Processing, Succeeded, Failed, etc.)
get_jobGet detailed job info including arguments and exception details
get_job_historyGet the state history of a job
retry_jobRetry a failed job
delete_jobDelete a job
requeue_jobMove a job back to queue

Recurring Job Tools

ToolDescription
list_recurring_jobsList all recurring jobs with cron schedules
get_recurring_jobGet recurring job details
trigger_recurring_jobRun a recurring job immediately
pause_recurring_jobPause scheduled executions
resume_recurring_jobResume a paused job

Statistics Tools

ToolDescription
get_statsServer statistics (succeeded, failed, processing counts)
list_queuesList queues with pending job counts
list_serversList active Hangfire servers

Configuration Tool

ToolDescription
configureSet connection string for current workspace

Web Dashboard

The package includes a built-in web dashboard for visual job management.

Installation

pip install hangfire-mcp[dashboard]

Running the Dashboard

# Windows
.\scripts\run-dashboard.ps1

# macOS / Linux
chmod +x scripts/run-dashboard.sh
./scripts/run-dashboard.sh

# Or manually (any platform)
export HANGFIRE_CONNECTION_STRING="Driver={ODBC Driver 17 for SQL Server};Server=localhost;Database=Hangfire;..."
python -m uvicorn hangfire_mcp.dashboard:app --host 127.0.0.1 --port 8080

Open http://127.0.0.1:8080 in your browser.

Dashboard Features

  • Real-time Stats: Succeeded, Failed, Processing, Enqueued, Scheduled counts
  • Job List: View all jobs with filtering by state
  • Job Actions: Retry, Delete, View details with one click
  • Recurring Jobs: Pause, Resume, Trigger recurring jobs
  • Server Status: Online/Idle/Offline status based on heartbeat
  • Auto-refresh: Updates every 10 seconds

Development

# Clone the repository
git clone https://github.com/inansen/hangfire-mcp.git
cd hangfire-mcp

# Install all dependencies
pip install -e ".[dev]"

# Run tests
pytest