@elastic.io/mcp 1.0.0 → 1.0.1-dev1
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 +43 -76
- package/dist/config.d.ts +0 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -5
- package/dist/config.js.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/tools/handlers/search.d.ts.map +1 -1
- package/dist/tools/handlers/search.js +38 -46
- package/dist/tools/handlers/search.js.map +1 -1
- package/package.json +1 -2
- package/resources/docs/complex-flow-scenarios.md +116 -0
- package/resources/docs/unique-components.md +0 -2
package/README.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
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.
|
|
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
|
+
This server enables AI assistants (such as Antigravity, Claude Desktop, Claude Code, Cursor, or custom frontends) to discover, construct, modify, manage, and debug integration flows directly.
|
|
6
|
+
|
|
7
|
+
It is published on npm as `@elastic.io/mcp` and can be run directly via `npx @elastic.io/mcp`.
|
|
6
8
|
|
|
7
9
|
---
|
|
8
10
|
|
|
@@ -10,32 +12,19 @@ This server enables AI assistants (such as Antigravity, Claude Desktop, Cursor,
|
|
|
10
12
|
|
|
11
13
|
This server implements the **Model Context Protocol (MCP)**, a standard protocol that lets LLMs securely query and mutate data in external systems.
|
|
12
14
|
|
|
13
|
-
Specifically, this server acts as an intelligent intermediary between an LLM agent and the elastic.io integration platform, exposing
|
|
15
|
+
Specifically, this server acts as an intelligent intermediary between an LLM agent and the elastic.io integration platform, exposing 36 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, debug individual flow steps, manage data samples, analyze run-time logs, and more.
|
|
14
16
|
|
|
15
17
|
---
|
|
16
18
|
|
|
17
19
|
## How It Works
|
|
18
20
|
|
|
19
|
-
The server
|
|
21
|
+
The server runs in **Stdio mode**: the LLM client starts the server as a subprocess, and communication occurs over standard input/output streams.
|
|
20
22
|
|
|
21
23
|
```
|
|
22
|
-
|
|
23
|
-
LLM Client (Cursor) <--> [stdin / stdout] <--> MCP Server (uses static env keys)
|
|
24
|
-
|
|
25
|
-
[SSE Mode (Cloud)]
|
|
26
|
-
LLM Client (Browser/IDE) <--> [HTTP / SSE] <--> Express Server <--> Session Manager <--> Scoped MCP Server & Client (uses dynamic user keys)
|
|
24
|
+
LLM Client (Cursor/Claude Code/Claude Desktop) <--> [stdin / stdout] <--> MCP Server
|
|
27
25
|
```
|
|
28
26
|
|
|
29
|
-
|
|
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).
|
|
32
|
-
|
|
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.
|
|
27
|
+
The server loads authentication credentials (`ELASTICIO_API_EMAIL` and `ELASTICIO_API_KEY`) from environment variables or a local `.env` file.
|
|
39
28
|
|
|
40
29
|
### Core Safeguards & Optimizations
|
|
41
30
|
* **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.
|
|
@@ -66,63 +55,73 @@ LLM Client (Browser/IDE) <--> [HTTP / SSE] <--> Express Server <--> Session Mana
|
|
|
66
55
|
npm run build
|
|
67
56
|
```
|
|
68
57
|
|
|
69
|
-
### Running
|
|
58
|
+
### Running the Server
|
|
70
59
|
To run the server locally inside your IDE (e.g. Cursor or Claude Desktop):
|
|
71
60
|
```bash
|
|
72
61
|
node dist/index.js
|
|
73
62
|
```
|
|
63
|
+
|
|
64
|
+
#### Using npx (no local clone needed)
|
|
65
|
+
If the package is published to npm, you can run it directly:
|
|
66
|
+
```bash
|
|
67
|
+
ELASTICIO_API_EMAIL="your_email@example.com" \
|
|
68
|
+
ELASTICIO_API_KEY="your_api_key" \
|
|
69
|
+
npx @elastic.io/mcp
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Environment variables:**
|
|
73
|
+
|
|
74
|
+
| Variable | Required | Description |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `ELASTICIO_API_EMAIL` | Yes | Your elastic.io account email |
|
|
77
|
+
| `ELASTICIO_API_KEY` | Yes | Your elastic.io API key |
|
|
78
|
+
| `ELASTICIO_API_BASE_URL` | No | API base URL (default: `https://api.elastic.io/v2`) |
|
|
79
|
+
|
|
80
|
+
Semantic search (documentation, flow samples) is handled server-side through the elastic.io API — no additional configuration needed.
|
|
81
|
+
|
|
82
|
+
#### Client Configuration
|
|
74
83
|
Configure your client configuration file (e.g., `mcp_config.json`) to invoke this command, providing the required environment variables:
|
|
84
|
+
|
|
85
|
+
**Using npx (recommended):**
|
|
75
86
|
```json
|
|
76
87
|
{
|
|
77
88
|
"mcpServers": {
|
|
78
89
|
"elasticio-mcp": {
|
|
79
|
-
"command": "
|
|
80
|
-
"args": ["/
|
|
81
|
-
"cwd": "/path/to/project",
|
|
90
|
+
"command": "npx",
|
|
91
|
+
"args": ["-y", "@elastic.io/mcp"],
|
|
82
92
|
"env": {
|
|
83
93
|
"ELASTICIO_API_EMAIL": "your_email@example.com",
|
|
84
|
-
"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"
|
|
94
|
+
"ELASTICIO_API_KEY": "your_api_key"
|
|
88
95
|
}
|
|
89
96
|
}
|
|
90
97
|
}
|
|
91
98
|
}
|
|
92
99
|
```
|
|
93
100
|
|
|
94
|
-
|
|
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:
|
|
101
|
+
**Using a local clone:**
|
|
104
102
|
```json
|
|
105
103
|
{
|
|
106
104
|
"mcpServers": {
|
|
107
|
-
"elasticio-mcp
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
|
|
111
|
-
|
|
105
|
+
"elasticio-mcp": {
|
|
106
|
+
"command": "node",
|
|
107
|
+
"args": ["/path/to/project/dist/index.js"],
|
|
108
|
+
"cwd": "/path/to/project",
|
|
109
|
+
"env": {
|
|
110
|
+
"ELASTICIO_API_EMAIL": "your_email@example.com",
|
|
111
|
+
"ELASTICIO_API_KEY": "your_api_key"
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
```
|
|
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
117
|
|
|
119
118
|
---
|
|
120
119
|
|
|
121
120
|
## Embedding & Ingestion Process
|
|
122
121
|
|
|
123
|
-
The server uses semantic search to locate documentation and similar flow configuration examples for the LLM. You must populate the vector database
|
|
122
|
+
The server uses semantic search to locate documentation and similar flow configuration examples for the LLM. You must populate the vector database by ingesting local resources:
|
|
124
123
|
|
|
125
|
-
###
|
|
124
|
+
### Ingesting Local Files
|
|
126
125
|
The project includes command-line scripts to parse, embed, and index local resources:
|
|
127
126
|
* **Ingest Documentation:** Parses the markdown files located in `resources/elasticio.github.io/content/` and uploads them to the Qdrant `documentation` collection:
|
|
128
127
|
```bash
|
|
@@ -137,35 +136,3 @@ The project includes command-line scripts to parse, embed, and index local resou
|
|
|
137
136
|
node dist/scripts/test_search.js --query "your query string" --collection "flow_samples"
|
|
138
137
|
```
|
|
139
138
|
|
|
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.
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
## Limitations
|
|
153
|
-
|
|
154
|
-
If you deploy this MCP server to a cloud infrastructure, be aware of the following implementation limitations:
|
|
155
|
-
|
|
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.
|
|
160
|
-
|
|
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.
|
|
165
|
-
|
|
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.
|
|
171
|
-
|
package/dist/config.d.ts
CHANGED
package/dist/config.d.ts.map
CHANGED
|
@@ -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
|
|
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
|
package/dist/config.js.map
CHANGED
|
@@ -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;IACD,MAAM,IAAI,KAAK,CAAC,+DAA+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
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { config
|
|
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
|
|
222
|
-
logger.error(`[Server Error]
|
|
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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,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;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,MAAM,MAAM,aAAa,CAAC;AAEj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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
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
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
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
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
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
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,
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/tools/handlers/search.ts"],"names":[],"mappings":"AAAA,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,SAAS,yBAAyB,CAAC,GAAQ;IACzC,MAAM,MAAM,GAAG,GAAG,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,EAAE,UAAU,CAAC;IACxD,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC3B,OAAO,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2
|
"name": "@elastic.io/mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1-dev1",
|
|
4
4
|
"description": "elastic.io Model Context Protocol (MCP) Server",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -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` |
|