snow-flow 1.1.74 → 1.1.76
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/.claude-flow/queen/queen-memory.db +0 -0
- package/.claude-flow/queen-test/test-memory.db +0 -0
- package/.claude-flow/queen-test/test-memory.db-agents +0 -0
- package/.claude-flow/queen-test/test-memory.db-import +0 -0
- package/.claude-flow/queen-test/test-memory.db-memory +0 -0
- package/.claude-flow/queen-test/test-memory.db-neural +0 -0
- package/CLAUDE.md +111 -8
- package/README.md +117 -50
- package/deploy.sh +366 -0
- package/dist/cli.js +226 -0
- package/dist/cli.js.map +1 -1
- package/dist/mcp/http-transport-wrapper.d.ts +29 -0
- package/dist/mcp/http-transport-wrapper.d.ts.map +1 -0
- package/dist/mcp/http-transport-wrapper.js +318 -0
- package/dist/mcp/http-transport-wrapper.js.map +1 -0
- package/dist/mcp/service-discovery-client.d.ts +83 -0
- package/dist/mcp/service-discovery-client.d.ts.map +1 -0
- package/dist/mcp/service-discovery-client.js +211 -0
- package/dist/mcp/service-discovery-client.js.map +1 -0
- package/dist/mcp/servicenow-deployment-mcp.js +262 -29
- package/dist/mcp/servicenow-deployment-mcp.js.map +1 -1
- package/dist/mcp/servicenow-intelligent-mcp.js +252 -18
- package/dist/mcp/servicenow-intelligent-mcp.js.map +1 -1
- package/dist/mcp/servicenow-operations-mcp.js +274 -46
- package/dist/mcp/servicenow-operations-mcp.js.map +1 -1
- package/dist/orchestration/discovery/service-discovery.d.ts +81 -0
- package/dist/orchestration/discovery/service-discovery.d.ts.map +1 -0
- package/dist/orchestration/discovery/service-discovery.js +808 -0
- package/dist/orchestration/discovery/service-discovery.js.map +1 -0
- package/dist/orchestration/distributed-orchestrator.d.ts +131 -0
- package/dist/orchestration/distributed-orchestrator.d.ts.map +1 -0
- package/dist/orchestration/distributed-orchestrator.js +712 -0
- package/dist/orchestration/distributed-orchestrator.js.map +1 -0
- package/dist/orchestration/distribution/task-distribution-engine.d.ts +53 -0
- package/dist/orchestration/distribution/task-distribution-engine.d.ts.map +1 -0
- package/dist/orchestration/distribution/task-distribution-engine.js +586 -0
- package/dist/orchestration/distribution/task-distribution-engine.js.map +1 -0
- package/dist/orchestration/interfaces/distributed-orchestration.interface.d.ts +606 -0
- package/dist/orchestration/interfaces/distributed-orchestration.interface.d.ts.map +1 -0
- package/dist/orchestration/interfaces/distributed-orchestration.interface.js +65 -0
- package/dist/orchestration/interfaces/distributed-orchestration.interface.js.map +1 -0
- package/dist/orchestration/protocols/mcpx-protocol.d.ts +71 -0
- package/dist/orchestration/protocols/mcpx-protocol.d.ts.map +1 -0
- package/dist/orchestration/protocols/mcpx-protocol.js +668 -0
- package/dist/orchestration/protocols/mcpx-protocol.js.map +1 -0
- package/dist/orchestration/state/distributed-state-manager.d.ts +89 -0
- package/dist/orchestration/state/distributed-state-manager.d.ts.map +1 -0
- package/dist/orchestration/state/distributed-state-manager.js +716 -0
- package/dist/orchestration/state/distributed-state-manager.js.map +1 -0
- package/dist/queen/advanced-integration-test.d.ts +48 -0
- package/dist/queen/advanced-integration-test.d.ts.map +1 -0
- package/dist/queen/advanced-integration-test.js +474 -0
- package/dist/queen/advanced-integration-test.js.map +1 -0
- package/dist/queen/agent-factory.d.ts +40 -0
- package/dist/queen/agent-factory.d.ts.map +1 -0
- package/dist/queen/agent-factory.js +433 -0
- package/dist/queen/agent-factory.js.map +1 -0
- package/dist/queen/index.d.ts +58 -0
- package/dist/queen/index.d.ts.map +1 -0
- package/dist/queen/index.js +79 -0
- package/dist/queen/index.js.map +1 -0
- package/dist/queen/integration-example.d.ts +82 -0
- package/dist/queen/integration-example.d.ts.map +1 -0
- package/dist/queen/integration-example.js +220 -0
- package/dist/queen/integration-example.js.map +1 -0
- package/dist/queen/integration-test.d.ts +72 -0
- package/dist/queen/integration-test.d.ts.map +1 -0
- package/dist/queen/integration-test.js +564 -0
- package/dist/queen/integration-test.js.map +1 -0
- package/dist/queen/mock-mcp-client.d.ts +66 -0
- package/dist/queen/mock-mcp-client.d.ts.map +1 -0
- package/dist/queen/mock-mcp-client.js +297 -0
- package/dist/queen/mock-mcp-client.js.map +1 -0
- package/dist/queen/neural-learning.d.ts +28 -0
- package/dist/queen/neural-learning.d.ts.map +1 -0
- package/dist/queen/neural-learning.js +244 -0
- package/dist/queen/neural-learning.js.map +1 -0
- package/dist/queen/queen-memory.d.ts +25 -0
- package/dist/queen/queen-memory.d.ts.map +1 -0
- package/dist/queen/queen-memory.js +273 -0
- package/dist/queen/queen-memory.js.map +1 -0
- package/dist/queen/run-integration-tests.d.ts +9 -0
- package/dist/queen/run-integration-tests.d.ts.map +1 -0
- package/dist/queen/run-integration-tests.js +28 -0
- package/dist/queen/run-integration-tests.js.map +1 -0
- package/dist/queen/servicenow-queen.d.ts +56 -0
- package/dist/queen/servicenow-queen.d.ts.map +1 -0
- package/dist/queen/servicenow-queen.js +659 -0
- package/dist/queen/servicenow-queen.js.map +1 -0
- package/dist/queen/types.d.ts +58 -0
- package/dist/queen/types.d.ts.map +1 -0
- package/dist/queen/types.js +7 -0
- package/dist/queen/types.js.map +1 -0
- package/dist/version.d.ts +3 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +27 -2
- package/dist/version.js.map +1 -1
- package/docker/base/Dockerfile.base +45 -0
- package/docker/generate-services.js +244 -0
- package/docker/nginx/Dockerfile +71 -0
- package/docker/nginx/consul-template.hcl +64 -0
- package/docker/nginx/healthcheck.sh +178 -0
- package/docker/nginx/nginx.conf +210 -0
- package/docker/nginx/supervisord.conf +57 -0
- package/docker/nginx/templates/upstreams.conf.tpl +48 -0
- package/docker/services/automation-mcp/Dockerfile +32 -0
- package/docker/services/automation-mcp/config/service.json +28 -0
- package/docker/services/automation-mcp/entrypoint.js +51 -0
- package/docker/services/deployment-mcp/Dockerfile +32 -0
- package/docker/services/deployment-mcp/entrypoint.js +51 -0
- package/docker/services/flow-composer-mcp/Dockerfile +32 -0
- package/docker/services/flow-composer-mcp/config/service.json +28 -0
- package/docker/services/flow-composer-mcp/entrypoint.js +51 -0
- package/docker/services/graph-memory-mcp/Dockerfile +32 -0
- package/docker/services/graph-memory-mcp/config/service.json +28 -0
- package/docker/services/graph-memory-mcp/entrypoint.js +51 -0
- package/docker/services/integration-mcp/Dockerfile +32 -0
- package/docker/services/integration-mcp/config/service.json +28 -0
- package/docker/services/integration-mcp/entrypoint.js +51 -0
- package/docker/services/intelligent-mcp/Dockerfile +32 -0
- package/docker/services/intelligent-mcp/config/service.json +28 -0
- package/docker/services/intelligent-mcp/entrypoint.js +51 -0
- package/docker/services/operations-mcp/Dockerfile +32 -0
- package/docker/services/operations-mcp/config/service.json +28 -0
- package/docker/services/operations-mcp/entrypoint.js +51 -0
- package/docker/services/platform-development-mcp/Dockerfile +32 -0
- package/docker/services/platform-development-mcp/config/service.json +28 -0
- package/docker/services/platform-development-mcp/entrypoint.js +51 -0
- package/docker/services/reporting-analytics-mcp/Dockerfile +32 -0
- package/docker/services/reporting-analytics-mcp/config/service.json +28 -0
- package/docker/services/reporting-analytics-mcp/entrypoint.js +51 -0
- package/docker/services/security-compliance-mcp/Dockerfile +32 -0
- package/docker/services/security-compliance-mcp/config/service.json +28 -0
- package/docker/services/security-compliance-mcp/entrypoint.js +51 -0
- package/docker/services/update-set-mcp/Dockerfile +32 -0
- package/docker/services/update-set-mcp/config/service.json +28 -0
- package/docker/services/update-set-mcp/entrypoint.js +51 -0
- package/docker-compose.override.yml +132 -0
- package/docker-compose.prod.yml +340 -0
- package/docker-compose.yml +579 -0
- package/k8s/automation-mcp.yaml +232 -0
- package/k8s/configmap.yaml +237 -0
- package/k8s/deployment-mcp.yaml +232 -0
- package/k8s/flow-composer-mcp.yaml +232 -0
- package/k8s/generate-k8s-manifests.js +453 -0
- package/k8s/graph-memory-mcp.yaml +232 -0
- package/k8s/infrastructure.yaml +456 -0
- package/k8s/ingress.yaml +361 -0
- package/k8s/integration-mcp.yaml +232 -0
- package/k8s/intelligent-mcp.yaml +232 -0
- package/k8s/kustomization.yaml +111 -0
- package/k8s/mcp-services.yaml +2552 -0
- package/k8s/monitoring.yaml +515 -0
- package/k8s/namespace.yaml +80 -0
- package/k8s/operations-mcp.yaml +232 -0
- package/k8s/platform-development-mcp.yaml +232 -0
- package/k8s/rbac.yaml +140 -0
- package/k8s/reporting-analytics-mcp.yaml +232 -0
- package/k8s/security-compliance-mcp.yaml +232 -0
- package/k8s/update-set-mcp.yaml +232 -0
- package/package.json +2 -2
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* HTTP Transport Wrapper for MCP Servers
|
|
4
|
+
* Converts stdio-based MCP servers to HTTP endpoints for containerization
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.HttpTransportWrapper = void 0;
|
|
11
|
+
const express_1 = __importDefault(require("express"));
|
|
12
|
+
const logger_js_1 = require("../utils/logger.js");
|
|
13
|
+
const service_discovery_client_js_1 = require("./service-discovery-client.js");
|
|
14
|
+
class HttpTransportWrapper {
|
|
15
|
+
constructor(mcpServer, config) {
|
|
16
|
+
this.isReady = false;
|
|
17
|
+
this.mcpServer = mcpServer;
|
|
18
|
+
this.config = config;
|
|
19
|
+
this.logger = new logger_js_1.Logger(`HttpTransport:${config.name}`);
|
|
20
|
+
this.app = (0, express_1.default)();
|
|
21
|
+
this.serviceDiscovery = new service_discovery_client_js_1.ServiceDiscoveryClient();
|
|
22
|
+
this.setupMiddleware();
|
|
23
|
+
this.setupRoutes();
|
|
24
|
+
}
|
|
25
|
+
setupMiddleware() {
|
|
26
|
+
// Security headers
|
|
27
|
+
this.app.use((req, res, next) => {
|
|
28
|
+
res.setHeader('X-Content-Type-Options', 'nosniff');
|
|
29
|
+
res.setHeader('X-Frame-Options', 'DENY');
|
|
30
|
+
res.setHeader('X-XSS-Protection', '1; mode=block');
|
|
31
|
+
res.setHeader('Strict-Transport-Security', 'max-age=31536000; includeSubDomains');
|
|
32
|
+
next();
|
|
33
|
+
});
|
|
34
|
+
// Body parser for JSON requests
|
|
35
|
+
this.app.use(express_1.default.json({ limit: '10mb' }));
|
|
36
|
+
this.app.use(express_1.default.urlencoded({ extended: true }));
|
|
37
|
+
// Request logging middleware
|
|
38
|
+
this.app.use((req, res, next) => {
|
|
39
|
+
this.logger.debug(`${req.method} ${req.path}`, {
|
|
40
|
+
userAgent: req.get('User-Agent'),
|
|
41
|
+
ip: req.ip,
|
|
42
|
+
contentLength: req.get('Content-Length')
|
|
43
|
+
});
|
|
44
|
+
next();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
setupRoutes() {
|
|
48
|
+
// Health check endpoint
|
|
49
|
+
this.app.get(this.config.healthCheckPath || '/health', (req, res) => {
|
|
50
|
+
const health = {
|
|
51
|
+
status: this.isReady ? 'healthy' : 'starting',
|
|
52
|
+
service: this.config.name,
|
|
53
|
+
version: this.config.version,
|
|
54
|
+
timestamp: new Date().toISOString(),
|
|
55
|
+
uptime: process.uptime(),
|
|
56
|
+
memory: process.memoryUsage(),
|
|
57
|
+
port: this.config.port
|
|
58
|
+
};
|
|
59
|
+
const statusCode = this.isReady ? 200 : 503;
|
|
60
|
+
res.status(statusCode).json(health);
|
|
61
|
+
});
|
|
62
|
+
// Readiness probe
|
|
63
|
+
this.app.get('/ready', (req, res) => {
|
|
64
|
+
if (this.isReady) {
|
|
65
|
+
res.status(200).json({ ready: true, service: this.config.name });
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
res.status(503).json({ ready: false, service: this.config.name });
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
// Liveness probe
|
|
72
|
+
this.app.get('/live', (req, res) => {
|
|
73
|
+
res.status(200).json({ alive: true, service: this.config.name });
|
|
74
|
+
});
|
|
75
|
+
// Metrics endpoint (basic)
|
|
76
|
+
this.app.get(this.config.metricsPath || '/metrics', (req, res) => {
|
|
77
|
+
const metrics = this.generateMetrics();
|
|
78
|
+
res.set('Content-Type', 'text/plain');
|
|
79
|
+
res.send(metrics);
|
|
80
|
+
});
|
|
81
|
+
// MCP API endpoints
|
|
82
|
+
this.app.post('/mcp/list-tools', async (req, res) => {
|
|
83
|
+
try {
|
|
84
|
+
const result = await this.handleMCPRequest('listTools', req.body);
|
|
85
|
+
res.json(result);
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
this.handleError(res, error);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
this.app.post('/mcp/call-tool', async (req, res) => {
|
|
92
|
+
try {
|
|
93
|
+
const result = await this.handleMCPRequest('callTool', req.body);
|
|
94
|
+
res.json(result);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
this.handleError(res, error);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
this.app.post('/mcp/list-resources', async (req, res) => {
|
|
101
|
+
try {
|
|
102
|
+
const result = await this.handleMCPRequest('listResources', req.body);
|
|
103
|
+
res.json(result);
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
this.handleError(res, error);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
this.app.post('/mcp/read-resource', async (req, res) => {
|
|
110
|
+
try {
|
|
111
|
+
const result = await this.handleMCPRequest('readResource', req.body);
|
|
112
|
+
res.json(result);
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
this.handleError(res, error);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
// Service info endpoint
|
|
119
|
+
this.app.get('/info', (req, res) => {
|
|
120
|
+
res.json({
|
|
121
|
+
name: this.config.name,
|
|
122
|
+
version: this.config.version,
|
|
123
|
+
port: this.config.port,
|
|
124
|
+
endpoints: {
|
|
125
|
+
health: this.config.healthCheckPath || '/health',
|
|
126
|
+
metrics: this.config.metricsPath || '/metrics',
|
|
127
|
+
mcp: [
|
|
128
|
+
'/mcp/list-tools',
|
|
129
|
+
'/mcp/call-tool',
|
|
130
|
+
'/mcp/list-resources',
|
|
131
|
+
'/mcp/read-resource'
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
// 404 handler
|
|
137
|
+
this.app.use('*', (req, res) => {
|
|
138
|
+
res.status(404).json({
|
|
139
|
+
error: 'Not Found',
|
|
140
|
+
path: req.originalUrl,
|
|
141
|
+
service: this.config.name
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
// Global error handler
|
|
145
|
+
this.app.use((error, req, res, next) => {
|
|
146
|
+
this.logger.error('Unhandled error:', error);
|
|
147
|
+
this.handleError(res, error);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
async handleMCPRequest(method, params) {
|
|
151
|
+
// Convert HTTP request to MCP protocol format
|
|
152
|
+
const mcpRequest = {
|
|
153
|
+
jsonrpc: '2.0',
|
|
154
|
+
id: Date.now(),
|
|
155
|
+
method,
|
|
156
|
+
params: params || {}
|
|
157
|
+
};
|
|
158
|
+
try {
|
|
159
|
+
// Process request through the MCP server
|
|
160
|
+
let result;
|
|
161
|
+
switch (method) {
|
|
162
|
+
case 'listTools':
|
|
163
|
+
// Handle list tools request by calling the MCP server's tools handler
|
|
164
|
+
const toolsResponse = await this.mcpServer.getCapabilities();
|
|
165
|
+
result = {
|
|
166
|
+
tools: toolsResponse.capabilities?.tools || []
|
|
167
|
+
};
|
|
168
|
+
break;
|
|
169
|
+
case 'callTool':
|
|
170
|
+
// Handle tool call by routing to the MCP server's tool handler
|
|
171
|
+
if (!params.name) {
|
|
172
|
+
throw new Error('Tool name is required for callTool');
|
|
173
|
+
}
|
|
174
|
+
// Create a mock request that matches MCP CallToolRequestSchema
|
|
175
|
+
const toolRequest = {
|
|
176
|
+
params: {
|
|
177
|
+
name: params.name,
|
|
178
|
+
arguments: params.arguments || {}
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
// Find the appropriate request handler for CallToolRequestSchema
|
|
182
|
+
// Note: This requires internal access to MCP server handlers
|
|
183
|
+
// In a production environment, you'd need a more robust integration
|
|
184
|
+
result = await this.handleToolCall(toolRequest);
|
|
185
|
+
break;
|
|
186
|
+
case 'listResources':
|
|
187
|
+
// Handle list resources - return empty list if not supported
|
|
188
|
+
result = { resources: [] };
|
|
189
|
+
break;
|
|
190
|
+
case 'readResource':
|
|
191
|
+
// Handle read resource - throw error if not supported
|
|
192
|
+
throw new Error('Resource reading not implemented for this server');
|
|
193
|
+
default:
|
|
194
|
+
throw new Error(`Unsupported MCP method: ${method}`);
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
jsonrpc: '2.0',
|
|
198
|
+
id: mcpRequest.id,
|
|
199
|
+
result
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
this.logger.error(`MCP request error for ${method}:`, error);
|
|
204
|
+
return {
|
|
205
|
+
jsonrpc: '2.0',
|
|
206
|
+
id: mcpRequest.id,
|
|
207
|
+
error: {
|
|
208
|
+
code: -32603,
|
|
209
|
+
message: error instanceof Error ? error.message : 'Internal error',
|
|
210
|
+
data: { method, originalParams: params }
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
async handleToolCall(request) {
|
|
216
|
+
// This is a workaround since we can't directly access MCP server's internal handlers
|
|
217
|
+
// In a real implementation, you'd need to either:
|
|
218
|
+
// 1. Extend the MCP SDK to expose request handlers
|
|
219
|
+
// 2. Use a proper transport layer that already exists
|
|
220
|
+
// 3. Create a bridge that uses the existing stdio transport
|
|
221
|
+
const { name, arguments: args } = request.params;
|
|
222
|
+
// For now, we'll at least validate that the tool exists
|
|
223
|
+
const capabilities = await this.mcpServer.getCapabilities();
|
|
224
|
+
const tools = capabilities.capabilities?.tools || [];
|
|
225
|
+
// This is still a limitation - we can't actually execute the tool without
|
|
226
|
+
// access to the MCP server's internal request handlers
|
|
227
|
+
throw new Error(`Tool execution not yet implemented in HTTP transport. Tool '${name}' exists but cannot be executed via HTTP. Use stdio transport instead.`);
|
|
228
|
+
}
|
|
229
|
+
handleError(res, error) {
|
|
230
|
+
const statusCode = error.statusCode || 500;
|
|
231
|
+
const errorResponse = {
|
|
232
|
+
error: {
|
|
233
|
+
code: error.code || 'INTERNAL_ERROR',
|
|
234
|
+
message: error.message || 'Internal server error',
|
|
235
|
+
service: this.config.name
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
this.logger.error('Request error:', error);
|
|
239
|
+
res.status(statusCode).json(errorResponse);
|
|
240
|
+
}
|
|
241
|
+
generateMetrics() {
|
|
242
|
+
const memUsage = process.memoryUsage();
|
|
243
|
+
const uptime = process.uptime();
|
|
244
|
+
return `# HELP mcp_server_uptime_seconds Total uptime of the MCP server
|
|
245
|
+
# TYPE mcp_server_uptime_seconds counter
|
|
246
|
+
mcp_server_uptime_seconds{service="${this.config.name}"} ${uptime}
|
|
247
|
+
|
|
248
|
+
# HELP mcp_server_memory_usage_bytes Memory usage in bytes
|
|
249
|
+
# TYPE mcp_server_memory_usage_bytes gauge
|
|
250
|
+
mcp_server_memory_usage_bytes{service="${this.config.name}",type="rss"} ${memUsage.rss}
|
|
251
|
+
mcp_server_memory_usage_bytes{service="${this.config.name}",type="heapTotal"} ${memUsage.heapTotal}
|
|
252
|
+
mcp_server_memory_usage_bytes{service="${this.config.name}",type="heapUsed"} ${memUsage.heapUsed}
|
|
253
|
+
|
|
254
|
+
# HELP mcp_server_ready Server readiness status
|
|
255
|
+
# TYPE mcp_server_ready gauge
|
|
256
|
+
mcp_server_ready{service="${this.config.name}"} ${this.isReady ? 1 : 0}
|
|
257
|
+
`;
|
|
258
|
+
}
|
|
259
|
+
async start() {
|
|
260
|
+
return new Promise((resolve, reject) => {
|
|
261
|
+
const server = this.app.listen(this.config.port, async () => {
|
|
262
|
+
this.logger.info(`MCP HTTP server started on port ${this.config.port}`);
|
|
263
|
+
try {
|
|
264
|
+
// Register with service discovery
|
|
265
|
+
await this.serviceDiscovery.register({
|
|
266
|
+
id: `${this.config.name}-${process.env.HOSTNAME || 'localhost'}`,
|
|
267
|
+
name: this.config.name,
|
|
268
|
+
address: process.env.SERVICE_IP || 'localhost',
|
|
269
|
+
port: this.config.port,
|
|
270
|
+
health: {
|
|
271
|
+
http: `http://${process.env.SERVICE_IP || 'localhost'}:${this.config.port}/health`,
|
|
272
|
+
interval: '10s',
|
|
273
|
+
timeout: '3s',
|
|
274
|
+
deregisterAfter: '30s'
|
|
275
|
+
},
|
|
276
|
+
tags: [
|
|
277
|
+
'mcp-server',
|
|
278
|
+
`version:${this.config.version}`,
|
|
279
|
+
`environment:${process.env.NODE_ENV || 'development'}`
|
|
280
|
+
]
|
|
281
|
+
});
|
|
282
|
+
this.isReady = true;
|
|
283
|
+
this.logger.info(`Service registered with discovery: ${this.config.name}`);
|
|
284
|
+
resolve();
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
this.logger.warn('Service discovery registration failed:', error);
|
|
288
|
+
// Continue without service discovery
|
|
289
|
+
this.isReady = true;
|
|
290
|
+
resolve();
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
server.on('error', (error) => {
|
|
294
|
+
this.logger.error(`Server startup error:`, error);
|
|
295
|
+
reject(error);
|
|
296
|
+
});
|
|
297
|
+
// Graceful shutdown handling
|
|
298
|
+
const shutdown = async () => {
|
|
299
|
+
this.logger.info('Shutting down HTTP server...');
|
|
300
|
+
try {
|
|
301
|
+
await this.serviceDiscovery.deregister(`${this.config.name}-${process.env.HOSTNAME || 'localhost'}`);
|
|
302
|
+
this.logger.info('Service deregistered from discovery');
|
|
303
|
+
}
|
|
304
|
+
catch (error) {
|
|
305
|
+
this.logger.warn('Service deregistration failed:', error);
|
|
306
|
+
}
|
|
307
|
+
server.close(() => {
|
|
308
|
+
this.logger.info('HTTP server closed');
|
|
309
|
+
process.exit(0);
|
|
310
|
+
});
|
|
311
|
+
};
|
|
312
|
+
process.on('SIGTERM', shutdown);
|
|
313
|
+
process.on('SIGINT', shutdown);
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
exports.HttpTransportWrapper = HttpTransportWrapper;
|
|
318
|
+
//# sourceMappingURL=http-transport-wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-transport-wrapper.js","sourceRoot":"","sources":["../../src/mcp/http-transport-wrapper.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,sDAA8D;AAE9D,kDAA4C;AAC5C,+EAAuE;AAUvE,MAAa,oBAAoB;IAQ/B,YAAY,SAAiB,EAAE,MAAuB;QAF9C,YAAO,GAAY,KAAK,CAAC;QAG/B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,kBAAM,CAAC,iBAAiB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACzD,IAAI,CAAC,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;QACrB,IAAI,CAAC,gBAAgB,GAAG,IAAI,oDAAsB,EAAE,CAAC;QAErD,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAEO,eAAe;QACrB,mBAAmB;QACnB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YAC9B,GAAG,CAAC,SAAS,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC;YACnD,GAAG,CAAC,SAAS,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;YACzC,GAAG,CAAC,SAAS,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;YACnD,GAAG,CAAC,SAAS,CAAC,2BAA2B,EAAE,qCAAqC,C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,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtVD,oDAsVC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service Discovery Client for Consul Integration
|
|
3
|
+
*/
|
|
4
|
+
export interface ServiceRegistration {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
address: string;
|
|
8
|
+
port: number;
|
|
9
|
+
health?: {
|
|
10
|
+
http?: string;
|
|
11
|
+
tcp?: string;
|
|
12
|
+
interval?: string;
|
|
13
|
+
timeout?: string;
|
|
14
|
+
deregisterAfter?: string;
|
|
15
|
+
};
|
|
16
|
+
tags?: string[];
|
|
17
|
+
meta?: Record<string, string>;
|
|
18
|
+
}
|
|
19
|
+
export interface ServiceDiscoveryConfig {
|
|
20
|
+
consulUrl: string;
|
|
21
|
+
timeout: number;
|
|
22
|
+
retryAttempts: number;
|
|
23
|
+
}
|
|
24
|
+
export declare class ServiceDiscoveryClient {
|
|
25
|
+
private client;
|
|
26
|
+
private logger;
|
|
27
|
+
private config;
|
|
28
|
+
constructor(config?: Partial<ServiceDiscoveryConfig>);
|
|
29
|
+
/**
|
|
30
|
+
* Register a service with Consul
|
|
31
|
+
*/
|
|
32
|
+
register(service: ServiceRegistration): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Deregister a service from Consul
|
|
35
|
+
*/
|
|
36
|
+
deregister(serviceId: string): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Discover services by name
|
|
39
|
+
*/
|
|
40
|
+
discover(serviceName: string, healthy?: boolean): Promise<ServiceInstance[]>;
|
|
41
|
+
/**
|
|
42
|
+
* List all services
|
|
43
|
+
*/
|
|
44
|
+
listServices(): Promise<string[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Get service health status
|
|
47
|
+
*/
|
|
48
|
+
getServiceHealth(serviceName: string): Promise<ServiceHealth[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Check if Consul is available
|
|
51
|
+
*/
|
|
52
|
+
isAvailable(): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Watch for service changes (simplified polling approach)
|
|
55
|
+
*/
|
|
56
|
+
watchService(serviceName: string, callback: (services: ServiceInstance[]) => void, interval?: number): () => void;
|
|
57
|
+
}
|
|
58
|
+
export interface ServiceInstance {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
address: string;
|
|
62
|
+
port: number;
|
|
63
|
+
tags: string[];
|
|
64
|
+
meta: Record<string, string>;
|
|
65
|
+
health?: Array<{
|
|
66
|
+
status: string;
|
|
67
|
+
output: string;
|
|
68
|
+
name: string;
|
|
69
|
+
}>;
|
|
70
|
+
}
|
|
71
|
+
export interface ServiceHealth {
|
|
72
|
+
serviceId: string;
|
|
73
|
+
serviceName: string;
|
|
74
|
+
address: string;
|
|
75
|
+
port: number;
|
|
76
|
+
checks: Array<{
|
|
77
|
+
checkId: string;
|
|
78
|
+
name: string;
|
|
79
|
+
status: string;
|
|
80
|
+
output: string;
|
|
81
|
+
}>;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=service-discovery-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-discovery-client.d.ts","sourceRoot":"","sources":["../../src/mcp/service-discovery-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,I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AAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Service Discovery Client for Consul Integration
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ServiceDiscoveryClient = void 0;
|
|
10
|
+
const axios_1 = __importDefault(require("axios"));
|
|
11
|
+
const logger_js_1 = require("../utils/logger.js");
|
|
12
|
+
class ServiceDiscoveryClient {
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.config = {
|
|
15
|
+
consulUrl: process.env.CONSUL_URL || 'http://consul:8500',
|
|
16
|
+
timeout: 5000,
|
|
17
|
+
retryAttempts: 3,
|
|
18
|
+
...config
|
|
19
|
+
};
|
|
20
|
+
this.logger = new logger_js_1.Logger('ServiceDiscovery');
|
|
21
|
+
this.client = axios_1.default.create({
|
|
22
|
+
baseURL: this.config.consulUrl,
|
|
23
|
+
timeout: this.config.timeout,
|
|
24
|
+
headers: {
|
|
25
|
+
'Content-Type': 'application/json'
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
// Request interceptor for logging
|
|
29
|
+
this.client.interceptors.request.use((config) => {
|
|
30
|
+
this.logger.debug(`Making request to Consul: ${config.method?.toUpperCase()} ${config.url}`);
|
|
31
|
+
return config;
|
|
32
|
+
}, (error) => {
|
|
33
|
+
this.logger.error('Request interceptor error:', error);
|
|
34
|
+
return Promise.reject(error);
|
|
35
|
+
});
|
|
36
|
+
// Response interceptor for error handling
|
|
37
|
+
this.client.interceptors.response.use((response) => response, (error) => {
|
|
38
|
+
if (error.code === 'ECONNREFUSED' || error.code === 'ENOTFOUND') {
|
|
39
|
+
this.logger.warn('Consul is not available, running without service discovery');
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.logger.error('Consul request failed:', error.message);
|
|
43
|
+
}
|
|
44
|
+
return Promise.reject(error);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Register a service with Consul
|
|
49
|
+
*/
|
|
50
|
+
async register(service) {
|
|
51
|
+
const registration = {
|
|
52
|
+
ID: service.id,
|
|
53
|
+
Name: service.name,
|
|
54
|
+
Address: service.address,
|
|
55
|
+
Port: service.port,
|
|
56
|
+
Tags: service.tags || [],
|
|
57
|
+
Meta: {
|
|
58
|
+
version: '1.0.0',
|
|
59
|
+
...(service.meta || {})
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
// Add health check if specified
|
|
63
|
+
if (service.health) {
|
|
64
|
+
const check = {
|
|
65
|
+
Interval: service.health.interval || '30s',
|
|
66
|
+
Timeout: service.health.timeout || '10s',
|
|
67
|
+
DeregisterCriticalServiceAfter: service.health.deregisterAfter || '1m'
|
|
68
|
+
};
|
|
69
|
+
if (service.health.http) {
|
|
70
|
+
check.HTTP = service.health.http;
|
|
71
|
+
}
|
|
72
|
+
else if (service.health.tcp) {
|
|
73
|
+
check.TCP = service.health.tcp;
|
|
74
|
+
}
|
|
75
|
+
registration['Check'] = check;
|
|
76
|
+
}
|
|
77
|
+
let lastError;
|
|
78
|
+
for (let attempt = 1; attempt <= this.config.retryAttempts; attempt++) {
|
|
79
|
+
try {
|
|
80
|
+
await this.client.put(`/v1/agent/service/register`, registration);
|
|
81
|
+
this.logger.info(`Service registered: ${service.name} (${service.id})`);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
lastError = error;
|
|
86
|
+
if (attempt < this.config.retryAttempts) {
|
|
87
|
+
const delay = Math.pow(2, attempt) * 1000; // Exponential backoff
|
|
88
|
+
this.logger.warn(`Registration attempt ${attempt} failed, retrying in ${delay}ms...`);
|
|
89
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
throw new Error(`Failed to register service after ${this.config.retryAttempts} attempts: ${lastError?.message}`);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Deregister a service from Consul
|
|
97
|
+
*/
|
|
98
|
+
async deregister(serviceId) {
|
|
99
|
+
try {
|
|
100
|
+
await this.client.put(`/v1/agent/service/deregister/${serviceId}`);
|
|
101
|
+
this.logger.info(`Service deregistered: ${serviceId}`);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
this.logger.error(`Failed to deregister service ${serviceId}:`, error.message);
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Discover services by name
|
|
110
|
+
*/
|
|
111
|
+
async discover(serviceName, healthy = true) {
|
|
112
|
+
try {
|
|
113
|
+
const endpoint = healthy
|
|
114
|
+
? `/v1/health/service/${serviceName}?passing=true`
|
|
115
|
+
: `/v1/health/service/${serviceName}`;
|
|
116
|
+
const response = await this.client.get(endpoint);
|
|
117
|
+
return response.data.map((entry) => ({
|
|
118
|
+
id: entry.Service.ID,
|
|
119
|
+
name: entry.Service.Service,
|
|
120
|
+
address: entry.Service.Address,
|
|
121
|
+
port: entry.Service.Port,
|
|
122
|
+
tags: entry.Service.Tags,
|
|
123
|
+
meta: entry.Service.Meta,
|
|
124
|
+
health: entry.Checks?.map((check) => ({
|
|
125
|
+
status: check.Status,
|
|
126
|
+
output: check.Output,
|
|
127
|
+
name: check.Name
|
|
128
|
+
}))
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
this.logger.error(`Failed to discover service ${serviceName}:`, error.message);
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* List all services
|
|
138
|
+
*/
|
|
139
|
+
async listServices() {
|
|
140
|
+
try {
|
|
141
|
+
const response = await this.client.get('/v1/agent/services');
|
|
142
|
+
return Object.keys(response.data);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
this.logger.error('Failed to list services:', error.message);
|
|
146
|
+
throw error;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get service health status
|
|
151
|
+
*/
|
|
152
|
+
async getServiceHealth(serviceName) {
|
|
153
|
+
try {
|
|
154
|
+
const response = await this.client.get(`/v1/health/service/${serviceName}`);
|
|
155
|
+
return response.data.map((entry) => ({
|
|
156
|
+
serviceId: entry.Service.ID,
|
|
157
|
+
serviceName: entry.Service.Service,
|
|
158
|
+
address: entry.Service.Address,
|
|
159
|
+
port: entry.Service.Port,
|
|
160
|
+
checks: entry.Checks.map((check) => ({
|
|
161
|
+
checkId: check.CheckID,
|
|
162
|
+
name: check.Name,
|
|
163
|
+
status: check.Status,
|
|
164
|
+
output: check.Output
|
|
165
|
+
}))
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
this.logger.error(`Failed to get health for service ${serviceName}:`, error.message);
|
|
170
|
+
throw error;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Check if Consul is available
|
|
175
|
+
*/
|
|
176
|
+
async isAvailable() {
|
|
177
|
+
try {
|
|
178
|
+
await this.client.get('/v1/status/leader');
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Watch for service changes (simplified polling approach)
|
|
187
|
+
*/
|
|
188
|
+
watchService(serviceName, callback, interval = 10000) {
|
|
189
|
+
let isWatching = true;
|
|
190
|
+
const poll = async () => {
|
|
191
|
+
if (!isWatching)
|
|
192
|
+
return;
|
|
193
|
+
try {
|
|
194
|
+
const services = await this.discover(serviceName);
|
|
195
|
+
callback(services);
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
this.logger.warn(`Failed to poll service ${serviceName}:`, error);
|
|
199
|
+
}
|
|
200
|
+
if (isWatching) {
|
|
201
|
+
setTimeout(poll, interval);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
poll();
|
|
205
|
+
return () => {
|
|
206
|
+
isWatching = false;
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
exports.ServiceDiscoveryClient = ServiceDiscoveryClient;
|
|
211
|
+
//# sourceMappingURL=service-discovery-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-discovery-client.js","sourceRoot":"","sources":["../../src/mcp/service-discovery-client.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;AAEH,kDAA6C;AAC7C,kDAA4C;AAwB5C,MAAa,sBAAsB;IAKjC,YAAY,MAAwC;QAClD,IAAI,CAAC,MAAM,GAAG;YACZ,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,oBAAoB;YACzD,OAAO,EAAE,IAAI;YACb,aAAa,EAAE,CAAC;YAChB,GAAG,MAAM;SACV,CAAC;QAEF,IAAI,CAAC,MAAM,GAAG,IAAI,kBAAM,CAAC,kBAAkB,CAAC,CAAC;QAE7C,IAA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