@forestadmin/mcp-server 1.13.0 → 1.14.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.
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse error from the agent RPC client.
|
|
3
|
-
* The error structure can vary:
|
|
4
|
-
* - Error with message containing JSON: { error: { text: '{"errors":[{"detail":"..."}]}' } }
|
|
5
|
-
* - Error with message containing JSON: { text: '{"errors":[{"detail":"..."}]}' }
|
|
6
|
-
* - Error with message containing JSON: { message: '...' }
|
|
7
|
-
* - Error with plain string message
|
|
8
|
-
*/
|
|
9
1
|
export default function parseAgentError(error: unknown): string | null;
|
|
10
2
|
//# sourceMappingURL=error-parser.d.ts.map
|
|
@@ -1,56 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = parseAgentError;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
const agent_client_1 = require("@forestadmin/agent-client");
|
|
5
|
+
// Extract the JSON:API detail message from a parsed body or its raw text.
|
|
6
|
+
function jsonApiDetail(body, text) {
|
|
7
|
+
const fromBody = body?.errors?.[0]?.detail;
|
|
8
|
+
if (fromBody)
|
|
9
|
+
return fromBody;
|
|
10
|
+
if (typeof text === 'string') {
|
|
11
|
+
try {
|
|
12
|
+
const parsed = JSON.parse(text);
|
|
13
|
+
if (parsed.errors?.[0]?.detail)
|
|
14
|
+
return parsed.errors[0].detail;
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// not JSON:API → fall through
|
|
12
18
|
}
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
// Ignore parsing failures
|
|
16
19
|
}
|
|
17
20
|
return null;
|
|
18
21
|
}
|
|
19
|
-
|
|
20
|
-
* Parse error from the agent RPC client.
|
|
21
|
-
* The error structure can vary:
|
|
22
|
-
* - Error with message containing JSON: { error: { text: '{"errors":[{"detail":"..."}]}' } }
|
|
23
|
-
* - Error with message containing JSON: { text: '{"errors":[{"detail":"..."}]}' }
|
|
24
|
-
* - Error with message containing JSON: { message: '...' }
|
|
25
|
-
* - Error with plain string message
|
|
26
|
-
*/
|
|
22
|
+
// Turn an agent RPC error into a human-readable message (AgentHttpError detail, else raw message).
|
|
27
23
|
function parseAgentError(error) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// Try nested error.text first (e.g., { error: { text: '...' } })
|
|
31
|
-
if (err.error?.text) {
|
|
32
|
-
const detail = parseJsonApiErrorText(err.error.text);
|
|
33
|
-
if (detail)
|
|
34
|
-
return detail;
|
|
35
|
-
}
|
|
36
|
-
// Try direct text property (e.g., { text: '...' })
|
|
37
|
-
if (err.text) {
|
|
38
|
-
const detail = parseJsonApiErrorText(err.text);
|
|
39
|
-
if (detail)
|
|
40
|
-
return detail;
|
|
41
|
-
}
|
|
42
|
-
// Fallback to message property
|
|
43
|
-
if (err.message) {
|
|
44
|
-
return err.message;
|
|
45
|
-
}
|
|
46
|
-
return null;
|
|
24
|
+
if (error instanceof agent_client_1.AgentHttpError) {
|
|
25
|
+
return jsonApiDetail(error.body, error.responseText) ?? error.message;
|
|
47
26
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (error && typeof error === 'object' && 'message' in error) {
|
|
51
|
-
return error.message || null;
|
|
52
|
-
}
|
|
53
|
-
return null;
|
|
27
|
+
if (error && typeof error === 'object' && 'message' in error) {
|
|
28
|
+
return error.message || null;
|
|
54
29
|
}
|
|
30
|
+
return null;
|
|
55
31
|
}
|
|
56
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3ItcGFyc2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4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UFFLENBQUM7UUFDN0QsT0FBUSxLQUE2QixDQUFDLE9BQU8sSUFBSSxJQUFJLENBQUM7SUFDeEQsQ0FBQztJQUVELE9BQU8sSUFBSSxDQUFDO0FBQ2QsQ0FBQyJ9
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forestadmin/mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "Model Context Protocol server for Forest Admin with OAuth authentication",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"directory": "packages/mcp-server"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@forestadmin/agent-client": "1.
|
|
19
|
+
"@forestadmin/agent-client": "1.7.0",
|
|
20
20
|
"@forestadmin/forestadmin-client": "1.40.3",
|
|
21
21
|
"@modelcontextprotocol/sdk": "^1.28.0",
|
|
22
22
|
"cors": "^2.8.5",
|