reportdash-datastore-mcp-claude-desktop 1.0.5 → 1.0.6
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 +16 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -41,7 +41,8 @@ rl.on('line', (line) => {
|
|
|
41
41
|
const mcpRequest = JSON.parse(line);
|
|
42
42
|
forwardToAPI(mcpRequest);
|
|
43
43
|
} catch (error) {
|
|
44
|
-
|
|
44
|
+
// Only output to stdout, never stderr for MCP protocol
|
|
45
|
+
console.log(JSON.stringify({
|
|
45
46
|
jsonrpc: '2.0',
|
|
46
47
|
error: {
|
|
47
48
|
code: -32700,
|
|
@@ -78,9 +79,9 @@ function forwardToAPI(mcpRequest) {
|
|
|
78
79
|
});
|
|
79
80
|
|
|
80
81
|
res.on('end', () => {
|
|
81
|
-
// Treat 200-299 as success
|
|
82
|
+
// Treat 200-299 as success (including 204 No Content)
|
|
82
83
|
if (res.statusCode >= 200 && res.statusCode < 300) {
|
|
83
|
-
// For 204 No Content, return empty success
|
|
84
|
+
// For 204 No Content or empty response, return empty success
|
|
84
85
|
if (res.statusCode === 204 || !data.trim()) {
|
|
85
86
|
console.log(JSON.stringify({
|
|
86
87
|
jsonrpc: '2.0',
|
|
@@ -88,10 +89,12 @@ function forwardToAPI(mcpRequest) {
|
|
|
88
89
|
id: mcpRequest.id || null
|
|
89
90
|
}));
|
|
90
91
|
} else {
|
|
92
|
+
// Forward the response as-is
|
|
91
93
|
console.log(data);
|
|
92
94
|
}
|
|
93
95
|
} else {
|
|
94
|
-
|
|
96
|
+
// Send errors to stdout (not stderr!) so Claude can properly handle them
|
|
97
|
+
console.log(JSON.stringify({
|
|
95
98
|
jsonrpc: '2.0',
|
|
96
99
|
error: {
|
|
97
100
|
code: res.statusCode,
|
|
@@ -105,7 +108,8 @@ function forwardToAPI(mcpRequest) {
|
|
|
105
108
|
});
|
|
106
109
|
|
|
107
110
|
req.on('error', (error) => {
|
|
108
|
-
|
|
111
|
+
// Send errors to stdout (not stderr!)
|
|
112
|
+
console.log(JSON.stringify({
|
|
109
113
|
jsonrpc: '2.0',
|
|
110
114
|
error: {
|
|
111
115
|
code: -32603,
|
|
@@ -118,7 +122,8 @@ function forwardToAPI(mcpRequest) {
|
|
|
118
122
|
|
|
119
123
|
req.on('timeout', () => {
|
|
120
124
|
req.destroy();
|
|
121
|
-
|
|
125
|
+
// Send errors to stdout (not stderr!)
|
|
126
|
+
console.log(JSON.stringify({
|
|
122
127
|
jsonrpc: '2.0',
|
|
123
128
|
error: {
|
|
124
129
|
code: -32603,
|
|
@@ -176,7 +181,7 @@ function testConnection() {
|
|
|
176
181
|
if (res.statusCode === 204 || !data.trim()) {
|
|
177
182
|
console.log('✅ Connection successful!');
|
|
178
183
|
console.log('✅ API key is valid');
|
|
179
|
-
console.log('ℹ️ Server returned 204 No Content
|
|
184
|
+
console.log('ℹ️ Server returned 204 No Content\n');
|
|
180
185
|
} else {
|
|
181
186
|
try {
|
|
182
187
|
const response = JSON.parse(data);
|
|
@@ -185,10 +190,13 @@ function testConnection() {
|
|
|
185
190
|
|
|
186
191
|
if (response.result && response.result.tools) {
|
|
187
192
|
console.log(`📦 Available Tools: ${response.result.tools.length}\n`);
|
|
188
|
-
response.result.tools.forEach((tool, index) => {
|
|
193
|
+
response.result.tools.slice(0, 5).forEach((tool, index) => {
|
|
189
194
|
console.log(`${index + 1}. ${tool.name}`);
|
|
190
195
|
console.log(` ${tool.description}\n`);
|
|
191
196
|
});
|
|
197
|
+
if (response.result.tools.length > 5) {
|
|
198
|
+
console.log(`... and ${response.result.tools.length - 5} more tools`);
|
|
199
|
+
}
|
|
192
200
|
} else {
|
|
193
201
|
console.log('Response:', JSON.stringify(response, null, 2));
|
|
194
202
|
}
|