@contextstream/mcp-server 0.3.22 → 0.3.23
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/dist/index.js +18 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4629,6 +4629,14 @@ var globalCache = new MemoryCache();
|
|
|
4629
4629
|
|
|
4630
4630
|
// src/client.ts
|
|
4631
4631
|
var uuidSchema = external_exports.string().uuid();
|
|
4632
|
+
function unwrapApiResponse(result) {
|
|
4633
|
+
if (!result || typeof result !== "object") return result;
|
|
4634
|
+
const maybe = result;
|
|
4635
|
+
if (typeof maybe.success === "boolean" && "data" in maybe) {
|
|
4636
|
+
return maybe.data;
|
|
4637
|
+
}
|
|
4638
|
+
return result;
|
|
4639
|
+
}
|
|
4632
4640
|
var ContextStreamClient = class {
|
|
4633
4641
|
constructor(config) {
|
|
4634
4642
|
this.config = config;
|
|
@@ -4696,8 +4704,9 @@ var ContextStreamClient = class {
|
|
|
4696
4704
|
const suffix = query.toString() ? `?${query.toString()}` : "";
|
|
4697
4705
|
return request(this.config, `/workspaces${suffix}`);
|
|
4698
4706
|
}
|
|
4699
|
-
createWorkspace(input) {
|
|
4700
|
-
|
|
4707
|
+
async createWorkspace(input) {
|
|
4708
|
+
const result = await request(this.config, "/workspaces", { body: input });
|
|
4709
|
+
return unwrapApiResponse(result);
|
|
4701
4710
|
}
|
|
4702
4711
|
updateWorkspace(workspaceId, input) {
|
|
4703
4712
|
uuidSchema.parse(workspaceId);
|
|
@@ -4716,9 +4725,10 @@ var ContextStreamClient = class {
|
|
|
4716
4725
|
const suffix = query.toString() ? `?${query.toString()}` : "";
|
|
4717
4726
|
return request(this.config, `/projects${suffix}`);
|
|
4718
4727
|
}
|
|
4719
|
-
createProject(input) {
|
|
4728
|
+
async createProject(input) {
|
|
4720
4729
|
const payload = this.withDefaults(input);
|
|
4721
|
-
|
|
4730
|
+
const result = await request(this.config, "/projects", { body: payload });
|
|
4731
|
+
return unwrapApiResponse(result);
|
|
4722
4732
|
}
|
|
4723
4733
|
updateProject(projectId, input) {
|
|
4724
4734
|
uuidSchema.parse(projectId);
|
|
@@ -6548,8 +6558,11 @@ Access: ${accessLabel}${accessLabel === "PRO" ? ` (upgrade: ${upgradeUrl2})` : "
|
|
|
6548
6558
|
const errorMessage = error?.message || String(error);
|
|
6549
6559
|
const errorDetails = error?.body || error?.details || null;
|
|
6550
6560
|
const errorCode = error?.code || error?.status || "UNKNOWN_ERROR";
|
|
6561
|
+
const isPlanLimit = String(errorCode).toUpperCase() === "FORBIDDEN" && String(errorMessage).toLowerCase().includes("plan limit reached");
|
|
6562
|
+
const upgradeHint = isPlanLimit ? `
|
|
6563
|
+
Upgrade: ${upgradeUrl2}` : "";
|
|
6551
6564
|
const serializedError = new Error(
|
|
6552
|
-
`[${errorCode}] ${errorMessage}${errorDetails ? `: ${JSON.stringify(errorDetails)}` : ""}`
|
|
6565
|
+
`[${errorCode}] ${errorMessage}${upgradeHint}${errorDetails ? `: ${JSON.stringify(errorDetails)}` : ""}`
|
|
6553
6566
|
);
|
|
6554
6567
|
throw serializedError;
|
|
6555
6568
|
}
|
package/package.json
CHANGED