@elastic.io/mcp 1.0.1-dev4 → 1.0.1-dev6
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 +49 -83
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +10 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.js +194 -199
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,119 +1,85 @@
|
|
|
1
1
|
# elastic.io Model Context Protocol (MCP) Server
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
It is published on npm as `@elastic.io/mcp` and can be run directly via `npx @elastic.io/mcp`.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## What is the MCP Server?
|
|
12
|
-
|
|
13
|
-
This server implements the **Model Context Protocol (MCP)**, a standard protocol that lets LLMs securely query and mutate data in external systems.
|
|
14
|
-
|
|
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.
|
|
5
|
+
Published on npm as `@elastic.io/mcp`.
|
|
16
6
|
|
|
17
7
|
---
|
|
18
8
|
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
The server runs in **Stdio mode**: the LLM client starts the server as a subprocess, and communication occurs over standard input/output streams.
|
|
9
|
+
## Quick Start
|
|
22
10
|
|
|
23
|
-
|
|
24
|
-
LLM Client (Cursor/Claude Code/Claude Desktop) <--> [stdin / stdout] <--> MCP Server
|
|
25
|
-
```
|
|
11
|
+
### Prerequisites
|
|
26
12
|
|
|
27
|
-
|
|
13
|
+
1. **Node.js 18+** — download from [nodejs.org](https://nodejs.org/)
|
|
14
|
+
2. **A desktop AI client** — install one of the following:
|
|
15
|
+
- [Claude Desktop](https://claude.ai/download)
|
|
16
|
+
- [ChatGPT Desktop](https://openai.com/chatgpt/desktop/)
|
|
17
|
+
- [Cursor](https://cursor.com/)
|
|
18
|
+
- [Windsurf](https://codeium.com/windsurf)
|
|
19
|
+
3. **elastic.io credentials** — your account email and API key
|
|
28
20
|
|
|
29
|
-
###
|
|
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.
|
|
31
|
-
* **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`.
|
|
32
|
-
* **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.
|
|
21
|
+
### One-Command Setup
|
|
33
22
|
|
|
34
|
-
|
|
23
|
+
Run this in your terminal — it will detect your installed AI clients and configure them automatically:
|
|
35
24
|
|
|
36
|
-
## Execution Process & Requirements
|
|
37
|
-
|
|
38
|
-
### Requirements
|
|
39
|
-
* **Node.js** (version 18 or higher)
|
|
40
|
-
* **npm** or yarn
|
|
41
|
-
* **Embedding Provider API Key** (required for creating documentation and flow sample embeddings, e.g. Gemini).
|
|
42
|
-
* **Vector Store URL and API Key** (for semantic search capabilities, e.g. Qdrant).
|
|
43
|
-
|
|
44
|
-
### Local Setup
|
|
45
|
-
1. Clone this repository and install dependencies:
|
|
46
|
-
```bash
|
|
47
|
-
npm install
|
|
48
|
-
```
|
|
49
|
-
2. Copy `.env.example` to `.env` and fill out your variables:
|
|
50
|
-
```bash
|
|
51
|
-
cp .env.example .env
|
|
52
|
-
```
|
|
53
|
-
3. Build the project:
|
|
54
|
-
```bash
|
|
55
|
-
npm run build
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Running the Server
|
|
59
|
-
To run the server locally inside your IDE (e.g. Cursor or Claude Desktop):
|
|
60
25
|
```bash
|
|
61
|
-
|
|
26
|
+
npx -y @elastic.io/mcp setup
|
|
62
27
|
```
|
|
63
28
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
npx @elastic.io/mcp
|
|
70
|
-
```
|
|
29
|
+
The setup wizard will:
|
|
30
|
+
1. Ask for your elastic.io email and API key
|
|
31
|
+
2. Detect which AI clients are installed on your machine
|
|
32
|
+
3. Let you choose which clients to configure
|
|
33
|
+
4. Write the MCP config files automatically
|
|
71
34
|
|
|
72
|
-
**
|
|
35
|
+
After setup, **restart your AI client** — the elastic.io tools will appear in the chat.
|
|
73
36
|
|
|
74
|
-
|
|
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`) |
|
|
37
|
+
### Manual Configuration
|
|
79
38
|
|
|
80
|
-
|
|
39
|
+
If you prefer to configure manually, add the following to your client's MCP config file:
|
|
81
40
|
|
|
82
|
-
|
|
83
|
-
|
|
41
|
+
| Client | Config file location |
|
|
42
|
+
|---|---|
|
|
43
|
+
| Claude Desktop | `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) |
|
|
44
|
+
| ChatGPT | `~/.chatgpt/mcp.json` |
|
|
45
|
+
| Cursor | `~/.cursor/mcp.json` |
|
|
46
|
+
| Windsurf | `~/.codeium/windsurf/mcp_config.json` |
|
|
47
|
+
| Claude Code | `~/.claude.json` |
|
|
84
48
|
|
|
85
|
-
**Using npx (recommended):**
|
|
86
49
|
```json
|
|
87
50
|
{
|
|
88
51
|
"mcpServers": {
|
|
89
|
-
"elasticio
|
|
52
|
+
"elasticio": {
|
|
90
53
|
"command": "npx",
|
|
91
54
|
"args": ["-y", "@elastic.io/mcp"],
|
|
92
55
|
"env": {
|
|
93
56
|
"ELASTICIO_API_EMAIL": "your_email@example.com",
|
|
94
|
-
"ELASTICIO_API_KEY": "your_api_key"
|
|
57
|
+
"ELASTICIO_API_KEY": "your_api_key",
|
|
58
|
+
"ELASTICIO_API_BASE_URL": "https://api.elastic.io/v2"
|
|
95
59
|
}
|
|
96
60
|
}
|
|
97
61
|
}
|
|
98
62
|
}
|
|
99
63
|
```
|
|
100
64
|
|
|
101
|
-
**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
"env": {
|
|
110
|
-
"ELASTICIO_API_EMAIL": "your_email@example.com",
|
|
111
|
-
"ELASTICIO_API_KEY": "your_api_key"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
65
|
+
> **Note:** ChatGPT uses `"servers"` instead of `"mcpServers"` as the top-level key.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## How It Works
|
|
70
|
+
|
|
71
|
+
The AI client starts the MCP server as a subprocess and communicates over stdin/stdout:
|
|
72
|
+
|
|
116
73
|
```
|
|
74
|
+
AI Client (Claude/ChatGPT/Cursor/...) <--> [stdin / stdout] <--> MCP Server <--> elastic.io API
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
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.
|
|
78
|
+
|
|
79
|
+
### Built-in Safeguards
|
|
80
|
+
* **State-Machine Verification** — components and credentials must be discovered in the current session before they can be used, preventing hallucinated IDs.
|
|
81
|
+
* **JSONata Safety Checks** — warns when mappings have common mistakes (quoted expressions, missing `$getPassthrough()` calls).
|
|
82
|
+
* **Token Optimization** — large metadata and enums are dynamically pruned to stay within context limits.
|
|
117
83
|
|
|
118
84
|
---
|
|
119
85
|
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEhC,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;IACxB,MAAM,CAAC,YAAY,CAAC,CAAC;AACvB,CAAC;KAAM,CAAC;IACN,MAAM,CAAC,YAAY,CAAC,CAAC;AACvB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,222 +9,217 @@ import { logger } from './api/logger.js';
|
|
|
9
9
|
import { ingestionQueue } from './api/samples.js';
|
|
10
10
|
import crypto from 'node:crypto';
|
|
11
11
|
const args = process.argv.slice(2);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
res.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
12
|
+
const transportFlag = args.find((arg) => arg.startsWith('--transport='));
|
|
13
|
+
const isSseMode = transportFlag ? transportFlag.split('=')[1] === 'sse' : false;
|
|
14
|
+
if (isSseMode) {
|
|
15
|
+
const app = express();
|
|
16
|
+
const sessionManager = new SessionManager();
|
|
17
|
+
sessionManager.startReaper(30 * 60 * 1000); // 30 minutes idle timeout
|
|
18
|
+
const port = config.port;
|
|
19
|
+
// Custom CORS middleware to support cross-origin browser dashboards or clients
|
|
20
|
+
app.use((req, res, next) => {
|
|
21
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
22
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PATCH, PUT, DELETE, OPTIONS');
|
|
23
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, mcp-session-id, x-elasticio-email, x-elasticio-api-key');
|
|
24
|
+
if (req.method === 'OPTIONS') {
|
|
25
|
+
res.sendStatus(200);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
next();
|
|
29
|
+
});
|
|
30
|
+
// Global HTTP request logging middleware
|
|
31
|
+
app.use((req, res, next) => {
|
|
32
|
+
const start = Date.now();
|
|
33
|
+
res.on('finish', () => {
|
|
34
|
+
const duration = Date.now() - start;
|
|
35
|
+
logger.info(`[HTTP] ${req.method} ${req.originalUrl} - Status: ${res.statusCode} (${duration}ms)`);
|
|
33
36
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
next();
|
|
38
|
+
});
|
|
39
|
+
// Custom Security Headers middleware to enforce baseline security controls
|
|
40
|
+
app.use((req, res, next) => {
|
|
41
|
+
res.setHeader('X-Content-Type-Options', 'nosniff');
|
|
42
|
+
res.setHeader('X-Frame-Options', 'DENY');
|
|
43
|
+
res.setHeader('X-XSS-Protection', '1; mode=block');
|
|
44
|
+
res.setHeader('Strict-Transport-Security', 'max-age=15552000; includeSubDomains');
|
|
45
|
+
res.setHeader('Content-Security-Policy', "default-src 'none'");
|
|
46
|
+
next();
|
|
47
|
+
});
|
|
48
|
+
app.get('/health', (req, res) => {
|
|
49
|
+
res.status(200).json({
|
|
50
|
+
status: 'OK',
|
|
51
|
+
activeSessions: sessionManager.activeSessionCount()
|
|
42
52
|
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
});
|
|
54
|
+
const connectionRateLimits = new Map();
|
|
55
|
+
const sseRateLimiter = (limit, windowMs) => {
|
|
56
|
+
return (req, res, next) => {
|
|
57
|
+
const ip = req.headers['x-forwarded-for'] || req.ip || req.socket.remoteAddress || 'unknown';
|
|
58
|
+
const now = Date.now();
|
|
59
|
+
let info = connectionRateLimits.get(ip);
|
|
60
|
+
if (!info) {
|
|
61
|
+
info = { timestamps: [] };
|
|
62
|
+
connectionRateLimits.set(ip, info);
|
|
63
|
+
}
|
|
64
|
+
info.timestamps = info.timestamps.filter((ts) => now - ts < windowMs);
|
|
65
|
+
if (info.timestamps.length >= limit) {
|
|
66
|
+
logger.warn(`[Rate Limit Exceeded] IP: ${ip} exceeded session connection limit for ${req.path}`);
|
|
67
|
+
res.status(429).send('Too Many Requests: SSE connection rate limit exceeded. Please wait a minute and try again.');
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
info.timestamps.push(now);
|
|
50
71
|
next();
|
|
51
|
-
});
|
|
52
|
-
app.get('/health', (req, res) => {
|
|
53
|
-
res.status(200).json({
|
|
54
|
-
status: 'OK',
|
|
55
|
-
activeSessions: sessionManager.activeSessionCount()
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
const connectionRateLimits = new Map();
|
|
59
|
-
const sseRateLimiter = (limit, windowMs) => {
|
|
60
|
-
return (req, res, next) => {
|
|
61
|
-
const ip = req.headers['x-forwarded-for'] || req.ip || req.socket.remoteAddress || 'unknown';
|
|
62
|
-
const now = Date.now();
|
|
63
|
-
let info = connectionRateLimits.get(ip);
|
|
64
|
-
if (!info) {
|
|
65
|
-
info = { timestamps: [] };
|
|
66
|
-
connectionRateLimits.set(ip, info);
|
|
67
|
-
}
|
|
68
|
-
info.timestamps = info.timestamps.filter((ts) => now - ts < windowMs);
|
|
69
|
-
if (info.timestamps.length >= limit) {
|
|
70
|
-
logger.warn(`[Rate Limit Exceeded] IP: ${ip} exceeded session connection limit for ${req.path}`);
|
|
71
|
-
res.status(429).send('Too Many Requests: SSE connection rate limit exceeded. Please wait a minute and try again.');
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
info.timestamps.push(now);
|
|
75
|
-
next();
|
|
76
|
-
};
|
|
77
72
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
73
|
+
};
|
|
74
|
+
const getAuthHeader = (req) => {
|
|
75
|
+
let authHeader = req.headers['authorization'];
|
|
76
|
+
const emailHeader = req.headers['x-elasticio-email'];
|
|
77
|
+
const apiKeyHeader = req.headers['x-elasticio-api-key'];
|
|
78
|
+
if (!authHeader && typeof emailHeader === 'string' && typeof apiKeyHeader === 'string') {
|
|
79
|
+
const token = Buffer.from(`${emailHeader}:${apiKeyHeader}`).toString('base64');
|
|
80
|
+
authHeader = `Basic ${token}`;
|
|
81
|
+
}
|
|
82
|
+
if (config.nodeEnv !== 'production') {
|
|
83
|
+
const queryEmail = req.query.email;
|
|
84
|
+
const queryApiKey = req.query.apiKey;
|
|
85
|
+
const queryAuth = req.query.auth;
|
|
86
|
+
if (!authHeader && typeof queryEmail === 'string' && typeof queryApiKey === 'string') {
|
|
87
|
+
const token = Buffer.from(`${queryEmail}:${queryApiKey}`).toString('base64');
|
|
84
88
|
authHeader = `Basic ${token}`;
|
|
85
89
|
}
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
const queryApiKey = req.query.apiKey;
|
|
89
|
-
const queryAuth = req.query.auth;
|
|
90
|
-
if (!authHeader && typeof queryEmail === 'string' && typeof queryApiKey === 'string') {
|
|
91
|
-
const token = Buffer.from(`${queryEmail}:${queryApiKey}`).toString('base64');
|
|
92
|
-
authHeader = `Basic ${token}`;
|
|
93
|
-
}
|
|
94
|
-
if (!authHeader && typeof queryAuth === 'string') {
|
|
95
|
-
authHeader = queryAuth;
|
|
96
|
-
}
|
|
90
|
+
if (!authHeader && typeof queryAuth === 'string') {
|
|
91
|
+
authHeader = queryAuth;
|
|
97
92
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
// Verify credentials to prevent session hijacking
|
|
114
|
-
const currentAuth = getAuthHeader(req);
|
|
115
|
-
if (!currentAuth || currentAuth !== session.authHeader) {
|
|
116
|
-
res.status(401).send('Unauthorized: Credentials do not match the session owner.');
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
session.lastActive = Date.now();
|
|
120
|
-
if (req.method === 'DELETE') {
|
|
121
|
-
sessionManager.removeSession(sessionId);
|
|
122
|
-
res.sendStatus(200);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
await session.transport.handleRequest(req, res, req.body);
|
|
93
|
+
}
|
|
94
|
+
return authHeader;
|
|
95
|
+
};
|
|
96
|
+
const handleSessionRoute = async (req, res, next) => {
|
|
97
|
+
try {
|
|
98
|
+
const sessionId = req.headers['mcp-session-id'] || req.query.sessionId;
|
|
99
|
+
if (typeof sessionId === 'string' &&
|
|
100
|
+
sessionId.trim() !== '' &&
|
|
101
|
+
sessionId !== 'undefined' &&
|
|
102
|
+
sessionId !== 'null') {
|
|
103
|
+
// Existing session
|
|
104
|
+
const session = sessionManager.getSession(sessionId);
|
|
105
|
+
if (!session) {
|
|
106
|
+
res.status(404).send(`Session with ID '${sessionId}' not found.`);
|
|
126
107
|
return;
|
|
127
108
|
}
|
|
128
|
-
|
|
129
|
-
|
|
109
|
+
// Verify credentials to prevent session hijacking
|
|
110
|
+
const currentAuth = getAuthHeader(req);
|
|
111
|
+
if (!currentAuth || currentAuth !== session.authHeader) {
|
|
112
|
+
res.status(401).send('Unauthorized: Credentials do not match the session owner.');
|
|
130
113
|
return;
|
|
131
114
|
}
|
|
132
|
-
|
|
133
|
-
if (
|
|
134
|
-
|
|
115
|
+
session.lastActive = Date.now();
|
|
116
|
+
if (req.method === 'DELETE') {
|
|
117
|
+
sessionManager.removeSession(sessionId);
|
|
118
|
+
res.sendStatus(200);
|
|
135
119
|
return;
|
|
136
120
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const client = createElasticioClient(authHeader);
|
|
140
|
-
const server = createMcpServer(client);
|
|
141
|
-
const transport = new StreamableHTTPServerTransport({
|
|
142
|
-
sessionIdGenerator: () => generatedSessionId,
|
|
143
|
-
enableJsonResponse: true
|
|
144
|
-
});
|
|
145
|
-
transport.onerror = (err) => {
|
|
146
|
-
logger.error('[SSE Transport Error]', err.message || err, err.stack || '');
|
|
147
|
-
};
|
|
148
|
-
await server.connect(transport);
|
|
149
|
-
sessionManager.registerSession(generatedSessionId, {
|
|
150
|
-
server,
|
|
151
|
-
transport,
|
|
152
|
-
client,
|
|
153
|
-
authHeader,
|
|
154
|
-
lastActive: Date.now()
|
|
155
|
-
});
|
|
156
|
-
res.setHeader('mcp-session-id', generatedSessionId);
|
|
157
|
-
logger.info(`[Session Created] ID: ${generatedSessionId} (Active: ${sessionManager.activeSessionCount()})`);
|
|
158
|
-
await transport.handleRequest(req, res, req.body);
|
|
159
|
-
req.on('close', () => {
|
|
160
|
-
sessionManager.removeSession(generatedSessionId);
|
|
161
|
-
logger.info(`[Session Closed] ID: ${generatedSessionId} (Active: ${sessionManager.activeSessionCount()})`);
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
catch (err) {
|
|
165
|
-
next(err);
|
|
121
|
+
await session.transport.handleRequest(req, res, req.body);
|
|
122
|
+
return;
|
|
166
123
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
app.delete('/sse', handleSessionRoute);
|
|
171
|
-
app.post('/messages', express.json({ limit: '2mb' }), handleSessionRoute);
|
|
172
|
-
app.delete('/messages', handleSessionRoute);
|
|
173
|
-
app.post('/api/samples', express.json({ limit: '50mb' }), (req, res, next) => {
|
|
174
|
-
try {
|
|
175
|
-
const authHeader = getAuthHeader(req);
|
|
176
|
-
if (!authHeader) {
|
|
177
|
-
res.status(401).send('Unauthorized: Missing credentials.');
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
const flows = Array.isArray(req.body) ? req.body : [req.body];
|
|
181
|
-
const purge = req.query.purge === 'true';
|
|
182
|
-
ingestionQueue.enqueue(flows, purge).catch((err) => {
|
|
183
|
-
logger.error('[Samples Ingest Queue Error]', err);
|
|
184
|
-
});
|
|
185
|
-
res.status(202).json({
|
|
186
|
-
status: 'Accepted',
|
|
187
|
-
message: `Ingestion of ${flows.length} flow samples started in the background.${purge ? ' Collection purged first.' : ''}`
|
|
188
|
-
});
|
|
124
|
+
if (req.method !== 'GET' && req.method !== 'POST') {
|
|
125
|
+
res.status(405).send('Method Not Allowed: New session must be GET or POST.');
|
|
126
|
+
return;
|
|
189
127
|
}
|
|
190
|
-
|
|
191
|
-
|
|
128
|
+
const authHeader = getAuthHeader(req);
|
|
129
|
+
if (!authHeader) {
|
|
130
|
+
res.status(401).send('Unauthorized: Authorization header or "x-elasticio-email" & "x-elasticio-api-key" headers are required.');
|
|
131
|
+
return;
|
|
192
132
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
133
|
+
const generatedSessionId = crypto.randomUUID();
|
|
134
|
+
// Create new session resources
|
|
135
|
+
const client = createElasticioClient(authHeader);
|
|
136
|
+
const server = createMcpServer(client);
|
|
137
|
+
const transport = new StreamableHTTPServerTransport({
|
|
138
|
+
sessionIdGenerator: () => generatedSessionId,
|
|
139
|
+
enableJsonResponse: true
|
|
140
|
+
});
|
|
141
|
+
transport.onerror = (err) => {
|
|
142
|
+
logger.error('[SSE Transport Error]', err.message || err, err.stack || '');
|
|
143
|
+
};
|
|
144
|
+
await server.connect(transport);
|
|
145
|
+
sessionManager.registerSession(generatedSessionId, {
|
|
146
|
+
server,
|
|
147
|
+
transport,
|
|
148
|
+
client,
|
|
149
|
+
authHeader,
|
|
150
|
+
lastActive: Date.now()
|
|
151
|
+
});
|
|
152
|
+
res.setHeader('mcp-session-id', generatedSessionId);
|
|
153
|
+
logger.info(`[Session Created] ID: ${generatedSessionId} (Active: ${sessionManager.activeSessionCount()})`);
|
|
154
|
+
await transport.handleRequest(req, res, req.body);
|
|
155
|
+
req.on('close', () => {
|
|
156
|
+
sessionManager.removeSession(generatedSessionId);
|
|
157
|
+
logger.info(`[Session Closed] ID: ${generatedSessionId} (Active: ${sessionManager.activeSessionCount()})`);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
next(err);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
app.get('/sse', sseRateLimiter(10, 60000), handleSessionRoute);
|
|
165
|
+
app.post('/sse', express.json({ limit: '2mb' }), handleSessionRoute);
|
|
166
|
+
app.delete('/sse', handleSessionRoute);
|
|
167
|
+
app.post('/messages', express.json({ limit: '2mb' }), handleSessionRoute);
|
|
168
|
+
app.delete('/messages', handleSessionRoute);
|
|
169
|
+
app.post('/api/samples', express.json({ limit: '50mb' }), (req, res, next) => {
|
|
170
|
+
try {
|
|
171
|
+
const authHeader = getAuthHeader(req);
|
|
172
|
+
if (!authHeader) {
|
|
173
|
+
res.status(401).send('Unauthorized: Missing credentials.');
|
|
174
|
+
return;
|
|
198
175
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
const email = config.elasticioApiEmail;
|
|
209
|
-
const apiKey = config.elasticioApiKey;
|
|
210
|
-
if (!email || !apiKey) {
|
|
211
|
-
logger.error('[Error] Missing elastic.io credentials. For local Stdio mode, please set ELASTICIO_API_EMAIL and ELASTICIO_API_KEY in your environment or .env file.');
|
|
212
|
-
logger.error('[Server Error] Missing elastic.io credentials on startup');
|
|
213
|
-
process.exit(1);
|
|
176
|
+
const flows = Array.isArray(req.body) ? req.body : [req.body];
|
|
177
|
+
const purge = req.query.purge === 'true';
|
|
178
|
+
ingestionQueue.enqueue(flows, purge).catch((err) => {
|
|
179
|
+
logger.error('[Samples Ingest Queue Error]', err);
|
|
180
|
+
});
|
|
181
|
+
res.status(202).json({
|
|
182
|
+
status: 'Accepted',
|
|
183
|
+
message: `Ingestion of ${flows.length} flow samples started in the background.${purge ? ' Collection purged first.' : ''}`
|
|
184
|
+
});
|
|
214
185
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
});
|
|
186
|
+
catch (err) {
|
|
187
|
+
next(err);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
app.use((err, req, res, next) => {
|
|
191
|
+
logger.error('[SSE Server Express Error]', err.message || err, err.stack || '');
|
|
192
|
+
if (!res.headersSent) {
|
|
193
|
+
res.status(500).send('Internal Server Error');
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
app.listen(port, () => {
|
|
197
|
+
logger.info(`[elastic.io MCP Server] Running in SSE mode on port ${port}`);
|
|
198
|
+
logger.info(`[SSE Endpoint] GET http://localhost:${port}/sse`);
|
|
199
|
+
logger.info(`[Message Endpoint] POST http://localhost:${port}/messages`);
|
|
200
|
+
logger.info(`[Server Start] SSE mode listening on port ${port}`);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
const email = config.elasticioApiEmail;
|
|
205
|
+
const apiKey = config.elasticioApiKey;
|
|
206
|
+
if (!email || !apiKey) {
|
|
207
|
+
logger.error('[Error] Missing elastic.io credentials. For local Stdio mode, please set ELASTICIO_API_EMAIL and ELASTICIO_API_KEY in your environment or .env file.');
|
|
208
|
+
logger.error('[Server Error] Missing elastic.io credentials on startup');
|
|
209
|
+
process.exit(1);
|
|
228
210
|
}
|
|
229
|
-
|
|
211
|
+
const token = Buffer.from(`${email}:${apiKey}`).toString('base64');
|
|
212
|
+
const authHeader = `Basic ${token}`;
|
|
213
|
+
const client = createElasticioClient(authHeader);
|
|
214
|
+
const server = createMcpServer(client);
|
|
215
|
+
const transport = new StdioServerTransport();
|
|
216
|
+
server.connect(transport).then(() => {
|
|
217
|
+
logger.info('[elastic.io MCP Server] Running in local stdio mode.');
|
|
218
|
+
logger.info('[Server Start] Local stdio mode initialized successfully');
|
|
219
|
+
}).catch((err) => {
|
|
220
|
+
logger.error('[Fatal Error] Failed to start:', err);
|
|
221
|
+
logger.error(`[Server Error] ${err.message || err}`);
|
|
222
|
+
process.exit(1);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
230
225
|
//# sourceMappingURL=index.js.map
|
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,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;AAEjC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,C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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"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic.io/mcp",
|
|
3
|
-
"version": "1.0.1-
|
|
3
|
+
"version": "1.0.1-dev6",
|
|
4
4
|
"description": "elastic.io Model Context Protocol (MCP) Server",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"elasticio-mcp
|
|
8
|
-
"elasticio-mcp-setup": "dist/setup.js"
|
|
7
|
+
"elasticio-mcp": "dist/cli.js"
|
|
9
8
|
},
|
|
10
9
|
"type": "module",
|
|
11
10
|
"files": [
|