Standalone, vendor-agnostic MCP server for Ansible tooling
Project description
ansible-mcp
Standalone MCP server for Ansible tooling (lint, playbook operations, inventory parsing) with plugin-based routing and token-aware responses.
Install from package index (standalone)
After first release to PyPI, install directly with:
uv tool install ansible-mcp
# or
pip install ansible-mcp
Run:
ansible-mcp serve --stdio
Install from source (development)
cd /Users/sunny/Ansible/ansible-mcp
python -m venv .venv
source .venv/bin/activate
pip install -e .[dev]
Run (stdio)
ansible-mcp serve --stdio
Requirements files
This project uses pyproject.toml as the dependency source of truth.
For teams/tools that expect pip-style requirement files, optional exports are included:
requirements.txt(runtime)requirements-dev.txt(development)
Install with pip if needed:
pip install -r requirements.txt
# or
pip install -r requirements-dev.txt
VS Code MCP config (project)
Create .vscode/mcp.json:
{
"servers": {
"ansible-mcp": {
"command": "ansible-mcp",
"args": ["serve", "--stdio"],
"type": "stdio",
"env": {
"WORKSPACE_ROOT": "${workspaceFolder}"
}
}
}
}
Current tools (MVP)
lint— runansible-linton a file/directoryplaybook_syntax_check— runansible-playbook --syntax-checkplaybook_run— runansible-playbookinventory_parse— runansible-inventory --listinventory_graph— runansible-inventory --graph
Upstream-compatible tools (parity track)
list_available_tools— list upstream endpoints and current availabilityzen_of_ansible— upstream philosophy endpointansible_content_best_practices— upstream guidance endpointansible_lint— upstream-compatible wrapper (mapped tolint)ade_environment_info— environment diagnostics endpointade_setup_environment— development environment setup endpointadt_check_env— ADT check/install endpointansible_create_playbook— playbook project scaffold endpointansible_create_collection— collection project scaffold endpointdefine_and_build_execution_env— execution environment definition endpointansible_navigator— navigator execution/info endpoint
Detailed parity status is available at ansible://docs/upstream-parity.
Upstream vs standalone (this project)
| Area | VS Code Ansible MCP (upstream model) | ansible-mcp (this repo) |
|---|---|---|
| Packaging | Coupled to extension/monorepo workflows | Standalone Python package (ansible-mcp) |
| Client scope | Primarily VS Code/Copilot flows | Any MCP-compatible client (VS Code, Claude, Cursor, CLI, etc.) |
| Transport | Typically extension-managed STDIO | STDIO, Streamable HTTP, SSE |
| Tool architecture | Extension-shaped integration | Plugin router + entry-point based expansion |
| Token strategy | More verbose tool metadata by default | Compact tool descriptions + capped/truncated responses |
| Docs delivery | Mostly extension/context-driven docs | MCP resources (ansible://docs/*) on demand |
Token efficiency targets
- Tool description budget:
< 60tokens per tool tools/listtotal budget target:< 800tokens- Per-tool response budget target:
< 500tokens (before truncation markers)
These budgets are enforced through TokenBudget and formatting/truncation helpers in the server runtime.
Roadmap: upstream parity first
Before adding non-upstream capabilities, this project will complete parity with the current upstream endpoint surface.
Phase 1 — upstream endpoint parity (completed)
zen_of_ansible✅ansible_content_best_practices✅list_available_tools✅ansible_lint✅ (mapped to locallint)ade_environment_info✅ade_setup_environment✅adt_check_env✅ansible_create_playbook✅ansible_create_collection✅define_and_build_execution_env✅ansible_navigator✅
With parity complete, additional standalone-only tool families can be layered in without changing upstream-compatible contracts.
Definition of done for each new plugin/tool
- Tool schema and compact description added to plugin metadata
- Unit tests for argument validation and result shaping
- Integration tests against real backend executable/API
- MCP resource docs added under
ansible://docs/* - Token budgets respected in tool listing and responses
- Included in CI lanes (quality, unit, integration)
Tests
-
Fast unit lane:
pytest tests/unit -v --tb=short
-
Integration lane (real Ansible executables):
pytest tests/integration -v --tb=short -m integration
Integration tests require ansible-lint, ansible-playbook, and
ansible-inventory. Tests are skipped automatically when required executables
are missing.
Pre-commit hooks
Install the shared hooks once per clone:
uv run --extra dev pre-commit install --hook-type pre-commit --hook-type pre-push
What runs automatically:
pre-commit:ruff,mypy, andtests/unitpre-push:tests/integration -m integration
Run all hooks manually:
uv run --extra dev pre-commit run --all-files
uv run --extra dev pre-commit run --all-files --hook-stage pre-push
Publish to PyPI
This repo includes .github/workflows/publish.yml for package publishing.
One-time setup
- In PyPI and TestPyPI, create the
ansible-mcpproject (or reserve the name). - Configure Trusted Publishing for this GitHub repository and workflow.
- Create GitHub environments expected by the workflow:
testpypipypi
Publish flow
- Manual test publish: run Publish Package workflow with
repository=testpypi. - Production publish: push a version tag (for example
v0.1.1) to trigger PyPI publish.
git tag v0.1.1
git push origin v0.1.1
Notes
- Tool descriptions are intentionally compact for token efficiency.
- Detailed docs are available as MCP resources:
ansible://docs/lintansible://docs/playbookansible://docs/inventoryansible://docs/environmentansible://docs/project-generatorsansible://docs/execution-environmentansible://docs/navigatorschema://execution-environmentsample://execution-environmentrules://execution-environmentguidelines://ansible-content-best-practices
Developer guidelines
- Use Python 3.12+ and
uvfor dependency and environment management. - Keep tool descriptions compact and schema-first.
- Return structured outputs; avoid unbounded free-text payloads.
- Keep subprocess execution safe (
create_subprocess_exec, noshell=True). - Add tests for every new tool path (unit + integration).
- Keep client-agnostic behavior: no VS Code-only assumptions in core runtime.
License
MIT (declared in pyproject.toml).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ansible_mcp-0.1.0.tar.gz.
File metadata
- Download URL: ansible_mcp-0.1.0.tar.gz
- Upload date:
- Size: 29.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e49853432d7454a4bc1d55022d795b1ab70cca4b8a3911275e5160010c32e2aa
|
|
| MD5 |
636dcd64222abd3540ac6aa8057b0d95
|
|
| BLAKE2b-256 |
eb07f25cbfdea2a1e2f066b477e3a2fed25cd9744d9bbb4033cd862882db55bc
|
Provenance
The following attestation bundles were made for ansible_mcp-0.1.0.tar.gz:
Publisher:
publish.yml on shreyanshjain7174/ansible-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ansible_mcp-0.1.0.tar.gz -
Subject digest:
e49853432d7454a4bc1d55022d795b1ab70cca4b8a3911275e5160010c32e2aa - Sigstore transparency entry: 1042860274
- Sigstore integration time:
-
Permalink:
shreyanshjain7174/ansible-mcp@6162aacb0534862675a51930895389531f82924c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/shreyanshjain7174
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6162aacb0534862675a51930895389531f82924c -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file ansible_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ansible_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cc50dcd6a8b158cec7b6a2d449174eb03580c35d590aaababf47faa22b698e0
|
|
| MD5 |
0f4c82e6a239fee09848db63ed53a6d9
|
|
| BLAKE2b-256 |
d5b2de5949af3baef0676616dfcee5afa2861c4b9f7136d136ef6cc2b9f9ae9f
|
Provenance
The following attestation bundles were made for ansible_mcp-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on shreyanshjain7174/ansible-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ansible_mcp-0.1.0-py3-none-any.whl -
Subject digest:
8cc50dcd6a8b158cec7b6a2d449174eb03580c35d590aaababf47faa22b698e0 - Sigstore transparency entry: 1042860348
- Sigstore integration time:
-
Permalink:
shreyanshjain7174/ansible-mcp@6162aacb0534862675a51930895389531f82924c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/shreyanshjain7174
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6162aacb0534862675a51930895389531f82924c -
Trigger Event:
workflow_dispatch
-
Statement type: