Skip to main content
Glama

Ansible MCP Server

by tarnover

MCP システムオペレーター

Infrastructure as Code 運用のための Model Context Protocol (MCP) サーバー。このサーバーにより、AI アシスタントは Ansible および Terraform と連携し、プレイブックや Terraform プランを実行したり、クラウドリソースを管理したり、その他のインフラストラクチャ操作を直接実行したりできるようになります。
(以前はmcp-ansibleとして知られていたプロジェクト)

デモプロジェクト

デモのすべてのコードは、Claude 3.7 Sonnet (OpenRouter経由)、Cline、およびSysOperatorを使用して生成されています。

  • AWS LAMP スタック- AWS でサンプル LAMP スタックをデプロイするためのすべての Ansible コード
  • AWS Terraform LAMP - LAMPスタックに応答するためのTerraformとAnsibleコード

特徴

  • Ansible プレイブックの実行: インベントリ、追加変数、タグ、制限などのパラメータをサポートした Ansible プレイブックを実行します。
  • インベントリの一覧表示: Ansible インベントリ ファイルからホストとグループを表示します。
  • 構文チェック: 実行せずにAnsibleプレイブックの構文を検証する
  • タスクの一覧: プレイブックによって実行されるタスクをプレビューします
  • デフォルトのインベントリにアクセス: リソース API 経由でデフォルトの Ansible インベントリ ファイルにアクセスします。
  • AWS 統合: AWS リソース (EC2、S3、VPC、CloudFormation など) を管理します
  • Terraform サポート: Terraform コマンド (init、plan、apply、destroy、output など) を実行します。
  • tflocal 統合: ローカル クラウド開発用の LocalStack で Terraform 構成をテストする
  • LocalStack サポート: 実際の AWS 認証情報なしで LocalStack を使用して AWS 操作をローカルでテストします

要件

  • Node.js 18以上
  • npmまたはyarn
  • 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 設定構成ファイルに追加します。

Claude 拡張機能付きの VSCode の場合:

  • ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonにあるファイルを編集します。

Claude デスクトップ アプリの場合:

  • 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 サーバーをインストールして構成すると、AI アシスタントに次のツールが提供されます。

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. プレイブックの構文を確認する

<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. Terraform 適用

<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 を使用した Terraform (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統合

このプロジェクトには、実際のAWS認証情報を使用せずにAWSオペレーションをローカルでテストするためのLocalStackとの統合が含まれています。LocalStackとの統合により、以下のことが可能になります。

  1. AWS サービスをローカルで使用する Ansible プレイブックをテストする
  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ライセンス - 詳細はライセンスを参照

Related MCP Servers

  • A
    security
    A
    license
    A
    quality
    This server implements the Model Context Protocol to facilitate meaningful interaction and understanding development between humans and AI through structured tools and progressive interaction patterns.
    Last updated -
    13
    51
    MIT License
  • -
    security
    F
    license
    -
    quality
    A comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.
    Last updated -
    3
    1
    TypeScript
  • A
    security
    A
    license
    A
    quality
    A Model Context Protocol server enabling AI assistants to directly interact with infrastructure tools like Ansible and Terraform for executing playbooks, managing cloud resources, and performing other infrastructure operations.
    Last updated -
    18
    13
    TypeScript
    MIT License
    • Apple
    • Linux
  • -
    security
    F
    license
    -
    quality
    A Model Context Protocol server that provides AI models with structured access to external data and services, acting as a bridge between AI assistants and applications, databases, and APIs in a standardized, secure way.
    Last updated -
    1
    Python

View all related MCP servers

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tarnover/mcp-ansible'

If you have feedback or need assistance with the MCP directory API, please join our Discord server