@clicbase/mcp 0.3.1 → 0.3.2
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/clicbase-mcp.mjs +24 -3
- package/package.json +1 -1
package/clicbase-mcp.mjs
CHANGED
|
@@ -75,10 +75,19 @@ async function lireEchec(res) {
|
|
|
75
75
|
const via = res.headers.get("cf-ray")
|
|
76
76
|
? `Cloudflare (cf-ray ${res.headers.get("cf-ray")})`
|
|
77
77
|
: (res.headers.get("server") ?? "origine inconnue");
|
|
78
|
+
// ⚠️ UN CORPS NON-JSON INTERDIT D'EXPLIQUER LE STATUT. `expliquer(403)` dit
|
|
79
|
+
// « hors du perimetre de cette cle » : c'est ce que NOTRE 403 signifie, et
|
|
80
|
+
// cette reponse ne vient pas de nous. Le 2026-09-18 une session a lu
|
|
81
|
+
// « hors du perimetre » alors que son bac a sable bloquait la sortie reseau
|
|
82
|
+
// vers clicbase.com — le vrai motif etait dans le corps, sous une phrase qui
|
|
83
|
+
// le contredisait. Affirmer une cause qu'on ne connait pas est exactement le
|
|
84
|
+
// defaut que ce fichier corrige ailleurs.
|
|
78
85
|
return {
|
|
79
86
|
json,
|
|
80
87
|
// ⚠️ UN CORPS NON-JSON EST LA SIGNATURE D'UN REFUS EN AMONT. On le dit en
|
|
81
88
|
// clair au lieu de rendre un objet vide qui ressemble a une reponse.
|
|
89
|
+
// Vrai seulement quand la reponse vient bien de l'application.
|
|
90
|
+
denotre: json !== null,
|
|
82
91
|
detail: json
|
|
83
92
|
? JSON.stringify(json)
|
|
84
93
|
: brut.trim()
|
|
@@ -113,7 +122,11 @@ async function trouver(name) {
|
|
|
113
122
|
});
|
|
114
123
|
if (!res.ok) {
|
|
115
124
|
const e = await lireEchec(res);
|
|
116
|
-
throw new Error(
|
|
125
|
+
throw new Error(
|
|
126
|
+
e.denotre
|
|
127
|
+
? `Clicbase ${res.status} — ${expliquer(res.status)} ${e.detail}`
|
|
128
|
+
: `Clicbase ${res.status} — ${e.detail}`,
|
|
129
|
+
);
|
|
117
130
|
}
|
|
118
131
|
const data = await res.json().catch(() => ({}));
|
|
119
132
|
const liste = Array.isArray(data.projects) ? data.projects : [];
|
|
@@ -155,7 +168,11 @@ async function resolve(name, domain, { creer = true } = {}) {
|
|
|
155
168
|
});
|
|
156
169
|
if (!res.ok) {
|
|
157
170
|
const e = await lireEchec(res);
|
|
158
|
-
throw new Error(
|
|
171
|
+
throw new Error(
|
|
172
|
+
e.denotre
|
|
173
|
+
? `Clicbase ${res.status} — ${expliquer(res.status)} ${e.detail}`
|
|
174
|
+
: `Clicbase ${res.status} — ${e.detail}`,
|
|
175
|
+
);
|
|
159
176
|
}
|
|
160
177
|
const data = await res.json().catch(() => ({}));
|
|
161
178
|
const info = {
|
|
@@ -284,7 +301,11 @@ async function admin(chemin, methode = "GET") {
|
|
|
284
301
|
});
|
|
285
302
|
if (!res.ok) {
|
|
286
303
|
const e = await lireEchec(res);
|
|
287
|
-
throw new Error(
|
|
304
|
+
throw new Error(
|
|
305
|
+
e.denotre
|
|
306
|
+
? `Clicbase ${res.status} — ${expliquer(res.status)} ${e.detail}`
|
|
307
|
+
: `Clicbase ${res.status} — ${e.detail}`,
|
|
308
|
+
);
|
|
288
309
|
}
|
|
289
310
|
return res.json();
|
|
290
311
|
}
|