The Model Context Protocol (MCP) server enables seamless integration between Claude Desktop and your infrastructure tools like Ansible Automation Platform and OpenShift. This server acts as a bridge, allowing Claude to directly access and manage your automation workflows and Kubernetes resources through natural language commands.
First, install the uv
package manager and jbang:
curl -LsSf https://astral.sh/uv/install.sh | sh
Install jbang (needed for the Kubernetes MCP Server). Using Homebrew is recommended:
brew install jbang
Restart your terminal to ensure both commands are available.
# Create a new directory for the 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 the server file
touch ansible.py
Create an ansible.py
file with the MCP server code. The code provides tools for interacting with your Ansible Automation Platform, including:
For self-signed SSL certificates, modify the async client to use httpx.AsyncClient(verify=False)
.
Locate and edit the Claude Desktop configuration file:
# On macOS
nano ~/Library/Application\ Support/Claude/claude_desktop_config.json
Add the following configuration:
{
"mcpServers": {
"ansible": {
"command": "/absolute/path/to/uv",
"args": [
"--directory",
"/absolute/path/to/ansible_mcp",
"run",
"ansible.py"
],
"env": {
"AAP_TOKEN": "<aap-token>",
"AAP_URL": "https://<aap-url>/api/controller/v2"
}
},
"kubernetes": {
"command": "jbang",
"args": [
"--quiet",
"https://github.com/quarkiverse/quarkus-mcp-servers/blob/main/kubernetes/src/main/java/io/quarkiverse/mcp/servers/kubernetes/MCPServerKubernetes.java"
]
}
}
}
Be sure to:
/absolute/path/to/uv
with the output of which uv
/absolute/path/to/ansible_mcp
with your project directoryTo create an AAP token:
Restart Claude Desktop to apply the changes. Verify the MCP servers are loaded by checking for the hammer icon with a number indicating available tools.
Try asking Claude questions such as:
You can extend your setup with Event-Driven Ansible support:
eda.py
file in your project directoryThe EDA MCP Server provides tools for:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "ansible" '{"command":"/absolute/path/to/uv","args":["--directory","/absolute/path/to/ansible_mcp","run","ansible.py"],"env":{"AAP_TOKEN":"<aap-token>","AAP_URL":"https://<aap-url>/api/controller/v2"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"ansible": {
"command": "/absolute/path/to/uv",
"args": [
"--directory",
"/absolute/path/to/ansible_mcp",
"run",
"ansible.py"
],
"env": {
"AAP_TOKEN": "<aap-token>",
"AAP_URL": "https://<aap-url>/api/controller/v2"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"ansible": {
"command": "/absolute/path/to/uv",
"args": [
"--directory",
"/absolute/path/to/ansible_mcp",
"run",
"ansible.py"
],
"env": {
"AAP_TOKEN": "<aap-token>",
"AAP_URL": "https://<aap-url>/api/controller/v2"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect