Introduction

Red Hat's Ansible MCP Server (Model Context Protocol) connects large language models directly to Ansible Automation Platform. LLMs can launch jobs, analyze failures, validate surveys, and manage automation — all through natural language interactions. Demonstrated live at Red Hat Tech Day Netherlands 2026.

What is MCP?

The Model Context Protocol (MCP) is an open standard for connecting AI models to external tools and data sources. The Ansible MCP Server exposes AAP as a set of tools that any MCP-compatible AI client can use.

Architecture

┌─────────────────┐     ┌──────────────┐     ┌─────────────────┐
│  AI Client      │────▶│  MCP Server  │────▶│  AAP Controller │
│  (Cursor/VSCode)│◀────│  (Ansible)   │◀────│  (Jobs/Inventory)│
└─────────────────┘     └──────────────┘     └─────────────────┘
         │                                            │
         ▼                                            ▼
    Natural Language                          Playbook Execution
    "Fix the web server"                     ansible-playbook fix.yml

MCP Tool Sets (6 Categories)

Tool SetCapabilities
Job ManagementLaunch, monitor, cancel jobs
InventoryQuery hosts, groups, variables
TemplatesList, describe job templates
CredentialsValidate credential access
ProjectsSync, update SCM projects
AnalyticsFailed job analysis, trends

Live Demo: Cursor IDE Integration

User: "Why did the last deployment to production fail?"

AI + MCP: 
1. Queries AAP for recent failed jobs
2. Retrieves job stdout and error details
3. Analyzes root cause
4. Suggests fix: "The deployment failed because the SSL cert 
   expired. I can launch the cert-renewal template — shall I?"

User: "Yes, do it"

AI + MCP:
1. Launches cert-renewal job template
2. Monitors execution
3. Reports: "Certificate renewed. Deployment retried successfully."

Setting Up Ansible MCP Server

# Install MCP server
pip install ansible-mcp-server

# Configure connection to AAP
export AAP_URL=https://controller.example.com
export AAP_TOKEN=your-api-token

# Start MCP server
ansible-mcp-server --port 8080

VS Code Configuration

{
  "mcp.servers": {
    "ansible": {
      "command": "ansible-mcp-server",
      "args": ["--port", "8080"],
      "env": {
        "AAP_URL": "https://controller.example.com",
        "AAP_TOKEN": "${secret:aap-token}"
      }
    }
  }
}

Automation Intelligent Assistant (AIA)

The full AIA architecture includes:

  • BYOK RAG — Bring Your Own Knowledge for context-aware responses
  • BYOM — Bring Your Own Model (Red Hat AI, OpenAI, Azure, watsonx, Gemini)
  • MCP Server — Hosted, production-grade tool exposure
  • Human-in-the-loop — Approval gates for critical operations

Use Cases

1. Failed Job Root Cause Analysis

AI automatically analyzes failed jobs, correlates with inventory changes, and suggests fixes.

2. Natural Language Job Launching

"Deploy the latest version of the payments service to staging with the blue-green strategy."

3. Survey Validation

AI validates job template survey inputs before launch, preventing misconfiguration.

4. Compliance Reporting

"Show me all hosts that haven't run the security baseline in the last 30 days."

Security Considerations

  1. RBAC enforcement — MCP respects AAP role-based access control
  2. Audit trail — all AI-initiated actions logged in AAP
  3. Approval gates — critical operations require human confirmation
  4. Token scoping — limit MCP server to specific AAP permissions
  5. Network isolation — run MCP server in trusted network segment

Best Practices

  1. Start read-only — give AI query access before execution access
  2. Approval gates for production — never auto-execute in prod without human review
  3. Audit everything — correlate MCP actions with AAP audit logs
  4. Scope tokens narrowly — principle of least privilege
  5. Test in staging — validate AI behavior before production access

Conclusion

The Ansible MCP Server bridges the gap between AI assistants and infrastructure automation. It enables natural language operations while maintaining AAP's security model. Start with read-only access for analytics and troubleshooting, then gradually enable execution with approval gates.