Skip to main content
Glama

Ansible MCP Server

A Model Context Protocol (MCP) server that enables AI assistants to manage infrastructure using Ansible and Terraform.

Features

  • 58 Infrastructure Management Tools

    • Ansible playbook creation and execution

    • Terraform infrastructure provisioning

    • Hardware discovery and inventory

    • Security scanning and auditing

    • Service deployment from catalog

    • Network device management

    • Environment management (test/staging/production)

  • AI-Optimized Design

    • Flexible playbook creation accepting YAML strings

    • Comprehensive error handling

    • Context persistence between sessions

    • Dynamic tool loading for services

  • Cross-Platform Support

    • Linux server deployment

    • Windows client support via SSE proxy

    • Remote server management

Related MCP server: Cloud Pilot MCP

Quick Start

Prerequisites

  • Node.js 16+

  • Ansible 2.9+

  • Terraform (optional)

Installation

# Clone the repository
git clone https://github.com/yourusername/ansible-mcp-server.git
cd ansible-mcp-server

# Install dependencies
npm install

# Copy and configure environment
cp .env.example .env
# Edit .env with your settings

# Run the server
npm start

For Claude Desktop

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "ansible": {
      "command": "node",
      "args": ["/path/to/ansible-mcp-server/src/index.js"],
      "env": {
        "PROXMOX_HOST": "your-proxmox-host",
        "PROXMOX_USER": "root@pam",
        "PROXMOX_PASSWORD": "your-password"
      }
    }
  }
}

Windows Users

For Windows Claude Desktop, use the SSE proxy:

  1. Deploy the MCP server to a Linux host

  2. Run the SSE server on the Linux host

  3. Configure Claude Desktop to use the Windows client

See Windows Setup Guide for details.

Available Tools

Ansible Tools

  • create-playbook-flexible - Create playbooks with YAML strings or objects

  • ansible-playbook - Run Ansible playbooks

  • ansible-task - Run ad-hoc Ansible tasks

  • ansible-role - Execute Ansible roles

  • validate-playbook - Validate playbook syntax

  • create-role-structure - Generate Ansible role directories

Infrastructure Tools

  • hardware-scan - Comprehensive hardware discovery

  • storage-analysis - Storage and SMART health analysis

  • network-interfaces - Network adapter discovery

  • discover-proxmox - Discover Proxmox VMs

  • generate-inventory - Create Ansible inventories

Security Tools

  • security-quick-scan - Quick security assessment

  • security-scan-ports - Port scanning

  • security-check-passwords - Password policy audit

  • security-audit-accounts - User account audit

  • security-check-ssh - SSH configuration audit

Service Management

  • browse-services - Browse service catalog

  • deploy-service - Deploy services from catalog

  • list-environments - List deployment environments

  • deploy-to-environment - Deploy with environment protection

Documentation

Testing

Run the comprehensive feature test suite:

# Run tests in development environment
npm test

# Test specific environments
npm run test:dev      # Development
npm run test:qa       # QA
npm run test:staging  # Staging
npm run test:prod     # Production

# Verbose output for debugging
npm run test:verbose

Our feature tests validate complete VM lifecycle workflows including:

  • VM creation from Proxmox templates

  • Service installation (Jenkins, etc.)

  • Service verification and management

  • VM deletion and cleanup

  • MCP context management

See Testing Guidelines for detailed information.

Contributing

  1. Fork the repository

  2. Create your feature branch (git checkout -b feature/amazing-feature)

  3. Commit your changes (git commit -m 'Add amazing feature')

  4. Push to the branch (git push origin feature/amazing-feature)

  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Available Tools

87 tools
add-external-serverB

Add an external server to the Ansible inventory

Inputs: name (required), ip (required), type (required), sshPort, +4 more.

ansible-playbookC

Run an Ansible playbook

Inputs: playbook (required), inventory, hosts, check, +7 more.

ansible-roleC

Run an Ansible role

Inputs: role (required), hosts, inventory, become, +3 more.

ansible-taskC

Run a single Ansible task ad-hoc

Inputs: task (required), hosts, inventory, become, +3 more.

browse-servicesC

Browse available services in the catalog with optional filtering

Inputs: category, search.

capture-stateB

Capture current infrastructure state for change tracking

Inputs: outputDir, includeDiagrams, captureConfigs.

check-node-capacityC

Check if a node has capacity for requested resources

Inputs: nodeName (required), requestedResources (required).

compare-inventory-stateA

Compare context inventory with live Proxmox inventory and detect deviations

Inputs: autoAlert, updateContext.

compare-service-requirementsC

Compare requirements for multiple services

Inputs: services (required).

create-acceptance-testC

Create an acceptance test deployment

Inputs: serviceName (required), testType (required), testConfig.

create-compliant-templateC

Create a new MCP-compliant template from a base VM

Inputs: baseVmId (required), templateName (required), osType.

create-playbookC

Create a new Ansible playbook file

Inputs: name (required), tasks (required), hosts, vars, +1 more.

create-playbook-flexibleB

Create an Ansible playbook with flexible input (YAML string or structured data)

Inputs: name (required), content (required), directory.

create-role-structureB

Create a complete Ansible role directory structure

Inputs: roleName (required), includeTasks, includeHandlers, includeTemplates, +1 more.

create-vm-enhancedB

Create VM in Proxmox and automatically update infrastructure context

Inputs: vmId (required), vmName (required), serviceName (required), vmIP (required), +5 more.

create-vm-templateC

Generate Terraform configuration for Proxmox VMs

Inputs: name (required), vmid (required), template (required), cores, +4 more.

delete-vm-enhancedB

Delete VM from Proxmox and automatically update infrastructure context

Inputs: vmId (required), serviceName (required), vmIP (required), vmName, +2 more.

deploy-serviceC

Deploy a service from the catalog by creating VM and configuring it

Inputs: serviceName (required), vmName (required), vmid (required), ipAddress, +1 more.

deploy-to-environmentC

Deploy a service to a specific environment

Inputs: serviceName (required), environment (required), config.

detect-existing-serviceC

Detect if a service is already installed in the infrastructure

Inputs: serviceName (required), searchMethod, port.

discover-ansible-controllerB

Discover existing Ansible controllers on the network

Inputs: subnet.

discover-network-devicesC

Discover devices on the network and classify them

Inputs: subnet, knownDevices.

discover-proxmoxB

Discover all VMs on a Proxmox server and extract their configuration

Inputs: proxmoxHost, proxmoxUser, proxmoxPassword, includeTemplates, +1 more.

discover-templatesC

Discover and validate all templates in infrastructure

Inputs: validateAll, fixNonCompliant.

find-best-nodeC

Find the best node for VM placement based on resources and preferences

Inputs: requiredResources (required), preferences.

fix-templateC

Fix non-compliant template issues

Inputs: templateId (required), issue (required), action (required), credentials.

generate-diagramB

Generate infrastructure diagram from current state

Inputs: format, includeNetworks, includeStorage.

generate-inventoryC

Generate an Ansible inventory file from discovered Proxmox VMs

Inputs: outputFile, groupBy, includeOffline.

generate-inventory-playbookC

Generate a playbook for gathering inventory information

Inputs: name (required), targetHosts, gatherFacts, outputFile.

generate-secure-passwordC

Generate a secure password for ansible-admin accounts

Inputs: length, includeSpecial.

get-best-practiceC

Get best practices for MCP operations

Inputs: topic (required).

get-configC

Get current configuration values

Inputs: section.

get-error-recoveryC

Get error recovery steps for common issues

Inputs: error (required).

get-mcp-contextB

Get stored context information from MCP

Inputs: key.

get-service-sopC

Get installation and management procedures for a specific service

Inputs: serviceName (required), section.

get-validation-checksC

Get validation checks for operations

Inputs: phase (required).

gpu-detectionC

Detect and analyze GPU hardware

Inputs: target, includeDriverInfo.

handle-duplicate-serviceC

Handle user decision for duplicate service

Inputs: serviceName (required), existingVm (required), action (required), options.

hardware-benchmarkC

Run basic hardware benchmarks

Inputs: target, tests, duration.

hardware-inventoryC

Manage hardware inventory database

Inputs: action (required), hostname, hardware.

hardware-scanC

Comprehensive hardware scan of a system

Inputs: target, categories, format, saveToInventory.

import-ansible-configB

Import configuration from existing Ansible controller

Inputs: controllerHost (required), sshUser, configTypes.

inventory-statusC

Check inventory status and staleness

Inputs: detailed.

list-environmentsA

List available deployment environments

Inputs: no named parameters.

list-hostsB

List all hosts in inventory

Inputs: inventory, group, format.

list-loaded-toolsA

List all currently loaded tools and services

Inputs: no named parameters.

list-service-sopsA

List all available service-specific SOPs

Inputs: no named parameters.

list-sopsC

List all available standard operating procedures

Inputs: category.

list-vm-credentialsB

List all VMs with stored credentials

Inputs: no named parameters.

load-service-toolsC

Load tools specific to a service

Inputs: serviceName (required).

manage-service-enhancedC

Manage services and automatically update their status in context

Inputs: serviceName (required), action (required), vmIP (required).

migrate-ssh-keysC

Migrate SSH keys from existing controller

Inputs: sourceHost (required), sshUser, keyTypes.

network-interfacesC

Detailed network interface information

Inputs: target, includeVirtual, includeStats.

process-deviationC

Process a specific inventory deviation with user decision

Inputs: deviationType (required), vmId (required), action (required), details.

proxmox-inventoryC

Discover and manage Proxmox infrastructure inventory

Inputs: action (required), force, categories.

query-sopC

Query standard operating procedures for common MCP operations

Inputs: operation (required), category, detailed.

remove-external-serverA

Remove an external server from inventory

Inputs: name (required).

retrieve-vm-credentialsB

Retrieve ansible-admin credentials for a VM

Inputs: vmId (required), decrypt.

security-audit-accountsC

Audit user accounts for security issues

Inputs: checkSudo, checkDefaults.

security-check-firewallB

Check firewall configuration and rules

Inputs: no named parameters.

security-check-passwordsC

Check for weak passwords and password policies

Inputs: checkPolicy.

security-check-sshC

Audit SSH configuration for security

Inputs: no named parameters.

security-check-updatesC

Check for security updates and vulnerable packages

Inputs: checkCVE.

security-quick-scanC

Run a quick security assessment covering basic checks

Inputs: target.

security-scan-portsC

Scan for open ports on specified hosts

Inputs: targets, portRange.

server-debugC

Run diagnostic commands for debugging

Inputs: command (required), safe.

server-healthD

Check server health and dependencies

Inputs: detailed.

server-logsC

Get server logs for debugging

Inputs: service (required), lines, since.

server-restartA

Restart MCP or SSE server to recover from errors

Inputs: service (required), reason.

service-detailsC

Get detailed information about a specific service

Inputs: serviceName (required).

set-mcp-contextB

Store context information in MCP for future sessions

Inputs: key (required), value.

setup-networkC

Configure network settings for VMs

Inputs: gateway (required), nameserver, networkCidr, domain.

setup-proxmoxC

Configure Proxmox connection settings

Inputs: host (required), user, password, apiTokenId, +3 more.

setup-servicesC

Configure IP addresses for services

Inputs: nextcloudIp, mailserverIp, keycloakIp, nginxIp.

setup-wizardA

Run interactive setup wizard to configure all settings

Inputs: no named parameters.

storage-analysisC

Detailed storage analysis including health checks

Inputs: target, includePartitions, includeSmartData.

store-vm-credentialsC

Store ansible-admin credentials for a VM in context

Inputs: vmId (required), vmName (required), vmIp (required), adminUser, +4 more.

terraform-applyB

Apply Terraform configuration to create/update infrastructure

Inputs: directory (required), autoApprove, target.

terraform-outputA

Get outputs from Terraform state

Inputs: directory (required), json.

terraform-planB

Create an execution plan for Terraform changes

Inputs: directory (required), destroy, target, varFile, +1 more.

test-connectionC

Test connection to configured services

Inputs: service (required).

test-server-connectivityC

Test connectivity to a server using various methods

Inputs: target (required), methods.

unload-service-toolsC

Unload tools specific to a service

Inputs: serviceName (required).

update-context-after-operationC

Update MCP context after successful VM or service operations

Inputs: operationType (required), entityId (required), updates (required).

update-ollama-modelsC

Update models on existing Ollama server

Inputs: vmIp (required), action (required), models.

validate-playbookB

Validate an Ansible playbook syntax

Inputs: playbook (required), syntaxCheck.

validate-templateC

Validate a template meets MCP standards

Inputs: templateId (required), testVmId, cleanup.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    C2.4/5.0

    Scored across 87 tools

    Disambiguation2/5

    Several tools have unclear boundaries, such as create-playbook vs create-playbook-flexible, discover-proxmox vs proxmox-inventory, and test-server-connectivity vs test-connection. The large number of overlapping operational areas makes it easy for an agent to select the wrong tool despite mostly descriptive names.

    Naming Consistency3/5

    The tool names consistently use lowercase hyphenated snake_case, which is readable. However, the pattern is mixed: many are verb_noun like create-playbook, but others are noun_noun like inventory-status or noun_verb like server-restart, so the convention is not strictly enforced.

    Tool Count1/5

    With 87 tools, the server is dramatically over-scoped for an Ansible-focused MCP. Many tools cover tangential domains like Terraform, hardware benchmarking, security scanning, and server debugging, making the toolset unwieldy and difficult for agents to navigate effectively.

    Completeness4/5

    The toolset provides broad lifecycle coverage across Ansible playbooks, Proxmox VM management, inventory, credentials, services, security checks, and context persistence. Minor gaps exist, such as no explicit Terraform destroy/state tool or playbook update/delete, but overall agents have enough tools to complete most workflows without dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables comprehensive DevOps infrastructure management through tools for Jenkins, Ansible, Terraform, Kubernetes, and Docker operations. Features a sophisticated memory system for context retention and provides validation, generation, and optimization capabilities across DevOps workflows.
      1
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides AI agents with natural language control over AWS, Azure, GCP, and Alibaba Cloud infrastructure through dynamic API discovery and execution. Supports 51,900+ cloud operations and includes OpenTofu integration for complete infrastructure lifecycle management.
      3
      MIT