Ansible MCP Server

by tarnover
MIT License
1
  • Linux
  • Apple

Integrations

  • Allows AI assistants to execute Ansible playbooks, view and manage inventory, validate playbook syntax, and preview tasks that would be executed by a playbook.

  • Serves as the runtime environment for the MCP server, allowing the Ansible integration to operate.

Ansible MCP サーバー

Ansible自動化のためのモデルコンテキストプロトコル(MCP)サーバー。このサーバーにより、AIアシスタントはAnsibleと連携し、プレイブックの実行、インベントリ管理、その他のAnsible操作を直接実行できるようになります。

特徴

  • Ansible プレイブックの実行: インベントリ、追加変数、タグ、制限などのパラメータをサポートした Ansible プレイブックを実行します。
  • インベントリの一覧表示: Ansible インベントリ ファイルからホストとグループを表示します。
  • 構文チェック: 実行せずにAnsibleプレイブックの構文を検証する
  • タスクの一覧: プレイブックによって実行されるタスクをプレビューします
  • デフォルトのインベントリにアクセス: リソース API 経由でデフォルトの Ansible インベントリ ファイルにアクセスします。

要件

  • Node.js 18以上
  • npmまたはyarn
  • Ansibleがインストールされ、PATHに設定されている
  • @modelcontextprotocol/sdk (自動的にインストールされます)

インストール

1. リポジトリをクローンする

git clone https://github.com/your-username/mcp-ansible.git cd mcp-ansible

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": { "ansible": { "command": "node", "args": ["/absolute/path/to/mcp-ansible/build/index.js"], "env": {} } } }

/absolute/path/to/mcp-ansibleを実際のインストールパスに置き換えてください。

使用例

MCP サーバーをインストールして構成すると、AI アシスタントに次のツールが提供されます。

1. プレイブックを実行する

<use_mcp_tool> <server_name>ansible</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>ansible</server_name> <tool_name>list_inventory</tool_name> <arguments> { "inventory": "/path/to/inventory.ini" } </arguments> </use_mcp_tool>

3. プレイブックの構文を確認する

<use_mcp_tool> <server_name>ansible</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>ansible</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>ansible</server_name> <uri>ansible://inventory/default</uri> </access_mcp_resource>

発達

プロジェクト構造

mcp-ansible/ ├── src/ │ ├── index.ts # Main entry point │ └── ansible-mcp-server/ │ └── index.ts # Ansible MCP server implementation ├── package.json # Project configuration and dependencies ├── tsconfig.json # TypeScript configuration └── README.md # Documentation

新機能の追加

MCP サーバーに新しい Ansible 機能を追加するには:

  1. src/ansible-mcp-server/index.ts変更する
  2. setupToolHandlersメソッドに新しいツールを追加します
  3. ツールのハンドラー関数を実装する
  4. npm run buildでリビルドする

ライセンス

MITライセンス - 詳細はライセンスを参照

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

このモデル コンテキスト プロトコル サーバーにより、AI アシスタントは Ansible と直接対話できるようになり、プレイブックの実行、インベントリの管理、構文のチェック、その他の Ansible 操作の実行が可能になります。

  1. 特徴
    1. 要件
      1. インストール
        1. 1. リポジトリをクローンする
        2. 2. 依存関係をインストールする
        3. 3. サーバーを構築する
        4. 4. MCP設定を構成する
      2. 使用例
        1. 1. プレイブックを実行する
        2. 2. 在庫リスト
        3. 3. プレイブックの構文を確認する
        4. 4. プレイブックにタスクをリストする
        5. 5. デフォルトの在庫リソースにアクセスする
      3. 発達
        1. プロジェクト構造
        2. 新機能の追加
      4. ライセンス

        Related MCP Servers

        • A
          security
          F
          license
          A
          quality
          A Model Context Protocol server that allows secure execution of pre-approved commands, enabling AI assistants to safely interact with the user's system.
          Last updated -
          1
          3
          18
          JavaScript
        • -
          security
          F
          license
          -
          quality
          A Model Context Protocol server that enables AI assistants to access Flow blockchain data and perform operations such as checking balances, resolving domains, executing scripts, and submitting transactions.
          Last updated -
          JavaScript
          • Linux
          • Apple
        • -
          security
          F
          license
          -
          quality
          A Model Context Protocol server that provides persistent task management capabilities for AI assistants, allowing them to create, update, and track tasks beyond their usual context limitations.
          Last updated -
          1
          TypeScript
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol server that connects AI assistants like Claude to Moneybird accounting software, enabling management of contacts, financial data, products, and business operations through natural language.
          Last updated -
          1
          JavaScript
          MIT License
          • Apple

        View all related MCP servers

        ID: vkbe70d98s