Skip to content

Cursor

Cursor is a VS Code fork with built-in AI capabilities. The Ansible extension installs and works identically to VS Code for all editing, sidebar, and playbook features. The primary difference is how the MCP server is registered.

Install the extension from Cursor’s extension panel – search for Ansible (publisher: Red Hat, ID: redhat.ansible). The same marketplace package is used for both VS Code and Cursor.

When the extension activates in Cursor, it detects the IDE via vscode.env.appName and automatically registers the MCP server using Cursor’s extension API:

cursor.mcp.registerServer({
name: 'ansible-environments',
server: { command: 'node', args: [serverPath], env: { ... } }
})

The server is immediately available and enabled with no manual configuration needed. You can verify registration by running the Ansible: Show MCP Status command (ansible-environments.showMcpStatus), which opens a status panel showing the server path, Cursor API availability, and config file state.

If the Cursor extension API is unavailable (older Cursor versions), the extension falls back to writing an mcp.json configuration file.

Run the Ansible: Configure Cursor MCP command (ansible-environments.configureCursorMcp). You will be prompted to choose where to save the configuration:

Scope File path Effect
Global ~/.cursor/mcp.json Available in all Cursor workspaces
Workspace .cursor/mcp.json Available only in the current workspace

The command writes the server entry and prompts you to enable it in Cursor Settings (Ctrl+Shift+J) under Features > MCP.

The generated mcp.json entry looks like:

{
"mcpServers": {
"ansible-environments": {
"command": "node",
"args": ["/path/to/packages/mcp-server/out/server.js"],
"env": {}
}
}
}

All extension features work identically in Cursor:

  • Sidebar views (Environment Managers, Collections, Creator, Playbooks, AI Tools, AI Skills)
  • Webview panels (Plugin Docs, Creator Forms, EE Details, Playbook Config/Progress)
  • Status bar items (Python environment, Ansible metadata)
  • Language Server (completions, hover, diagnostics, semantic tokens)
  • Playbook execution (terminal and progress modes)
  • Vault encrypt/decrypt

The one difference is the chat integration: where VS Code routes AI prompts through GitHub Copilot Chat, Cursor routes them through its native chat interface. In IBM Bob, set ansibleEnvironments.llm.chatProvider to bob to send prompts directly to Bob’s chat via bob-code.sendMessageWithHiddenPrompt. The vscode setting works in both VS Code and Cursor since both implement workbench.action.chat.open.

The extension depends on ms-python.python (hard dependency) and recommends ms-python.vscode-python-envs for the best experience. Cursor may not bundle the Python Environments extension, so the extension provides tiered fallbacks:

Capability With python-envs Without python-envs (terminal fallback)
List environments PET-based fast discovery ms-python.python known environments
Select environment python-envs.select picker python.setInterpreter picker
Create venv Native create-env wizard Terminal python -m venv + auto-select
Install ansible-dev-tools managePackages API Terminal pip install ansible-dev-tools
Upgrade ansible-dev-tools Terminal pip (same) Terminal pip (same)

When python-envs is missing, the extension shows a one-time notice recommending installation and uses terminal-based fallbacks for environment creation and package management. The sidebar Environment Managers view displays a welcome message explaining the limited mode with a link to install the recommended extension.