@insforge/mcp 1.2.8 → 1.2.9
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/{chunk-DZ5W3BSP.js → chunk-YH7HSQYJ.js} +322 -29
- package/dist/http-server.js +10 -4
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -41,17 +41,40 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
41
41
|
|
|
42
42
|
// src/shared/usage-tracker.ts
|
|
43
43
|
import fetch from "node-fetch";
|
|
44
|
+
var PLATFORM_API_BASE = "https://api.insforge.dev";
|
|
45
|
+
function parseAppKey(apiBaseUrl) {
|
|
46
|
+
try {
|
|
47
|
+
const url = new URL(apiBaseUrl);
|
|
48
|
+
const match = url.hostname.match(/^([^.]+)\.[^.]+\.insforge\.app$/);
|
|
49
|
+
return match ? match[1] : null;
|
|
50
|
+
} catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
44
54
|
var UsageTracker = class {
|
|
45
55
|
apiBaseUrl;
|
|
46
56
|
apiKey;
|
|
47
|
-
|
|
57
|
+
agentConnectedReported = false;
|
|
58
|
+
projectId;
|
|
59
|
+
accessToken;
|
|
60
|
+
isRemote;
|
|
61
|
+
constructor(apiBaseUrl, apiKey, options) {
|
|
48
62
|
this.apiBaseUrl = apiBaseUrl;
|
|
49
63
|
this.apiKey = apiKey;
|
|
64
|
+
this.projectId = options?.projectId;
|
|
65
|
+
this.accessToken = options?.accessToken;
|
|
66
|
+
this.isRemote = options?.isRemote ?? false;
|
|
50
67
|
}
|
|
51
68
|
async trackUsage(toolName, success = true) {
|
|
52
69
|
if (!this.apiKey) {
|
|
53
70
|
return;
|
|
54
71
|
}
|
|
72
|
+
if (!this.agentConnectedReported) {
|
|
73
|
+
this.agentConnectedReported = true;
|
|
74
|
+
this.reportAgentConnected().catch((error) => {
|
|
75
|
+
console.error("Failed to report agent-connected:", error);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
55
78
|
try {
|
|
56
79
|
const payload = {
|
|
57
80
|
tool_name: toolName,
|
|
@@ -70,6 +93,27 @@ var UsageTracker = class {
|
|
|
70
93
|
console.error("Failed to track usage:", error);
|
|
71
94
|
}
|
|
72
95
|
}
|
|
96
|
+
async reportAgentConnected() {
|
|
97
|
+
const body = {};
|
|
98
|
+
const headers = { "Content-Type": "application/json" };
|
|
99
|
+
if (this.isRemote && this.projectId && this.projectId !== "legacy") {
|
|
100
|
+
body.project_id = this.projectId;
|
|
101
|
+
if (this.accessToken) {
|
|
102
|
+
headers["Authorization"] = `Bearer ${this.accessToken}`;
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
const appKey = parseAppKey(this.apiBaseUrl);
|
|
106
|
+
if (!appKey) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
body.app_key = appKey;
|
|
110
|
+
}
|
|
111
|
+
await fetch(`${PLATFORM_API_BASE}/tracking/v1/agent-connected`, {
|
|
112
|
+
method: "POST",
|
|
113
|
+
headers,
|
|
114
|
+
body: JSON.stringify(body)
|
|
115
|
+
});
|
|
116
|
+
}
|
|
73
117
|
};
|
|
74
118
|
|
|
75
119
|
// src/shared/tools/docs.ts
|
|
@@ -394,6 +438,12 @@ var storageBucketSchema = z5.object({
|
|
|
394
438
|
public: z5.boolean(),
|
|
395
439
|
createdAt: z5.string()
|
|
396
440
|
});
|
|
441
|
+
var storageConfigSchema = z5.object({
|
|
442
|
+
id: z5.string().uuid(),
|
|
443
|
+
maxFileSizeMb: z5.number().int().positive(),
|
|
444
|
+
createdAt: z5.string(),
|
|
445
|
+
updatedAt: z5.string()
|
|
446
|
+
});
|
|
397
447
|
|
|
398
448
|
// node_modules/@insforge/shared-schemas/dist/storage-api.schema.js
|
|
399
449
|
import { z as z6 } from "zod";
|
|
@@ -440,6 +490,9 @@ var confirmUploadRequestSchema = z6.object({
|
|
|
440
490
|
contentType: z6.string().optional(),
|
|
441
491
|
etag: z6.string().optional()
|
|
442
492
|
});
|
|
493
|
+
var updateStorageConfigRequestSchema = z6.object({
|
|
494
|
+
maxFileSizeMb: z6.number().int().min(1, "Must be at least 1 MB").max(200, "Must be at most 200 MB")
|
|
495
|
+
});
|
|
443
496
|
|
|
444
497
|
// node_modules/@insforge/shared-schemas/dist/auth.schema.js
|
|
445
498
|
import { z as z7 } from "zod";
|
|
@@ -497,6 +550,7 @@ var oAuthConfigSchema = z7.object({
|
|
|
497
550
|
updatedAt: z7.string()
|
|
498
551
|
// PostgreSQL timestamp
|
|
499
552
|
});
|
|
553
|
+
var allowedRedirectUrlsRegex = /^(?:(?:https?:\/\/)(?:(?:\*\.)?[^\s/:?#]+|\[[0-9A-Fa-f:.]+\])(?::\d+)?(?:\/[^\s]*)?|(?!(?:https?|javascript|data|file|vbscript):)[a-zA-Z][a-zA-Z0-9+.-]*:(?:\/\/[^\s/]+(?:\/[^\s]*)?|\/[^\s]*))$/i;
|
|
500
554
|
var authConfigSchema = z7.object({
|
|
501
555
|
id: z7.string().uuid(),
|
|
502
556
|
requireEmailVerification: z7.boolean(),
|
|
@@ -507,7 +561,7 @@ var authConfigSchema = z7.object({
|
|
|
507
561
|
requireSpecialChar: z7.boolean(),
|
|
508
562
|
verifyEmailMethod: verificationMethodSchema,
|
|
509
563
|
resetPasswordMethod: verificationMethodSchema,
|
|
510
|
-
|
|
564
|
+
allowedRedirectUrls: z7.array(z7.string().regex(allowedRedirectUrlsRegex, { message: "Invalid URL or wildcard URL" })).optional().nullable(),
|
|
511
565
|
createdAt: z7.string(),
|
|
512
566
|
// PostgreSQL timestamp
|
|
513
567
|
updatedAt: z7.string()
|
|
@@ -523,6 +577,16 @@ var tokenPayloadSchema = z7.object({
|
|
|
523
577
|
exp: z7.number().optional()
|
|
524
578
|
// Expiration
|
|
525
579
|
});
|
|
580
|
+
var customOAuthKeySchema = z7.string().min(1).max(64).regex(/^[a-z0-9_-]+$/, "Key must contain only lowercase letters, numbers, hyphens, and underscores");
|
|
581
|
+
var customOAuthConfigSchema = z7.object({
|
|
582
|
+
id: z7.string().uuid(),
|
|
583
|
+
key: customOAuthKeySchema,
|
|
584
|
+
name: z7.string().min(1),
|
|
585
|
+
discoveryEndpoint: z7.string().url(),
|
|
586
|
+
clientId: z7.string().min(1),
|
|
587
|
+
createdAt: z7.string(),
|
|
588
|
+
updatedAt: z7.string()
|
|
589
|
+
});
|
|
526
590
|
|
|
527
591
|
// node_modules/@insforge/shared-schemas/dist/auth-api.schema.js
|
|
528
592
|
import { z as z8 } from "zod";
|
|
@@ -530,19 +594,19 @@ var paginationSchema = z8.object({
|
|
|
530
594
|
limit: z8.string().optional(),
|
|
531
595
|
offset: z8.string().optional()
|
|
532
596
|
});
|
|
533
|
-
var authOptionsSchema = z8.object({
|
|
534
|
-
emailRedirectTo: z8.string().url().optional()
|
|
535
|
-
}).optional();
|
|
536
597
|
var createUserRequestSchema = z8.object({
|
|
537
598
|
email: emailSchema,
|
|
538
599
|
password: passwordSchema,
|
|
539
600
|
name: nameSchema.optional(),
|
|
540
|
-
|
|
601
|
+
redirectTo: z8.string().url().optional()
|
|
541
602
|
});
|
|
542
603
|
var createSessionRequestSchema = z8.object({
|
|
543
604
|
email: emailSchema,
|
|
544
605
|
password: passwordSchema
|
|
545
606
|
});
|
|
607
|
+
var refreshSessionRequestSchema = z8.object({
|
|
608
|
+
refreshToken: z8.string().min(1, "refreshToken is required")
|
|
609
|
+
});
|
|
546
610
|
var exchangeAdminSessionRequestSchema = z8.object({
|
|
547
611
|
code: z8.string()
|
|
548
612
|
});
|
|
@@ -557,20 +621,19 @@ var updateProfileRequestSchema = z8.object({
|
|
|
557
621
|
});
|
|
558
622
|
var sendVerificationEmailRequestSchema = z8.object({
|
|
559
623
|
email: emailSchema,
|
|
560
|
-
|
|
624
|
+
redirectTo: z8.string().url().optional()
|
|
561
625
|
});
|
|
562
626
|
var verifyEmailRequestSchema = z8.object({
|
|
563
|
-
email: emailSchema
|
|
564
|
-
otp: z8.string().
|
|
565
|
-
}).refine((data) => data.email || data.otp, {
|
|
566
|
-
message: "Either email or otp must be provided"
|
|
627
|
+
email: emailSchema,
|
|
628
|
+
otp: z8.string().regex(/^\d{6}$/, "OTP code must be a 6-digit numeric code")
|
|
567
629
|
});
|
|
568
630
|
var sendResetPasswordEmailRequestSchema = z8.object({
|
|
569
|
-
email: emailSchema
|
|
631
|
+
email: emailSchema,
|
|
632
|
+
redirectTo: z8.string().url().optional()
|
|
570
633
|
});
|
|
571
634
|
var exchangeResetPasswordTokenRequestSchema = z8.object({
|
|
572
635
|
email: emailSchema,
|
|
573
|
-
code: z8.string().
|
|
636
|
+
code: z8.string().regex(/^\d{6}$/, "Reset password code must be a 6-digit numeric code")
|
|
574
637
|
});
|
|
575
638
|
var resetPasswordRequestSchema = z8.object({
|
|
576
639
|
newPassword: passwordSchema,
|
|
@@ -580,7 +643,6 @@ var createUserResponseSchema = z8.object({
|
|
|
580
643
|
user: userSchema.optional(),
|
|
581
644
|
accessToken: z8.string().nullable(),
|
|
582
645
|
requireEmailVerification: z8.boolean().optional(),
|
|
583
|
-
redirectTo: z8.string().url().optional(),
|
|
584
646
|
csrfToken: z8.string().nullable().optional(),
|
|
585
647
|
refreshToken: z8.string().optional()
|
|
586
648
|
// For mobile/desktop clients (no cookies)
|
|
@@ -588,7 +650,6 @@ var createUserResponseSchema = z8.object({
|
|
|
588
650
|
var createSessionResponseSchema = z8.object({
|
|
589
651
|
user: userSchema,
|
|
590
652
|
accessToken: z8.string(),
|
|
591
|
-
redirectTo: z8.string().url().optional(),
|
|
592
653
|
csrfToken: z8.string().nullable().optional(),
|
|
593
654
|
refreshToken: z8.string().optional()
|
|
594
655
|
// For mobile/desktop clients (no cookies)
|
|
@@ -596,7 +657,6 @@ var createSessionResponseSchema = z8.object({
|
|
|
596
657
|
var verifyEmailResponseSchema = z8.object({
|
|
597
658
|
user: userSchema,
|
|
598
659
|
accessToken: z8.string(),
|
|
599
|
-
redirectTo: z8.string().url().optional(),
|
|
600
660
|
csrfToken: z8.string().nullable().optional(),
|
|
601
661
|
refreshToken: z8.string().optional()
|
|
602
662
|
// For mobile/desktop clients (no cookies)
|
|
@@ -676,11 +736,12 @@ var updateAuthConfigRequestSchema = authConfigSchema.omit({
|
|
|
676
736
|
}).partial();
|
|
677
737
|
var getPublicAuthConfigResponseSchema = z8.object({
|
|
678
738
|
oAuthProviders: z8.array(oAuthProvidersSchema),
|
|
739
|
+
customOAuthProviders: z8.array(customOAuthKeySchema),
|
|
679
740
|
...authConfigSchema.omit({
|
|
680
741
|
id: true,
|
|
681
742
|
updatedAt: true,
|
|
682
743
|
createdAt: true,
|
|
683
|
-
|
|
744
|
+
allowedRedirectUrls: true
|
|
684
745
|
}).shape
|
|
685
746
|
});
|
|
686
747
|
var authErrorResponseSchema = z8.object({
|
|
@@ -689,6 +750,16 @@ var authErrorResponseSchema = z8.object({
|
|
|
689
750
|
statusCode: z8.number().int(),
|
|
690
751
|
nextActions: z8.string().optional()
|
|
691
752
|
});
|
|
753
|
+
var createCustomOAuthConfigRequestSchema = customOAuthConfigSchema.omit({ id: true, createdAt: true, updatedAt: true }).extend({
|
|
754
|
+
clientSecret: z8.string().min(1, "Client secret is required")
|
|
755
|
+
});
|
|
756
|
+
var updateCustomOAuthConfigRequestSchema = customOAuthConfigSchema.omit({ id: true, key: true, createdAt: true, updatedAt: true }).extend({
|
|
757
|
+
clientSecret: z8.string().min(1).optional()
|
|
758
|
+
}).partial();
|
|
759
|
+
var listCustomOAuthConfigsResponseSchema = z8.object({
|
|
760
|
+
data: z8.array(customOAuthConfigSchema),
|
|
761
|
+
count: z8.number()
|
|
762
|
+
});
|
|
692
763
|
|
|
693
764
|
// node_modules/@insforge/shared-schemas/dist/metadata.schema.js
|
|
694
765
|
import { z as z11 } from "zod";
|
|
@@ -718,6 +789,9 @@ var realtimeMessageSchema = z9.object({
|
|
|
718
789
|
whDeliveredCount: z9.number().int().min(0),
|
|
719
790
|
createdAt: z9.string().datetime()
|
|
720
791
|
});
|
|
792
|
+
var realtimeConfigSchema = z9.object({
|
|
793
|
+
retentionDays: z9.number().int().positive().nullable()
|
|
794
|
+
});
|
|
721
795
|
var subscribeChannelPayloadSchema = z9.object({
|
|
722
796
|
channel: z9.string().min(1)
|
|
723
797
|
// The resolved channel instance, e.g., "order:123"
|
|
@@ -803,7 +877,8 @@ var messageStatsResponseSchema = z10.object({
|
|
|
803
877
|
topEvents: z10.array(z10.object({
|
|
804
878
|
eventName: z10.string(),
|
|
805
879
|
count: z10.number().int().min(0)
|
|
806
|
-
}))
|
|
880
|
+
})),
|
|
881
|
+
retentionDays: realtimeConfigSchema.shape.retentionDays
|
|
807
882
|
});
|
|
808
883
|
var rlsPolicySchema = z10.object({
|
|
809
884
|
policyName: z10.string(),
|
|
@@ -883,6 +958,9 @@ var databasePasswordInfoSchema = z11.object({
|
|
|
883
958
|
var apiKeyResponseSchema = z11.object({
|
|
884
959
|
apiKey: z11.string()
|
|
885
960
|
});
|
|
961
|
+
var projectIdResponseSchema = z11.object({
|
|
962
|
+
projectId: z11.string().nullable()
|
|
963
|
+
});
|
|
886
964
|
|
|
887
965
|
// node_modules/@insforge/shared-schemas/dist/ai.schema.js
|
|
888
966
|
import { z as z12 } from "zod";
|
|
@@ -975,12 +1053,42 @@ var contentSchema = z13.union([
|
|
|
975
1053
|
audioContentSchema,
|
|
976
1054
|
fileContentSchema
|
|
977
1055
|
]);
|
|
1056
|
+
var toolFunctionSchema = z13.object({
|
|
1057
|
+
name: z13.string(),
|
|
1058
|
+
description: z13.string().optional(),
|
|
1059
|
+
parameters: z13.record(z13.unknown()).optional()
|
|
1060
|
+
});
|
|
1061
|
+
var toolSchema = z13.object({
|
|
1062
|
+
type: z13.literal("function"),
|
|
1063
|
+
function: toolFunctionSchema
|
|
1064
|
+
});
|
|
1065
|
+
var toolChoiceSchema = z13.union([
|
|
1066
|
+
z13.enum(["auto", "none", "required"]),
|
|
1067
|
+
z13.object({
|
|
1068
|
+
type: z13.literal("function"),
|
|
1069
|
+
function: z13.object({ name: z13.string() })
|
|
1070
|
+
})
|
|
1071
|
+
]);
|
|
1072
|
+
var toolCallSchema = z13.object({
|
|
1073
|
+
id: z13.string(),
|
|
1074
|
+
type: z13.literal("function"),
|
|
1075
|
+
function: z13.object({
|
|
1076
|
+
name: z13.string(),
|
|
1077
|
+
arguments: z13.string()
|
|
1078
|
+
})
|
|
1079
|
+
});
|
|
978
1080
|
var chatMessageSchema = z13.object({
|
|
979
|
-
role: z13.enum(["user", "assistant", "system"]),
|
|
1081
|
+
role: z13.enum(["user", "assistant", "system", "tool"]),
|
|
980
1082
|
// New format: content can be string or array of content parts (OpenAI-compatible)
|
|
981
|
-
content: z13.union([z13.string(), z13.array(contentSchema)]),
|
|
1083
|
+
content: z13.union([z13.string(), z13.array(contentSchema)]).nullable(),
|
|
982
1084
|
// Legacy format: separate images field (deprecated but supported for backward compatibility)
|
|
983
|
-
images: z13.array(z13.object({ url: z13.string() })).optional()
|
|
1085
|
+
images: z13.array(z13.object({ url: z13.string() })).optional(),
|
|
1086
|
+
// Tool calls made by the assistant
|
|
1087
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1088
|
+
tool_calls: z13.array(toolCallSchema).optional(),
|
|
1089
|
+
// Tool call ID for tool response messages
|
|
1090
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1091
|
+
tool_call_id: z13.string().optional()
|
|
984
1092
|
});
|
|
985
1093
|
var webSearchPluginSchema = z13.object({
|
|
986
1094
|
enabled: z13.boolean(),
|
|
@@ -1020,7 +1128,13 @@ var chatCompletionRequestSchema = z13.object({
|
|
|
1020
1128
|
fileParser: fileParserPluginSchema.optional(),
|
|
1021
1129
|
// Thinking/Reasoning mode: Enable extended reasoning capabilities
|
|
1022
1130
|
// Appends ":thinking" to the model ID for chain-of-thought reasoning
|
|
1023
|
-
thinking: z13.boolean().optional()
|
|
1131
|
+
thinking: z13.boolean().optional(),
|
|
1132
|
+
// Tool calling: Define functions the AI can call
|
|
1133
|
+
tools: z13.array(toolSchema).optional(),
|
|
1134
|
+
// Tool choice: Control whether/which tool is called ('auto', 'none', 'required', or specific function)
|
|
1135
|
+
toolChoice: toolChoiceSchema.optional(),
|
|
1136
|
+
// Parallel tool calls: Allow the model to call multiple tools in parallel
|
|
1137
|
+
parallelToolCalls: z13.boolean().optional()
|
|
1024
1138
|
});
|
|
1025
1139
|
var urlCitationAnnotationSchema = z13.object({
|
|
1026
1140
|
type: z13.literal("url_citation"),
|
|
@@ -1046,6 +1160,9 @@ var fileAnnotationSchema = z13.object({
|
|
|
1046
1160
|
var annotationSchema = z13.union([urlCitationAnnotationSchema, fileAnnotationSchema]);
|
|
1047
1161
|
var chatCompletionResponseSchema = z13.object({
|
|
1048
1162
|
text: z13.string(),
|
|
1163
|
+
// Tool calls from the assistant (present when the model invokes tools)
|
|
1164
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1165
|
+
tool_calls: z13.array(toolCallSchema).optional(),
|
|
1049
1166
|
// Annotations from web search or file parsing (can be URL citations or file annotations)
|
|
1050
1167
|
annotations: z13.array(annotationSchema).optional(),
|
|
1051
1168
|
metadata: z13.object({
|
|
@@ -1135,6 +1252,15 @@ var getAIUsageSummaryRequestSchema = z13.object({
|
|
|
1135
1252
|
startDate: z13.string().datetime().optional(),
|
|
1136
1253
|
endDate: z13.string().datetime().optional()
|
|
1137
1254
|
});
|
|
1255
|
+
var keySourceSchema = z13.enum(["byok", "cloud", "env", "unconfigured"]);
|
|
1256
|
+
var gatewayConfigResponseSchema = z13.object({
|
|
1257
|
+
keySource: keySourceSchema,
|
|
1258
|
+
hasByokKey: z13.boolean(),
|
|
1259
|
+
maskedKey: z13.string().optional()
|
|
1260
|
+
});
|
|
1261
|
+
var setGatewayBYOKKeyRequestSchema = z13.object({
|
|
1262
|
+
apiKey: z13.string().min(1, "API key is required")
|
|
1263
|
+
});
|
|
1138
1264
|
|
|
1139
1265
|
// node_modules/@insforge/shared-schemas/dist/logs.schema.js
|
|
1140
1266
|
import { z as z14 } from "zod";
|
|
@@ -1165,6 +1291,16 @@ var logStatsSchema = z14.object({
|
|
|
1165
1291
|
count: z14.number(),
|
|
1166
1292
|
lastActivity: z14.string()
|
|
1167
1293
|
});
|
|
1294
|
+
var buildLogEntrySchema = z14.object({
|
|
1295
|
+
level: z14.string(),
|
|
1296
|
+
message: z14.string()
|
|
1297
|
+
});
|
|
1298
|
+
var getBuildLogsResponseSchema = z14.object({
|
|
1299
|
+
deploymentId: z14.string(),
|
|
1300
|
+
status: z14.enum(["pending", "success", "failed"]),
|
|
1301
|
+
logs: z14.array(buildLogEntrySchema),
|
|
1302
|
+
createdAt: z14.string()
|
|
1303
|
+
});
|
|
1168
1304
|
|
|
1169
1305
|
// node_modules/@insforge/shared-schemas/dist/logs-api.schema.js
|
|
1170
1306
|
import { z as z15 } from "zod";
|
|
@@ -1240,7 +1376,19 @@ var listFunctionsResponseSchema = z17.object({
|
|
|
1240
1376
|
functions: z17.array(functionSchema),
|
|
1241
1377
|
runtime: z17.object({
|
|
1242
1378
|
status: z17.enum(["running", "unavailable"])
|
|
1243
|
-
})
|
|
1379
|
+
}),
|
|
1380
|
+
deploymentUrl: z17.string().nullable().optional()
|
|
1381
|
+
});
|
|
1382
|
+
var deploymentResultSchema = z17.object({
|
|
1383
|
+
id: z17.string(),
|
|
1384
|
+
status: z17.enum(["success", "failed"]),
|
|
1385
|
+
url: z17.string().nullable(),
|
|
1386
|
+
buildLogs: z17.array(z17.string()).optional()
|
|
1387
|
+
});
|
|
1388
|
+
var functionResponseSchema = z17.object({
|
|
1389
|
+
success: z17.boolean(),
|
|
1390
|
+
function: functionSchema,
|
|
1391
|
+
deployment: deploymentResultSchema.nullable().optional()
|
|
1244
1392
|
});
|
|
1245
1393
|
|
|
1246
1394
|
// node_modules/@insforge/shared-schemas/dist/cloud-events.schema.js
|
|
@@ -1280,6 +1428,9 @@ var showContactModalEventSchema = z18.object({
|
|
|
1280
1428
|
var showConnectOverlayEventSchema = z18.object({
|
|
1281
1429
|
type: z18.literal("SHOW_CONNECT_OVERLAY")
|
|
1282
1430
|
});
|
|
1431
|
+
var showPlanModalEventSchema = z18.object({
|
|
1432
|
+
type: z18.literal("SHOW_PLAN_MODAL")
|
|
1433
|
+
});
|
|
1283
1434
|
var authorizationCodeEventSchema = z18.object({
|
|
1284
1435
|
type: z18.literal("AUTHORIZATION_CODE"),
|
|
1285
1436
|
code: z18.string()
|
|
@@ -1288,6 +1439,51 @@ var routeChangeEventSchema = z18.object({
|
|
|
1288
1439
|
type: z18.literal("ROUTE_CHANGE"),
|
|
1289
1440
|
path: z18.string()
|
|
1290
1441
|
});
|
|
1442
|
+
var requestProjectInfoEventSchema = z18.object({
|
|
1443
|
+
type: z18.literal("REQUEST_PROJECT_INFO")
|
|
1444
|
+
});
|
|
1445
|
+
var projectInfoEventSchema = z18.object({
|
|
1446
|
+
type: z18.literal("PROJECT_INFO"),
|
|
1447
|
+
name: z18.string(),
|
|
1448
|
+
instanceType: z18.string(),
|
|
1449
|
+
region: z18.string(),
|
|
1450
|
+
latestVersion: z18.string().optional()
|
|
1451
|
+
});
|
|
1452
|
+
var requestInstanceInfoEventSchema = z18.object({
|
|
1453
|
+
type: z18.literal("REQUEST_INSTANCE_INFO")
|
|
1454
|
+
});
|
|
1455
|
+
var instanceInfoEventSchema = z18.object({
|
|
1456
|
+
type: z18.literal("INSTANCE_INFO"),
|
|
1457
|
+
currentInstanceType: z18.string(),
|
|
1458
|
+
planName: z18.string(),
|
|
1459
|
+
computeCredits: z18.number(),
|
|
1460
|
+
currentOrgComputeCost: z18.number(),
|
|
1461
|
+
instanceTypes: z18.array(z18.object({
|
|
1462
|
+
id: z18.string(),
|
|
1463
|
+
name: z18.string(),
|
|
1464
|
+
cpu: z18.string(),
|
|
1465
|
+
ram: z18.string(),
|
|
1466
|
+
pricePerHour: z18.number(),
|
|
1467
|
+
pricePerMonth: z18.number()
|
|
1468
|
+
})),
|
|
1469
|
+
projects: z18.array(z18.object({
|
|
1470
|
+
name: z18.string(),
|
|
1471
|
+
instanceType: z18.string(),
|
|
1472
|
+
monthlyCost: z18.number(),
|
|
1473
|
+
isCurrent: z18.boolean(),
|
|
1474
|
+
status: z18.string()
|
|
1475
|
+
}))
|
|
1476
|
+
});
|
|
1477
|
+
var requestInstanceTypeChangeEventSchema = z18.object({
|
|
1478
|
+
type: z18.literal("REQUEST_INSTANCE_TYPE_CHANGE"),
|
|
1479
|
+
instanceType: z18.string()
|
|
1480
|
+
});
|
|
1481
|
+
var instanceTypeChangeResultEventSchema = z18.object({
|
|
1482
|
+
type: z18.literal("INSTANCE_TYPE_CHANGE_RESULT"),
|
|
1483
|
+
success: z18.boolean(),
|
|
1484
|
+
instanceType: z18.string().optional(),
|
|
1485
|
+
error: z18.string().optional()
|
|
1486
|
+
});
|
|
1291
1487
|
var cloudEventSchema = z18.discriminatedUnion("type", [
|
|
1292
1488
|
appRouteChangeEventSchema,
|
|
1293
1489
|
authSuccessEventSchema,
|
|
@@ -1299,8 +1495,15 @@ var cloudEventSchema = z18.discriminatedUnion("type", [
|
|
|
1299
1495
|
navigateToUsageSchema,
|
|
1300
1496
|
showContactModalEventSchema,
|
|
1301
1497
|
showConnectOverlayEventSchema,
|
|
1498
|
+
showPlanModalEventSchema,
|
|
1302
1499
|
authorizationCodeEventSchema,
|
|
1303
|
-
routeChangeEventSchema
|
|
1500
|
+
routeChangeEventSchema,
|
|
1501
|
+
requestProjectInfoEventSchema,
|
|
1502
|
+
projectInfoEventSchema,
|
|
1503
|
+
requestInstanceInfoEventSchema,
|
|
1504
|
+
instanceInfoEventSchema,
|
|
1505
|
+
requestInstanceTypeChangeEventSchema,
|
|
1506
|
+
instanceTypeChangeResultEventSchema
|
|
1304
1507
|
]);
|
|
1305
1508
|
|
|
1306
1509
|
// node_modules/@insforge/shared-schemas/dist/docs.schema.js
|
|
@@ -1336,8 +1539,6 @@ var docTypeSchema = z19.enum([
|
|
|
1336
1539
|
"storage-sdk",
|
|
1337
1540
|
"functions-sdk",
|
|
1338
1541
|
"ai-integration-sdk",
|
|
1339
|
-
"auth-components-react",
|
|
1340
|
-
"auth-components-nextjs",
|
|
1341
1542
|
"real-time",
|
|
1342
1543
|
"deployment"
|
|
1343
1544
|
]).describe(`
|
|
@@ -1347,8 +1548,6 @@ var docTypeSchema = z19.enum([
|
|
|
1347
1548
|
"storage-sdk" (file storage),
|
|
1348
1549
|
"functions-sdk" (edge functions),
|
|
1349
1550
|
"auth-sdk" (direct SDK methods for custom auth flows),
|
|
1350
|
-
"auth-components-react" (authentication components for React+Vite applications),
|
|
1351
|
-
"auth-components-nextjs" (authentication components for Next.js applications),
|
|
1352
1551
|
"ai-integration-sdk" (AI features),
|
|
1353
1552
|
"real-time" (real-time pub/sub through WebSockets),
|
|
1354
1553
|
"deployment" (deploy frontend applications via MCP tool)
|
|
@@ -1433,6 +1632,96 @@ var listDeploymentsResponseSchema = z22.object({
|
|
|
1433
1632
|
total: z22.number()
|
|
1434
1633
|
})
|
|
1435
1634
|
});
|
|
1635
|
+
var deploymentEnvVarSchema = z22.object({
|
|
1636
|
+
id: z22.string(),
|
|
1637
|
+
// Vercel env var ID (needed for delete/get)
|
|
1638
|
+
key: z22.string(),
|
|
1639
|
+
type: z22.enum(["plain", "encrypted", "secret", "sensitive", "system"]),
|
|
1640
|
+
updatedAt: z22.number().optional()
|
|
1641
|
+
// Unix timestamp (milliseconds)
|
|
1642
|
+
});
|
|
1643
|
+
var deploymentEnvVarWithValueSchema = z22.object({
|
|
1644
|
+
id: z22.string(),
|
|
1645
|
+
key: z22.string(),
|
|
1646
|
+
value: z22.string(),
|
|
1647
|
+
type: z22.enum(["plain", "encrypted", "secret", "sensitive", "system"]),
|
|
1648
|
+
updatedAt: z22.number().optional()
|
|
1649
|
+
});
|
|
1650
|
+
var listEnvVarsResponseSchema = z22.object({
|
|
1651
|
+
envVars: z22.array(deploymentEnvVarSchema)
|
|
1652
|
+
});
|
|
1653
|
+
var getEnvVarResponseSchema = z22.object({
|
|
1654
|
+
envVar: deploymentEnvVarWithValueSchema
|
|
1655
|
+
});
|
|
1656
|
+
var upsertEnvVarRequestSchema = z22.object({
|
|
1657
|
+
key: z22.string().trim().min(1, "key is required"),
|
|
1658
|
+
value: z22.string()
|
|
1659
|
+
});
|
|
1660
|
+
var upsertEnvVarsRequestSchema = z22.object({
|
|
1661
|
+
envVars: z22.array(upsertEnvVarRequestSchema).min(1)
|
|
1662
|
+
}).superRefine(({ envVars }, ctx) => {
|
|
1663
|
+
const firstSeenByKey = /* @__PURE__ */ new Map();
|
|
1664
|
+
envVars.forEach((envVar, index) => {
|
|
1665
|
+
const existingIndex = firstSeenByKey.get(envVar.key);
|
|
1666
|
+
if (existingIndex !== void 0) {
|
|
1667
|
+
ctx.addIssue({
|
|
1668
|
+
code: z22.ZodIssueCode.custom,
|
|
1669
|
+
message: "duplicate environment variable key",
|
|
1670
|
+
path: ["envVars", index, "key"]
|
|
1671
|
+
});
|
|
1672
|
+
return;
|
|
1673
|
+
}
|
|
1674
|
+
firstSeenByKey.set(envVar.key, index);
|
|
1675
|
+
});
|
|
1676
|
+
});
|
|
1677
|
+
var upsertEnvVarResponseSchema = z22.object({
|
|
1678
|
+
success: z22.literal(true),
|
|
1679
|
+
message: z22.string()
|
|
1680
|
+
});
|
|
1681
|
+
var upsertEnvVarsResponseSchema = z22.object({
|
|
1682
|
+
success: z22.literal(true),
|
|
1683
|
+
message: z22.string(),
|
|
1684
|
+
count: z22.number().int().positive()
|
|
1685
|
+
});
|
|
1686
|
+
var deleteEnvVarResponseSchema = z22.object({
|
|
1687
|
+
success: z22.literal(true),
|
|
1688
|
+
message: z22.string()
|
|
1689
|
+
});
|
|
1690
|
+
var updateSlugRequestSchema = z22.object({
|
|
1691
|
+
slug: z22.string().trim().min(3, "slug must be at least 3 characters").max(63, "slug must be at most 63 characters").regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/, "slug must be lowercase alphanumeric with hyphens, not starting or ending with hyphen").nullable()
|
|
1692
|
+
});
|
|
1693
|
+
var updateSlugResponseSchema = z22.object({
|
|
1694
|
+
success: z22.boolean(),
|
|
1695
|
+
slug: z22.string().nullable(),
|
|
1696
|
+
domain: z22.string().nullable()
|
|
1697
|
+
});
|
|
1698
|
+
var deploymentMetadataResponseSchema = z22.object({
|
|
1699
|
+
currentDeploymentId: z22.string().uuid().nullable(),
|
|
1700
|
+
defaultDomainUrl: z22.string().nullable(),
|
|
1701
|
+
customDomainUrl: z22.string().nullable()
|
|
1702
|
+
});
|
|
1703
|
+
var domainVerificationRecordSchema = z22.object({
|
|
1704
|
+
type: z22.string(),
|
|
1705
|
+
domain: z22.string(),
|
|
1706
|
+
value: z22.string()
|
|
1707
|
+
});
|
|
1708
|
+
var customDomainSchema = z22.object({
|
|
1709
|
+
domain: z22.string(),
|
|
1710
|
+
apexDomain: z22.string(),
|
|
1711
|
+
verified: z22.boolean(),
|
|
1712
|
+
misconfigured: z22.boolean(),
|
|
1713
|
+
verification: z22.array(domainVerificationRecordSchema),
|
|
1714
|
+
cnameTarget: z22.string().nullable(),
|
|
1715
|
+
aRecordValue: z22.string().nullable()
|
|
1716
|
+
});
|
|
1717
|
+
var addCustomDomainRequestSchema = z22.object({
|
|
1718
|
+
domain: z22.string().trim().min(1, "Domain is required").regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/i, "Invalid domain format (e.g. myapp.com or www.myapp.com)").refine((domain) => !domain.toLowerCase().endsWith(".insforge.site"), {
|
|
1719
|
+
message: "Domains ending with .insforge.site are reserved by InsForge"
|
|
1720
|
+
})
|
|
1721
|
+
});
|
|
1722
|
+
var listCustomDomainsResponseSchema = z22.object({
|
|
1723
|
+
domains: z22.array(customDomainSchema)
|
|
1724
|
+
});
|
|
1436
1725
|
|
|
1437
1726
|
// node_modules/@insforge/shared-schemas/dist/schedules.schema.js
|
|
1438
1727
|
import { z as z23 } from "zod";
|
|
@@ -2628,7 +2917,11 @@ async function registerInsforgeTools(server, config = {}) {
|
|
|
2628
2917
|
const GLOBAL_API_KEY = config.apiKey || process.env.API_KEY || "";
|
|
2629
2918
|
const API_BASE_URL = config.apiBaseUrl || process.env.API_BASE_URL || "http://localhost:7130";
|
|
2630
2919
|
const isRemote = config.mode === "remote";
|
|
2631
|
-
const usageTracker = new UsageTracker(API_BASE_URL, GLOBAL_API_KEY
|
|
2920
|
+
const usageTracker = new UsageTracker(API_BASE_URL, GLOBAL_API_KEY, {
|
|
2921
|
+
projectId: config.projectId,
|
|
2922
|
+
accessToken: config.accessToken,
|
|
2923
|
+
isRemote
|
|
2924
|
+
});
|
|
2632
2925
|
let backendVersion;
|
|
2633
2926
|
try {
|
|
2634
2927
|
backendVersion = await fetchBackendVersion(API_BASE_URL);
|
package/dist/http-server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
registerInsforgeTools
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YH7HSQYJ.js";
|
|
5
5
|
|
|
6
6
|
// src/http/server.ts
|
|
7
7
|
import "dotenv/config";
|
|
@@ -98,7 +98,9 @@ var SessionManager = class {
|
|
|
98
98
|
const toolsConfig = await registerInsforgeTools(server, {
|
|
99
99
|
apiKey: sessionData.apiKey,
|
|
100
100
|
apiBaseUrl: sessionData.apiBaseUrl,
|
|
101
|
-
mode: "remote"
|
|
101
|
+
mode: "remote",
|
|
102
|
+
projectId: sessionData.projectId,
|
|
103
|
+
accessToken: sessionData.oauthTokenHash
|
|
102
104
|
});
|
|
103
105
|
await server.connect(transport);
|
|
104
106
|
const fullSessionData = {
|
|
@@ -186,7 +188,9 @@ var SessionManager = class {
|
|
|
186
188
|
await registerInsforgeTools(server, {
|
|
187
189
|
apiKey: sessionData.apiKey,
|
|
188
190
|
apiBaseUrl: sessionData.apiBaseUrl,
|
|
189
|
-
mode: "remote"
|
|
191
|
+
mode: "remote",
|
|
192
|
+
projectId: sessionData.projectId,
|
|
193
|
+
accessToken: sessionData.oauthTokenHash
|
|
190
194
|
});
|
|
191
195
|
await server.connect(transport);
|
|
192
196
|
this.runtimeSessions.set(sessionId, { server, transport, transportType: "streamable" });
|
|
@@ -210,7 +214,9 @@ var SessionManager = class {
|
|
|
210
214
|
const toolsConfig = await registerInsforgeTools(server, {
|
|
211
215
|
apiKey: sessionData.apiKey,
|
|
212
216
|
apiBaseUrl: sessionData.apiBaseUrl,
|
|
213
|
-
mode: "remote"
|
|
217
|
+
mode: "remote",
|
|
218
|
+
projectId: sessionData.projectId,
|
|
219
|
+
accessToken: sessionData.oauthTokenHash
|
|
214
220
|
});
|
|
215
221
|
await server.connect(transport);
|
|
216
222
|
const fullSessionData = {
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@insforge/mcp",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.9",
|
|
4
4
|
"description": "MCP (Model Context Protocol) server for Insforge backend-as-a-service",
|
|
5
5
|
"mcpName": "io.github.InsForge/insforge-mcp",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"server.json"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@insforge/shared-schemas": "1.1.
|
|
48
|
+
"@insforge/shared-schemas": "1.1.47",
|
|
49
49
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
50
50
|
"archiver": "^7.0.1",
|
|
51
51
|
"commander": "^14.0.0",
|