sqlcipher-mcp-server 1.0.4-debug.0 → 1.1.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/index.js +0 -32
- package/package.json +1 -1
- package/src/config/constants.js +1 -1
- package/src/server/mcp-server.js +11 -68
package/index.js
CHANGED
|
@@ -5,42 +5,10 @@
|
|
|
5
5
|
* Provides read-only access to SQLCipher-encrypted SQLite databases via MCP
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
// #region agent log
|
|
9
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'index.js:8',message:'Script started',data:{cwd:process.cwd(),argv:process.argv.slice(0,3)},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'A'})}).catch(()=>{});
|
|
10
|
-
// #endregion
|
|
11
|
-
|
|
12
|
-
// #region agent log
|
|
13
|
-
process.on('unhandledRejection', (reason, promise) => {
|
|
14
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'index.js:12',message:'Unhandled promise rejection',data:{reason:reason?.message||String(reason),stack:reason?.stack,name:reason?.name},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'B'})}).catch(()=>{});
|
|
15
|
-
console.error('Unhandled rejection:', reason);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
process.on('uncaughtException', (error) => {
|
|
19
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'index.js:17',message:'Uncaught exception',data:{error:error?.message,stack:error?.stack,name:error?.name},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'B'})}).catch(()=>{});
|
|
20
|
-
console.error('Uncaught exception:', error);
|
|
21
|
-
process.exit(1);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
process.on('exit', (code) => {
|
|
25
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'index.js:22',message:'Process exiting',data:{code},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'B'})}).catch(()=>{});
|
|
26
|
-
});
|
|
27
|
-
// #endregion
|
|
28
|
-
|
|
29
|
-
// #region agent log
|
|
30
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'index.js:26',message:'Before import startMcpServer',data:{},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'A'})}).catch(()=>{});
|
|
31
|
-
// #endregion
|
|
32
|
-
|
|
33
8
|
import { startMcpServer } from './src/server/mcp-server.js';
|
|
34
9
|
|
|
35
|
-
// #region agent log
|
|
36
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'index.js:30',message:'Import completed, calling startMcpServer',data:{startMcpServer:!!startMcpServer},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'A'})}).catch(()=>{});
|
|
37
|
-
// #endregion
|
|
38
|
-
|
|
39
10
|
// Start the server
|
|
40
11
|
startMcpServer().catch((error) => {
|
|
41
|
-
// #region agent log
|
|
42
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'index.js:35',message:'startMcpServer catch handler',data:{error:error?.message,stack:error?.stack,name:error?.name},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'A'})}).catch(()=>{});
|
|
43
|
-
// #endregion
|
|
44
12
|
console.error('Fatal error starting server:', error);
|
|
45
13
|
process.exit(1);
|
|
46
14
|
});
|
package/package.json
CHANGED
package/src/config/constants.js
CHANGED
package/src/server/mcp-server.js
CHANGED
|
@@ -31,35 +31,19 @@ export function createMcpServer() {
|
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
// Register list tools handler
|
|
34
|
+
// Register list tools handler
|
|
35
35
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
36
|
-
|
|
37
|
-
return await handleListTools();
|
|
38
|
-
} catch (error) {
|
|
39
|
-
// #region agent log
|
|
40
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'mcp-server.js:36',message:'ListTools handler error',data:{error:error?.message,stack:error?.stack},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'D'})}).catch(()=>{});
|
|
41
|
-
// #endregion
|
|
42
|
-
console.error('Error in ListTools handler:', error);
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
36
|
+
return handleListTools();
|
|
45
37
|
});
|
|
46
38
|
|
|
47
|
-
// Register tool execution handler
|
|
39
|
+
// Register tool execution handler
|
|
48
40
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return handleUnknownTool(name);
|
|
56
|
-
}
|
|
57
|
-
} catch (error) {
|
|
58
|
-
// #region agent log
|
|
59
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'mcp-server.js:48',message:'CallTool handler error',data:{error:error?.message,stack:error?.stack},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'D'})}).catch(()=>{});
|
|
60
|
-
// #endregion
|
|
61
|
-
console.error('Error in CallTool handler:', error);
|
|
62
|
-
throw error;
|
|
41
|
+
const { name, arguments: args } = request.params;
|
|
42
|
+
|
|
43
|
+
if (name === 'execute_query') {
|
|
44
|
+
return await handleExecuteQuery(args);
|
|
45
|
+
} else {
|
|
46
|
+
return handleUnknownTool(name);
|
|
63
47
|
}
|
|
64
48
|
});
|
|
65
49
|
|
|
@@ -71,10 +55,6 @@ export function createMcpServer() {
|
|
|
71
55
|
* @returns {Promise<void>}
|
|
72
56
|
*/
|
|
73
57
|
export async function startMcpServer() {
|
|
74
|
-
// #region agent log
|
|
75
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'mcp-server.js:57',message:'startMcpServer entry',data:{},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'A'})}).catch(()=>{});
|
|
76
|
-
// #endregion
|
|
77
|
-
|
|
78
58
|
// Check configuration and log warnings
|
|
79
59
|
const warnings = getConfigurationWarnings();
|
|
80
60
|
if (warnings.length > 0) {
|
|
@@ -83,70 +63,33 @@ export async function startMcpServer() {
|
|
|
83
63
|
console.error('Configuration loaded: Database path and password set via environment variables.');
|
|
84
64
|
}
|
|
85
65
|
|
|
86
|
-
// #region agent log
|
|
87
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'mcp-server.js:67',message:'Before createMcpServer',data:{},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'A'})}).catch(()=>{});
|
|
88
|
-
// #endregion
|
|
89
|
-
|
|
90
66
|
// Create server
|
|
91
67
|
const server = createMcpServer();
|
|
92
68
|
|
|
93
|
-
// #region agent log
|
|
94
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'mcp-server.js:72',message:'Before transport creation',data:{server:!!server},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'C'})}).catch(()=>{});
|
|
95
|
-
// #endregion
|
|
96
|
-
|
|
97
69
|
// Create stdio transport
|
|
98
70
|
const transport = new StdioServerTransport();
|
|
99
71
|
|
|
100
|
-
// #region agent log
|
|
101
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'mcp-server.js:77',message:'Before server.connect()',data:{transport:!!transport},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'A'})}).catch(()=>{});
|
|
102
|
-
// #endregion
|
|
103
|
-
|
|
104
72
|
// Add error handler for transport errors
|
|
105
73
|
transport.onerror = (error) => {
|
|
106
|
-
// #region agent log
|
|
107
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'mcp-server.js:89',message:'Transport error',data:{error:error?.message,stack:error?.stack},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'D'})}).catch(()=>{});
|
|
108
|
-
// #endregion
|
|
109
74
|
console.error('Transport error:', error);
|
|
110
75
|
};
|
|
111
76
|
|
|
112
77
|
// Connect server to transport
|
|
113
|
-
|
|
114
|
-
await server.connect(transport);
|
|
115
|
-
|
|
116
|
-
// #region agent log
|
|
117
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'mcp-server.js:96',message:'server.connect() completed',data:{},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'A'})}).catch(()=>{});
|
|
118
|
-
// #endregion
|
|
119
|
-
} catch (connectError) {
|
|
120
|
-
// #region agent log
|
|
121
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'mcp-server.js:99',message:'server.connect() error',data:{error:connectError?.message,stack:connectError?.stack,name:connectError?.name},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'A'})}).catch(()=>{});
|
|
122
|
-
// #endregion
|
|
123
|
-
throw connectError;
|
|
124
|
-
}
|
|
78
|
+
await server.connect(transport);
|
|
125
79
|
|
|
126
80
|
console.error('SQLCipher MCP Server running on stdio');
|
|
127
81
|
|
|
128
|
-
//
|
|
129
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'mcp-server.js:106',message:'startMcpServer exit - server started',data:{},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'A'})}).catch(()=>{});
|
|
130
|
-
// #endregion
|
|
131
|
-
|
|
132
|
-
// Keep the process alive - the stdio transport should handle this, but ensure we don't exit
|
|
133
|
-
// Keep stdin open to prevent the process from exiting
|
|
82
|
+
// Keep the process alive - keep stdin open to prevent the process from exiting
|
|
134
83
|
process.stdin.resume();
|
|
135
84
|
|
|
136
85
|
// Handle stdin end event (when client disconnects)
|
|
137
86
|
process.stdin.on('end', () => {
|
|
138
|
-
// #region agent log
|
|
139
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'mcp-server.js:111',message:'stdin ended',data:{},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'D'})}).catch(()=>{});
|
|
140
|
-
// #endregion
|
|
141
87
|
// When stdin ends, exit gracefully
|
|
142
88
|
process.exit(0);
|
|
143
89
|
});
|
|
144
90
|
|
|
145
91
|
// Handle errors on stdin
|
|
146
92
|
process.stdin.on('error', (error) => {
|
|
147
|
-
// #region agent log
|
|
148
|
-
fetch('http://127.0.0.1:7245/ingest/ba5ae969-895e-4c8c-9b24-3b774e2457b2',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'mcp-server.js:118',message:'stdin error',data:{error:error?.message},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'D'})}).catch(()=>{});
|
|
149
|
-
// #endregion
|
|
150
93
|
console.error('Stdin error:', error);
|
|
151
94
|
});
|
|
152
95
|
}
|