Skip to main content
Glama
Foreman MCP Server

Foreman MCP Server

Official
by theforeman

foreman-mcp-server

How to run

Using VSCode with Copilot

Start the server via uv

uv run foreman-mcp-server \
  --foreman-url https://foreman.example.com \
  --foreman-username $FOREMAN_USERNAME \
  --foreman-password $FOREMAN_PASSWORD \
  --log-level debug \
  --host localhost \
  --port 8080 \
  --transport stdio \
  --no-verify-ssl

Default values if not provided:

  --foreman-url https://$hostname
  --log-level INFO
  --host '127.0.0.1'
  --port 8080
  --transport streamable-http
  --verify-ssl

Using custom CA certificates

If your Foreman instance uses a custom CA certificate, you have several options:

  1. Use the --ca-bundle option or FOREMAN_CA_BUNDLE environment variable:

uv run foreman-mcp-server \
  --foreman-url https://foreman.example.com \
  --foreman-username $FOREMAN_USERNAME \
  --foreman-password $FOREMAN_PASSWORD \
  --ca-bundle /path/to/ca-bundle.pem
  1. Place your CA certificate as ./ca.pem in the working directory (automatically detected):

cp /path/to/ca-bundle.pem ./ca.pem
uv run foreman-mcp-server \
  --foreman-url https://foreman.example.com \
  --foreman-username $FOREMAN_USERNAME \
  --foreman-password $FOREMAN_PASSWORD

Related MCP server: mcp-infrastructure-servers

Start the server via podman

First, build the container:

podman build -t foreman-mcp-server .

Now run the container:

podman run -it -p 8080:8080 foreman-mcp-server \
  --foreman-url https://my-foreman-instance.something.somewhere \
  --log-level debug \
  --host localhost \
  --port 8080 \
  --transport streamable-http

Using custom CA certificates with containers

To use custom CA certificates with the container, you can either mount your CA bundle to the default ca.pem location (automatically detected) or specify a custom path:

Option 1: Mount to default location (recommended)

# Standard container or UBI9 image - mount to /app/ca.pem
podman run -it -p 8080:8080 \
  -v /path/to/your-ca-bundle.pem:/app/ca.pem:ro,Z \
  foreman-mcp-server \
  --foreman-url https://my-foreman-instance.something.somewhere \
  --transport streamable-http

**Option 2: Mount to custom location**
```shell
podman run -it -p 8080:8080 \
  -v /path/to/your-ca-bundle.pem:/custom/ca.pem:ro,Z \
  foreman-mcp-server \
  --foreman-url https://my-foreman-instance.something.somewhere \
  --ca-bundle /custom/ca.pem \
  --transport streamable-http

Configure VSCode

# settings.json
{
    "mcp": {
        "servers": {
            "foreman": {
                "url": "http://127.0.0.1:8080/mcp/sse",
                "type": "http",
                  "headers": {
                    "FOREMAN_USERNAME": "login",
                    "FOREMAN_TOKEN": "token"
                  }
            }
        }
    },
}

Run VSCode client

  • Press Ctrl+Shift+P

  • Select MCP: List Servers command

  • Select foreman

  • Press Start Server

Using in Copilot Chat

  • Press Ctrl+Alt+I to open the chat

  • In Configure Tools select the MCP tools only

  • Prompts can be listed in the chat, e.g. /mcp.foreman.basic_hosts_pending_sec_updates_static_report

  • Resources can be attached via Add Context... > MCP Resources > resource

Using MCP Inspector

For use with mcp inspector

  1. Start the inspector with npx @modelcontextprotocol/inspector

  2. Open http://localhost:6274 in your browser

  3. Set Type to Streamable HTTP and URL to http://localhost:8080/mcp

  4. Click connect

Using Claude Desktop on Linux

Note: this is highly experimental. Tested in a virtual machine running CentOS Stream 9.

Installation

Configuration

# ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "foreman": {
      "command": "uv",
      "args": ["--directory", "/home/$USER/foreman-mcp-server", "run","foreman-mcp-server", "--transport", "stdio", "--foreman-username", "login", "--foreman-password", "password/token"],
    }
  }
}

To use custom CA certificates with Claude Desktop:

# ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "foreman": {
      "command": "uv",
      "args": ["--directory", "/home/$USER/foreman-mcp-server", "run","foreman-mcp-server", "--transport", "stdio", "--foreman-username", "login", "--foreman-password", "password/token", "--ca-bundle", "/path/to/ca-bundle.pem"],
    }
  }
}

Run Claude client

This will launch UI application, log in into your account. It will start and connect to the MCP server automatically.

claude-desktop
  • Click + button > Add from foreman: > Select any of Prompts and Resources from the server

  • Click Configuration button to select Tools from the server

Remote Execution Features

The MCP server can trigger remote execution jobs on Foreman hosts. This functionality is opt-in and disabled by default for security reasons.

Enabling Remote Execution

To enable remote execution, you must explicitly specify which remote execution features are allowed using the --allowed-rex-features option or the FOREMAN_ALLOWED_REX_FEATURES environment variable:

uv run foreman-mcp-server \
  --foreman-url https://foreman.example.com \
  --foreman-username $FOREMAN_USERNAME \
  --foreman-password $FOREMAN_PASSWORD \
  --allowed-rex-features "katello_errata_install,katello_package_install"

Or using the environment variable:

export FOREMAN_ALLOWED_REX_FEATURES="katello_errata_install,katello_package_install"
uv run foreman-mcp-server ...

How It Works

  1. Allowlist-based security: Only remote execution features explicitly listed in --allowed-rex-features can be triggered. Any attempt to use a feature not on the list will be rejected.

  2. Available features resource: When allowed features are configured, a resource becomes available at foreman://remote_execution/allowed_features. This resource returns information about each allowed feature, including:

    • Feature label, ID, name, and description

    • Associated job template ID and name

    • Any errors (e.g., if the feature doesn't exist in Foreman)

  3. Trigger tool: The trigger_remote_execution_job tool is only enabled when at least one feature is allowed. To use it, the AI agent should:

    1. Read the "Allowed Remote Execution Features" resource to see available features

    2. Pick the appropriate feature for the task

    3. Use call_foreman_api_get to read the feature's job template (resource: "job_templates", action: "show") to see what inputs it accepts

    4. Call trigger_remote_execution_job with the feature label, search query, and appropriate inputs

Common Remote Execution Features

Here are some commonly used remote execution feature labels:

Feature Label

Description

katello_errata_install

Install errata on hosts

katello_package_install

Install packages on hosts

katello_package_update

Update packages on hosts

katello_package_remove

Remove packages from hosts

katello_host_tracer_resolve

Resolve Tracer-detected services

To find all available features in your Foreman instance, you can use the API:

curl -u $USER:$PASSWORD https://foreman.example.com/api/remote_execution_features

Content View Actions

The MCP server can publish, promote, and incrementally update content views. This functionality is opt-in and disabled by default for security reasons.

Enabling Content View Actions

To enable content view actions, you must explicitly specify which actions are allowed using the --allowed-cv-actions option or the FOREMAN_ALLOWED_CV_ACTIONS environment variable:

uv run foreman-mcp-server \
  --foreman-url https://foreman.example.com \
  --foreman-username $FOREMAN_USERNAME \
  --foreman-password $FOREMAN_PASSWORD \
  --allowed-cv-actions "publish,promote,incremental_update"

Or using the environment variable:

export FOREMAN_ALLOWED_CV_ACTIONS="publish,promote,incremental_update"
uv run foreman-mcp-server ...

How It Works

  1. Allowlist-based security: Only content view actions explicitly listed in --allowed-cv-actions can be triggered. If the option is not set or empty, all content view tools are disabled.

  2. Available tools: When specific actions are allowed, the corresponding tools become enabled:

Action

Tool

Description

publish

publish_content_view

Publishes a new version of a content view

promote

promote_content_view_version

Promotes a content view version to lifecycle environments

incremental_update

incremental_content_view_update

Performs an incremental update adding errata to content view versions

  1. Usage flow: To use the content view tools, the AI agent should:

    1. Use call_foreman_api_get to find the content view (resource: "content_views", action: "index")

    2. Publish a new version with publish_content_view

    3. Promote the version with promote_content_view_version

    4. Use poll_task to monitor the task progress

Available Tools

5 tools
call_foreman_api_getCall Foreman API GET ActionC
Read-only

Calls GET action on Foreman API.

Inputs: resource (required), action (required), params (required).

fetch_foreman_dsl_docsFetch Foreman DSL DocumentationB
Read-onlyIdempotent

Fetches the DSL documentation from Foreman for a specific section.

Inputs: section (required).

get_foreman_api_resource_docsGet Foreman API Resource DocumentationB
Read-onlyIdempotent

Fetches the documentation for a specific Foreman API resource.

Inputs: resource (required).

get_foreman_dsl_docsGet Foreman DSL DocumentationA
Read-onlyIdempotent

Reads from cache and returns the documentation of available macros for template writing in Markdown format based on provided section.

Inputs: section (required).

poll_taskPoll Task Until CompletionA
Read-onlyIdempotent

Polls a Foreman task until it reaches a terminal state (stopped or paused). Returns the final task state. Supports background execution for long-running tasks.

Inputs: task_id (required), timeout, poll_interval.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 5 tools

    Disambiguation4/5

    Most tools have distinct purposes: call_foreman_api_get handles API calls, fetch_foreman_dsl_docs and get_foreman_dsl_docs both fetch DSL documentation but differ slightly in source (direct fetch vs. cache read), get_foreman_api_resource_docs fetches API resource docs, and poll_task handles task polling. There is minor overlap between the two DSL documentation tools, which could cause slight confusion, but descriptions clarify the difference.

    Naming Consistency3/5

    The naming is mixed but readable: tools use verb_noun patterns like call_foreman_api_get and fetch_foreman_dsl_docs, but there are inconsistencies such as get_foreman_api_resource_docs (longer noun phrase) and poll_task (shorter, simpler). While not chaotic, the lack of a uniform structure (e.g., varying verb choices and noun lengths) reduces predictability.

    Tool Count5/5

    With 5 tools, this server is well-scoped for interacting with Foreman, covering key areas like API calls, documentation retrieval, and task management. Each tool appears to earn its place without being overly sparse or bloated, making it manageable for agents to use effectively.

    Completeness3/5

    The tool set covers documentation fetching and basic API/task operations, but there are notable gaps for a Foreman server, such as missing CRUD operations for resources (e.g., create, update, delete), limited API actions beyond GET, and no tools for managing hosts or other core Foreman entities. This could lead to agent workarounds or failures in broader workflows.

    Maintenance

    ActivityMaintained
    ResponsivenessLimited data

    Related MCP Connectors

    • Contractor Foreman MCP server for ChatGPT, Claude and any AI agent: create estimate, add daily log, create change order, update schedule, list invoices and get job costing in your own Contractor Foreman account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Contractor Foreman yourself; Cotlet does not store your password and you need no Contractor Foreman API key. About the official Contractor Foreman API: Contractor Foreman has no public API (checked 11 Oct 2026). Its only programmatic access is a Zapier app with 7 triggers for leads, customers and file uploads, and 2 actions: Create Lead and Create Customer. Setup and FAQ: https://cotlet.dev/integrations/contractor-foreman-api-mcp-server

    • The Cortex MCP server provides read-only access to real-time engineering context from the Cortex developer portal, allowing AI coding assistants to answer natural language questions about your organization's catalog (microservices, libraries, domains, teams, infrastructure), scorecards (engineering standards and best practices), initiatives (goals and deadlines), and Engineering Intelligence metrics. It includes tools for querying documentation, tracking personal entities, and accessing AI-assisted insights across the entire Cortex ecosystem.

      https://mcp.cortex.io/mcp
    • Procore MCP server for ChatGPT, Claude and any AI agent: list RFIs, create RFI, list submittals, create punch list item, create observation and add manpower entry in your own Procore account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Procore yourself; Cotlet does not store your password and you need no Procore API key. About the official Procore API: Procore has a REST API with OAuth 2.0 and a sandbox, but publishes no MCP server for your own AI agent (checked 5 Nov 2026). The API runs through an app that you register in the Developer Portal and a company admin installs. Setup and FAQ: https://cotlet.dev/integrations/procore-api-mcp-server

      https://cotlet.dev/mcp/v1/procore
    • Redmine MCP server for ChatGPT, Claude and any AI agent: create issue, update issue, log time, list my issues, add comment and list projects in your own Redmine account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Redmine yourself; Cotlet does not store your password and you need no Redmine API key. About the official Redmine API: Yes, Redmine has a REST API (checked 16 Oct 2026). Issues, projects, users and time entries are marked Stable, in JSON or XML, with an API key per user; an administrator must first turn on Enable REST API under Administration > Settings > API. Setup and FAQ: https://cotlet.dev/integrations/redmine-api-mcp-server

      https://cotlet.dev/mcp/v1/redmine

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI coding agents to interact with Redmine projects, issues, time tracking, and members through natural language via the Model Context Protocol.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI language models to securely interact with Jenkins through the Model Context Protocol, exposing tools for querying and managing jobs, builds, nodes, queues, views, plugins, artifacts, and Groovy scripts.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to securely interact with Jenkins through the Model Context Protocol, allowing inspection and management of jobs, builds, nodes, queues, plugins, artifacts, and pipelines.
      -