reportdash-datastore-mcp-claude-desktop 1.0.3 ā 1.0.5
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 +58 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -78,14 +78,24 @@ function forwardToAPI(mcpRequest) {
|
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
res.on('end', () => {
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
// Treat 200-299 as success
|
|
82
|
+
if (res.statusCode >= 200 && res.statusCode < 300) {
|
|
83
|
+
// For 204 No Content, return empty success response
|
|
84
|
+
if (res.statusCode === 204 || !data.trim()) {
|
|
85
|
+
console.log(JSON.stringify({
|
|
86
|
+
jsonrpc: '2.0',
|
|
87
|
+
result: {},
|
|
88
|
+
id: mcpRequest.id || null
|
|
89
|
+
}));
|
|
90
|
+
} else {
|
|
91
|
+
console.log(data);
|
|
92
|
+
}
|
|
83
93
|
} else {
|
|
84
94
|
console.error(JSON.stringify({
|
|
85
95
|
jsonrpc: '2.0',
|
|
86
96
|
error: {
|
|
87
97
|
code: res.statusCode,
|
|
88
|
-
message: `API error: ${res.statusCode} -
|
|
98
|
+
message: `API error: ${res.statusCode}${data ? ' - ' + data : ''}`,
|
|
89
99
|
data: { statusCode: res.statusCode, body: data }
|
|
90
100
|
},
|
|
91
101
|
id: mcpRequest.id || null
|
|
@@ -131,24 +141,63 @@ function testConnection() {
|
|
|
131
141
|
const isHttps = url.protocol === 'https:';
|
|
132
142
|
const client = isHttps ? https : http;
|
|
133
143
|
|
|
144
|
+
// Create MCP tools/list request
|
|
145
|
+
const mcpRequest = {
|
|
146
|
+
jsonrpc: '2.0',
|
|
147
|
+
method: 'tools/list',
|
|
148
|
+
id: 'test-connection'
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const postData = JSON.stringify(mcpRequest);
|
|
152
|
+
|
|
134
153
|
const options = {
|
|
135
154
|
hostname: url.hostname,
|
|
136
155
|
port: url.port || (isHttps ? 443 : 80),
|
|
137
156
|
path: url.pathname,
|
|
138
|
-
method: '
|
|
157
|
+
method: 'POST',
|
|
139
158
|
headers: {
|
|
140
|
-
'
|
|
159
|
+
'Content-Type': 'application/json',
|
|
160
|
+
'X-Api-Key': API_KEY,
|
|
161
|
+
'Content-Length': Buffer.byteLength(postData),
|
|
162
|
+
'User-Agent': 'ReportDash-DataStore-MCP/1.0'
|
|
141
163
|
},
|
|
142
164
|
timeout: 10000
|
|
143
165
|
};
|
|
144
166
|
|
|
167
|
+
console.log('š” Sending MCP tools/list request...\n');
|
|
168
|
+
|
|
145
169
|
const req = client.request(options, (res) => {
|
|
146
170
|
let data = '';
|
|
147
171
|
res.on('data', (chunk) => { data += chunk; });
|
|
148
172
|
res.on('end', () => {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
173
|
+
console.log(`Response Status: ${res.statusCode}\n`);
|
|
174
|
+
|
|
175
|
+
if (res.statusCode >= 200 && res.statusCode < 300) {
|
|
176
|
+
if (res.statusCode === 204 || !data.trim()) {
|
|
177
|
+
console.log('ā
Connection successful!');
|
|
178
|
+
console.log('ā
API key is valid');
|
|
179
|
+
console.log('ā¹ļø Server returned 204 No Content (this is normal for some endpoints)\n');
|
|
180
|
+
} else {
|
|
181
|
+
try {
|
|
182
|
+
const response = JSON.parse(data);
|
|
183
|
+
console.log('ā
Connection successful!');
|
|
184
|
+
console.log('ā
API key is valid\n');
|
|
185
|
+
|
|
186
|
+
if (response.result && response.result.tools) {
|
|
187
|
+
console.log(`š¦ Available Tools: ${response.result.tools.length}\n`);
|
|
188
|
+
response.result.tools.forEach((tool, index) => {
|
|
189
|
+
console.log(`${index + 1}. ${tool.name}`);
|
|
190
|
+
console.log(` ${tool.description}\n`);
|
|
191
|
+
});
|
|
192
|
+
} else {
|
|
193
|
+
console.log('Response:', JSON.stringify(response, null, 2));
|
|
194
|
+
}
|
|
195
|
+
} catch (e) {
|
|
196
|
+
console.log('ā
Connection successful but response parsing failed');
|
|
197
|
+
console.log('Raw response:', data);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
152
201
|
console.log('\nš You can now use ReportDash DataStore in Claude Desktop!');
|
|
153
202
|
console.log('\nTry asking Claude: "list my reportdash datastore sources"');
|
|
154
203
|
} else {
|
|
@@ -171,5 +220,6 @@ function testConnection() {
|
|
|
171
220
|
console.log('\nš” Check your internet connection');
|
|
172
221
|
});
|
|
173
222
|
|
|
223
|
+
req.write(postData);
|
|
174
224
|
req.end();
|
|
175
225
|
}
|