@specverse/engines 4.3.5 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/examples/10-api/README.md +3 -3
- package/assets/prompts/core/README.md +1 -1
- package/dist/inference/core/rule-engine.d.ts +0 -12
- package/dist/inference/core/rule-engine.d.ts.map +1 -1
- package/dist/inference/core/rule-engine.js +99 -968
- package/dist/inference/core/rule-engine.js.map +1 -1
- package/dist/inference/core/template-helpers.d.ts +56 -0
- package/dist/inference/core/template-helpers.d.ts.map +1 -0
- package/dist/inference/core/template-helpers.js +87 -0
- package/dist/inference/core/template-helpers.js.map +1 -0
- package/dist/inference/logical/generators/service-generator.d.ts.map +1 -1
- package/dist/inference/logical/generators/service-generator.js +0 -4
- package/dist/inference/logical/generators/service-generator.js.map +1 -1
- package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +27 -5
- package/dist/libs/instance-factories/tools/README.md +1 -1
- package/dist/libs/instance-factories/tools/mcp.yaml +1 -1
- package/dist/libs/instance-factories/tools/templates/mcp/mcp-server-generator.js +336 -116
- package/dist/libs/instance-factories/tools/templates/vscode/vscode-extension-generator.js +172 -8
- package/dist/libs/instance-factories/tools/vscode.yaml +1 -1
- package/libs/instance-factories/cli/templates/commander/command-generator.ts +27 -5
- package/libs/instance-factories/tools/README.md +1 -1
- package/libs/instance-factories/tools/mcp.yaml +1 -1
- package/libs/instance-factories/tools/templates/mcp/mcp-server-generator.ts +386 -141
- package/libs/instance-factories/tools/templates/vscode/static/extension.ts +9 -2
- package/libs/instance-factories/tools/templates/vscode/vscode-extension-generator.ts +246 -10
- package/libs/instance-factories/tools/vscode.yaml +1 -1
- package/package.json +5 -4
- package/libs/instance-factories/tools/templates/mcp/static/docs/DEPLOYMENT_GUIDE.md +0 -630
- package/libs/instance-factories/tools/templates/mcp/static/docs/HYBRID_RESOURCE_SYSTEM.md +0 -330
- package/libs/instance-factories/tools/templates/mcp/static/docs/deployments/EXTENSION_DEPLOYMENT.md +0 -552
- package/libs/instance-factories/tools/templates/mcp/static/docs/deployments/LOCAL_DEPLOYMENT.md +0 -164
- package/libs/instance-factories/tools/templates/mcp/static/docs/deployments/WEB_DEPLOYMENT.md +0 -247
- package/libs/instance-factories/tools/templates/mcp/static/package.json +0 -94
- package/libs/instance-factories/tools/templates/mcp/static/scripts/build-enterprise.js +0 -284
- package/libs/instance-factories/tools/templates/mcp/static/scripts/build-extension.js +0 -139
- package/libs/instance-factories/tools/templates/mcp/static/scripts/build-local.js +0 -74
- package/libs/instance-factories/tools/templates/mcp/static/scripts/build-web.js +0 -156
- package/libs/instance-factories/tools/templates/mcp/static/scripts/copy-canonical-files.js +0 -41
- package/libs/instance-factories/tools/templates/mcp/static/scripts/test-deployments.js +0 -259
- package/libs/instance-factories/tools/templates/mcp/static/scripts/test-hybrid-resources.js +0 -231
- package/libs/instance-factories/tools/templates/mcp/static/scripts/test-hybrid-simple.js +0 -196
- package/libs/instance-factories/tools/templates/mcp/static/src/controllers/MCPServerController.ts +0 -293
- package/libs/instance-factories/tools/templates/mcp/static/src/events/EventEmitter.ts +0 -90
- package/libs/instance-factories/tools/templates/mcp/static/src/index.ts +0 -24
- package/libs/instance-factories/tools/templates/mcp/static/src/interfaces/ResourceProvider.ts +0 -15
- package/libs/instance-factories/tools/templates/mcp/static/src/models/LibrarySuggestion.ts +0 -106
- package/libs/instance-factories/tools/templates/mcp/static/src/models/SpecVerseResource.ts +0 -75
- package/libs/instance-factories/tools/templates/mcp/static/src/server/mcp-server.ts +0 -239
- package/libs/instance-factories/tools/templates/mcp/static/src/services/CLIProxyService.ts +0 -1501
- package/libs/instance-factories/tools/templates/mcp/static/src/services/EmbeddedResourcesAdapter.ts +0 -211
- package/libs/instance-factories/tools/templates/mcp/static/src/services/EntityModuleService.ts +0 -308
- package/libs/instance-factories/tools/templates/mcp/static/src/services/HybridResourcesProvider.ts +0 -210
- package/libs/instance-factories/tools/templates/mcp/static/src/services/LibraryToolsService.ts +0 -356
- package/libs/instance-factories/tools/templates/mcp/static/src/services/OrchestratorBridge.ts +0 -522
- package/libs/instance-factories/tools/templates/mcp/static/src/services/OrchestratorToolsService.ts +0 -530
- package/libs/instance-factories/tools/templates/mcp/static/src/services/PromptToolsService.ts +0 -594
- package/libs/instance-factories/tools/templates/mcp/static/src/services/ResourcesProviderService.ts +0 -170
- package/libs/instance-factories/tools/templates/mcp/static/src/tests/unit/CLIProxyService.init.test.ts +0 -544
- package/libs/instance-factories/tools/templates/mcp/static/src/tests/unit/CLIProxyService.test.ts +0 -189
- package/libs/instance-factories/tools/templates/mcp/static/src/tests/unit/ResourcesProviderService.test.ts +0 -89
- package/libs/instance-factories/tools/templates/mcp/static/src/types/index.ts +0 -110
- package/libs/instance-factories/tools/templates/mcp/static/tsconfig.json +0 -28
- package/libs/instance-factories/tools/templates/vscode/static/schemas/specverse-v3-schema.json +0 -4279
- /package/libs/instance-factories/tools/templates/vscode/static/themes/{specverse-complete-theme.json → specverse-dark-theme.json} +0 -0
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* SpecVerse AI Support MCP Server - Clean Implementation
|
|
4
|
-
*
|
|
5
|
-
* Generated from extracted specifications using MCP materialization prompt
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
9
|
-
import { MCPServerController } from '../controllers/MCPServerController.js';
|
|
10
|
-
import type { MCPServerConfig, MCPServerMode } from '../types/index.js';
|
|
11
|
-
|
|
12
|
-
export class SpecVerseCleanMCPServer {
|
|
13
|
-
private controller: MCPServerController;
|
|
14
|
-
private config: MCPServerConfig;
|
|
15
|
-
|
|
16
|
-
constructor(config: MCPServerConfig) {
|
|
17
|
-
this.config = config;
|
|
18
|
-
this.controller = new MCPServerController(config);
|
|
19
|
-
this.setupEventHandlers();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
private setupEventHandlers(): void {
|
|
23
|
-
const eventEmitter = this.controller.getEventEmitter();
|
|
24
|
-
|
|
25
|
-
// Log server events if logging is enabled (but not in local/stdio mode)
|
|
26
|
-
if (this.config.logging && this.config.mode !== 'local') {
|
|
27
|
-
eventEmitter.on('server-started', (event) => {
|
|
28
|
-
const serverEvent = event as import('../types/index.js').ServerStartedEvent;
|
|
29
|
-
console.error(`Clean MCP Server started in ${serverEvent.mode} mode (PID: ${serverEvent.pid})`);
|
|
30
|
-
if (serverEvent.port) {
|
|
31
|
-
console.error(`Server listening on port ${serverEvent.port}`);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
eventEmitter.on('tool-called', (event) => {
|
|
36
|
-
const toolEvent = event as import('../types/index.js').ToolCalledEvent;
|
|
37
|
-
console.error(`Tool executed: ${toolEvent.toolName} (${toolEvent.executionTime}ms)`);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
eventEmitter.on('resource-requested', (event) => {
|
|
41
|
-
const resourceEvent = event as import('../types/index.js').ResourceRequestedEvent;
|
|
42
|
-
console.error(`Resource accessed: ${resourceEvent.uri}`);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
eventEmitter.on('error-occurred', (event) => {
|
|
46
|
-
const errorEvent = event as import('../types/index.js').ErrorOccurredEvent;
|
|
47
|
-
console.error(`Error in ${errorEvent.operation}: ${errorEvent.error}`);
|
|
48
|
-
if (errorEvent.context) {
|
|
49
|
-
console.error('Context:', JSON.stringify(errorEvent.context, null, 2));
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async start(): Promise<void> {
|
|
56
|
-
// Initialize the controller first
|
|
57
|
-
await this.controller.initialize();
|
|
58
|
-
|
|
59
|
-
if (this.config.mode === 'local') {
|
|
60
|
-
// Local mode: use stdio transport
|
|
61
|
-
const transport = new StdioServerTransport(process.stdin, process.stdout);
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
await this.controller.getServer().connect(transport);
|
|
65
|
-
} catch (error) {
|
|
66
|
-
console.error('MCP Server connection failed:', error);
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Handle graceful shutdown
|
|
71
|
-
const gracefulShutdown = () => {
|
|
72
|
-
process.exit(0);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
process.on('SIGINT', gracefulShutdown);
|
|
76
|
-
process.on('SIGTERM', gracefulShutdown);
|
|
77
|
-
|
|
78
|
-
// Keep process alive for stdio transport
|
|
79
|
-
process.stdin.resume();
|
|
80
|
-
|
|
81
|
-
} else if (this.config.mode === 'remote') {
|
|
82
|
-
// Remote mode: simple HTTP server for web deployments
|
|
83
|
-
if (this.config.logging) {
|
|
84
|
-
console.error('Starting Clean MCP Server in remote mode...');
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Create a simple health check endpoint for testing
|
|
88
|
-
const { createServer } = await import('http');
|
|
89
|
-
const server = createServer(async (req, res) => {
|
|
90
|
-
if (req.url === '/health') {
|
|
91
|
-
const metrics = this.controller.getMetrics();
|
|
92
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
93
|
-
res.end(JSON.stringify({
|
|
94
|
-
status: 'healthy',
|
|
95
|
-
mode: 'remote',
|
|
96
|
-
metrics
|
|
97
|
-
}));
|
|
98
|
-
} else if (req.url === '/mcp/resources') {
|
|
99
|
-
// List all available resources
|
|
100
|
-
try {
|
|
101
|
-
const resources = await this.controller.listResources();
|
|
102
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
103
|
-
res.end(JSON.stringify({
|
|
104
|
-
resources,
|
|
105
|
-
count: resources.length,
|
|
106
|
-
mode: 'remote'
|
|
107
|
-
}));
|
|
108
|
-
} catch (error) {
|
|
109
|
-
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
110
|
-
res.end(JSON.stringify({
|
|
111
|
-
error: error instanceof Error ? error.message : String(error)
|
|
112
|
-
}));
|
|
113
|
-
}
|
|
114
|
-
} else if (req.url?.startsWith('/mcp/resource/')) {
|
|
115
|
-
// Read specific resource by URI (encoded in path)
|
|
116
|
-
try {
|
|
117
|
-
const uri = decodeURIComponent(req.url.replace('/mcp/resource/', ''));
|
|
118
|
-
const resource = await this.controller.readResource(uri);
|
|
119
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
120
|
-
res.end(JSON.stringify(resource));
|
|
121
|
-
} catch (error) {
|
|
122
|
-
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
123
|
-
res.end(JSON.stringify({
|
|
124
|
-
error: error instanceof Error ? error.message : String(error)
|
|
125
|
-
}));
|
|
126
|
-
}
|
|
127
|
-
} else if (req.url === '/mcp') {
|
|
128
|
-
// Future: Full MCP over HTTP would go here
|
|
129
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
130
|
-
res.end(JSON.stringify({
|
|
131
|
-
message: 'MCP over HTTP partially implemented',
|
|
132
|
-
mode: 'remote',
|
|
133
|
-
endpoints: [
|
|
134
|
-
'/mcp/resources - List all resources',
|
|
135
|
-
'/mcp/resource/{uri} - Read specific resource'
|
|
136
|
-
]
|
|
137
|
-
}));
|
|
138
|
-
} else {
|
|
139
|
-
res.writeHead(404);
|
|
140
|
-
res.end('Not found');
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
const port = this.config.port || 3000;
|
|
145
|
-
server.listen(port, () => {
|
|
146
|
-
if (this.config.logging) {
|
|
147
|
-
console.error(`Clean MCP Server listening on port ${port}`);
|
|
148
|
-
console.error('Health check: http://localhost:' + port + '/health');
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
// Handle graceful shutdown
|
|
153
|
-
const gracefulShutdown = () => {
|
|
154
|
-
if (this.config.logging) {
|
|
155
|
-
console.error('Clean MCP Server shutting down...');
|
|
156
|
-
}
|
|
157
|
-
server.close(() => {
|
|
158
|
-
process.exit(0);
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
process.on('SIGINT', gracefulShutdown);
|
|
163
|
-
process.on('SIGTERM', gracefulShutdown);
|
|
164
|
-
|
|
165
|
-
} else {
|
|
166
|
-
throw new Error(`Unsupported mode: ${this.config.mode}`);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
getController(): MCPServerController {
|
|
171
|
-
return this.controller;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// CLI entry point
|
|
176
|
-
async function main(): Promise<void> {
|
|
177
|
-
// Global error handlers
|
|
178
|
-
process.on('uncaughtException', (error) => {
|
|
179
|
-
console.error('Uncaught exception in Clean MCP server:', error);
|
|
180
|
-
process.exit(1);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
process.on('unhandledRejection', (reason, promise) => {
|
|
184
|
-
console.error('Unhandled rejection in Clean MCP server:', reason);
|
|
185
|
-
process.exit(1);
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
// Parse command line arguments
|
|
189
|
-
const args = process.argv.slice(2);
|
|
190
|
-
const mode = (args.includes('--mode')
|
|
191
|
-
? args[args.indexOf('--mode') + 1]
|
|
192
|
-
: 'local') as MCPServerMode;
|
|
193
|
-
|
|
194
|
-
const port = args.includes('--port')
|
|
195
|
-
? parseInt(args[args.indexOf('--port') + 1])
|
|
196
|
-
: 3000;
|
|
197
|
-
|
|
198
|
-
const config: MCPServerConfig = {
|
|
199
|
-
mode,
|
|
200
|
-
port,
|
|
201
|
-
logging: !args.includes('--silent'),
|
|
202
|
-
resources_path: args.includes('--resources-path')
|
|
203
|
-
? args[args.indexOf('--resources-path') + 1]
|
|
204
|
-
: undefined,
|
|
205
|
-
features: {
|
|
206
|
-
orchestrator: args.includes('--enable-orchestrator')
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
// Suppress all logging in local mode (stdio MCP protocol)
|
|
211
|
-
if (config.logging && config.mode !== 'local') {
|
|
212
|
-
console.error('Starting Clean SpecVerse MCP Server with config:', JSON.stringify(config, null, 2));
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
try {
|
|
216
|
-
const server = new SpecVerseCleanMCPServer(config);
|
|
217
|
-
await server.start();
|
|
218
|
-
} catch (error) {
|
|
219
|
-
console.error('Failed to start Clean MCP Server:', error);
|
|
220
|
-
process.exit(1);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Execute main if this file is run directly or as a binary
|
|
225
|
-
const condition1 = import.meta.url === `file://${process.argv[1]}`;
|
|
226
|
-
const condition2 = process.argv[1]?.includes('mcp-server.js');
|
|
227
|
-
const condition3 = process.argv[0]?.includes('specverse-mcp');
|
|
228
|
-
const condition4 = process.argv[1]?.includes('specverse-mcp'); // npm wrapper detection
|
|
229
|
-
const isMainModule = condition1 || condition2 || condition3 || condition4;
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
if (isMainModule) {
|
|
233
|
-
main().catch((error) => {
|
|
234
|
-
console.error('Fatal error in Clean MCP Server:', error);
|
|
235
|
-
process.exit(1);
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
export { main };
|