air-mcp-server 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +90 -0
  2. package/bin/air-mcp-http.js +2 -0
  3. package/bin/air-mcp.js +10 -0
  4. package/dist/core/utils/air-home.d.ts +6 -0
  5. package/dist/core/utils/air-home.js +72 -0
  6. package/dist/http.js +12738 -0
  7. package/dist/http.js.map +7 -0
  8. package/dist/index.js +12571 -0
  9. package/dist/index.js.map +7 -0
  10. package/dist/packages/mcp-server/src/config.d.ts +17 -0
  11. package/dist/packages/mcp-server/src/config.js +105 -0
  12. package/dist/packages/mcp-server/src/context.d.ts +10 -0
  13. package/dist/packages/mcp-server/src/context.js +18 -0
  14. package/dist/packages/mcp-server/src/http.d.ts +1 -0
  15. package/dist/packages/mcp-server/src/http.js +189 -0
  16. package/dist/packages/mcp-server/src/index.d.ts +1 -0
  17. package/dist/packages/mcp-server/src/index.js +37 -0
  18. package/dist/packages/mcp-server/src/server.d.ts +18 -0
  19. package/dist/packages/mcp-server/src/server.js +35 -0
  20. package/dist/packages/mcp-server/src/tools/get-session-flow-review.d.ts +2 -0
  21. package/dist/packages/mcp-server/src/tools/get-session-flow-review.js +62 -0
  22. package/dist/packages/mcp-server/src/tools/get-session-generation-context.d.ts +2 -0
  23. package/dist/packages/mcp-server/src/tools/get-session-generation-context.js +118 -0
  24. package/dist/packages/mcp-server/src/tools/index.d.ts +2 -0
  25. package/dist/packages/mcp-server/src/tools/index.js +13 -0
  26. package/dist/packages/mcp-server/src/tools/list-recorded-sessions.d.ts +2 -0
  27. package/dist/packages/mcp-server/src/tools/list-recorded-sessions.js +57 -0
  28. package/dist/packages/mcp-server/src/utils/errors.d.ts +4 -0
  29. package/dist/packages/mcp-server/src/utils/errors.js +15 -0
  30. package/dist/packages/mcp-server/src/utils/privacy.d.ts +8 -0
  31. package/dist/packages/mcp-server/src/utils/privacy.js +15 -0
  32. package/package.json +46 -0
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # AIR MCP Server
2
+
3
+ The **AIR MCP Server** (Model Context Protocol) provides AI agents (like Claude Desktop, Gemini, or Cline) with deterministic, semantic access to your web automation recordings.
4
+
5
+ It acts as the intelligent bridge between the [AIR VS Code Extension]https://marketplace.visualstudio.com/items?itemName=TestMasterHubAI.AIRAIInteractionRecorder and your LLMs, allowing AI to review user flows,intent, extract resilient locators, and generate Playwright tests with minimal effort to no effort.
6
+
7
+ ---
8
+
9
+ ## 🚀 Quick Start (Zero Installation)
10
+
11
+ If you have the AIR VS Code Extension installed and have recorded a session, you do **not** need to install this package manually.
12
+
13
+ You can connect your AI directly using `npx`. Just add this configuration to your MCP client:
14
+
15
+ ### Claude Desktop Configuration
16
+ Open your `claude_desktop_config.json` (or your chosen MCP client's config file) and add:
17
+
18
+ ```json
19
+ {
20
+ "mcpServers": {
21
+ "air-desktop": {
22
+ "command": "npx",
23
+ "args": [
24
+ "-y",
25
+ "air-mcp-server@latest"
26
+ ]
27
+ }
28
+ }
29
+ }
30
+ ```
31
+ *Note for Windows users: Depending on your terminal environment, you may need to use `"npx.cmd"` instead of `"npx"`.*
32
+
33
+ Restart Claude Desktop, and your AI will immediately have access to your AIR recordings!
34
+
35
+ ---
36
+
37
+ ## 🛠️ Requirements
38
+
39
+ - **Node.js 22 or higher** (Required for native `node:sqlite` database support).
40
+ - Sessions recorded via the **AIR VS Code Extension**.
41
+
42
+ ---
43
+
44
+ ## 🧠 Capabilities (MCP Tools)
45
+
46
+ This server exposes powerful tools directly to the LLM:
47
+
48
+ 1. **`list_recorded_sessions`**
49
+ - Retrieves all sessions recorded locally on your machine.
50
+ - LLMs use this to discover what web flows you have automated.
51
+
52
+ 2. **`get_session_flow_review`**
53
+ - Generates a human-readable summary of a specific session.
54
+ - Provides the AI with the overarching "intent" of the recording, the sequence of pages visited, and any warnings (like user interventions or assertions).
55
+
56
+ 3. **`get_session_generation_context`**
57
+ - The core engine for test generation.
58
+ - Retrieves the machine-readable "AIR Selector Proof Packets" for every step in the session. This provides the LLM with the deterministic data needed to write resilient, self-healing Playwright scripts.
59
+
60
+ ---
61
+
62
+ ## ⚙️ Advanced: Custom Database Paths
63
+
64
+ By default, the server reads the recording database from your unified AIR home directory (`~/.air/air-data.db`).
65
+
66
+ If you are running in a CI/CD environment or need to point to a specific database file, you can override this by passing the `--db` flag:
67
+
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "air-desktop": {
72
+ "command": "npx",
73
+ "args": [
74
+ "-y",
75
+ "air-mcp-server@latest",
76
+ "--db",
77
+ "/absolute/path/to/custom-air-data.db"
78
+ ]
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ ---
85
+
86
+ ## 📖 About AIR (Autonomous Interaction Recorder)
87
+
88
+ AIR is designed to bridge the gap between human intent and deterministic web automation. By capturing semantic state changes rather than brittle XPaths, AIR ensures your UI tests remain resilient across app updates.
89
+
90
+
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../dist/http.js');
package/bin/air-mcp.js ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ const [major] = process.versions.node.split('.').map(Number);
3
+ if (major < 22) {
4
+ console.error('[AIR MCP] Error: Node.js version 22 or higher is required.');
5
+ console.error(`[AIR MCP] You are currently running Node.js ${process.versions.node}.`);
6
+ console.error('[AIR MCP] Please upgrade Node.js to use the AIR MCP Server.');
7
+ process.exit(1);
8
+ }
9
+
10
+ require('../dist/index.js');
@@ -0,0 +1,6 @@
1
+ export declare function getAirHome(): string;
2
+ export declare function ensureAirHome(): void;
3
+ export declare function getDatabasePath(): string;
4
+ export declare function getConfigPath(): string;
5
+ export declare function getExportsPath(): string;
6
+ export declare function getSessionMapsPath(): string;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.getAirHome = getAirHome;
27
+ exports.ensureAirHome = ensureAirHome;
28
+ exports.getDatabasePath = getDatabasePath;
29
+ exports.getConfigPath = getConfigPath;
30
+ exports.getExportsPath = getExportsPath;
31
+ exports.getSessionMapsPath = getSessionMapsPath;
32
+ const os = __importStar(require("os"));
33
+ const path = __importStar(require("path"));
34
+ const fs = __importStar(require("fs"));
35
+ function getAirHome() {
36
+ if (process.env.AIR_HOME) {
37
+ return process.env.AIR_HOME;
38
+ }
39
+ if (process.env.AIR_DB_PATH) {
40
+ return path.dirname(process.env.AIR_DB_PATH);
41
+ }
42
+ return path.join(os.tmpdir(), 'air-desktop');
43
+ }
44
+ function ensureAirHome() {
45
+ const home = getAirHome();
46
+ if (!fs.existsSync(home)) {
47
+ fs.mkdirSync(home, { recursive: true });
48
+ }
49
+ }
50
+ function getDatabasePath() {
51
+ if (process.env.AIR_DB_PATH) {
52
+ return process.env.AIR_DB_PATH;
53
+ }
54
+ return path.join(getAirHome(), 'air-data.db');
55
+ }
56
+ function getConfigPath() {
57
+ return path.join(getAirHome(), 'config.json');
58
+ }
59
+ function getExportsPath() {
60
+ const exportsPath = path.join(getAirHome(), 'exports');
61
+ if (!fs.existsSync(exportsPath)) {
62
+ fs.mkdirSync(exportsPath, { recursive: true });
63
+ }
64
+ return exportsPath;
65
+ }
66
+ function getSessionMapsPath() {
67
+ const sessionMapsPath = path.join(getAirHome(), 'session-maps');
68
+ if (!fs.existsSync(sessionMapsPath)) {
69
+ fs.mkdirSync(sessionMapsPath, { recursive: true });
70
+ }
71
+ return sessionMapsPath;
72
+ }