# microsoft/autogenesis architecture

> Architecture diagram of the GitHub repository microsoft/autogenesis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/microsoft/autogenesis
- Repository: https://github.com/microsoft/autogenesis

## Overview

1. **Repository shape**
   - AutoGenesis is a multi-package monorepo centered on AI-assisted test automation.
   - It has three main product surfaces: a VS Code extension, a Python MCP server for mobile/mac automation, and a Python MCP server for Windows desktop automation.
   - A small `behave-demo` project acts as a sample BDD consumer of the toolchain.

2. **VS Code extension: `bdd_ai_toolkit/`**
   - This is the orchestration and authoring layer.
   - It provides BDD feature support, UI surfaces, file watching, code generation, and Copilot/MCP integration.
   - The extension is split into:
     - `core/gherkin` for parsing features, scenarios, backgrounds, and steps
     - `core/matching` for mapping feature steps to step definitions
     - `providers/` for editor UI such as CodeLens, decorations, and a webview
     - `services/` for automation status, dry runs, file watching, and Copilot integration
     - `setup/` for environment preparation and MCP server lifecycle management
     - `tools/` for higher-level generators and input adapters

3. **BDD processing pipeline in the extension**
   - The extension reads `.feature` files, extracts Gherkin structure, and matches steps against existing step definitions.
   - It caches parsed features, Python file metadata, automation status, and step matches to keep editor feedback responsive.
   - That pipeline drives editor affordances such as code lenses, decorations, and the automation details webview.

4. **Automation generation and analysis tools**
   - The extension includes utilities for generating test cases and converting external inputs into automation-ready artifacts.
   - Notable inputs include natural language tasks, Figma-derived content, and XMind diagrams.
   - This is the layer that turns user intent or design artifacts into BDD/test-case output rather than executing automation itself.

5. **Mobile/mac automation server: `appium-mcp-server/`**
   - This Python package exposes platform automation capabilities through MCP-style tools.
   - It is organized around platform-specific driver tools for Android, iOS, macOS, and shared Appium operations.
   - `driver_session.py` holds session state, while `tools/` contains the executable automation actions.

6. **Windows automation server: `pywinauto-mcp-server/`**
   - This is the Windows desktop counterpart, built around pywinauto rather than Appium.
   - Its tool set is smaller and Windows-focused: common actions, mouse operations, verification, and code generation.
   - `app_session.py` manages the automation session boundary for the desktop app under test.

7. **Shared server patterns across Python packages**
   - Both Python servers have a similar internal shape: configuration, LLM prompt/chat support, tool handlers, and shared utilities.
   - Common utilities handle logging, element inspection, response formatting, and generated-code support.
   - Each server can be run standalone through a simple server entry point, which keeps the automation back end decoupled from the VS Code extension.

8. **Configuration and runtime setup**
   - Both MCP servers are configuration-driven, with templates or JSON config files under `conf/`.
   - The VS Code extension has a substantial setup subsystem for locating Python, managing environments, launching terminals, installing or starting MCP servers, and platform detection.
   - This setup layer is important because the extension does not just call APIs; it also provisions the local automation runtime.

9. **External dependencies and execution boundaries**
   - The mobile/mac path depends on Appium and, for some flows, cloud/device services such as BrowserStack as described in the README.
   - The Windows path depends on native Windows UI automation via pywinauto.
   - The extension sits above those runtimes and coordinates them; the Python servers sit at the boundary between editor workflows and OS/device automation.

10. **Sample consumer project**
   - `behave-demo/` shows the expected BDD output shape: feature files, environment hooks, and step definitions.
   - It is useful as a reference for how generated tests or recorded steps are expected to be organized and executed.

11. **Overall data flow**
   - Typical flow is: user writes or generates a feature/test case in VS Code → extension parses and matches BDD steps → extension may dry-run or request automation actions → extension launches/contacts the appropriate MCP server → server invokes the platform driver or UI automation library → results and status flow back to the extension for editor feedback.

12. **Key architectural boundary**
   - The most important boundary is between the **authoring/intelligence layer** in `bdd_ai_toolkit` and the **execution layer** in the two Python MCP servers.
   - That separation lets the repo support multiple platforms with a shared user experience while keeping each automation backend platform-specific.

Main entry points: [`appium-mcp-server/simple_server.py`](https://github.com/microsoft/autogenesis/blob/main/appium-mcp-server/simple_server.py) (Appium server), [`pywinauto-mcp-server/simple_server.py`](https://github.com/microsoft/autogenesis/blob/main/pywinauto-mcp-server/simple_server.py) (Windows server), [`bdd_ai_toolkit/src/extension.ts`](https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/extension.ts) (Extension entry), [`bdd_ai_toolkit/src/bdd-feature-support/services/AutomationStatusService.ts`](https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/bdd-feature-support/services/AutomationStatusService.ts) (Automation services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_extension["VS Code extension"]
  node_ext_entry["Extension entry<br/>vscode activation<br/>[extension.ts]"]
  node_ext_bdd_core["BDD core<br/>gherkin pipeline<br/>[FeatureParser.ts]"]
  node_ext_matching["Step matching<br/>step matcher<br/>[StepMatcher.ts]"]
  node_ext_cache[("Caches<br/>editor cache")]
  node_ext_providers["UI providers<br/>editor ui<br/>[WebviewProvider.ts]"]
  node_ext_services["Automation services<br/>orchestration services"]
  node_ext_setup["Setup system<br/>runtime provisioning"]
  node_ext_tools["Authoring tools<br/>test generation"]
  node_ext_constants["Prompt templates<br/>prompt constants<br/>[prompts.ts]"]
end

subgraph group_group_appium["Mobile/mac server"]
  node_appium_entry["Appium server<br/>mcp entrypoint<br/>[simple_server.py]"]
  node_appium_session[("Driver session<br/>session state<br/>[driver_session.py]")]
  node_appium_tools["Driver tools<br/>platform actions"]
  node_appium_llm["LLM support<br/>prompt/chat<br/>[chat.py]"]
  node_appium_utils["Shared utils<br/>server utilities<br/>[config_manager.py]"]
  node_appium_config["Config template<br/>runtime config"]
end

subgraph group_group_windows["Windows server"]
  node_win_entry["Windows server<br/>mcp entrypoint<br/>[simple_server.py]"]
  node_win_session[("App session<br/>session state<br/>[app_session.py]")]
  node_win_tools["Desktop tools<br/>ui actions<br/>[common_tool.py]"]
  node_win_llm["LLM support<br/>prompt/chat<br/>[chat.py]"]
  node_win_utils["Shared utils<br/>server utilities<br/>[gen_code.py]"]
  node_win_config["Config file<br/>runtime config"]
end

subgraph group_group_sample["Sample consumer"]
  node_demo_features["Demo features<br/>bdd sample<br/>[demo.feature]"]
  node_demo_steps["Step defs<br/>bdd sample<br/>[__init__.py]"]
  node_demo_env["Env hooks<br/>bdd sample<br/>[environment.py]"]
end

node_ext_entry -->|"parse features"| node_ext_bdd_core
node_ext_entry -->|"match steps"| node_ext_matching
node_ext_bdd_core -->|"cache parsed data"| node_ext_cache
node_ext_matching -->|"cache matches"| node_ext_cache
node_ext_cache -->|"drive ui"| node_ext_providers
node_ext_services -->|"read/write"| node_ext_cache
node_ext_entry -->|"orchestrate"| node_ext_services
node_ext_entry -->|"provision runtime"| node_ext_setup
node_ext_tools -->|"use prompts"| node_ext_constants
node_ext_tools -.->|"emit bdd"| node_demo_features
node_ext_setup -->|"start server"| node_appium_entry
node_ext_setup -->|"start server"| node_win_entry
node_appium_entry -->|"manage session"| node_appium_session
node_appium_entry -->|"expose tools"| node_appium_tools
node_appium_tools -->|"shared helpers"| node_appium_utils
node_appium_tools -->|"assist prompts"| node_appium_llm
node_appium_entry -->|"load config"| node_appium_config
node_win_entry -->|"manage session"| node_win_session
node_win_entry -->|"expose tools"| node_win_tools
node_win_tools -->|"shared helpers"| node_win_utils
node_win_tools -->|"assist prompts"| node_win_llm
node_win_entry -->|"load config"| node_win_config
node_ext_services -.->|"request actions"| node_appium_entry
node_ext_services -.->|"request actions"| node_win_entry
node_demo_features -->|"bind steps"| node_demo_steps
node_demo_env -->|"support run"| node_demo_steps

click node_ext_entry "https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/extension.ts"
click node_ext_bdd_core "https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/bdd-feature-support/core/gherkin/FeatureParser.ts"
click node_ext_matching "https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/bdd-feature-support/core/matching/StepMatcher.ts"
click node_ext_cache "https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/bdd-feature-support/cache/UnifiedCacheManager.ts"
click node_ext_providers "https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/bdd-feature-support/providers/WebviewProvider.ts"
click node_ext_services "https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/bdd-feature-support/services/AutomationStatusService.ts"
click node_ext_setup "https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/setup/mcpServerManager.ts"
click node_ext_tools "https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/tools/testCaseGenerator.ts"
click node_ext_constants "https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/constants/prompts.ts"
click node_appium_entry "https://github.com/microsoft/autogenesis/blob/main/appium-mcp-server/simple_server.py"
click node_appium_session "https://github.com/microsoft/autogenesis/blob/main/appium-mcp-server/driver_session.py"
click node_appium_tools "https://github.com/microsoft/autogenesis/blob/main/appium-mcp-server/tools/appium_driver_tool.py"
click node_appium_llm "https://github.com/microsoft/autogenesis/blob/main/appium-mcp-server/llm/chat.py"
click node_appium_utils "https://github.com/microsoft/autogenesis/blob/main/appium-mcp-server/utils/config_manager.py"
click node_appium_config "https://github.com/microsoft/autogenesis/blob/main/appium-mcp-server/conf/appium_conf.template.json"
click node_win_entry "https://github.com/microsoft/autogenesis/blob/main/pywinauto-mcp-server/simple_server.py"
click node_win_session "https://github.com/microsoft/autogenesis/blob/main/pywinauto-mcp-server/app_session.py"
click node_win_tools "https://github.com/microsoft/autogenesis/blob/main/pywinauto-mcp-server/tools/common_tool.py"
click node_win_llm "https://github.com/microsoft/autogenesis/blob/main/pywinauto-mcp-server/llm/chat.py"
click node_win_utils "https://github.com/microsoft/autogenesis/blob/main/pywinauto-mcp-server/utils/gen_code.py"
click node_win_config "https://github.com/microsoft/autogenesis/blob/main/pywinauto-mcp-server/conf/pywinauto_conf.json"
click node_demo_features "https://github.com/microsoft/autogenesis/blob/main/behave-demo/features/demo.feature"
click node_demo_steps "https://github.com/microsoft/autogenesis/blob/main/behave-demo/features/steps/__init__.py"
click node_demo_env "https://github.com/microsoft/autogenesis/blob/main/behave-demo/features/environment.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ext_entry,node_ext_bdd_core,node_ext_matching,node_ext_cache,node_ext_providers,node_ext_services,node_ext_setup,node_ext_tools,node_ext_constants toneBlue
class node_appium_entry,node_appium_session,node_appium_tools,node_appium_llm,node_appium_utils,node_appium_config toneAmber
class node_win_entry,node_win_session,node_win_tools,node_win_llm,node_win_utils,node_win_config toneMint
class node_demo_features,node_demo_steps,node_demo_env toneRose
```

## Components

### VS Code extension

Authoring, orchestration, BDD processing, and runtime setup layer.

- [Extension entry](https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/extension.ts): vscode activation · Top-level VS Code extension activation and integration point. · `bdd_ai_toolkit/src/extension.ts`
- [BDD core](https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/bdd-feature-support/core/gherkin/FeatureParser.ts): gherkin pipeline · Parses features and extracts Gherkin structure for downstream analysis. · `bdd_ai_toolkit/src/bdd-feature-support/core/gherkin/FeatureParser.ts`
- [Step matching](https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/bdd-feature-support/core/matching/StepMatcher.ts): step matcher · Loads step definitions and matches feature steps to implementation patterns. · `bdd_ai_toolkit/src/bdd-feature-support/core/matching/StepMatcher.ts`
- [Caches](https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/bdd-feature-support/cache/UnifiedCacheManager.ts): editor cache · Caches parsed features, Python metadata, automation status, and step matches. · `bdd_ai_toolkit/src/bdd-feature-support/cache/UnifiedCacheManager.ts`
- [UI providers](https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/bdd-feature-support/providers/WebviewProvider.ts): editor ui · CodeLens, decorations, and webview surfaces for BDD feedback. · `bdd_ai_toolkit/src/bdd-feature-support/providers/WebviewProvider.ts`
- [Automation services](https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/bdd-feature-support/services/AutomationStatusService.ts): orchestration services · Dry runs, status tracking, file watching, and Copilot integration. · `bdd_ai_toolkit/src/bdd-feature-support/services/AutomationStatusService.ts`
- [Setup system](https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/setup/mcpServerManager.ts): runtime provisioning · Locates Python, manages environments, launches terminals, and starts MCP servers. · `bdd_ai_toolkit/src/setup/mcpServerManager.ts`
- [Authoring tools](https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/tools/testCaseGenerator.ts): test generation · Transforms natural language, Figma, and XMind inputs into test-case artifacts. · `bdd_ai_toolkit/src/tools/testCaseGenerator.ts`
- [Prompt templates](https://github.com/microsoft/autogenesis/blob/main/bdd_ai_toolkit/src/constants/prompts.ts): prompt constants · Shared prompt definitions used by extension-side generation and assistant flows. · `bdd_ai_toolkit/src/constants/prompts.ts`

### Mobile/mac server

Appium-backed MCP execution layer for Android, iOS, and macOS automation.

- [Appium server](https://github.com/microsoft/autogenesis/blob/main/appium-mcp-server/simple_server.py): mcp entrypoint · Standalone server entry for mobile and macOS automation tools. · `appium-mcp-server/simple_server.py`
- [Driver session](https://github.com/microsoft/autogenesis/blob/main/appium-mcp-server/driver_session.py): session state · Holds active Appium session state and runtime context. · `appium-mcp-server/driver_session.py`
- [Driver tools](https://github.com/microsoft/autogenesis/blob/main/appium-mcp-server/tools/appium_driver_tool.py): platform actions · Android, iOS, macOS, and shared Appium automation actions. · `appium-mcp-server/tools/appium_driver_tool.py`
- [LLM support](https://github.com/microsoft/autogenesis/blob/main/appium-mcp-server/llm/chat.py): prompt/chat · Chat and prompt helpers for model-assisted server behavior. · `appium-mcp-server/llm/chat.py`
- [Shared utils](https://github.com/microsoft/autogenesis/blob/main/appium-mcp-server/utils/config_manager.py): server utilities · Logging, element inspection, config handling, and response formatting. · `appium-mcp-server/utils/config_manager.py`
- [Config template](https://github.com/microsoft/autogenesis/blob/main/appium-mcp-server/conf/appium_conf.template.json): runtime config · Template configuration for the Appium-based server runtime. · `appium-mcp-server/conf/appium_conf.template.json`

### Windows server

pywinauto-backed MCP execution layer for Windows desktop automation.

- [Windows server](https://github.com/microsoft/autogenesis/blob/main/pywinauto-mcp-server/simple_server.py): mcp entrypoint · Standalone server entry for Windows desktop automation tools. · `pywinauto-mcp-server/simple_server.py`
- [App session](https://github.com/microsoft/autogenesis/blob/main/pywinauto-mcp-server/app_session.py): session state · Tracks the active desktop application session boundary. · `pywinauto-mcp-server/app_session.py`
- [Desktop tools](https://github.com/microsoft/autogenesis/blob/main/pywinauto-mcp-server/tools/common_tool.py): ui actions · Windows actions for common operations, mouse input, verification, and code generation. · `pywinauto-mcp-server/tools/common_tool.py`
- [LLM support](https://github.com/microsoft/autogenesis/blob/main/pywinauto-mcp-server/llm/chat.py): prompt/chat · Chat and prompt helpers for model-assisted server behavior. · `pywinauto-mcp-server/llm/chat.py`
- [Shared utils](https://github.com/microsoft/autogenesis/blob/main/pywinauto-mcp-server/utils/gen_code.py): server utilities · Logging, element inspection, code generation, and response formatting. · `pywinauto-mcp-server/utils/gen_code.py`
- [Config file](https://github.com/microsoft/autogenesis/blob/main/pywinauto-mcp-server/conf/pywinauto_conf.json): runtime config · JSON configuration for the Windows automation server. · `pywinauto-mcp-server/conf/pywinauto_conf.json`

### Sample consumer

Minimal BDD project showing the expected generated/test output shape.

- [Demo features](https://github.com/microsoft/autogenesis/blob/main/behave-demo/features/demo.feature): bdd sample · Sample feature file demonstrating expected BDD structure. · `behave-demo/features/demo.feature`
- [Step defs](https://github.com/microsoft/autogenesis/blob/main/behave-demo/features/steps/__init__.py): bdd sample · Sample step-definition package for the demo consumer project. · `behave-demo/features/steps/__init__.py`
- [Env hooks](https://github.com/microsoft/autogenesis/blob/main/behave-demo/features/environment.py): bdd sample · Sample environment hooks for the demo consumer project. · `behave-demo/features/environment.py`

## Connections

- Extension entry → BDD core: parse features · Reads .feature files and extracts scenarios, backgrounds, and steps.
- Extension entry → Step matching: match steps · Maps feature steps to step definitions for editor feedback.
- BDD core → Caches: cache parsed data · Stores parsed Gherkin structure for responsive reuse.
- Step matching → Caches: cache matches · Stores resolved step matches and lookup results.
- Caches → UI providers: drive ui · Feeds CodeLens, decorations, and webview state.
- Automation services → Caches: read/write · Uses shared caches for status, file watching, and dry-run flows.
- Extension entry → Automation services: orchestrate · Coordinates automation status, file watching, and Copilot integration.
- Extension entry → Setup system: provision runtime · Finds Python, manages environments, and launches MCP servers.
- Authoring tools → Prompt templates: use prompts · Uses prompt templates for generation and transformation workflows.
- Authoring tools → Demo features: emit bdd · Produces test-case and feature-shaped outputs for consumer projects.
- Setup system → Appium server: start server · Launches or connects to the mobile/mac automation backend.
- Setup system → Windows server: start server · Launches or connects to the Windows automation backend.
- Appium server → Driver session: manage session · Initializes and uses active device/session state.
- Appium server → Driver tools: expose tools · Publishes platform automation actions through MCP-style tools.
- Driver tools → Shared utils: shared helpers · Uses common utilities for config, logging, element inspection, and formatting.
- Driver tools → LLM support: assist prompts · Uses chat/prompt support where model assistance is needed.
- Appium server → Config template: load config · Reads configuration template or JSON config at startup.
- Windows server → App session: manage session · Initializes and uses active desktop application session state.
- Windows server → Desktop tools: expose tools · Publishes Windows automation actions through MCP-style tools.
- Desktop tools → Shared utils: shared helpers · Uses common utilities for code generation, element inspection, and formatting.
- Desktop tools → LLM support: assist prompts · Uses chat/prompt support where model assistance is needed.
- Windows server → Config file: load config · Reads JSON configuration at startup.
- Automation services → Appium server: request actions · Routes automation requests toward the Appium-based execution layer.
- Automation services → Windows server: request actions · Routes automation requests toward the Windows execution layer.
- Demo features → Step defs: bind steps · Feature scenarios are intended to map to step definitions.
- Env hooks → Step defs: support run · Environment hooks support execution of the sample BDD suite.
