@softtechai/quickmcp 1.0.8
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 +553 -0
- package/dist/client/MCPClient.d.ts +24 -0
- package/dist/client/MCPClient.d.ts.map +1 -0
- package/dist/client/MCPClient.js +211 -0
- package/dist/client/MCPClient.js.map +1 -0
- package/dist/client/MCPClientUnified.d.ts +31 -0
- package/dist/client/MCPClientUnified.d.ts.map +1 -0
- package/dist/client/MCPClientUnified.js +275 -0
- package/dist/client/MCPClientUnified.js.map +1 -0
- package/dist/client/MCPTestRunner.d.ts +44 -0
- package/dist/client/MCPTestRunner.d.ts.map +1 -0
- package/dist/client/MCPTestRunner.js +220 -0
- package/dist/client/MCPTestRunner.js.map +1 -0
- package/dist/client/MCPTestRunnerUnified.d.ts +48 -0
- package/dist/client/MCPTestRunnerUnified.d.ts.map +1 -0
- package/dist/client/MCPTestRunnerUnified.js +183 -0
- package/dist/client/MCPTestRunnerUnified.js.map +1 -0
- package/dist/database/json-manager.d.ts +55 -0
- package/dist/database/json-manager.d.ts.map +1 -0
- package/dist/database/json-manager.js +128 -0
- package/dist/database/json-manager.js.map +1 -0
- package/dist/database/sqlite-manager.d.ts +53 -0
- package/dist/database/sqlite-manager.d.ts.map +1 -0
- package/dist/database/sqlite-manager.js +193 -0
- package/dist/database/sqlite-manager.js.map +1 -0
- package/dist/dynamic-mcp-executor.d.ts +14 -0
- package/dist/dynamic-mcp-executor.d.ts.map +1 -0
- package/dist/dynamic-mcp-executor.js +274 -0
- package/dist/dynamic-mcp-executor.js.map +1 -0
- package/dist/generators/MCPServerGenerator-new.d.ts +37 -0
- package/dist/generators/MCPServerGenerator-new.d.ts.map +1 -0
- package/dist/generators/MCPServerGenerator-new.js +287 -0
- package/dist/generators/MCPServerGenerator-new.js.map +1 -0
- package/dist/generators/MCPServerGenerator.d.ts +42 -0
- package/dist/generators/MCPServerGenerator.d.ts.map +1 -0
- package/dist/generators/MCPServerGenerator.js +494 -0
- package/dist/generators/MCPServerGenerator.js.map +1 -0
- package/dist/generators/database/sqlite-manager.d.ts +52 -0
- package/dist/generators/database/sqlite-manager.js +143 -0
- package/dist/generators/generators/MCPServerGenerator.d.ts +37 -0
- package/dist/generators/generators/MCPServerGenerator.js +396 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/integrated-mcp-server-new.d.ts +12 -0
- package/dist/integrated-mcp-server-new.d.ts.map +1 -0
- package/dist/integrated-mcp-server-new.js +253 -0
- package/dist/integrated-mcp-server-new.js.map +1 -0
- package/dist/integrated-mcp-server.d.ts +25 -0
- package/dist/integrated-mcp-server.d.ts.map +1 -0
- package/dist/integrated-mcp-server.js +541 -0
- package/dist/integrated-mcp-server.js.map +1 -0
- package/dist/mcp-inspector-server.d.ts +3 -0
- package/dist/mcp-inspector-server.d.ts.map +1 -0
- package/dist/mcp-inspector-server.js +119 -0
- package/dist/mcp-inspector-server.js.map +1 -0
- package/dist/mcp-sdk-server.d.ts +3 -0
- package/dist/mcp-sdk-server.d.ts.map +1 -0
- package/dist/mcp-sdk-server.js +90 -0
- package/dist/mcp-sdk-server.js.map +1 -0
- package/dist/mcp-server.d.ts +3 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +300 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/parsers/CsvParser.d.ts +7 -0
- package/dist/parsers/CsvParser.d.ts.map +1 -0
- package/dist/parsers/CsvParser.js +98 -0
- package/dist/parsers/CsvParser.js.map +1 -0
- package/dist/parsers/DatabaseParser.d.ts +18 -0
- package/dist/parsers/DatabaseParser.d.ts.map +1 -0
- package/dist/parsers/DatabaseParser.js +372 -0
- package/dist/parsers/DatabaseParser.js.map +1 -0
- package/dist/parsers/ExcelParser.d.ts +8 -0
- package/dist/parsers/ExcelParser.d.ts.map +1 -0
- package/dist/parsers/ExcelParser.js +119 -0
- package/dist/parsers/ExcelParser.js.map +1 -0
- package/dist/parsers/index.d.ts +13 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/index.js +88 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/parsers/ExcelParser.js +118 -0
- package/dist/parsers/types/index.js +2 -0
- package/dist/quickmcp-unified-bridge.d.ts +13 -0
- package/dist/quickmcp-unified-bridge.d.ts.map +1 -0
- package/dist/quickmcp-unified-bridge.js +176 -0
- package/dist/quickmcp-unified-bridge.js.map +1 -0
- package/dist/server/ServerManager.d.ts +37 -0
- package/dist/server/ServerManager.d.ts.map +1 -0
- package/dist/server/ServerManager.js +376 -0
- package/dist/server/ServerManager.js.map +1 -0
- package/dist/sqlite-manager.js +145 -0
- package/dist/start-new-server.d.ts +3 -0
- package/dist/start-new-server.d.ts.map +1 -0
- package/dist/start-new-server.js +10 -0
- package/dist/start-new-server.js.map +1 -0
- package/dist/test-app.d.ts +2 -0
- package/dist/test-app.d.ts.map +1 -0
- package/dist/test-app.js +119 -0
- package/dist/test-app.js.map +1 -0
- package/dist/test-new-architecture.d.ts +3 -0
- package/dist/test-new-architecture.d.ts.map +1 -0
- package/dist/test-new-architecture.js +72 -0
- package/dist/test-new-architecture.js.map +1 -0
- package/dist/transport/base-transport.d.ts +21 -0
- package/dist/transport/base-transport.d.ts.map +1 -0
- package/dist/transport/base-transport.js +16 -0
- package/dist/transport/base-transport.js.map +1 -0
- package/dist/transport/index.d.ts +10 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +12 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/transport/sse-transport.d.ts +13 -0
- package/dist/transport/sse-transport.d.ts.map +1 -0
- package/dist/transport/sse-transport.js +106 -0
- package/dist/transport/sse-transport.js.map +1 -0
- package/dist/transport/stdio-transport.d.ts +8 -0
- package/dist/transport/stdio-transport.d.ts.map +1 -0
- package/dist/transport/stdio-transport.js +53 -0
- package/dist/transport/stdio-transport.js.map +1 -0
- package/dist/transport/streamable-http-transport.d.ts +15 -0
- package/dist/transport/streamable-http-transport.d.ts.map +1 -0
- package/dist/transport/streamable-http-transport.js +151 -0
- package/dist/transport/streamable-http-transport.js.map +1 -0
- package/dist/types/index.d.ts +64 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/web/client/MCPClient.js +348 -0
- package/dist/web/client/MCPTestRunner.js +317 -0
- package/dist/web/database/json-manager.js +124 -0
- package/dist/web/database/sqlite-manager.js +146 -0
- package/dist/web/dynamic-mcp-executor.js +443 -0
- package/dist/web/generators/MCPServerGenerator-new.js +284 -0
- package/dist/web/generators/MCPServerGenerator.js +566 -0
- package/dist/web/integrated-mcp-server-new.js +394 -0
- package/dist/web/parsers/CsvParser.js +144 -0
- package/dist/web/parsers/DatabaseParser.js +637 -0
- package/dist/web/parsers/ExcelParser.js +180 -0
- package/dist/web/parsers/index.js +152 -0
- package/dist/web/server.d.ts +3 -0
- package/dist/web/server.d.ts.map +1 -0
- package/dist/web/server.js +790 -0
- package/dist/web/server.js.map +1 -0
- package/dist/web/types/index.js +2 -0
- package/dist/web/web/server.js +860 -0
- package/package.json +68 -0
- package/quickmcp-direct-stdio.js +328 -0
- package/src/web/public/app.js +1795 -0
- package/src/web/public/database-tables.html +711 -0
- package/src/web/public/how-to-use.html +571 -0
- package/src/web/public/how-to-use.js +255 -0
- package/src/web/public/images/1-claude-quickmcp-stdio.png +0 -0
- package/src/web/public/images/2-claude-tools.png +0 -0
- package/src/web/public/images/3-claude-developer-settings.png +0 -0
- package/src/web/public/images/4-claude-config.png +0 -0
- package/src/web/public/images/5-claude-config-edit.png +0 -0
- package/src/web/public/index.html +626 -0
- package/src/web/public/manage-servers.html +198 -0
- package/src/web/public/modern-styles.css +946 -0
- package/src/web/public/shared-styles.css +2091 -0
- package/src/web/public/shared.js +93 -0
- package/src/web/public/test-servers.html +302 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const express_1 = __importDefault(require("express"));
|
|
8
|
+
const sqlite_manager_1 = require("./database/sqlite-manager");
|
|
9
|
+
const dynamic_mcp_executor_1 = require("./dynamic-mcp-executor");
|
|
10
|
+
const app = (0, express_1.default)();
|
|
11
|
+
app.use(express_1.default.json());
|
|
12
|
+
// CORS headers
|
|
13
|
+
app.use((req, res, next) => {
|
|
14
|
+
res.header('Access-Control-Allow-Origin', '*');
|
|
15
|
+
res.header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS');
|
|
16
|
+
res.header('Access-Control-Allow-Headers', 'Content-Type, Accept');
|
|
17
|
+
if (req.method === 'OPTIONS') {
|
|
18
|
+
return res.sendStatus(200);
|
|
19
|
+
}
|
|
20
|
+
next();
|
|
21
|
+
});
|
|
22
|
+
const sqliteManager = new sqlite_manager_1.SQLiteManager();
|
|
23
|
+
const executor = new dynamic_mcp_executor_1.DynamicMCPExecutor();
|
|
24
|
+
// Single endpoint for MCP Inspector
|
|
25
|
+
app.post('/', async (req, res) => {
|
|
26
|
+
const message = req.body;
|
|
27
|
+
console.error(`[Inspector] Received: ${message.method} (id: ${message.id})`);
|
|
28
|
+
let response = null;
|
|
29
|
+
try {
|
|
30
|
+
switch (message.method) {
|
|
31
|
+
case 'initialize':
|
|
32
|
+
response = {
|
|
33
|
+
jsonrpc: '2.0',
|
|
34
|
+
id: message.id,
|
|
35
|
+
result: {
|
|
36
|
+
protocolVersion: '2024-11-05',
|
|
37
|
+
serverInfo: {
|
|
38
|
+
name: 'quickmcp-inspector',
|
|
39
|
+
version: '1.0.0'
|
|
40
|
+
},
|
|
41
|
+
capabilities: {
|
|
42
|
+
tools: { listChanged: false },
|
|
43
|
+
resources: { listChanged: false }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
break;
|
|
48
|
+
case 'tools/list':
|
|
49
|
+
const tools = sqliteManager.getAllTools();
|
|
50
|
+
const formattedTools = tools.map(tool => ({
|
|
51
|
+
name: `${tool.server_id}__${tool.name}`,
|
|
52
|
+
description: `[${tool.server_id}] ${tool.description}`,
|
|
53
|
+
inputSchema: typeof tool.inputSchema === 'string'
|
|
54
|
+
? JSON.parse(tool.inputSchema)
|
|
55
|
+
: tool.inputSchema
|
|
56
|
+
}));
|
|
57
|
+
response = {
|
|
58
|
+
jsonrpc: '2.0',
|
|
59
|
+
id: message.id,
|
|
60
|
+
result: { tools: formattedTools }
|
|
61
|
+
};
|
|
62
|
+
break;
|
|
63
|
+
case 'tools/call':
|
|
64
|
+
const toolResult = await executor.executeTool(message.params?.name || '', message.params?.arguments || {});
|
|
65
|
+
response = {
|
|
66
|
+
jsonrpc: '2.0',
|
|
67
|
+
id: message.id,
|
|
68
|
+
result: {
|
|
69
|
+
content: [{
|
|
70
|
+
type: 'text',
|
|
71
|
+
text: JSON.stringify(toolResult, null, 2)
|
|
72
|
+
}]
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
break;
|
|
76
|
+
case 'resources/list':
|
|
77
|
+
const resources = sqliteManager.getAllResources();
|
|
78
|
+
const formattedResources = resources.map(resource => ({
|
|
79
|
+
name: `${resource.server_id}__${resource.name}`,
|
|
80
|
+
description: `[${resource.server_id}] ${resource.description}`,
|
|
81
|
+
uri: resource.uri_template
|
|
82
|
+
}));
|
|
83
|
+
response = {
|
|
84
|
+
jsonrpc: '2.0',
|
|
85
|
+
id: message.id,
|
|
86
|
+
result: { resources: formattedResources }
|
|
87
|
+
};
|
|
88
|
+
break;
|
|
89
|
+
default:
|
|
90
|
+
response = {
|
|
91
|
+
jsonrpc: '2.0',
|
|
92
|
+
id: message.id,
|
|
93
|
+
error: {
|
|
94
|
+
code: -32601,
|
|
95
|
+
message: `Method not found: ${message.method}`
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
console.error(`[Inspector] Sending response for id ${message.id}`);
|
|
100
|
+
res.json(response);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
console.error('[Inspector] Error:', error);
|
|
104
|
+
res.json({
|
|
105
|
+
jsonrpc: '2.0',
|
|
106
|
+
id: message.id,
|
|
107
|
+
error: {
|
|
108
|
+
code: -32603,
|
|
109
|
+
message: `Server error: ${error instanceof Error ? error.message : 'Unknown'}`
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
const PORT = process.env.PORT || 3006;
|
|
115
|
+
app.listen(PORT, () => {
|
|
116
|
+
console.log(`MCP Inspector Server running on http://localhost:${PORT}`);
|
|
117
|
+
console.log('Use this URL in MCP Inspector: http://localhost:' + PORT);
|
|
118
|
+
});
|
|
119
|
+
//# sourceMappingURL=mcp-inspector-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-inspector-server.js","sourceRoot":"","sources":["../src/mcp-inspector-server.ts"],"names":[],"mappings":";;;;;;AAEA,sDAA8B;AAC9B,8DAA0D;AAC1D,iEAA4D;AAE5D,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;AACtB,GAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AAExB,eAAe;AACf,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;IACzB,GAAG,CAAC,MAAM,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;IAC/C,GAAG,CAAC,MAAM,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,CAAC;IACjE,GAAG,CAAC,MAAM,CAAC,8BAA8B,EAAE,sBAAsB,CAAC,CAAC;IACnE,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;Q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[],"mappings":""}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
5
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
6
|
+
const sqlite_manager_1 = require("./database/sqlite-manager");
|
|
7
|
+
const dynamic_mcp_executor_1 = require("./dynamic-mcp-executor");
|
|
8
|
+
const sqliteManager = new sqlite_manager_1.SQLiteManager();
|
|
9
|
+
const executor = new dynamic_mcp_executor_1.DynamicMCPExecutor();
|
|
10
|
+
// Create MCP server with official SDK
|
|
11
|
+
const server = new index_js_1.Server({
|
|
12
|
+
name: 'quickmcp-sdk',
|
|
13
|
+
version: '1.0.0',
|
|
14
|
+
}, {
|
|
15
|
+
capabilities: {
|
|
16
|
+
tools: {},
|
|
17
|
+
resources: {}
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
// List tools handler
|
|
21
|
+
server.setRequestHandler('tools/list', async () => {
|
|
22
|
+
const tools = sqliteManager.getAllTools();
|
|
23
|
+
const formattedTools = tools.map(tool => ({
|
|
24
|
+
name: `${tool.server_id}__${tool.name}`,
|
|
25
|
+
description: `[${tool.server_id}] ${tool.description}`,
|
|
26
|
+
inputSchema: typeof tool.inputSchema === 'string'
|
|
27
|
+
? JSON.parse(tool.inputSchema)
|
|
28
|
+
: tool.inputSchema
|
|
29
|
+
}));
|
|
30
|
+
return { tools: formattedTools };
|
|
31
|
+
});
|
|
32
|
+
// Call tool handler
|
|
33
|
+
server.setRequestHandler('tools/call', async (request) => {
|
|
34
|
+
const { name, arguments: args } = request.params;
|
|
35
|
+
try {
|
|
36
|
+
const result = await executor.executeTool(name, args || {});
|
|
37
|
+
return {
|
|
38
|
+
content: [{
|
|
39
|
+
type: 'text',
|
|
40
|
+
text: JSON.stringify(result, null, 2)
|
|
41
|
+
}]
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
return {
|
|
46
|
+
content: [{
|
|
47
|
+
type: 'text',
|
|
48
|
+
text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
49
|
+
}]
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
// List resources handler
|
|
54
|
+
server.setRequestHandler('resources/list', async () => {
|
|
55
|
+
const resources = sqliteManager.getAllResources();
|
|
56
|
+
const formattedResources = resources.map(resource => ({
|
|
57
|
+
name: `${resource.server_id}__${resource.name}`,
|
|
58
|
+
description: `[${resource.server_id}] ${resource.description}`,
|
|
59
|
+
uri: resource.uri_template
|
|
60
|
+
}));
|
|
61
|
+
return { resources: formattedResources };
|
|
62
|
+
});
|
|
63
|
+
// Read resource handler
|
|
64
|
+
server.setRequestHandler('resources/read', async (request) => {
|
|
65
|
+
const { uri } = request.params;
|
|
66
|
+
try {
|
|
67
|
+
const result = await executor.readResource(uri);
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
return {
|
|
72
|
+
contents: [{
|
|
73
|
+
uri: uri,
|
|
74
|
+
mimeType: 'text/plain',
|
|
75
|
+
text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
76
|
+
}]
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
// Start server with STDIO transport
|
|
81
|
+
async function main() {
|
|
82
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
83
|
+
await server.connect(transport);
|
|
84
|
+
console.error('QuickMCP SDK Server started with STDIO transport');
|
|
85
|
+
}
|
|
86
|
+
main().catch(error => {
|
|
87
|
+
console.error('Failed to start server:', error);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=mcp-sdk-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-sdk-server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Q,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,QAAQ,EAAE,CAAC;oBACT,GAAG,EAAE,GAAG;oBACR,QAAQ,EAAE,YAAY;oBACtB,IAAI,EAAE,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE;iBAC3E,CAAC;SACH,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,oCAAoC;AACpC,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;AACpE,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;IAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
5
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
6
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
7
|
+
const DatabaseParser_1 = require("./parsers/DatabaseParser");
|
|
8
|
+
const MCPServerGenerator_1 = require("./generators/MCPServerGenerator");
|
|
9
|
+
class QuickMCPServer {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.currentConnection = null;
|
|
12
|
+
this.currentParsedData = [];
|
|
13
|
+
this.server = new index_js_1.Server({
|
|
14
|
+
name: 'quickmcp-generator',
|
|
15
|
+
version: '1.0.0'
|
|
16
|
+
});
|
|
17
|
+
this.dbParser = new DatabaseParser_1.DatabaseParser();
|
|
18
|
+
this.generator = new MCPServerGenerator_1.MCPServerGenerator();
|
|
19
|
+
this.setupHandlers();
|
|
20
|
+
}
|
|
21
|
+
setupHandlers() {
|
|
22
|
+
this.server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
|
|
23
|
+
tools: [
|
|
24
|
+
{
|
|
25
|
+
name: 'connect_database',
|
|
26
|
+
description: 'Connect to a database (MySQL, PostgreSQL, SQLite, MSSQL)',
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
type: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
enum: ['mysql', 'postgresql', 'sqlite', 'mssql'],
|
|
33
|
+
description: 'Database type'
|
|
34
|
+
},
|
|
35
|
+
host: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
description: 'Database host (not required for SQLite)'
|
|
38
|
+
},
|
|
39
|
+
port: {
|
|
40
|
+
type: 'number',
|
|
41
|
+
description: 'Database port (not required for SQLite)'
|
|
42
|
+
},
|
|
43
|
+
database: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
description: 'Database name or file path for SQLite'
|
|
46
|
+
},
|
|
47
|
+
username: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
description: 'Database username (not required for SQLite)'
|
|
50
|
+
},
|
|
51
|
+
password: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
description: 'Database password (not required for SQLite)'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
required: ['type', 'database']
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'list_tables',
|
|
61
|
+
description: 'List all tables in the currently connected database',
|
|
62
|
+
inputSchema: {
|
|
63
|
+
type: 'object',
|
|
64
|
+
properties: {},
|
|
65
|
+
additionalProperties: false
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'parse_database',
|
|
70
|
+
description: 'Parse and analyze all data from the connected database',
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: 'object',
|
|
73
|
+
properties: {
|
|
74
|
+
tableNames: {
|
|
75
|
+
type: 'array',
|
|
76
|
+
items: { type: 'string' },
|
|
77
|
+
description: 'Specific table names to parse (optional - if empty, parses all tables)'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'generate_mcp_server',
|
|
84
|
+
description: 'Generate an MCP server from the currently parsed data',
|
|
85
|
+
inputSchema: {
|
|
86
|
+
type: 'object',
|
|
87
|
+
properties: {
|
|
88
|
+
name: {
|
|
89
|
+
type: 'string',
|
|
90
|
+
description: 'Name for the MCP server'
|
|
91
|
+
},
|
|
92
|
+
description: {
|
|
93
|
+
type: 'string',
|
|
94
|
+
description: 'Description of the MCP server'
|
|
95
|
+
},
|
|
96
|
+
version: {
|
|
97
|
+
type: 'string',
|
|
98
|
+
description: 'Version of the MCP server',
|
|
99
|
+
default: '1.0.0'
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
required: ['name']
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}));
|
|
107
|
+
this.server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
108
|
+
const { name, arguments: args } = request.params;
|
|
109
|
+
try {
|
|
110
|
+
switch (name) {
|
|
111
|
+
case 'connect_database':
|
|
112
|
+
return await this.connectDatabase(args);
|
|
113
|
+
case 'list_tables':
|
|
114
|
+
return await this.listTables();
|
|
115
|
+
case 'parse_database':
|
|
116
|
+
return await this.parseDatabase(args);
|
|
117
|
+
case 'generate_mcp_server':
|
|
118
|
+
return await this.generateMCPServer(args);
|
|
119
|
+
default:
|
|
120
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Tool execution failed: ${error?.message || error}`);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
async connectDatabase(args) {
|
|
129
|
+
try {
|
|
130
|
+
const connection = {
|
|
131
|
+
type: args.type,
|
|
132
|
+
host: args.host,
|
|
133
|
+
port: args.port,
|
|
134
|
+
database: args.database,
|
|
135
|
+
username: args.username,
|
|
136
|
+
password: args.password
|
|
137
|
+
};
|
|
138
|
+
// Test the connection by trying to get tables
|
|
139
|
+
await this.dbParser.getTables(connection);
|
|
140
|
+
this.currentConnection = connection;
|
|
141
|
+
this.currentParsedData = []; // Reset parsed data when connecting to new DB
|
|
142
|
+
return {
|
|
143
|
+
content: [
|
|
144
|
+
{
|
|
145
|
+
type: 'text',
|
|
146
|
+
text: `Successfully connected to ${connection.type} database: ${connection.database}`
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to connect to database: ${error?.message || error}`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
async listTables() {
|
|
156
|
+
if (!this.currentConnection) {
|
|
157
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidRequest, 'No database connection. Use connect_database first.');
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
const tables = await this.dbParser.getTables(this.currentConnection);
|
|
161
|
+
return {
|
|
162
|
+
content: [
|
|
163
|
+
{
|
|
164
|
+
type: 'text',
|
|
165
|
+
text: `Found ${tables.length} tables in ${this.currentConnection.database}:\n\n${tables.map(table => `• ${table}`).join('\n')}`
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to list tables: ${error?.message || error}`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
async parseDatabase(args) {
|
|
175
|
+
if (!this.currentConnection) {
|
|
176
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidRequest, 'No database connection. Use connect_database first.');
|
|
177
|
+
}
|
|
178
|
+
try {
|
|
179
|
+
// For now, parse all tables if no specific tables specified
|
|
180
|
+
this.currentParsedData = await this.dbParser.parse(this.currentConnection);
|
|
181
|
+
const summary = this.currentParsedData.map(data => ({
|
|
182
|
+
tableName: data.tableName || 'Unknown',
|
|
183
|
+
rows: data.metadata.rowCount,
|
|
184
|
+
columns: data.metadata.columnCount,
|
|
185
|
+
columnNames: data.headers
|
|
186
|
+
}));
|
|
187
|
+
return {
|
|
188
|
+
content: [
|
|
189
|
+
{
|
|
190
|
+
type: 'text',
|
|
191
|
+
text: `Successfully parsed ${this.currentParsedData.length} table(s):\n\n${JSON.stringify(summary, null, 2)}\n\nData is ready for MCP server generation. Use generate_mcp_server to create a server.`
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to parse database: ${error?.message || error}`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
async generateMCPServer(args) {
|
|
201
|
+
if (this.currentParsedData.length === 0) {
|
|
202
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidRequest, 'No parsed data available. Use parse_database first.');
|
|
203
|
+
}
|
|
204
|
+
try {
|
|
205
|
+
// Create a mock MCP server config
|
|
206
|
+
const config = {
|
|
207
|
+
name: args.name,
|
|
208
|
+
description: args.description || `MCP Server for ${this.currentConnection?.database}`,
|
|
209
|
+
version: args.version || '1.0.0',
|
|
210
|
+
dataSource: {
|
|
211
|
+
type: 'database',
|
|
212
|
+
name: `Database (${this.currentConnection?.type})`,
|
|
213
|
+
connection: this.currentConnection || undefined
|
|
214
|
+
},
|
|
215
|
+
tools: this.generateBasicTools(),
|
|
216
|
+
resources: this.generateBasicResources(),
|
|
217
|
+
prompts: this.generateBasicPrompts()
|
|
218
|
+
};
|
|
219
|
+
// Convert ParsedData[] to ParsedData format expected by generator
|
|
220
|
+
const parsedDataForGenerator = {};
|
|
221
|
+
this.currentParsedData.forEach(data => {
|
|
222
|
+
const tableName = data.tableName || `table_${Date.now()}`;
|
|
223
|
+
// Convert rows array to objects using headers
|
|
224
|
+
parsedDataForGenerator[tableName] = data.rows.map(row => {
|
|
225
|
+
const obj = {};
|
|
226
|
+
data.headers.forEach((header, index) => {
|
|
227
|
+
obj[header] = row[index];
|
|
228
|
+
});
|
|
229
|
+
return obj;
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
// Generate the server using the new virtual method
|
|
233
|
+
const result = await this.generator.generateServer(args.name, config.name, parsedDataForGenerator, this.currentConnection);
|
|
234
|
+
const totalRows = this.currentParsedData.reduce((sum, data) => sum + data.metadata.rowCount, 0);
|
|
235
|
+
return {
|
|
236
|
+
content: [
|
|
237
|
+
{
|
|
238
|
+
type: 'text',
|
|
239
|
+
text: result.success ?
|
|
240
|
+
`Successfully generated virtual MCP server "${args.name}"!\n\n${result.message}\n\nGenerated:\n• ${config.tools.length} tools\n• ${config.resources.length} resources\n• ${config.prompts.length} prompts\n• ${totalRows} total data rows\n\nServer is now available as a virtual MCP server in the integrated system.` :
|
|
241
|
+
`Failed to generate MCP server: ${result.message}`
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to generate MCP server: ${error?.message || error}`);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
generateBasicTools() {
|
|
251
|
+
const tools = [];
|
|
252
|
+
this.currentParsedData.forEach(data => {
|
|
253
|
+
const tableName = data.tableName || 'data';
|
|
254
|
+
tools.push({
|
|
255
|
+
name: `get_${tableName.toLowerCase()}_data`,
|
|
256
|
+
description: `Get data from ${tableName} table`,
|
|
257
|
+
inputSchema: {
|
|
258
|
+
type: 'object',
|
|
259
|
+
properties: {
|
|
260
|
+
limit: { type: 'number', description: 'Maximum number of rows to return' },
|
|
261
|
+
offset: { type: 'number', description: 'Number of rows to skip' }
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
handler: `this.getTableData('${tableName}', args)`
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
return tools;
|
|
268
|
+
}
|
|
269
|
+
generateBasicResources() {
|
|
270
|
+
return this.currentParsedData.map((data, index) => ({
|
|
271
|
+
uri: `schema://table_${index}`,
|
|
272
|
+
name: `${data.tableName || 'Data'} Schema`,
|
|
273
|
+
description: `Schema information for ${data.tableName || 'data'} table`,
|
|
274
|
+
mimeType: 'application/json'
|
|
275
|
+
}));
|
|
276
|
+
}
|
|
277
|
+
generateBasicPrompts() {
|
|
278
|
+
const prompts = [];
|
|
279
|
+
this.currentParsedData.forEach(data => {
|
|
280
|
+
const tableName = data.tableName || 'data';
|
|
281
|
+
prompts.push({
|
|
282
|
+
name: `analyze_${tableName.toLowerCase()}`,
|
|
283
|
+
description: `Analyze and summarize ${tableName} data`,
|
|
284
|
+
arguments: [
|
|
285
|
+
{ name: 'focus', description: 'What aspect to focus on in the analysis' }
|
|
286
|
+
],
|
|
287
|
+
template: `Please analyze the ${tableName} data focusing on {{focus}}. The table has ${data.metadata.rowCount} rows and includes columns: ${data.headers.join(', ')}.`
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
return prompts;
|
|
291
|
+
}
|
|
292
|
+
async run() {
|
|
293
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
294
|
+
await this.server.connect(transport);
|
|
295
|
+
console.error('QuickMCP Generator server running on stdio');
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
const server = new QuickMCPServer();
|
|
299
|
+
server.run().catch(console.error);
|
|
300
|
+
//# sourceMappingURL=mcp-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";;;AAEA,wEAAmE;AACnE,wEAAiF;AACjF,iEAK4C;AAC5C,6DAA0D;AAC1D,wEAAqE;AAKrE,MAAM,cAAc;IAOlB;QAHQ,sBAAiB,GAA8B,IAAI,CAAC;QACpD,sBAAiB,GAAiB,EAAE,CAAC;QAG3C,IAAI,CAAC,MAAM,GAAG,IAAI,iBAAM,CAAC;YACvB,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,GAAG,IAAI,+BAAc,EAAE,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,IAAI,uCAAkB,EAAE,CAAC;QAE1C,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAEO,aAAa;QACnB,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,iCAAsB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YACjE,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,kBAAkB;oBACxB,WAAW,EAAE,0DAA0D;oBACvE,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,IAAI,EAAE;gCACJ,IAAI,EAAE,QAAQ;gCACd,IAAI,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,CAAC;gCAChD,WAAW,EAAE,eAAe;6BAC7B;4BACD,IAAI,EAAE;gCACJ,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,yCAAyC;6BACvD;4BACD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