MCP server for reading and running Semaphore tasks
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Simon Cornet 118797596f
All checks were successful
ci/woodpecker/push/lint-test-release Pipeline was successful
ci/woodpecker/tag/lint-test-release Pipeline was successful
ci/woodpecker/release/lint-test-release Pipeline was successful
fix(run_task): send ansible options under params so dry_run is applied
Semaphore 2.19 reads dry_run, diff, debug, limit and tags from the params object, top level dry_run was ignored and ran the playbook for real. Adds tags and skip_tags, and fails when a requested dry_run is not confirmed by the server.
2026-10-24 14:21:19 +02:00
.woodpecker feat: add mcp server to read and run semaphore tasks 2026-10-24 14:12:06 +02:00
.gitignore feat: add mcp server to read and run semaphore tasks 2026-10-24 14:12:06 +02:00
.goreleaser.yaml ci(goreleaser): align the release config with mcp-proxmox 2026-10-24 14:15:09 +02:00
.markdownlint-cli2.jsonc feat: add mcp server to read and run semaphore tasks 2026-10-24 14:12:06 +02:00
go.mod feat: add mcp server to read and run semaphore tasks 2026-10-24 14:12:06 +02:00
go.sum feat: add mcp server to read and run semaphore tasks 2026-10-24 14:12:06 +02:00
main.go feat: add mcp server to read and run semaphore tasks 2026-10-24 14:12:06 +02:00
readme.md feat: add mcp server to read and run semaphore tasks 2026-10-24 14:12:06 +02:00
renovate.json feat: add mcp server to read and run semaphore tasks 2026-10-24 14:12:06 +02:00
semaphore.go fix: remove unused requireString helper 2026-10-24 14:13:55 +02:00
semaphore_test.go fix(run_task): send ansible options under params so dry_run is applied 2026-10-24 14:21:19 +02:00
tools.go fix(run_task): send ansible options under params so dry_run is applied 2026-10-24 14:21:19 +02:00

mcp-semaphore

MCP server to read and run tasks in Semaphore over stdio.

Environment Variables

Variable Description
SEMAPHORE_URL URL (default https://ops.simoncor.net)
SEMAPHORE_TOKEN API token of the user, sent as bearer (required)
SEMAPHORE_PROJECT_ID Default project (default: the only visible one)

Tools

Tool Description
list_projects List the projects the token can access
list_templates List the templates of a project and survey vars
get_template Get one template including its limit
list_tasks List recent tasks, filter by template or status
get_task Get the details of one task
get_task_output Get the log of a task (last 200 lines by default)
run_task Start a task, optionally waiting for the result
wait_task Wait for a task and return status and log tail

Running tasks

run_task starts a real playbook. Use dry_run to run in check mode first. Survey variables go in extra_vars as a JSON object, for example {"target":"netbox01.siempie.internal"}.

With wait the call returns when the task has finished. A task that ends in anything but success is returned as a tool error.

GET requests are retried on server errors. run_task never is, so a failed request cannot start a playbook twice. Credentials in URLs in task logs (Semaphore prints git clone URLs with their token) are redacted.

Build

go build -o mcp-semaphore .

Usage

Add to your MCP client config:

{
  "mcpServers": {
    "mcp-semaphore": {
      "command": "/path/to/mcp-semaphore",
      "env": {
        "SEMAPHORE_URL": "https://ops.simoncor.net",
        "SEMAPHORE_TOKEN": "your-token-here"
      }
    }
  }
}

The server communicates over stdio using the MCP protocol. With -http :8080 it serves streamable HTTP instead.