GI

GitHub Actions MCP Server for Workflow Automation

Automate GitHub Actions workflows with an MCP server for seamless CI/CD integration, monitoring, and custom workflow orchestration.

Quick Install
npx -y @ko1ynnky/github-actions-mcp-server

Overview

The GitHub Actions MCP Server is a lightweight service that implements the Model Context Protocol (MCP) to expose workflow-centric tools and APIs to large language models and agents running inside CI pipelines. By exposing a stable HTTP interface, the MCP server lets models invoke actions—such as triggering jobs, querying workflow status, or fetching logs—so automation logic can be delegated to model-driven agents while preserving reproducibility and auditability.

This server is useful when you want to combine LLM-based decision making with existing GitHub Actions CI/CD pipelines. Instead of embedding complex orchestration logic directly in workflows, you can run a small MCP server that provides curated tools (APIs) and let models orchestrate jobs, run diagnostics, or apply remediation steps. That makes experiment-driven automation, automated triage, and intelligent reruns easier to implement and observe.

Features

  • Exposes MCP-compatible HTTP endpoints for tool discovery and invocation.
  • Built-in workflow orchestration actions: trigger workflows, re-run jobs, and fetch run logs.
  • Authentication support using GitHub tokens (for GitHub API operations).
  • Health and metadata endpoints for monitoring and discovery.
  • Docker-friendly: run as a container in CI runners or as a standalone service.
  • Example resources and workflow snippets to integrate MCP server with GitHub Actions.

Installation / Configuration

Prerequisites: Docker (recommended) or a Node.js runtime that can run the repository code.

Clone the repository:

git clone https://github.com/ko1ynnky/github-actions-mcp-server.git
cd github-actions-mcp-server

Run with Docker:

# Build (if Dockerfile is present)
docker build -t gha-mcp-server .

# Run, passing a GitHub token and port
docker run -e GITHUB_TOKEN=${GITHUB_TOKEN} -e PORT=8080 -p 8080:8080 gha-mcp-server

Or run locally (Node.js example):

# install dependencies (if package.json exists)
npm install
# start the server
PORT=8080 GITHUB_TOKEN=${GITHUB_TOKEN} npm start

Basic environment variables:

  • PORT: TCP port the server listens on (default: 8080).
  • GITHUB_TOKEN: Personal access token or Actions token for GitHub API interactions.
  • MCP_HOST: optional host binding for multi-network environments.

Example configuration file (mcp-config.json):

{
  "port": 8080,
  "allowed_origins": ["http://localhost:3000"],
  "tools": {
    "trigger_workflow": true,
    "fetch_logs": true,
    "run_command": false
  }
}

Available Tools / Resources

Common endpoints and tools exposed by the server:

EndpointPurpose
GET /healthBasic health check
GET /metadataServer metadata and supported tools
GET /toolsList available tools and schemas
POST /tools/trigger_workflowTrigger a GitHub Actions workflow run
POST /tools/fetch_logsFetch logs for a run or job
POST /tools/rerunRe-run a specific workflow run
POST /tools/run_command(optional) Execute a safe shell command in sandbox

Example: check health

curl http://localhost:8080/health
# {"status":"ok"}

OpenAPI / schema: the repository includes example OpenAPI and MCP metadata descriptors that model agents can consume to discover tool signatures and response formats.

Use Cases

  1. Automated triage and rerun

    • A model monitors failing runs, calls /tools/fetch_logs to collect failure traces, decides on a minimal code patch or configuration change, and triggers a workflow re-run via /tools/trigger_workflow.
  2. Conditional workflow orchestration

    • In multi-stage CI, use an LLM to decide whether to skip expensive integration tests. The model queries job outputs, and calls /tools/rerun to trigger selective jobs only when necessary.
  3. ChatOps for CI

    • Expose MCP endpoints to a chatbot. Developers can ask the bot to “Re-run the last deployment for repo X” and the bot invokes the MCP tool, authenticates with GITHUB_TOKEN, and reports the run URL.
  4. Intelligent monitoring & automated fixes

    • Combine monitoring hooks with model-driven playbooks: on alert, fetch logs, classify the issue, and either create an issue or run an automated remediation workflow.

Example GitHub Actions snippet

This workflow step demonstrates calling the MCP server from a job. Replace ${MCP_URL} with your server address.

jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - name: Request MCP server to trigger workflow
        run: |
          curl -sS -X POST "${MCP_URL}/tools/trigger_workflow" \
            -H "Content-Type: application/json" \
            -d '{"owner":"my-org","repo":"my-repo","workflow":"deploy.yml","ref":"main"}'

Monitoring and Security Notes

  • Always scope GITHUB_TOKEN permissions to the minimum required scopes.
  • Expose the MCP server only to trusted networks or use authentication middleware.
  • Review tool availability in configuration to limit risky operations (e.g., running shell commands).

For detailed examples, OpenAPI schemas, and workflow templates, see the repository at https://github.com/ko1ynnky/github-actions-mcp-server.