AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

Ansible Development Tools MCP Server: Use Claude Code, Cursor, Copilot, and Gemini for Ansible Development

By Luca Berton · Published 2024-01-01 · Category: installation

Use the Ansible MCP Server with Claude Code, Cursor, Copilot, Gemini CLI, Windsurf, or IBM Bob for AI-driven Ansible dev.

Red Hat has announced the Ansible Development Tools MCP Server (Technical Preview), a flexible AI entry point that exposes Ansible development tools — scaffold, test, and lint — as MCP (Model Context Protocol) tools. This allows any compatible AI coding client to interact with Ansible's development toolchain.

What Is It?

The VS Code Extension MCP integration lets you use your preferred AI coding tool (Claude Code, Cursor, GitHub Copilot, etc.) to: • Scaffold new roles, collections, and playbook structures • Test with Molecule for automated role testing • Lint with ansible-lint for best practices enforcement

All through natural language — the MCP server translates AI requests into actual Ansible development tool commands.

See also: MCP Server for Ansible Automation Platform: Traditional vs AI-Driven Automation

Compatible Clients

The MCP server has been tested with six major AI coding clients:

| Client | Description | Model Support | |---|---|---| | Claude Code | Anthropic's coding agent for terminal | Claude models | | Cursor | AI-powered fork of VS Code | Multiple models (GPT-4, Claude, etc.) | | GitHub Copilot | GitHub's AI pair programmer | OpenAI models | | Gemini CLI | Google's AI terminal tool | Gemini models | | Windsurf | AI-native IDE by Codeium | Multiple models | | IBM Bob | IBM's AI development assistant | IBM watsonx models |

Bring Your Own LLM

The MCP server is model-agnostic — code generation happens through the client's AI model of choice. You're not locked into a specific LLM. Use whatever model works best for your team.

Architecture

┌──────────────────────────────────────────┐
│           Your AI Client                  │
│  (Claude Code / Cursor / Copilot / ...)   │
│                                           │
│  "Create a role for deploying Redis       │
│   on Ubuntu with molecule tests"          │
└──────────────┬───────────────────────────┘
               │ MCP Protocol
               ▼
┌──────────────────────────────────────────┐
│     Ansible Dev Tools MCP Server          │
│                                           │
│  Available Tools:                         │
│  ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│  │ scaffold │ │   test   │ │   lint   │ │
│  │          │ │          │ │          │ │
│  │ • role   │ │ • create │ │ • check  │ │
│  │ • collec.│ │ • run    │ │ • fix    │ │
│  │ • plugin │ │ • verify │ │ • rules  │ │
│  └──────────┘ └──────────┘ └──────────┘ │
└──────────────────────────────────────────┘
               │
               ▼
┌──────────────────────────────────────────┐
│     Ansible Development Tools             │
│  ansible-creator, molecule, ansible-lint  │
└──────────────────────────────────────────┘

See also: Ansible MCP Server: AI-Driven Automation with Model Context Protocol (Complete Guide)

Setup

Prerequisites

# Install Ansible Development Tools
pip install ansible-dev-tools

# This includes: # - ansible-creator (scaffolding) # - molecule (testing) # - ansible-lint (linting) # - ansible-navigator

VS Code Configuration

{
  "ansible.mcp.enabled": true,
  "ansible.mcp.tools": ["scaffold", "test", "lint"]
}

Claude Code Configuration

// ~/.claude/mcp_servers.json
{
  "ansible-dev-tools": {
    "command": "ansible-mcp-server",
    "args": ["--stdio"]
  }
}

Cursor Configuration

// .cursor/mcp.json
{
  "mcpServers": {
    "ansible-dev-tools": {
      "command": "ansible-mcp-server",
      "args": ["--stdio"]
    }
  }
}

Usage Examples

Scaffold a New Role

Prompt: "Create a new Ansible role called redis_cluster for deploying 
         Redis 7 on RHEL 9 with replication support"

MCP Server: → Calls scaffold tool → Creates role directory structure: roles/redis_cluster/ ├── defaults/main.yml (redis_version, port, cluster settings) ├── handlers/main.yml (restart/reload handlers) ├── tasks/main.yml (install, configure, start) ├── templates/redis.conf.j2 ├── molecule/default/ (test scenarios) └── meta/main.yml (role metadata)

Lint and Fix

Prompt: "Lint my playbook at playbooks/deploy.yml and fix all issues"

MCP Server: → Calls lint tool on deploy.yml → Returns: 3 violations found - fqcn[action-core]: Use FQCN for builtin modules (line 12) - yaml[truthy]: Use true/false, not yes/no (line 18) - no-changed-when: Command tasks need changed_when (line 24) → AI generates fixed version with all violations resolved

Run Molecule Tests

Prompt: "Run molecule tests for the nginx role and show me the results"

MCP Server: → Calls test tool → Executes: molecule test -s default → Returns results: ✓ dependency ✓ create (container created) ✓ converge (playbook ran) ✓ idempotence (no changes on re-run) ✓ verify (assertions passed) ✓ destroy (cleanup complete)

Generate Collection Skeleton

Prompt: "Scaffold a new Ansible collection called mycompany.infrastructure 
         with modules for load balancer management"

MCP Server: → Calls scaffold tool → Creates collection structure: mycompany/infrastructure/ ├── galaxy.yml ├── plugins/modules/ ├── roles/ ├── playbooks/ └── tests/

See also: Ansible Development Workspaces: Enterprise-Ready Dev Environments on OpenShift Dev Spaces

Why This Matters

Model Independence

Unlike Ansible Lightspeed (which uses a specific Red Hat-hosted model), the MCP server works with any LLM. Your organization can: • Use GPT-4 via Cursor today • Switch to Claude via Claude Code tomorrow • Run local models via Ollama • Use enterprise models (IBM watsonx, Azure OpenAI)

Tool Integration, Not Lock-in

The MCP server doesn't generate code itself — it provides the tools (scaffold, test, lint). The AI client generates the code using its model, then calls MCP tools to validate and structure it.

Consistent Quality

Regardless of which AI model generates the code, the MCP server ensures: • Scaffolding follows Ansible best practices and directory conventions • Linting catches issues before commit • Testing validates behavior in isolated environments

FAQ

Is the MCP server the same as Ansible Lightspeed?

No. Lightspeed is Red Hat's AI service for content generation using a specific model. The MCP server is model-agnostic — it exposes development tools to any AI client. They complement each other.

Do I need AAP to use the development tools MCP server?

No. The development tools MCP server is part of the Ansible VS Code Extension and works with the open-source ansible-dev-tools. AAP's MCP server (for operations) is a separate, enterprise feature.

Which client should I use?

Choose based on your existing workflow: • VS Code users: GitHub Copilot or Cursor • Terminal users: Claude Code or Gemini CLI • IBM shops: IBM Bob • Multi-model flexibility: Cursor or Windsurf

Is this production-ready?

The MCP server is in Technical Preview. It's suitable for development workflows but should be evaluated thoroughly before standardizing across teams.

Can I extend the MCP server with custom tools?

The MCP protocol is extensible. As the feature matures, expect additional tools beyond scaffold, test, and lint.

Related Articles

Ansible MCP Server: AI-Driven Automation GuideRed Hat Ansible Automation Platform 2.7: What's NewRed Hat Summit 2026 HighlightsHow to Install ansible-lint in macOS

Category: installation

Browse all Ansible tutorials · AnsiblePilot Home