@mhdd_24/ansible-mcp
# @mhdd_24/ansible-mcp
MCP server for Ansible: playbooks, inventories, and execution.
Same architecture as [@mhdd_24/sublime-mcp](https://github.com/Mhdd-24/Sublime-MCP).
**Full documentation:** [docs/WIKI.md](./docs/WIKI.md)
---
## How it works (30 seconds)
```
You (chat) → MCP client → ansible-mcp → Ansible APIs / CLIs / local tools
```
---
## Prerequisites
| Requirement | Notes |
|-------------|--------|
| **Node.js 18+** | ESM TypeScript MCP server |
| **Credentials / CLIs** | See environment variables below |
---
## Install
### Option A — npm (after publish)
```bash
npm install -g @mhdd_24/ansible-mcp
```
### Option B — npx
```bash
npx @mhdd_24/ansible-mcp
```
### Option C — clone and build
```bash
git clone https://github.com/Mhdd-24/Ansible-MCP.git
cd Ansible-MCP
npm install
npm run build
node dist/index.js
```
---
## Configure Cursor
Edit `~/.cursor/mcp.json`:
```json
{
"mcpServers": {
"ansible": {
"command": "npx",
"args": ["-y", "@mhdd_24/ansible-mcp"],
"env": {
"ANSIBLE_PLAYBOOK_BIN": "...",
"ANSIBLE_WORKDIR": "..."
}
}
}
}
```
**Local development:**
```json
{
"command": "node",
"args": ["/absolute/path/to/Ansible-MCP/dist/index.js"]
}
```
---
## Environment variables
| Variable | Description |
|----------|-------------|
| `ANSIBLE_PLAYBOOK_BIN` | ansible-playbook binary |
| `ANSIBLE_WORKDIR` | Default workdir |
---
## Tools
| Tool | Description |
|------|-------------|
| `ansible_status` | Check ansible / ansible-playbook availability. |
| `ansible_list_inventory` | List inventory hosts. |
| `ansible_syntax_check` | Syntax-check a playbook. |
| `ansible_run_playbook` | Run a playbook (confirm required). |
---
## License
ISC
TDQS
Scored across 4 tools
Each tool targets a distinct action: checking environment, inventory listing, syntax validation, and playbook execution. There is no overlap in purpose, making selection unambiguous.
All tools follow the same ansible_ prefix followed by clear verb_noun structure. This consistent pattern makes the tool names predictable and easy to scan.
With only 4 tools, the server is tightly scoped to the core Ansible workflows. Every tool addresses a fundamental need and none feel redundant or unnecessary.
The server covers the main lifecycle for working with Ansible: verify availability, inspect inventory, validate playbooks, and run them. Missing are advanced features like ad-hoc commands or detailed inventory introspection, but these are not essential for basic operation.