superops-it 1.1.14 → 1.1.18
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 +1 -1
- package/package.json +2 -2
- package/src/client.mjs +24 -2
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superops-it",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.18",
|
|
4
4
|
"description": "MCP server for SuperOps IT Teams GraphQL API documentation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.mjs",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"ai"
|
|
21
21
|
],
|
|
22
22
|
"author": "Limehawk",
|
|
23
|
-
"license": "
|
|
23
|
+
"license": "GPL-3.0",
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
26
|
"url": "git+https://github.com/limehawk/superops-mcp.git",
|
package/src/client.mjs
CHANGED
|
@@ -29,7 +29,22 @@ export class SuperOpsAPIError extends Error {
|
|
|
29
29
|
|
|
30
30
|
static formatMessage(status, body) {
|
|
31
31
|
if (status === 200 && Array.isArray(body)) {
|
|
32
|
-
|
|
32
|
+
// Try to extract message fields first
|
|
33
|
+
const messages = body.map(e => e.message).filter(Boolean);
|
|
34
|
+
if (messages.length > 0) {
|
|
35
|
+
return messages.join('; ');
|
|
36
|
+
}
|
|
37
|
+
// SuperOps sometimes returns null message with details in extensions.clientError
|
|
38
|
+
const clientErrors = body.flatMap(e =>
|
|
39
|
+
e.extensions?.clientError?.map(ce =>
|
|
40
|
+
`${ce.code}: ${ce.param?.attributes?.join(', ') || 'unknown'}`
|
|
41
|
+
) || []
|
|
42
|
+
);
|
|
43
|
+
if (clientErrors.length > 0) {
|
|
44
|
+
return clientErrors.join('; ');
|
|
45
|
+
}
|
|
46
|
+
// Fallback to full error structure
|
|
47
|
+
return JSON.stringify(body, null, 2);
|
|
33
48
|
}
|
|
34
49
|
return `HTTP ${status}: ${body?.message || body?.error || 'Request failed'}`;
|
|
35
50
|
}
|
|
@@ -113,7 +128,14 @@ export class SuperOpsClient {
|
|
|
113
128
|
signal: controller.signal
|
|
114
129
|
});
|
|
115
130
|
|
|
116
|
-
const
|
|
131
|
+
const rawText = await response.text();
|
|
132
|
+
|
|
133
|
+
let body;
|
|
134
|
+
try {
|
|
135
|
+
body = JSON.parse(rawText);
|
|
136
|
+
} catch (e) {
|
|
137
|
+
throw new Error(`Invalid JSON response (HTTP ${response.status}): ${rawText.substring(0, 200)}`);
|
|
138
|
+
}
|
|
117
139
|
|
|
118
140
|
if (!response.ok) {
|
|
119
141
|
throw new SuperOpsAPIError(response.status, body, context);
|