
rlopez133/mcp
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
This guide will walk you through setting up the MCP Servers + Claude Desktop portions of the demo that focused on using Claude Desktop to interact with your Ansible Automation Platform and OpenShift...
概要
This guide will walk you through setting up the MCP Servers + Claude Desktop portions of the demo that focused on using Claude Desktop to interact with your Ansible Automation Platform and OpenShift Cluster environments. Ensure you have the following installed. - An Ansible Automation Platform (AAP) environment - An OpenShift Cluster with OpenShift Virtualization - Claude Desktop installed on your laptop (Pro Plan required for best results) - Python 3.10 or higher installed on your laptop - Ensure you are authenticated with your OpenShift cluster (e.g. exporting kubeconfig) Install uv and setup your Python project and environment. Install jbang which will be used when using the Kubernetes MCP Server. (jbang needs to be installed globally, recommend using the homebrew install pattern. If you install it locally (the curl pattern), Claude won't be able to access it). Restart your terminal to ensure that the uv and jbang command are now available.
README
以下は原文 README の抜粋です。原文を見る。
Setup of the Environment for the AI Powered Ansible & OpenShift Automation with Model Context Protocols (MCP) Servers
Overview
This guide will walk you through setting up the MCP Servers + Claude Desktop portions of the demo that focused on using Claude Desktop to interact with your Ansible Automation Platform and OpenShift Cluster environments.
Prerequisites
Ensure you have the following installed.
Required
- An Ansible Automation Platform (AAP) environment
- An OpenShift Cluster with OpenShift Virtualization
- Claude Desktop installed on your laptop (Pro Plan required for best results)
- Python 3.10 or higher installed on your laptop
- Ensure you are authenticated with your OpenShift cluster (e.g. exporting kubeconfig)
Step One: Setup your laptop environment
Install uv and setup your Python project and environment.
curl -LsSf https://astral.sh/uv/install.sh | sh
Install jbang which will be used when using the Kubernetes MCP Server. (jbang needs to be installed globally, recommend using the homebrew install pattern. If you install it locally (the curl pattern), Claude won’t be able to access it).
Restart your terminal to ensure that the uv and jbang command are now available.
Step Two: Create and Setup your Project
# Create a new directory for our project
uv init ansible
cd ansible
# Create virtual environment and activate it
uv venv
source .venv/bin/activate
# Install dependencies
uv add "mcp[cli]" httpx
# Create our server file
touch ansible.py
Step 3 Building your Ansible Automation Controller MCP Server
This is the MCP Server I used to interact with my automation controller. Feel free to copy/paste this into your ansible.py file.
Note: to connect to self-signed SSL, use edit the async client to be https.AsyncClient(verify=False)
import os
import httpx
from mcp.server.fastmcp import FastMCP
from typing import Any
# Environment variables for authentication
AAP_URL = os.getenv("AAP_URL")
AAP_TOKEN = os.getenv("AAP_TOKEN")
if not AAP_TOKEN:
raise ValueError("AAP_TOKEN is required")
# Headers for API authentication
HEADERS = {
"Authorization": f"Bearer {AAP_TOKEN}",
"Content-Type": "application/json"
}
# Initialize FastMCP
mcp = FastMCP("ansible")
async def make_request(url: str, method: str = "GET", json: dict = None) -> Any:
"""Helper function to make authenticated API requests to AAP."""
async with httpx.AsyncClient() as client:
response = await client.request(method, url, headers=HEADERS, json=json)
if response.status_code not in [200, 201]:
return f"Error {response.status_code}: {response.text}"
return response.json() if "application/json" in response.headers.get("Content-Type", "") else response.text
@mcp.tool()
async def list_inventories() -> Any:
"""List all inventories in Ansible Automation Platform."""
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →