|
| 1 | +# AdaMCP |
| 2 | + |
| 3 | +`AdaMCP` exposes a live AdaEngine application as an MCP server. It is built for inspection-first workflows: world/entity/resource introspection, render capture, and AdaUI tree inspection with a small set of safe UI actions. |
| 4 | + |
| 5 | +## Modules |
| 6 | + |
| 7 | +- `AdaMCPCore`: runtime surface, type introspection, AdaUI inspection, and tool/resource payloads. |
| 8 | +- `AdaMCPServer`: MCP server bootstrapping plus HTTP and stdio transports. |
| 9 | +- `AdaMCPPlugin`: AdaEngine plugin for embedding `AdaMCP` directly into an app. |
| 10 | + |
| 11 | +## Current platform support |
| 12 | + |
| 13 | +`AdaMCP` currently ships for Apple platforms used by AdaEngine hosts today: `macOS 15+`, `iOS 18+`, `tvOS 18+`, and `visionOS 2+`. |
| 14 | + |
| 15 | +The important distinction is: |
| 16 | + |
| 17 | +- MCP clients can live anywhere and connect over HTTP or stdio. |
| 18 | +- The host runtime now builds on the broader Apple surface, while `stdio` remains primarily a local host transport and HTTP is the main cross-device option. |
| 19 | + |
| 20 | +So `SloppyClient` no longer needs a `macOS`-only gate just to embed the MCP plugin. |
| 21 | + |
| 22 | +## What you get |
| 23 | + |
| 24 | +- World, entity, component, resource, and asset inspection. |
| 25 | +- Screenshot capture for live render output. |
| 26 | +- AdaUI inspection tools such as `ui.list_windows`, `ui.get_tree`, `ui.get_node`, `ui.find_nodes`, and `ui.hit_test`. |
| 27 | +- AdaUI diagnostics and safe actions such as focus traversal, deterministic tap, and scroll-to-node. |
| 28 | +- MCP resources under `ada://...`, including `ada://ui/windows`, `ada://ui/window/{id}`, `ada://ui/tree/{id}`, and `ada://ui/node/{windowId}/{nodeRef}`. |
| 29 | + |
| 30 | +## Embedding in an AdaEngine app |
| 31 | + |
| 32 | +Until the package is published, add it as a local SwiftPM dependency: |
| 33 | + |
| 34 | +```swift |
| 35 | +dependencies: [ |
| 36 | + .package(path: "../AdaMCP") |
| 37 | +] |
| 38 | +``` |
| 39 | + |
| 40 | +Then add the plugin to your app: |
| 41 | + |
| 42 | +```swift |
| 43 | +import AdaEngine |
| 44 | +import AdaMCPPlugin |
| 45 | + |
| 46 | +@main |
| 47 | +struct ExampleApp: App { |
| 48 | + var body: some AppScene { |
| 49 | + WindowGroup { |
| 50 | + RootView() |
| 51 | + } |
| 52 | + .addPlugins( |
| 53 | + MCPPlugin(configuration: .init( |
| 54 | + enableHTTP: true, |
| 55 | + enableStdio: true, |
| 56 | + host: "127.0.0.1", |
| 57 | + port: 25102, |
| 58 | + endpoint: "/mcp", |
| 59 | + serverName: "example-app", |
| 60 | + serverVersion: "0.1.0", |
| 61 | + instructions: "Inspect the live AdaEngine runtime." |
| 62 | + )) |
| 63 | + ) |
| 64 | + } |
| 65 | +} |
| 66 | +``` |
| 67 | + |
| 68 | +## Runtime architecture |
| 69 | + |
| 70 | +`AdaMCP` is split into three layers: |
| 71 | + |
| 72 | +1. `AdaMCPRuntime` builds tool/resource payloads from live AdaEngine and AdaUI state. |
| 73 | +2. `AdaMCPServerFactory` exposes that runtime through the official MCP Swift SDK. |
| 74 | +3. `MCPPlugin` wires the runtime into an AdaEngine app and starts HTTP and/or stdio transports. |
| 75 | + |
| 76 | +## AdaUI surface |
| 77 | + |
| 78 | +AdaUI support is intentionally inspection-first. The main flow is: |
| 79 | + |
| 80 | +1. Locate windows or nodes. |
| 81 | +2. Inspect the live tree and layout diagnostics. |
| 82 | +3. Apply a limited, deterministic action. |
| 83 | +4. Re-read the tree or diagnostics to verify the result. |
| 84 | + |
| 85 | +External callers should target nodes by `accessibilityIdentifier`. `runtimeId` is returned in payloads as a session-local helper, but it is not intended to be a durable contract. |
| 86 | + |
| 87 | +## Documentation |
| 88 | + |
| 89 | +- [DocC landing page](./Sources/AdaMCPCore/AdaMCPCore.docc/AdaMCPCore.md) |
| 90 | +- [Getting Started With AdaMCP](./Sources/AdaMCPCore/AdaMCPCore.docc/Getting-Started-With-AdaMCP.md) |
| 91 | +- [AdaUI Inspection and Automation](./Sources/AdaMCPCore/AdaMCPCore.docc/AdaUI-Inspection-and-Automation.md) |
| 92 | + |
| 93 | +Swift Package Index configuration lives in [`./.spi.yml`](./.spi.yml). |
0 commit comments