Skip to main content
Glama
Ansible MCP Server
by tarnover

MCP SysOperator

Сервер Model Context Protocol (MCP) для операций Infrastructure as Code. Этот сервер позволяет помощникам ИИ взаимодействовать с Ansible и Terraform, выполнять сценарии и планы Terraform, управлять облачными ресурсами и выполнять другие операции по инфраструктуре напрямую.
(Проект ранее был известен как mcp-ansible )

Демонстрационные проекты

Весь код в демонстрациях сгенерирован с использованием Claude 3.7 Sonnet (через OpenRouter), Cline и SysOperator

  • AWS LAMP Stack — весь код Ansible для развертывания примера стека LAMP в AWS

  • AWS Terraform LAMP — код Terraform и Ansible для ответа на стек LAMP

Related MCP server: AAP MCP Server

Функции

  • Запуск Ansible Playbooks : выполнение Ansible Playbooks с поддержкой таких параметров, как инвентарь, дополнительные переменные, теги и ограничения.

  • Список инвентаря : просмотр хостов и групп из файла инвентаря Ansible

  • Проверка синтаксиса : проверка синтаксиса Ansible playbook без выполнения

  • Список задач : предварительный просмотр задач, которые будут выполнены в соответствии с планом действий.

  • Доступ к инвентарю по умолчанию : доступ к файлу инвентаря Ansible по умолчанию через API ресурсов.

  • Интеграция с AWS : управление ресурсами AWS (EC2, S3, VPC, CloudFormation и т. д.)

  • Поддержка Terraform : выполнение команд Terraform (инициализация, планирование, применение, уничтожение, вывод и т. д.)

  • Интеграция tflocal : тестирование конфигураций Terraform с LocalStack для разработки локального облака

  • Поддержка LocalStack : локальное тестирование операций AWS с использованием LocalStack без реальных учетных данных AWS.

Требования

  • Node.js 18 или выше

  • npm или пряжа

  • Ansible установлен и находится в PATH

  • @modelcontextprotocol/sdk (устанавливается автоматически)

  • Для операций AWS: AWS CLI и действительные учетные данные

  • Для LocalStack: LocalStack установлен и запущен, awslocal CLI

Установка

1. Клонировать репозиторий

git clone https://github.com/tarnover/mcp-sysoperator.git
cd mcp-sysoperator

2. Установка зависимостей

npm install

3. Сборка сервера

npm run build

4. Настройте параметры MCP

Добавьте сервер Ansible MCP в файл конфигурации настроек MCP.

Для VSCode с расширением Claude:

  • Отредактируйте файл ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

Для приложения Claude Desktop:

  • macOS: Измените ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: Измените %APPDATA%\Claude\claude_desktop_config.json

  • Linux: Измените ~/.config/Claude/claude_desktop_config.json

Добавьте в раздел mcpServers следующее:

{
  "mcpServers": {
    "sysoperator": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-sysoperator/build/index.js"],
      "env": {}
    }
  }
}

Обязательно замените /absolute/path/to/mcp-sysoperator на фактический путь к вашей установке.

Примеры использования

После установки и настройки сервер MCP предоставляет следующие инструменты помощнику на основе искусственного интеллекта:

1. Запустите план действий

<use_mcp_tool>
<server_name>sysoperator</server_name>
<tool_name>run_playbook</tool_name>
<arguments>
{
  "playbook": "/path/to/your/playbook.yml",
  "inventory": "/path/to/inventory.ini",
  "extraVars": {
    "var1": "value1",
    "var2": "value2"
  },
  "tags": "setup,configure",
  "limit": "webservers"
}
</arguments>
</use_mcp_tool>

2. Список инвентаря

<use_mcp_tool>
<server_name>sysoperator</server_name>
<tool_name>list_inventory</tool_name>
<arguments>
{
  "inventory": "/path/to/inventory.ini"
}
</arguments>
</use_mcp_tool>

3. Проверьте синтаксис Playbook

<use_mcp_tool>
<server_name>sysoperator</server_name>
<tool_name>check_syntax</tool_name>
<arguments>
{
  "playbook": "/path/to/your/playbook.yml"
}
</arguments>
</use_mcp_tool>

4. Перечислите задачи в книге действий

<use_mcp_tool>
<server_name>sysoperator</server_name>
<tool_name>list_tasks</tool_name>
<arguments>
{
  "playbook": "/path/to/your/playbook.yml"
}
</arguments>
</use_mcp_tool>

5. Доступ к ресурсу инвентаря по умолчанию

<access_mcp_resource>
<server_name>sysoperator</server_name>
<uri>sysoperator://inventory/default</uri>
</access_mcp_resource>

6. Операции AWS S3

<use_mcp_tool>
<server_name>sysoperator</server_name>
<tool_name>aws_s3</tool_name>
<arguments>
{
  "action": "list_buckets",
  "region": "us-east-1"
}
</arguments>
</use_mcp_tool>

7. Инициализация и план Terraform

<use_mcp_tool>
<server_name>sysoperator</server_name>
<tool_name>terraform</tool_name>
<arguments>
{
  "action": "init",
  "workingDir": "/path/to/terraform/project"
}
</arguments>
</use_mcp_tool>

<use_mcp_tool>
<server_name>sysoperator</server_name>
<tool_name>terraform</tool_name>
<arguments>
{
  "action": "plan",
  "workingDir": "/path/to/terraform/project",
  "vars": {
    "instance_type": "t2.micro",
    "region": "us-west-2"
  }
}
</arguments>
</use_mcp_tool>

8. Терраформировать применить

<use_mcp_tool>
<server_name>sysoperator</server_name>
<tool_name>terraform</tool_name>
<arguments>
{
  "action": "apply",
  "workingDir": "/path/to/terraform/project",
  "autoApprove": true,
  "vars": {
    "instance_type": "t2.micro",
    "region": "us-west-2"
  }
}
</arguments>
</use_mcp_tool>

9. Терраформирование с LocalStack (tflocal)

<use_mcp_tool>
<server_name>sysoperator</server_name>
<tool_name>terraform</tool_name>
<arguments>
{
  "action": "apply",
  "workingDir": "/path/to/terraform/project",
  "useLocalstack": true,
  "autoApprove": true,
  "vars": {
    "instance_type": "t2.micro",
    "region": "us-west-2"
  }
}
</arguments>
</use_mcp_tool>

Интеграция LocalStack

Этот проект включает интеграцию с LocalStack для тестирования операций AWS локально без реальных учетных данных AWS. Интеграция с LocalStack позволяет:

  1. Тестирование сценариев Ansible, использующих сервисы AWS локально

  2. Разрабатывайте и тестируйте операции AWS без дополнительных затрат на AWS

  3. Запускайте тесты, не требуя реальных учетных данных AWS

  4. Проверьте код своей инфраструктуры перед развертыванием в реальной среде AWS

Использование LocalStack

Подробные инструкции по использованию интеграции LocalStack см. в файле LocalStack README .

Быстрый старт:

# Install LocalStack and awslocal CLI
pip install localstack awscli-local

# Start LocalStack
localstack start

# Run the sample playbook
node localstack/run_sample_playbook.mjs

Разработка

Структура проекта

mcp-sysoperator/
├── src/
│   ├── index.ts                  # Main entry point
│   └── ansible-mcp-server/       # Will be renamed in filesystem in future updates
│       ├── index.ts              # MCP SysOperator server implementation
│       ├── common/               # Common utilities and types
│       │   ├── errors.ts         # Error definitions
│       │   ├── types.ts          # Type and schema definitions
│       │   ├── utils.ts          # Utility functions
│       │   └── version.ts        # Version information
│       └── operations/           # Operation handlers
│           ├── ad_hoc.ts         # Ansible ad-hoc commands
│           ├── aws.ts            # AWS operations
│           ├── inventory.ts      # Ansible inventory operations
│           ├── playbooks.ts      # Ansible playbook operations
│           ├── terraform.ts      # Terraform operations
│           └── vault.ts          # Ansible vault operations
├── localstack/                   # LocalStack integration
│   ├── README.md                 # LocalStack documentation
│   ├── sample_playbook.yml       # Sample playbook for LocalStack
│   ├── inventory.ini             # Sample inventory for LocalStack
│   ├── run_sample_playbook.mjs   # Script to run sample playbook
│   └── utils.localstack.ts       # Modified utils for LocalStack
├── package.json                  # Project configuration and dependencies
├── tsconfig.json                 # TypeScript configuration
└── README.md                     # Documentation

Добавление новых функций

Чтобы добавить новые возможности на сервер MCP:

  1. Измените src/ansible-mcp-server/index.ts (в будущем: src/sysoperator/index.ts )

  2. Добавьте новый инструмент в метод setupToolHandlers

  3. Реализуйте функцию обработчика для вашего инструмента в соответствующем файле операций.

  4. Добавьте определение схемы в common/types.ts

  5. Пересобрать с помощью npm run build

⚠️ Отказ от ответственности

SysOperator в настоящее время находится в стадии активной разработки и проходит обширное тестирование. В настоящее время не рекомендуется использовать его в производственных средах. В программном обеспечении могут возникнуть критические изменения, неполные функции или неожиданное поведение.

Используйте на свой страх и риск.

Лицензия

Лицензия MIT — подробности см. в разделе ЛИЦЕНЗИЯ

Available Tools

18 tools
aws_cloudformationC

Manage AWS CloudFormation stacks

Inputs: action (required), region (required), capabilities, parameters, +4 more.

aws_dynamic_inventoryC

Create AWS dynamic inventory

Inputs: region (required), compose, filters, hostnames, +1 more.

aws_ec2C

Manage AWS EC2 instances (list, create, start, stop, terminate)

Inputs: action (required), region (required), count, filters, +9 more.

aws_elbC

Manage AWS Elastic Load Balancers

Inputs: action (required), region (required), healthCheck, lbType, +7 more.

aws_iamC

Manage AWS IAM roles and policies

Inputs: action (required), region (required), assumeRolePolicyDocument, managedPolicies, +5 more.

aws_lambdaC

Manage AWS Lambda functions

Inputs: action (required), region (required), description, environment, +12 more.

aws_rdsC

Manage AWS RDS database instances

Inputs: action (required), region (required), allocatedStorage, backupRetentionPeriod, +10 more.

aws_route53C

Manage AWS Route53 DNS records and zones

Inputs: action (required), region (required), comment, recordName, +6 more.

aws_s3C

Manage AWS S3 buckets and objects

Inputs: action (required), region (required), acl, bucket, +5 more.

aws_vpcC

Manage AWS VPC networks

Inputs: action (required), region (required), cidrBlock, dnsHostnames, +5 more.

check_syntaxA

Check syntax of an Ansible playbook without executing it

Inputs: playbook (required).

list_inventoryC

List Ansible inventory hosts and groups

Inputs: inventory.

list_tasksC

List all tasks that would be executed by a playbook

Inputs: playbook (required).

run_ad_hocC

Run an Ansible ad-hoc command against specified hosts

Inputs: pattern (required), args, become, extra_vars, +2 more.

run_playbookC

Run an Ansible playbook

Inputs: playbook (required), extraVars, inventory, limit, +1 more.

terraformC

Execute Terraform commands (init, plan, apply, destroy, validate, output, etc.)

Inputs: action (required), workingDir (required), autoApprove, backendConfig, +8 more.

vault_decrypt_stringC

Decrypt a string encrypted with Ansible Vault

Inputs: string (required), vault_id, vault_password_file.

vault_encrypt_stringC

Encrypt a string using Ansible Vault

Inputs: string (required), name, vault_id, vault_password_file.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 18 tools

    Disambiguation4/5

    Most tools are clearly distinct by AWS service or Ansible function, with minimal overlap. However, aws_ec2's broad scope (list, create, start, stop, terminate) could be confused with more specific AWS tools, and terraform seems out of place in an Ansible-focused server, creating some ambiguity.

    Naming Consistency4/5

    Tools follow a consistent snake_case pattern throughout, with clear verb_noun structures (e.g., run_playbook, list_inventory). The main deviation is the terraform tool, which lacks a verb prefix, slightly breaking the pattern.

    Tool Count3/5

    With 18 tools, the count is borderline high for an Ansible server, especially since it includes AWS-specific tools that might be better scoped separately. It feels slightly heavy, but still manageable given the domain coverage.

    Completeness4/5

    The toolset covers core Ansible operations (syntax checking, inventory, tasks, ad-hoc commands, playbooks, vault) and extensive AWS management, but lacks tools for other cloud providers or non-AWS infrastructure, which could be gaps for broader automation needs.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      Not graded
      maintenance
      An MCP server for Infrastructure as Code that enables AI assistants to manage cloud resources through Ansible and Terraform operations. It supports executing playbooks, managing AWS services, and running Terraform commands with optional LocalStack integration.
      18
      -
    • A
      license
      B
      quality
      D
      maintenance
      Enterprise-grade MCP server exposing Ansible Automation Platform 2.x as a complete AI interface for LLMs, enabling natural language management of automation resources.
      86
      1
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      MCP server that exposes Ansible modules to AI agents with a search-schema-check-execute workflow, enabling safe ad-hoc runs via check mode by default. It provides tools to search modules, fetch schemas, run modules, and list collections.
      5
      3
      Apache 2.0