Conversation
Introduces an MCP (Model Context Protocol) server that dynamically generates one tool per ansible.platform resource from existing DOCUMENTATION metadata. ~800 lines of Python expose 22 Gateway resources to AI agents with the same schema, validation, and idempotent behavior as the Ansible modules. Dual-mode tools: 'execute' calls the Gateway API directly via PlatformService; 'emit' returns equivalent Ansible task YAML for playbook authoring. Packages: - packages/sdk/ (ansible-platform-sdk): Makes the collection pip-installable under its ansible_collections namespace for non-Ansible consumers. - packages/mcp-server/ (ansible-platform-mcp): MCP server with stdio transport, compatible with Cursor, Claude Desktop, and any MCP client. Docs: - docs/11-mcp-vision.md: Value proposition and strategic rationale. - docs/12-mcp-architecture.md: Detailed design and module-level documentation. Bugfix: - Fix version_parse() fallback in registry.py when the packaging library is not installed (missing staticmethod wrapper on dynamic class method).
Explains how both packages are published to PyPI, how the SDK is embedded in the MCP server's dependency chain, and the three install paths (PyPI production, editable dev, Galaxy for Ansible users).
cidrblock
marked this pull request as draft
June 18, 2026 20:38
This was referenced Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces an MCP (Model Context Protocol) server that exposes every
ansible.platformresource as an AI-agent tool — dynamically generated from the collection's ownDOCUMENTATIONmetadata. No per-resource boilerplate; ~800 lines of Python yield 22 tools with the same schema, validation, and idempotent behavior as the Ansible modules.What's included
Two pip packages under
packages/:ansible-platform-sdk— Makes the collection pip-installable under itsansible_collections.ansible.platformnamespace so non-Ansible consumers (MCP servers, CLIs, etc.) can import and use the SDK directly. Usespkgutil.extend_pathnamespace stubs and a build-time symlink toplugins/.ansible-platform-mcp— MCP server with stdio transport. Depends onansible-platform-sdk. Compatible with Cursor, Claude Desktop, and any MCP client. Install:pip install -e packages/sdk -e packages/mcp-server.Dual-mode tools:
Every tool supports two modes, selectable per invocation:
executePlatformServiceand returns the structured resultemitansible.platformtask YAML for playbook authoringDocumentation:
docs/11-mcp-vision.md— Value proposition and strategic rationale for engineering leadershipdocs/12-mcp-architecture.md— Detailed design: startup lifecycle, data flow, module-level documentation, SDK packaging, testing with the mock serverBugfix:
version_parse()fallback inregistry.pywhen thepackaginglibrary is not installed — the standalone function was bound as an instance method on a dynamic class withoutstaticmethod(), causing a "takes 1 positional argument but 2 were given" error.Architecture
The server reuses the existing SDK —
PlatformService,GatewayConfig,APIVersionRegistry— with zero code duplication. As modules are added to the collection, the MCP server gains tools automatically.Tested
Full CRUD lifecycle verified against
tools/mock_gateway_server.py:{id, changed: true}Test plan
pip install -e packages/sdk -e packages/mcp-serverin a clean venvpython tools/mock_gateway_server.py --port 9080AAP_GATEWAY_URL=http://127.0.0.1:9080 AAP_USERNAME=admin AAP_PASSWORD=password AAP_VALIDATE_CERTS=false ansible-platform-mcp