npm package: @scarlet-mesh/mcp-ansible-info
Description: MCP Server for Ansible information and playbook management
Latest version: 1.0.0

# Ansible Info MCP Server

## Overview

This MCP (Model Context Protocol) server, `ansible-info`, provides comprehensive information about Ansible automation and helps with playbook management. It offers access to Ansible version information, installation guides, module listings, and automated playbook generation from templates.

## Features

* **Version Information**: Get current Ansible version and documentation links
* **Module Listings**: Access to available Ansible modules and their documentation
* **Installation Guides**: Platform-specific installation instructions for RHEL/CentOS, Ubuntu, and pip-based installations
* **Playbook Generation**: Generate Ansible playbooks from predefined templates with custom variables
* **Template Management**: Support for multiple playbook templates including package installation, service configuration, and user setup

## Tools

The server provides the following MCP tools:

* `get-ansible-version`: Retrieves current Ansible version information and documentation links
* `get-ansible-modules`: Lists available Ansible modules with documentation references
* `get-installation-guide`: Provides detailed installation instructions for different operating systems
* `generate-playbook`: Generates Ansible playbooks from templates with customizable variables

## Available Templates

The server includes several predefined playbook templates:

* `install-package`: Creates playbooks for package installation
* `configure-service`: Generates service configuration and management playbooks
* `setup-user`: Creates user and group management playbooks

## Setup

### Prerequisites

* Node.js
* An MCP client (e.g., a compatible AI tool or application)

### Installation

1. Clone this repository or navigate to the ansible-info package.
2. Install the dependencies:

   ```bash
   npm install
   ```

### Running the Server

1. Start the server:

   ```bash
   npm start
   ```

   The server will listen for MCP requests via standard input/output.

### Usage

To use the server, send MCP requests from a compatible client. Here are example requests for each tool:

* **Get Ansible version:**

  ```json
  {
    "tool_name": "get-ansible-version",
    "input": {}
  }
  ```

* **Get available modules:**

  ```json
  {
    "tool_name": "get-ansible-modules",
    "input": {}
  }
  ```

* **Get installation guide:**

  ```json
  {
    "tool_name": "get-installation-guide",
    "input": {}
  }
  ```

* **Generate playbook from template:**

  ```json
  {
    "tool_name": "generate-playbook",
    "input": {
      "templateName": "install-package",
      "variables": {
        "package_name": "httpd"
      }
    }
  }
  ```

Refer to the MCP client documentation for instructions on sending requests and handling responses.

## Data Structures

The server works with the following data structures:

```typescript
interface AnsibleInfo {
  version: string;
  installation: {
    rhel: string[];
    ubuntu: string[];
    pip: string[];
  };
  documentation: {
    main: string;
    installation: string;
    playbooks: string;
  };
  modules: string[];
}

interface PlaybookTask {
  name: string;
  module: string;
  args: Record<string, any>;
}

interface Playbook {
  name: string;
  hosts: string[];
  tasks: PlaybookTask[];
  vars?: Record<string, any>;
}
```

## Supported Platforms

The installation guide provides instructions for:

* **RHEL/CentOS**: Using subscription-manager and DNF
* **Ubuntu**: Using apt package manager
* **Cross-platform**: Using Python pip

## Template Variables

Each template supports different variables:

* **install-package**: `package_name`
* **configure-service**: `service_name`, `config_template`, `config_path`
* **setup-user**: `username`, `group_name`, `user_shell`