reportdash-datastore-mcp-claude-desktop 1.0.6 → 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/index.js +25 -9
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
//goto folder, increment version then run > npm publish --access public
|
|
2
3
|
|
|
3
4
|
const https = require('https');
|
|
4
5
|
const http = require('http');
|
|
@@ -21,6 +22,18 @@ if (!API_KEY) {
|
|
|
21
22
|
process.exit(1);
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Ensure every outbound request includes platform="claude"
|
|
27
|
+
* without breaking existing requests.
|
|
28
|
+
*/
|
|
29
|
+
function withClaudePlatform(mcpRequest) {
|
|
30
|
+
// If caller already provided platform, keep it.
|
|
31
|
+
if (mcpRequest && typeof mcpRequest === 'object') {
|
|
32
|
+
if (!mcpRequest.platform) mcpRequest.platform = 'claude';
|
|
33
|
+
}
|
|
34
|
+
return mcpRequest;
|
|
35
|
+
}
|
|
36
|
+
|
|
24
37
|
// Test mode
|
|
25
38
|
if (process.argv.includes('--test')) {
|
|
26
39
|
testConnection();
|
|
@@ -39,7 +52,7 @@ rl.on('line', (line) => {
|
|
|
39
52
|
|
|
40
53
|
try {
|
|
41
54
|
const mcpRequest = JSON.parse(line);
|
|
42
|
-
forwardToAPI(mcpRequest);
|
|
55
|
+
forwardToAPI(withClaudePlatform(mcpRequest));
|
|
43
56
|
} catch (error) {
|
|
44
57
|
// Only output to stdout, never stderr for MCP protocol
|
|
45
58
|
console.log(JSON.stringify({
|
|
@@ -85,8 +98,12 @@ function forwardToAPI(mcpRequest) {
|
|
|
85
98
|
if (res.statusCode === 204 || !data.trim()) {
|
|
86
99
|
console.log(JSON.stringify({
|
|
87
100
|
jsonrpc: '2.0',
|
|
88
|
-
|
|
89
|
-
|
|
101
|
+
error: {
|
|
102
|
+
code: res.statusCode,
|
|
103
|
+
message: `API error: ${res.statusCode}${data ? ' - ' + data : ''}`,
|
|
104
|
+
data: { statusCode: res.statusCode, body: data }
|
|
105
|
+
},
|
|
106
|
+
id: mcpRequest.id ?? null
|
|
90
107
|
}));
|
|
91
108
|
} else {
|
|
92
109
|
// Forward the response as-is
|
|
@@ -113,10 +130,9 @@ function forwardToAPI(mcpRequest) {
|
|
|
113
130
|
jsonrpc: '2.0',
|
|
114
131
|
error: {
|
|
115
132
|
code: -32603,
|
|
116
|
-
message: '
|
|
117
|
-
data: { error: error.message }
|
|
133
|
+
message: 'Request timeout after 30 seconds'
|
|
118
134
|
},
|
|
119
|
-
id: mcpRequest.id
|
|
135
|
+
id: mcpRequest.id ?? null
|
|
120
136
|
}));
|
|
121
137
|
});
|
|
122
138
|
|
|
@@ -147,11 +163,11 @@ function testConnection() {
|
|
|
147
163
|
const client = isHttps ? https : http;
|
|
148
164
|
|
|
149
165
|
// Create MCP tools/list request
|
|
150
|
-
const mcpRequest = {
|
|
166
|
+
const mcpRequest = withClaudePlatform({
|
|
151
167
|
jsonrpc: '2.0',
|
|
152
168
|
method: 'tools/list',
|
|
153
169
|
id: 'test-connection'
|
|
154
|
-
};
|
|
170
|
+
});
|
|
155
171
|
|
|
156
172
|
const postData = JSON.stringify(mcpRequest);
|
|
157
173
|
|
|
@@ -230,4 +246,4 @@ function testConnection() {
|
|
|
230
246
|
|
|
231
247
|
req.write(postData);
|
|
232
248
|
req.end();
|
|
233
|
-
}
|
|
249
|
+
}
|