@elastic.io/mcp 1.0.0 → 1.0.1-dev10

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.
package/README.md CHANGED
@@ -1,171 +1,101 @@
1
1
  # elastic.io Model Context Protocol (MCP) Server
2
2
 
3
- A professional, production-ready TypeScript-based Model Context Protocol (MCP) server that connects Large Language Models (LLMs) to the **elastic.io** iPaaS platform REST API v2.
3
+ An MCP server that connects AI assistants to the **elastic.io** iPaaS platform — letting them discover, build, modify, and debug integration flows directly.
4
4
 
5
- This server enables AI assistants (such as Antigravity, Claude Desktop, Cursor, or custom frontends) to discover, construct, modify, manage, and debug integration flows directly.
5
+ Published on npm as `@elastic.io/mcp`.
6
6
 
7
7
  ---
8
8
 
9
- ## What is the MCP Server?
9
+ ## Quick Start
10
10
 
11
- This server implements the **Model Context Protocol (MCP)**, a standard protocol that lets LLMs securely query and mutate data in external systems.
11
+ ### Prerequisites
12
12
 
13
- Specifically, this server acts as an intelligent intermediary between an LLM agent and the elastic.io integration platform, exposing 32 distinct tools that translate high-level requests into raw API operations. It allows LLMs to list components, discover credentials, create and manage flows, build mappings with JSONata expressions, analyze run-time logs, and etc.
13
+ 1. **Node.js 18+** — download from [nodejs.org](https://nodejs.org/)
14
+ 2. **A desktop AI client** — install one of the supported clients (see below)
15
+ 3. **elastic.io credentials** — your account email and API key
14
16
 
15
- ---
17
+ ### One-Command Setup
16
18
 
17
- ## How It Works
19
+ Run this in your terminal — it will detect your installed AI clients and configure them automatically:
18
20
 
19
- The server can run in two modes, depending on the transport protocol selected:
21
+ **macOS / Linux:**
22
+ ```bash
23
+ npx -y @elastic.io/mcp setup
24
+ ```
20
25
 
26
+ **Windows (Command Prompt):**
27
+ ```cmd
28
+ npx -y @elastic.io/mcp setup
21
29
  ```
22
- [Stdio Mode (Local)]
23
- LLM Client (Cursor) <--> [stdin / stdout] <--> MCP Server (uses static env keys)
24
30
 
25
- [SSE Mode (Cloud)]
26
- LLM Client (Browser/IDE) <--> [HTTP / SSE] <--> Express Server <--> Session Manager <--> Scoped MCP Server & Client (uses dynamic user keys)
31
+ **Windows (PowerShell):**
32
+ ```powershell
33
+ npx -y @elastic.io/mcp setup
27
34
  ```
28
35
 
29
- ### 1. Stdio Mode (Standard Input/Output)
30
- * **Design:** Designed for a single developer working locally on an IDE (Cursor, Claude Desktop).
31
- * **Process:** The LLM client starts the node server as a subprocess. Communication occurs over standard streams. The server loads static authentication credentials (`ELASTICIO_API_EMAIL` and `ELASTICIO_API_KEY`) from environment variables (or a local `.env` file).
36
+ > The command is the same on all platforms. Make sure Node.js 18+ is installed and `npx` is available in your PATH.
32
37
 
33
- ### 2. SSE Mode (Server-Sent Events)
34
- * **Design:** Designed to be hosted centrally in the cloud as a multi-tenant service.
35
- * **Process:** The server runs an Express HTTP server.
36
- * **Session Initialization:** The client connects to `GET /sse` passing an `Authorization` header containing their personal elastic.io email/API Key (Basic Auth).
37
- * **Session Isolation:** The `SessionManager` captures this connection, generates a unique session ID, and spins up a dedicated `McpServer` and a request-scoped `Axios` instance. This guarantees that user credentials and API states are completely isolated.
38
- * **Tool Calls:** The client POSTs JSON-RPC tool calls to `POST /messages` or `POST /sse`, supplying the `mcp-session-id` header to route the message to their isolated session.
38
+ The setup wizard will:
39
+ 1. Ask for your elastic.io email and API key
40
+ 2. Detect which AI clients are installed on your machine
41
+ 3. Let you choose which clients to configure
42
+ 4. Write the MCP config files automatically
39
43
 
40
- ### Core Safeguards & Optimizations
41
- * **State-Machine Verification:** To prevent the LLM from configuring flows using cached or hallucinated IDs, the validation engine enforces that components and credentials must be fetched/discovered in the current session before they can be configured in a graph.
42
- * **JSONata Safety Checks:** The server reviews generated mappings, warning the LLM if it wraps JSONata mappers in outer quotes (making them strings) or references variables directly instead of using `$getPassthrough().step_id.body.field`.
43
- * **Token Optimization:** Component details are retrieved in two steps to prevent token bloat. Large metadata objects and enums are dynamically pruned when they exceed limits.
44
+ After setup, **restart your AI client** — the elastic.io tools will appear in the chat.
44
45
 
45
- ---
46
+ ### Supported Clients
47
+
48
+ | Client | macOS | Windows | Linux |
49
+ |---|---|---|---|
50
+ | [Claude Desktop](https://claude.ai/download) | `~/Library/Application Support/Claude/claude_desktop_config.json` | `%APPDATA%\Claude\claude_desktop_config.json` | `~/.config/Claude/claude_desktop_config.json` |
51
+ | [Claude Code](https://claude.ai/code) | `~/.claude.json` | `%USERPROFILE%\.claude.json` | `~/.claude.json` |
52
+ | [ChatGPT / Codex](https://openai.com/chatgpt/desktop/) | `~/.codex/config.toml` | `%USERPROFILE%\.codex\config.toml` | `~/.codex/config.toml` |
53
+ | [Cursor](https://cursor.com/) | `~/.cursor/mcp.json` | `%USERPROFILE%\.cursor\mcp.json` | `~/.cursor/mcp.json` |
54
+ | [Windsurf](https://codeium.com/windsurf) | `~/.codeium/windsurf/mcp_config.json` | `%USERPROFILE%\.codeium\windsurf\mcp_config.json` | `~/.codeium/windsurf/mcp_config.json` |
55
+ | [VS Code (Copilot)](https://code.visualstudio.com/) | `~/Library/Application Support/Code/User/mcp.json` | `%APPDATA%\Code\User\mcp.json` | `~/.config/Code/User/mcp.json` |
56
+ | [Gemini CLI](https://github.com/google-gemini/gemini-cli) | `~/.gemini/settings.json` | `%USERPROFILE%\.gemini\settings.json` | `~/.gemini/settings.json` |
57
+ | [Zed](https://zed.dev/) | `~/.config/zed/settings.json` | — | `~/.config/zed/settings.json` |
58
+ | [Trae (ByteDance)](https://www.trae.ai/) | `~/.trae/mcp.json` | `%USERPROFILE%\.trae\mcp.json` | `~/.trae/mcp.json` |
59
+ | [Cline (VS Code)](https://github.com/cline/cline) | VS Code globalStorage | VS Code globalStorage | VS Code globalStorage |
60
+ | [Qwen Code](https://qwenlm.github.io/) | `~/.qwen/settings.json` | `%USERPROFILE%\.qwen\settings.json` | `~/.qwen/settings.json` |
61
+ | [Kimi Code](https://kimi.moonshot.cn/) | `~/.kimi-code/mcp.json` | `%USERPROFILE%\.kimi-code\mcp.json` | `~/.kimi-code/mcp.json` |
62
+ | [DeepSeek](https://www.deepseek.com/) | `~/.deepseek/mcp.json` | `%USERPROFILE%\.deepseek\mcp.json` | `~/.deepseek/mcp.json` |
63
+
64
+ ### Manual Configuration
65
+
66
+ If you prefer to configure manually, add the following to your client's MCP config file:
46
67
 
47
- ## Execution Process & Requirements
48
-
49
- ### Requirements
50
- * **Node.js** (version 18 or higher)
51
- * **npm** or yarn
52
- * **Embedding Provider API Key** (required for creating documentation and flow sample embeddings, e.g. Gemini).
53
- * **Vector Store URL and API Key** (for semantic search capabilities, e.g. Qdrant).
54
-
55
- ### Local Setup
56
- 1. Clone this repository and install dependencies:
57
- ```bash
58
- npm install
59
- ```
60
- 2. Copy `.env.example` to `.env` and fill out your variables:
61
- ```bash
62
- cp .env.example .env
63
- ```
64
- 3. Build the project:
65
- ```bash
66
- npm run build
67
- ```
68
-
69
- ### Running Locally (Stdio Mode)
70
- To run the server locally inside your IDE (e.g. Cursor or Claude Desktop):
71
- ```bash
72
- node dist/index.js
73
- ```
74
- Configure your client configuration file (e.g., `mcp_config.json`) to invoke this command, providing the required environment variables:
75
68
  ```json
76
69
  {
77
70
  "mcpServers": {
78
- "elasticio-mcp": {
79
- "command": "node",
80
- "args": ["/path/to/project/dist/index.js"],
81
- "cwd": "/path/to/project",
71
+ "elasticio": {
72
+ "command": "npx",
73
+ "args": ["-y", "@elastic.io/mcp"],
82
74
  "env": {
83
75
  "ELASTICIO_API_EMAIL": "your_email@example.com",
84
76
  "ELASTICIO_API_KEY": "your_api_key",
85
- "EMBEDDING_PROVIDER_API_KEY": "your_embedding_provider_api_key",
86
- "VECTOR_STORE_URL": "your_vector_store_url",
87
- "VECTOR_STORE_API_KEY": "your_vector_store_api_key"
88
- }
89
- }
90
- }
91
- }
92
- ```
93
-
94
- ### Running in Cloud Mode (SSE Mode)
95
- To start the server in Server-Sent Events mode:
96
- ```bash
97
- npm run start:sse
98
- ```
99
- * The server will run on the port defined by the `PORT` environment variable (defaults to `3000`).
100
- * Connect via the SSE endpoint `http://localhost:3000/sse` (or your cloud hosting URL) supplying your elastic.io credentials via basic auth.
101
-
102
- #### Client Configuration (e.g., Cursor, Custom UI, or Antigravity)
103
- To connect your local client to a hosted cloud instance, configure it to run over the HTTP/SSE transport instead of command lines:
104
- ```json
105
- {
106
- "mcpServers": {
107
- "elasticio-mcp-cloud": {
108
- "url": "https://your-mcp-server.yourdomain.com/sse",
109
- "headers": {
110
- "x-elasticio-email": "your_email@example.com",
111
- "x-elasticio-api-key": "your_api_key"
77
+ "ELASTICIO_API_BASE_URL": "https://api.elastic.io/v2"
112
78
  }
113
79
  }
114
80
  }
115
81
  }
116
82
  ```
117
- *Note: Alternatively, you can use the standard HTTP Basic Authentication header: `"Authorization": "Basic <base64_encoded_email_and_api_key>"`. Using `x-elasticio-email` and `x-elasticio-api-key` is recommended to avoid manually calculating base64 values.*
118
-
119
- ---
120
83
 
121
- ## Embedding & Ingestion Process
122
-
123
- The server uses semantic search to locate documentation and similar flow configuration examples for the LLM. You must populate the vector database using one of two methods:
124
-
125
- ### 1. Ingesting Local Files
126
- The project includes command-line scripts to parse, embed, and index local resources:
127
- * **Ingest Documentation:** Parses the markdown files located in `resources/elasticio.github.io/content/` and uploads them to the Qdrant `documentation` collection:
128
- ```bash
129
- node dist/scripts/ingest_docs.js
130
- ```
131
- * **Ingest Flow Templates:** Parses the local JSON templates located in `resources/flow-examples/` and uploads them to the Qdrant `flow_samples` collection:
132
- ```bash
133
- node dist/scripts/ingest_flow_examples.js
134
- ```
135
- * **Verify Search:** Runs test search queries against Qdrant to confirm embeddings were correctly indexed:
136
- ```bash
137
- node dist/scripts/test_search.js --query "your query string" --collection "flow_samples"
138
- ```
139
-
140
- ### 2. Live Webhook Ingestion (SSE Mode)
141
- When running in cloud/SSE mode, the server exposes an endpoint to ingest real-time flows directly from platform databases or sync scripts:
142
- * **Endpoint:** `POST /api/samples` (accepts a JSON array of processed flows).
143
- * **Execution Workflow:**
144
- 1. The server accepts the payload immediately with a `202 Accepted` response to prevent blocking network execution, then queues the tasks.
145
- 2. The background queue processing cleans and formats the flow structure, step settings, and JSONata mapper edges into a markdown document.
146
- 3. The structured text chunks are batched (up to 100 items per batch) and sent to the embedding API provider.
147
- 4. A 5-second delay is introduced between batches to respect API provider rate limits.
148
- 5. The resulting vectors are saved under the `flow_samples` collection in the vector database.
84
+ > **Note:** ChatGPT / Codex uses TOML format — use `npx -y @elastic.io/mcp setup` for automatic configuration.
149
85
 
150
86
  ---
151
87
 
152
- ## Limitations
153
-
154
- If you deploy this MCP server to a cloud infrastructure, be aware of the following implementation limitations:
88
+ ## How It Works
155
89
 
156
- 1. **In-Memory Rate Limiter:**
157
- The connection rate limiter in `src/index.ts` records IP requests in an in-memory JavaScript `Map`. This has two drawbacks:
158
- * **Stale IP Leak:** Connected IP keys are never removed from the map. In long-running public environments, this will cause a slow memory leak.
159
- * **Clustering:** It cannot share rate limit state across multiple instances/containers running behind a load balancer. For production, replace it with `express-rate-limit` using a Redis store.
90
+ The AI client starts the MCP server as a subprocess and communicates over stdin/stdout:
160
91
 
161
- 2. **Local Logging writes:**
162
- The logger (`src/api/logger.ts`) is configured to append logs locally to a file named `mcp-server.log` on the filesystem, in addition to writing to `stderr`.
163
- * **Ephemereal Storage:** Writing logs to local disk will eventually fill up ephemeral disk storage in container environments like AWS ECS or GCP Cloud Run.
164
- * **Recommendation:** Disable local file writes in production, relying solely on standard output/error streaming.
92
+ ```
93
+ AI Client (Claude/ChatGPT/Cursor/...) <--> [stdin / stdout] <--> MCP Server <--> elastic.io API
94
+ ```
165
95
 
166
- 3. **In-Memory Session Management (Boilerplate Code):**
167
- The custom `SessionManager` manages stateful, multi-tenant mappings between SSE connection scopes and in-memory class instances. If the server process restarts, all active sessions are lost, causing `404` errors for connected clients until they re-establish connections.
168
- * **Recommendation (Shifting to Mature Solutions):** For enterprise deployment, you should consider transitioning from in-memory session multiplexing to one of two mature architectural patterns:
169
- * **3rd-Party Gateway/Proxy**: Run the MCP server in standard local `stdio` mode and wrap it using an off-the-shelf gateway (such as ContextForge Gateway, Apache APISIX with `mcp-bridge` plugin, or Supergateway). These gateways manage routing, SSL, authentication, and SSE session tracking out-of-the-box.
170
- * **Infrastructure Isolation**: Deploy the server purely in `stdio` mode inside isolated, single-tenant container tasks (e.g. AWS ECS, GCP Cloud Run, or Fly.io micro-VMs) scheduled on-demand by a cloud orchestrator. This provides strict process-level security isolation and delegates lifecycles to your cloud provider, eliminating the need to write custom reapers or session hydration logic.
96
+ The server exposes 36 tools that let the AI: list components, discover credentials, create and manage flows, build JSONata mappings, debug flow steps, manage data samples, analyze logs, and more.
171
97
 
98
+ ### Built-in Safeguards
99
+ * **State-Machine Verification** — components and credentials must be discovered in the current session before they can be used, preventing hallucinated IDs.
100
+ * **JSONata Safety Checks** — warns when mappings have common mistakes (quoted expressions, missing `$getPassthrough()` calls).
101
+ * **Token Optimization** — large metadata and enums are dynamically pruned to stay within context limits.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ if (process.argv.includes('setup')) {
3
+ import('./setup.js');
4
+ }
5
+ else {
6
+ import('./index.js');
7
+ }
8
+ export {};
9
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;IACnC,MAAM,CAAC,YAAY,CAAC,CAAC;AACvB,CAAC;KAAM,CAAC;IACN,MAAM,CAAC,YAAY,CAAC,CAAC;AACvB,CAAC"}
package/dist/config.d.ts CHANGED
@@ -12,5 +12,4 @@ export interface Config {
12
12
  logLevel: string;
13
13
  }
14
14
  export declare const config: Config;
15
- export declare function validateConfigOnStartup(): void;
16
15
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,MAAM;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uBAAuB,EAAE,MAAM,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;CAClB;AA6BD,eAAO,MAAM,MAAM,EAAE,MAYpB,CAAC;AAEF,wBAAgB,uBAAuB,IAAI,IAAI,CAI9C"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,MAAM;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uBAAuB,EAAE,MAAM,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;CAClB;AA6BD,eAAO,MAAM,MAAM,EAAE,MAYpB,CAAC"}
package/dist/config.js CHANGED
@@ -41,9 +41,4 @@ export const config = {
41
41
  elasticioApiBaseUrl: getEnv('ELASTICIO_API_BASE_URL', [], 'https://api.elastic.io/v2'),
42
42
  logLevel: getEnv('LOG_LEVEL', [], 'INFO'),
43
43
  };
44
- export function validateConfigOnStartup() {
45
- if (!config.embeddingProviderApiKey || !config.vectorStoreUrl) {
46
- process.stderr.write('[WARN] EMBEDDING_PROVIDER_API_KEY and/or VECTOR_STORE_URL not set — semantic search tools (search_documentation, search_flow_samples, search_flow_steps) will be unavailable.\n');
47
- }
48
- }
49
44
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;AAiB5D,SAAS,MAAM,CAAC,GAAW,EAAE,eAAyB,EAAE,EAAE,YAAqB;IAC7E,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC;IAC3B,CAAC;IACD,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE,CAAC;QACpC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE,CAAC;YACxC,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC;QAChC,CAAC;IACH,CAAC;IACD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,YAAY,CAAC;IACtB,CAAC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cAAc,CAAC,mBAAmB,CAAC;IACpD,mBAAmB,EAAE,MAAM,CAAC,wBAAwB,EAAE,EAAE,EAAE,2BAA2B,CAAC;IACtF,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC;CAC1C,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { config, validateConfigOnStartup } from './config.js';
3
- validateConfigOnStartup();
2
+ import { config } from './config.js';
4
3
  import express from 'express';
5
4
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
6
5
  import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
@@ -218,8 +217,8 @@ else {
218
217
  logger.info('[elastic.io MCP Server] Running in local stdio mode.');
219
218
  logger.info('[Server Start] Local stdio mode initialized successfully');
220
219
  }).catch((err) => {
221
- logger.error('[Fatal Error] Failed to connect to Stdio Transport:', err);
222
- logger.error(`[Server Error] Failed to connect to Stdio Transport: ${err.message || err}`);
220
+ logger.error('[Fatal Error] Failed to start:', err);
221
+ logger.error(`[Server Error] ${err.message || err}`);
223
222
  process.exit(1);
224
223
  });
225
224
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC9D,uBAAuB,EAAE,CAAC;AAC1B,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;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AAC,CAAC;QACpE,MAAM,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACf,MAAM,CAAC,KAAK,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;QACpD,MAAM,CAAC,KAAK,CAAC,kBAAkB,GAAG,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC,CAAC;QACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export declare function runSetup(): Promise<void>;
3
+ //# sourceMappingURL=setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";AAgPA,wBAAsB,QAAQ,kBAyD7B"}
package/dist/setup.js ADDED
@@ -0,0 +1,265 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import os from 'node:os';
5
+ import readline from 'node:readline';
6
+ const home = os.homedir();
7
+ // Resolve the full path to npx at setup time so clients that don't inherit
8
+ // the user's shell PATH (NVM, fnm, Homebrew, etc.) can still find it.
9
+ import { execSync } from 'node:child_process';
10
+ function resolveNpxPath() {
11
+ try {
12
+ return execSync('which npx', { encoding: 'utf-8' }).trim();
13
+ }
14
+ catch {
15
+ return 'npx'; // fallback to bare name
16
+ }
17
+ }
18
+ const npxPath = resolveNpxPath();
19
+ function mcpEntry(env) {
20
+ return {
21
+ command: npxPath,
22
+ args: ['-y', '@elastic.io/mcp@dev'],
23
+ env,
24
+ };
25
+ }
26
+ function writeTomlMcpServer(configPath, env) {
27
+ let content = '';
28
+ try {
29
+ content = fs.readFileSync(configPath, 'utf-8');
30
+ }
31
+ catch { /* file doesn't exist yet */ }
32
+ // Remove existing elasticio section if present
33
+ content = content.replace(/\n?\[mcp_servers\.elasticio\][\s\S]*?(?=\n\[|$)/, '');
34
+ // Build TOML section
35
+ const envLines = Object.entries(env)
36
+ .map(([k, v]) => `${k} = "${v}"`)
37
+ .join('\n');
38
+ const section = `
39
+ [mcp_servers.elasticio]
40
+ command = "${npxPath}"
41
+ args = ["-y", "@elastic.io/mcp@dev"]
42
+ startup_timeout_sec = 120
43
+
44
+ [mcp_servers.elasticio.env]
45
+ ${envLines}
46
+ `;
47
+ fs.mkdirSync(path.dirname(configPath), { recursive: true });
48
+ fs.writeFileSync(configPath, content.trimEnd() + '\n' + section, 'utf-8');
49
+ }
50
+ function platformPath(mac, win, linux) {
51
+ if (process.platform === 'darwin')
52
+ return mac;
53
+ if (process.platform === 'win32')
54
+ return win;
55
+ return linux;
56
+ }
57
+ const clients = [
58
+ {
59
+ name: 'Claude Desktop',
60
+ configPath: platformPath(path.join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json'), path.join(home, 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json'), path.join(home, '.config', 'Claude', 'claude_desktop_config.json')),
61
+ writeConfig(configPath, env) {
62
+ const existing = readJson(configPath);
63
+ existing.mcpServers = existing.mcpServers || {};
64
+ existing.mcpServers['elasticio'] = mcpEntry(env);
65
+ writeJson(configPath, existing);
66
+ },
67
+ },
68
+ {
69
+ name: 'Claude Code',
70
+ configPath: path.join(home, '.claude.json'),
71
+ writeConfig(configPath, env) {
72
+ const existing = readJson(configPath);
73
+ existing.mcpServers = existing.mcpServers || {};
74
+ existing.mcpServers['elasticio'] = mcpEntry(env);
75
+ writeJson(configPath, existing);
76
+ },
77
+ },
78
+ {
79
+ name: 'ChatGPT / Codex',
80
+ configPath: path.join(home, '.codex', 'config.toml'),
81
+ writeConfig(configPath, env) {
82
+ writeTomlMcpServer(configPath, env);
83
+ },
84
+ },
85
+ {
86
+ name: 'Cursor',
87
+ configPath: path.join(home, '.cursor', 'mcp.json'),
88
+ writeConfig(configPath, env) {
89
+ const existing = readJson(configPath);
90
+ existing.mcpServers = existing.mcpServers || {};
91
+ existing.mcpServers['elasticio'] = mcpEntry(env);
92
+ writeJson(configPath, existing);
93
+ },
94
+ },
95
+ {
96
+ name: 'Windsurf',
97
+ configPath: path.join(home, '.codeium', 'windsurf', 'mcp_config.json'),
98
+ writeConfig(configPath, env) {
99
+ const existing = readJson(configPath);
100
+ existing.mcpServers = existing.mcpServers || {};
101
+ existing.mcpServers['elasticio'] = mcpEntry(env);
102
+ writeJson(configPath, existing);
103
+ },
104
+ },
105
+ {
106
+ name: 'Gemini CLI',
107
+ configPath: path.join(home, '.gemini', 'settings.json'),
108
+ writeConfig(configPath, env) {
109
+ const existing = readJson(configPath);
110
+ existing.mcpServers = existing.mcpServers || {};
111
+ existing.mcpServers['elasticio'] = mcpEntry(env);
112
+ writeJson(configPath, existing);
113
+ },
114
+ },
115
+ {
116
+ name: 'Trae (ByteDance)',
117
+ configPath: path.join(home, '.trae', 'mcp.json'),
118
+ writeConfig(configPath, env) {
119
+ const existing = readJson(configPath);
120
+ existing.mcpServers = existing.mcpServers || {};
121
+ existing.mcpServers['elasticio'] = mcpEntry(env);
122
+ writeJson(configPath, existing);
123
+ },
124
+ },
125
+ {
126
+ name: 'VS Code (Copilot)',
127
+ configPath: platformPath(path.join(home, 'Library', 'Application Support', 'Code', 'User', 'mcp.json'), path.join(home, 'AppData', 'Roaming', 'Code', 'User', 'mcp.json'), path.join(home, '.config', 'Code', 'User', 'mcp.json')),
128
+ writeConfig(configPath, env) {
129
+ const existing = readJson(configPath);
130
+ existing.servers = existing.servers || {};
131
+ existing.servers['elasticio'] = mcpEntry(env);
132
+ writeJson(configPath, existing);
133
+ },
134
+ },
135
+ {
136
+ name: 'Zed',
137
+ configPath: path.join(home, '.config', 'zed', 'settings.json'),
138
+ writeConfig(configPath, env) {
139
+ const existing = readJson(configPath);
140
+ existing.context_servers = existing.context_servers || {};
141
+ existing.context_servers['elasticio'] = {
142
+ command: { path: 'npx', args: ['-y', '@elastic.io/mcp@dev'] },
143
+ settings: env,
144
+ };
145
+ writeJson(configPath, existing);
146
+ },
147
+ },
148
+ {
149
+ name: 'Cline (VS Code)',
150
+ configPath: platformPath(path.join(home, 'Library', 'Application Support', 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'), path.join(home, 'AppData', 'Roaming', 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'), path.join(home, '.config', 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json')),
151
+ writeConfig(configPath, env) {
152
+ const existing = readJson(configPath);
153
+ existing.mcpServers = existing.mcpServers || {};
154
+ existing.mcpServers['elasticio'] = mcpEntry(env);
155
+ writeJson(configPath, existing);
156
+ },
157
+ },
158
+ {
159
+ name: 'Qwen Code',
160
+ configPath: path.join(home, '.qwen', 'settings.json'),
161
+ writeConfig(configPath, env) {
162
+ const existing = readJson(configPath);
163
+ existing.mcpServers = existing.mcpServers || {};
164
+ existing.mcpServers['elasticio'] = mcpEntry(env);
165
+ writeJson(configPath, existing);
166
+ },
167
+ },
168
+ {
169
+ name: 'Kimi Code',
170
+ configPath: path.join(home, '.kimi-code', 'mcp.json'),
171
+ writeConfig(configPath, env) {
172
+ const existing = readJson(configPath);
173
+ existing.mcpServers = existing.mcpServers || {};
174
+ existing.mcpServers['elasticio'] = mcpEntry(env);
175
+ writeJson(configPath, existing);
176
+ },
177
+ },
178
+ {
179
+ name: 'DeepSeek',
180
+ configPath: path.join(home, '.deepseek', 'mcp.json'),
181
+ writeConfig(configPath, env) {
182
+ const existing = readJson(configPath);
183
+ existing.mcpServers = existing.mcpServers || {};
184
+ existing.mcpServers['elasticio'] = mcpEntry(env);
185
+ writeJson(configPath, existing);
186
+ },
187
+ },
188
+ ];
189
+ function readJson(filePath) {
190
+ try {
191
+ return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
192
+ }
193
+ catch {
194
+ return {};
195
+ }
196
+ }
197
+ function writeJson(filePath, data) {
198
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
199
+ fs.writeFileSync(filePath, JSON.stringify(data, null, 2) + '\n', 'utf-8');
200
+ }
201
+ function detectClients() {
202
+ return clients.filter((c) => {
203
+ // Check if config file or its parent directory exists
204
+ const dir = path.dirname(c.configPath);
205
+ return fs.existsSync(c.configPath) || fs.existsSync(dir);
206
+ });
207
+ }
208
+ function ask(rl, question) {
209
+ return new Promise((resolve) => rl.question(question, resolve));
210
+ }
211
+ export async function runSetup() {
212
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
213
+ console.log('\n🔧 elastic.io MCP Server Setup\n');
214
+ // 1. Collect credentials
215
+ const email = await ask(rl, 'elastic.io email: ');
216
+ const apiKey = await ask(rl, 'elastic.io API key: ');
217
+ const baseUrl = await ask(rl, 'API base URL (press Enter for https://api.elastic.io/v2): ');
218
+ const env = {
219
+ ELASTICIO_API_EMAIL: email.trim(),
220
+ ELASTICIO_API_KEY: apiKey.trim(),
221
+ ELASTICIO_API_BASE_URL: baseUrl.trim() || 'https://api.elastic.io/v2',
222
+ };
223
+ // 2. Detect clients
224
+ const detected = detectClients();
225
+ if (detected.length === 0) {
226
+ console.log('\nNo supported AI clients detected. Supported clients:');
227
+ clients.forEach((c) => console.log(` - ${c.name}`));
228
+ console.log('\nInstall one of the above clients and run setup again.');
229
+ rl.close();
230
+ return;
231
+ }
232
+ console.log('\nDetected AI clients:');
233
+ detected.forEach((c, i) => console.log(` ${i + 1}. ${c.name}`));
234
+ const selection = await ask(rl, `\nInstall to (comma-separated numbers, or "all"): `);
235
+ rl.close();
236
+ let selected;
237
+ if (selection.trim().toLowerCase() === 'all') {
238
+ selected = detected;
239
+ }
240
+ else {
241
+ const indices = selection.split(',').map((s) => parseInt(s.trim(), 10) - 1);
242
+ selected = indices.filter((i) => i >= 0 && i < detected.length).map((i) => detected[i]);
243
+ }
244
+ if (selected.length === 0) {
245
+ console.log('No clients selected. Exiting.');
246
+ return;
247
+ }
248
+ // 3. Write configs
249
+ for (const client of selected) {
250
+ try {
251
+ client.writeConfig(client.configPath, env);
252
+ console.log(`✅ ${client.name} — configured (${client.configPath})`);
253
+ }
254
+ catch (err) {
255
+ console.error(`❌ ${client.name} — failed: ${err.message}`);
256
+ }
257
+ }
258
+ console.log('\nDone! Restart your AI client to pick up the new MCP server.\n');
259
+ }
260
+ // Self-execute when run directly
261
+ runSetup().then(() => process.exit(0)).catch((err) => {
262
+ console.error(err);
263
+ process.exit(1);
264
+ });
265
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,QAAQ,MAAM,eAAe,CAAC;AAQrC,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;AAE1B,2EAA2E;AAC3E,sEAAsE;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,SAAS,cAAc;IACrB,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC,CAAC,wBAAwB;IACxC,CAAC;AACH,CAAC;AAED,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;AAEjC,SAAS,QAAQ,CAAC,GAA2B;IAC3C,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,CAAC,IAAI,EAAE,qBAAqB,CAAC;QACnC,GAAG;KACJ,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,UAAkB,EAAE,GAA2B;IACzE,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,CAAC;QAC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"search.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/search.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAiFtD,CAAC"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAY1C,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CA6DtD,CAAC"}
@@ -1,77 +1,69 @@
1
- import { getEmbeddingProvider } from '../../embeddings/factory.js';
2
- import { getVectorStore } from '../../vectorstore/factory.js';
3
1
  import { textResult } from '../helpers.js';
4
2
  import { logger } from '../../api/logger.js';
5
3
  import { SEARCH_RESULTS_DEFAULT_LIMIT } from '../constants.js';
4
+ function isCollectionNotFoundError(err) {
5
+ const status = err?.response?.status || err?.statusCode;
6
+ const errStr = String(err);
7
+ return status === 404
8
+ || errStr.toLowerCase().includes('not found')
9
+ || errStr.toLowerCase().includes('collection');
10
+ }
6
11
  export const searchHandlers = {
7
- search_documentation: async (args) => {
12
+ search_documentation: async (args, { client }) => {
8
13
  const { query } = args;
9
- const provider = getEmbeddingProvider();
10
- const vectorStore = getVectorStore();
11
14
  try {
12
- const queryVector = await provider.embedText(query);
13
- const searchResults = await vectorStore.search(queryVector, SEARCH_RESULTS_DEFAULT_LIMIT);
14
- return textResult(searchResults);
15
+ const response = await client.post('/mcp/search', {
16
+ query,
17
+ collection: 'documentation',
18
+ limit: SEARCH_RESULTS_DEFAULT_LIMIT,
19
+ });
20
+ return textResult(response.data.data);
15
21
  }
16
22
  catch (err) {
17
- const errStr = String(err);
18
- if (errStr.includes('404') || errStr.toLowerCase().includes('not found') || errStr.toLowerCase().includes('collection')) {
23
+ if (isCollectionNotFoundError(err)) {
19
24
  logger.warn(`[search_documentation] Collection 'documentation' does not exist yet. Returning empty search results.`);
20
25
  return textResult([]);
21
26
  }
22
27
  throw err;
23
28
  }
24
29
  },
25
- search_flow_samples: async (args) => {
30
+ search_flow_samples: async (args, { client }) => {
26
31
  const { query, limit = SEARCH_RESULTS_DEFAULT_LIMIT } = args;
27
- const provider = getEmbeddingProvider();
28
- const vectorStore = getVectorStore();
29
32
  try {
30
- const queryVector = await provider.embedText(query);
31
- const filter = {
32
- must: [
33
- {
34
- key: 'type',
35
- match: { value: 'flow_sample' }
36
- }
37
- ]
38
- };
39
- const searchResults = await vectorStore.search(queryVector, limit, filter, 'flow_samples');
40
- return textResult(searchResults);
33
+ const response = await client.post('/mcp/search', {
34
+ query,
35
+ collection: 'flow_samples',
36
+ limit,
37
+ filter: { must: [{ key: 'type', match: { value: 'flow_sample' } }] },
38
+ });
39
+ return textResult(response.data.data);
41
40
  }
42
41
  catch (err) {
43
- const errStr = String(err);
44
- if (errStr.includes('404') || errStr.toLowerCase().includes('not found') || errStr.toLowerCase().includes('collection')) {
42
+ if (isCollectionNotFoundError(err)) {
45
43
  logger.warn(`[search_flow_samples] Collection 'flow_samples' does not exist yet. Returning empty search results.`);
46
44
  return textResult([]);
47
45
  }
48
46
  throw err;
49
47
  }
50
48
  },
51
- search_flow_steps: async (args) => {
49
+ search_flow_steps: async (args, { client }) => {
52
50
  const { query, limit = SEARCH_RESULTS_DEFAULT_LIMIT } = args;
53
- const provider = getEmbeddingProvider();
54
- const vectorStore = getVectorStore();
55
51
  try {
56
- const queryVector = await provider.embedText(query);
57
- const filter = {
58
- should: [
59
- {
60
- key: 'type',
61
- match: { value: 'flow_step' }
62
- },
63
- {
64
- key: 'type',
65
- match: { value: 'flow_edge' }
66
- }
67
- ]
68
- };
69
- const searchResults = await vectorStore.search(queryVector, limit, filter, 'flow_samples');
70
- return textResult(searchResults);
52
+ const response = await client.post('/mcp/search', {
53
+ query,
54
+ collection: 'flow_samples',
55
+ limit,
56
+ filter: {
57
+ should: [
58
+ { key: 'type', match: { value: 'flow_step' } },
59
+ { key: 'type', match: { value: 'flow_edge' } },
60
+ ],
61
+ },
62
+ });
63
+ return textResult(response.data.data);
71
64
  }
72
65
  catch (err) {
73
- const errStr = String(err);
74
- if (errStr.includes('404') || errStr.toLowerCase().includes('not found') || errStr.toLowerCase().includes('collection')) {
66
+ if (isCollectionNotFoundError(err)) {
75
67
  logger.warn(`[search_flow_steps] Collection 'flow_samples' does not exist yet. Returning empty search results.`);
76
68
  return textResult([]);
77
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/tools/handlers/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAE/D,MAAM,CAAC,MAAM,cAAc,GAAgC;IACzD,oBAAoB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACnC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QACvB,MAAM,QAAQ,GAAG,oBAAoB,EAAE,CAAC;QACxC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;QAErC,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACpD,MAAM,aAAa,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,WAAW,EAAE,4BAA4B,CAAC,CAAC;YAE1F,OAAO,UAAU,CAAC,aAAa,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YAC3B,IAAI,MAAM,CAAC,QAAQ,CAAC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;qBAC/C;iBACF;aACF,CAAC,CAAC;YACH,OAAO,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,IAAI,yBAAyB,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnC,MAAM,CAAC,IAAI,CAAC,mGAAmG,CAAC,CAAC;gBACjH,OAAO,UAAU,CAAC,EAAE,CAAC,CAAC;YACxB,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF,CAAC"}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@elastic.io/mcp",
3
- "version": "1.0.0",
3
+ "version": "1.0.1-dev10",
4
4
  "description": "elastic.io Model Context Protocol (MCP) Server",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
7
- "elasticio-mcp-server": "dist/index.js"
7
+ "mcp": "dist/cli.js"
8
8
  },
9
9
  "type": "module",
10
10
  "files": [
@@ -21,7 +21,6 @@
21
21
  "prepublishOnly": "npm run build",
22
22
  "build": "tsc",
23
23
  "start": "node dist/index.js",
24
- "start:sse": "node dist/index.js --transport=sse",
25
24
  "dev": "tsc -w",
26
25
  "test": "vitest run"
27
26
  },
@@ -0,0 +1,116 @@
1
+ # Complex Multi-Component Flow Scenarios
2
+
3
+ Realistic end-to-end integration scenarios that combine multiple components into wide, branching flows.
4
+ Each scenario is a natural-language prompt for the LLM via the MCP server.
5
+
6
+ ---
7
+
8
+ ## Scenario 1: E-Commerce Order Processing Pipeline
9
+
10
+ **Components**: Shopify Admin V2, Router, Splitter, Code, PostgreSQL, Slack, Email (SMTP), Stripe
11
+
12
+ > Create a flow: Shopify Admin V2 polls new orders every 10 minutes. Then a Router splits into 3 branches:
13
+ > - Branch 1 (order total > $500): Code component enriches the order with a "VIP" flag, then Stripe Lookup Charge by order payment ID, then insert full order + payment details into PostgreSQL, then send a Slack message to #high-value-orders channel.
14
+ > - Branch 2 (order total <= $500 and status = "paid"): Insert the order into PostgreSQL, then send a confirmation email via SMTP to the customer.
15
+ > - Branch 3 (status = "pending"): Send a Slack message to #pending-orders with the order number and customer name.
16
+
17
+ ---
18
+
19
+ ## Scenario 2: Multi-Channel Lead Capture & CRM Sync
20
+
21
+ **Components**: Webhook, Router, HubSpot, Zoho CRM, Slack, Email (SMTP), Code, PostgreSQL
22
+
23
+ > Create a flow: Webhook trigger receives lead data with a `source` field. Then a Router branches:
24
+ > - Branch 1 (source = "website"): Code component normalizes the lead fields, then HubSpot creates a new contact, then send a Slack message to #marketing-leads.
25
+ > - Branch 2 (source = "partner"): Code component normalizes the lead fields, then Zoho CRM creates a new lead, then send an email via SMTP to the partner manager.
26
+ > - Branch 3 (source = "event"): Insert the lead into PostgreSQL events_leads table, then HubSpot creates a new contact, then Zoho CRM creates a new lead (sync to both CRMs).
27
+ > - Default branch: Log the unknown source lead to PostgreSQL unmatched_leads table and send a Slack alert to #data-issues.
28
+
29
+ ---
30
+
31
+ ## Scenario 3: Daily Data Warehouse ETL with AI Enrichment
32
+
33
+ **Components**: Simple Trigger, PostgreSQL, Splitter, ChatGPT, Code, REST API V2, Email (SMTP)
34
+
35
+ > Create a flow on a daily schedule at 2 AM: Simple Trigger fires, then PostgreSQL SELECT fetches all customer feedback records from yesterday where sentiment IS NULL. Then Splitter splits the result array into individual records. For each record: ChatGPT analyzes the feedback text and returns a sentiment score (positive/neutral/negative) and a summary. Then a Code component formats the result as an UPDATE statement payload. Then REST API V2 POSTs the enriched record to an internal analytics API at https://analytics.internal/api/feedback. At the end of the flow, send an email via SMTP with a summary report of how many records were processed.
36
+
37
+ ---
38
+
39
+ ## Scenario 4: Multi-Marketplace Inventory Sync
40
+
41
+ **Components**: Simple Trigger, REST API V2, Splitter, Router, Shopify Admin V2, Magento 2, Amazon SP, Code, Slack
42
+
43
+ > Create a flow running every 30 minutes: Simple Trigger fires, then REST API V2 GETs the current inventory from the warehouse API at https://warehouse.example.com/api/inventory. Then Splitter splits the product array. For each product, a Router branches:
44
+ > - Branch 1 (product.channels contains "shopify"): Shopify Admin V2 updates the inventory level for the product.
45
+ > - Branch 2 (product.channels contains "magento"): Magento 2 updates the stock item.
46
+ > - Branch 3 (product.channels contains "amazon"): Amazon SP updates the listing quantity.
47
+ > - Branch 4 (product.stock < product.reorder_point): Send a Slack message to #inventory-alerts with the product SKU and current stock level.
48
+
49
+ ---
50
+
51
+ ## Scenario 5: Support Ticket Triage with AI Classification
52
+
53
+ **Components**: Webhook, Claude AI, Router, HubSpot, Slack, Email (SMTP), SFTP, Code
54
+
55
+ > Create a flow: Webhook receives a new support ticket payload with `subject`, `body`, `customer_email`, `attachments_url`. Claude AI classifies the ticket into one of: billing, technical, feature_request, spam — and assigns a priority (P1-P4). Then a Router branches:
56
+ > - Branch 1 (category = "billing" AND priority = "P1"): Send a Slack message to #billing-urgent with all ticket details, then send an email via SMTP to billing-escalation@company.com.
57
+ > - Branch 2 (category = "technical"): HubSpot creates a new ticket, then Code component generates a formatted case summary, then send a Slack message to #engineering-support.
58
+ > - Branch 3 (category = "feature_request"): Code component formats the request as a CSV row, then SFTP uploads the row to /data/feature-requests/incoming.csv on the product analytics server.
59
+ > - Branch 4 (category = "spam"): Code component logs the spam ticket details (no further action).
60
+
61
+ ---
62
+
63
+ ## Scenario 6: Financial Reconciliation Pipeline
64
+
65
+ **Components**: SFTP, Splitter, Code, MSSQL, Router, Stripe, Slack, Email (SMTP), PostgreSQL
66
+
67
+ > Create a flow: SFTP polls for new CSV files in /incoming/transactions/ every hour. Then a Code component parses the CSV content into a JSON array of transactions. Then Splitter splits into individual transactions. For each transaction, a Code component formats lookup parameters. Then MSSQL SELECTs the matching internal record by transaction_ref. Then a Router:
68
+ > - Branch 1 (amounts match): PostgreSQL inserts a reconciled record into the reconciliation_log table.
69
+ > - Branch 2 (amounts differ by < 1%): PostgreSQL inserts a record flagged "minor_discrepancy" into reconciliation_log, then send a Slack message to #finance-review.
70
+ > - Branch 3 (amounts differ by >= 1% OR no match found): PostgreSQL inserts a record flagged "exception" into reconciliation_log, then send an email via SMTP to finance-exceptions@company.com with the full transaction details and the discrepancy amount.
71
+
72
+ ---
73
+
74
+ ## Scenario 7: Content Publishing Pipeline
75
+
76
+ **Components**: Google Sheets V2, Splitter, Claude AI, DeepL, WordPress, Twitter, Slack, Code
77
+
78
+ > Create a flow running daily at 8 AM: Google Sheets V2 reads rows from a "Content Calendar" sheet where publish_date = today. Then Splitter splits the rows. For each content item, Claude AI generates a blog post body from the provided outline and keywords. Then a Router:
79
+ > - Branch 1 (language = "en"): WordPress creates a new post with the generated content, then Code component generates a short tweet text from the title, then Twitter posts the tweet, then Slack sends a message to #content-published.
80
+ > - Branch 2 (language != "en"): DeepL translates the generated content to the target language, then WordPress creates a new post with the translated content, then Slack sends a message to #content-published with a note about the translation.
81
+
82
+ ---
83
+
84
+ ## Scenario 8: Real-Time Webhook Event Fan-Out
85
+
86
+ **Components**: Webhook, Code, Router, AMQP, AWS SQS, PostgreSQL, REST API V2, Slack
87
+
88
+ > Create a flow: Webhook trigger receives events from a payment gateway with `event_type` field. Code component enriches the event with a timestamp and request ID. Then a Router:
89
+ > - Branch 1 (event_type = "payment.success"): AMQP publishes to the "orders.confirmed" exchange, then PostgreSQL inserts the payment record, then REST API V2 POSTs to the fulfillment service at https://fulfillment.internal/api/ship.
90
+ > - Branch 2 (event_type = "payment.failed"): AWS SQS sends a message to the retry queue, then Slack sends a message to #payment-failures, then REST API V2 POSTs to the notification service at https://notify.internal/api/email to alert the customer.
91
+ > - Branch 3 (event_type = "refund.created"): AMQP publishes to the "refunds.processing" exchange, then PostgreSQL updates the payment record status, then Slack sends a message to #refunds.
92
+ > - Default: PostgreSQL logs the unhandled event type for monitoring.
93
+
94
+ ---
95
+
96
+ ## Scenario 9: HR Onboarding Automation
97
+
98
+ **Components**: Monday, Router, Google Sheets V2, Slack, Email (SMTP), REST API V2, Code, MailChimp
99
+
100
+ > Create a flow: Monday webhook triggers when a new item is created in the "New Hires" board. Code component extracts employee details (name, email, department, start_date, role). Then a Router:
101
+ > - Branch 1 (department = "Engineering"): REST API V2 POSTs to the GitHub API to invite the user to the org, then Google Sheets V2 adds a row to the "Engineering Roster" sheet, then Slack sends a welcome message to #engineering with the new hire's info, then Email via SMTP sends onboarding docs to the new hire.
102
+ > - Branch 2 (department = "Sales"): REST API V2 POSTs to the CRM admin API to create a user account, then Google Sheets V2 adds a row to "Sales Team" sheet, then Slack sends a welcome message to #sales, then MailChimp subscribes the new hire to the internal sales newsletter.
103
+ > - Branch 3 (department = "Marketing"): Google Sheets V2 adds a row to "Marketing Team" sheet, then Slack sends a welcome message to #marketing, then MailChimp subscribes the new hire to the marketing tools newsletter.
104
+ > All branches also: Email via SMTP sends a welcome email to the new hire with their start date and first-day instructions.
105
+
106
+ ---
107
+
108
+ ## Scenario 10: IoT Sensor Data Pipeline with Alerting
109
+
110
+ **Components**: AMQP, Splitter, Code, Router, PostgreSQL, MSSQL, Slack, Email (SMTP), REST API V2, Google Pub/Sub
111
+
112
+ > Create a flow: AMQP consumes messages from the "sensor.readings" queue (each message is a batch of sensor readings). Splitter splits the batch into individual readings. Code component validates each reading (checks for nulls, out-of-range values) and adds a `valid` flag. Then a Router:
113
+ > - Branch 1 (valid = true AND reading_type = "temperature"): PostgreSQL inserts into the temperature_readings table. Then a nested Router: if value > 85: Slack sends an alert to #ops-alerts AND Email via SMTP sends to oncall@company.com AND Google Pub/Sub publishes an alert event to the "critical-alerts" topic.
114
+ > - Branch 2 (valid = true AND reading_type = "humidity"): PostgreSQL inserts into humidity_readings table. If value > 90: Slack sends a warning to #ops-alerts.
115
+ > - Branch 3 (valid = true AND reading_type = "pressure"): MSSQL inserts into the legacy pressure_readings table (different DB system).
116
+ > - Branch 4 (valid = false): REST API V2 POSTs the invalid reading to the data quality API at https://dq.internal/api/anomalies for investigation.
@@ -13,7 +13,6 @@ Workspace: `59d341e9037f7200184a408b`
13
13
  | 11 | ChatGPT | VC-E1: Text Generation | `6a9ac51f03c95f0012cfa355` |
14
14
  | 12 | Claude AI | VC-E4: Text Generation | `6a9ad08a03c95f0012d0ac56` |
15
15
  | 13 | Gemini | VC-E6: Text Generation | `6a9ad0e303c95f0012d0b2f3` |
16
- | 14 | Grok | VC-E8: Text Generation | `6a9ad10b03c95f0012d0b5b0` |
17
16
  | 15 | HubSpot | VC-F1: Poll Contacts | `6a9ad12ba6268100126020dd` |
18
17
  | 16 | Zoho CRM | VC-F4: Poll Leads | `6a9ad179a62681001260263e` |
19
18
  | 20 | Apptivo | VC-F12: Raw Request Contacts | `6a9ad6d403c95f0012d10cef` |
@@ -23,7 +22,6 @@ Workspace: `59d341e9037f7200184a408b`
23
22
  | 24 | MailChimp | VC-F19: Subscribe Contact | `6a9ad88c03c95f0012d12c0e` |
24
23
  | 25 | Marketo | VC-F21: Poll Leads | `6a9ad89403c95f0012d12cdc` |
25
24
  | 26 | Magento 2 | VC-G1: Poll Orders | `6a9ad8f903c95f0012d13401` |
26
- | 27 | Shopify Admin V1 | VC-G5: Poll Products | `6a9ad93ea62681001260a50a` |
27
25
  | 28 | Shopify Admin V2 | VC-G6: Poll Orders | `6a9ad942a62681001260a57c` |
28
26
  | 29 | VTEX | VC-G9: Poll Customers | `6a9ad966a62681001260a90d` |
29
27
  | 30 | Amazon SP | VC-G12: Poll Orders | `6a9ad971a62681001260aa9f` |