@agent-vm/mcp-portal 0.0.69 → 0.0.71
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 +42 -11
- package/dist/agent-bearer-token-DCtpDPCZ.js +59 -0
- package/dist/agent-bearer-token-DCtpDPCZ.js.map +1 -0
- package/dist/bin/mcp-portal.d.ts +28 -0
- package/dist/bin/mcp-portal.d.ts.map +1 -0
- package/dist/bin/mcp-portal.js +318 -0
- package/dist/bin/mcp-portal.js.map +1 -0
- package/dist/{catalog-types--gUGFPpN.d.ts → catalog-types-BVuB4Ynx.d.ts} +1 -1
- package/dist/{catalog-types--gUGFPpN.d.ts.map → catalog-types-BVuB4Ynx.d.ts.map} +1 -1
- package/dist/cli/index.d.ts +101 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/core/index.d.ts +40 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +5 -0
- package/dist/hmac-env-B4shpRRB.js +20 -0
- package/dist/hmac-env-B4shpRRB.js.map +1 -0
- package/dist/hmac-token-DBqWY3-w.js +100 -0
- package/dist/hmac-token-DBqWY3-w.js.map +1 -0
- package/dist/index.d.ts +5 -485
- package/dist/index.js +4 -5
- package/dist/mcp-proxy/index.d.ts +24 -0
- package/dist/mcp-proxy/index.d.ts.map +1 -0
- package/dist/mcp-proxy/index.js +2 -0
- package/dist/portal-auth/agent-bearer-token.d.ts +22 -0
- package/dist/portal-auth/agent-bearer-token.d.ts.map +1 -0
- package/dist/portal-auth/agent-bearer-token.js +2 -0
- package/dist/portal-auth/hmac-env.d.ts +6 -0
- package/dist/portal-auth/hmac-env.d.ts.map +1 -0
- package/dist/portal-auth/hmac-env.js +2 -0
- package/dist/portal-auth/hmac-token.d.ts +40 -0
- package/dist/portal-auth/hmac-token.d.ts.map +1 -0
- package/dist/portal-auth/hmac-token.js +2 -0
- package/dist/portal-config/index.d.ts +11 -0
- package/dist/portal-config/index.d.ts.map +1 -0
- package/dist/{tool-vm → portal-config}/index.js +2 -3
- package/dist/portal-core-CZQI7Ob6.d.ts +264 -0
- package/dist/portal-core-CZQI7Ob6.d.ts.map +1 -0
- package/dist/portal-core-Cgu714CL.js +416 -0
- package/dist/portal-core-Cgu714CL.js.map +1 -0
- package/dist/portal-session-DG2CUjIo.d.ts +184 -0
- package/dist/portal-session-DG2CUjIo.d.ts.map +1 -0
- package/dist/portal-tools-DKci1szO.js +528 -0
- package/dist/portal-tools-DKci1szO.js.map +1 -0
- package/dist/resolve-agent-identity-DnC_Pmnh.js +550 -0
- package/dist/resolve-agent-identity-DnC_Pmnh.js.map +1 -0
- package/dist/resolve-agent-identity-FQL02YdW.d.ts +81 -0
- package/dist/resolve-agent-identity-FQL02YdW.d.ts.map +1 -0
- package/dist/serve-command-D3SlETy_.js +358 -0
- package/dist/serve-command-D3SlETy_.js.map +1 -0
- package/dist/testing/fake-upstream-mcp-server.d.ts +5 -2
- package/dist/testing/fake-upstream-mcp-server.d.ts.map +1 -1
- package/dist/testing/fake-upstream-mcp-server.js +14 -4
- package/dist/testing/fake-upstream-mcp-server.js.map +1 -1
- package/dist/typescript-artifact-BVLt3Ifd.js +60 -0
- package/dist/typescript-artifact-BVLt3Ifd.js.map +1 -0
- package/dist/upstream-mcp-client-runtime-JlsfTm7_.js +760 -0
- package/dist/upstream-mcp-client-runtime-JlsfTm7_.js.map +1 -0
- package/dist/upstream-response-middleware-1MZnAD9C.d.ts +115 -0
- package/dist/upstream-response-middleware-1MZnAD9C.d.ts.map +1 -0
- package/dist/upstream-response-middleware-BjUWZ2G8.js +172 -0
- package/dist/upstream-response-middleware-BjUWZ2G8.js.map +1 -0
- package/dist/{index-BcI9c8sg.d.ts → zod-schema-loader-DLGQpYFD.d.ts} +3 -9
- package/dist/zod-schema-loader-DLGQpYFD.d.ts.map +1 -0
- package/dist/{typescript-artifact-BqU8okQy.js → zod-schema-loader-yNekKNpm.js} +85 -55
- package/dist/zod-schema-loader-yNekKNpm.js.map +1 -0
- package/package.json +30 -13
- package/dist/bin/agent-vm-mcp-portal.d.ts +0 -10
- package/dist/bin/agent-vm-mcp-portal.d.ts.map +0 -1
- package/dist/bin/agent-vm-mcp-portal.js +0 -56
- package/dist/bin/agent-vm-mcp-portal.js.map +0 -1
- package/dist/bin/portal-server.d.ts +0 -55
- package/dist/bin/portal-server.d.ts.map +0 -1
- package/dist/bin/portal-server.js +0 -289
- package/dist/bin/portal-server.js.map +0 -1
- package/dist/index-BcI9c8sg.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/tool-vm/index.d.ts +0 -2
- package/dist/tool-vm-ihnzDyjJ.js +0 -3
- package/dist/typescript-artifact-BqU8okQy.js.map +0 -1
- package/dist/upstream-mcp-client-runtime-DiBCBsDj.js +0 -1729
- package/dist/upstream-mcp-client-runtime-DiBCBsDj.js.map +0 -1
- package/dist/zod-schema-loader-CDDtoRE1.js +0 -90
- package/dist/zod-schema-loader-CDDtoRE1.js.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { createHash } from "node:crypto";
|
|
3
2
|
//#region src/json-schema.ts
|
|
4
3
|
const jsonValueSchema = z.lazy(() => z.union([
|
|
5
4
|
z.string(),
|
|
@@ -10,11 +9,11 @@ const jsonValueSchema = z.lazy(() => z.union([
|
|
|
10
9
|
jsonObjectSchema
|
|
11
10
|
]));
|
|
12
11
|
const jsonObjectSchema = z.record(z.string(), jsonValueSchema);
|
|
13
|
-
function isJsonObject(value) {
|
|
12
|
+
function isJsonObject$1(value) {
|
|
14
13
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15
14
|
}
|
|
16
15
|
function assertJsonObject(value, label) {
|
|
17
|
-
if (!isJsonObject(value)) throw new Error(`${label} must be a JSON object.`);
|
|
16
|
+
if (!isJsonObject$1(value)) throw new Error(`${label} must be a JSON object.`);
|
|
18
17
|
return jsonObjectSchema.parse(value);
|
|
19
18
|
}
|
|
20
19
|
//#endregion
|
|
@@ -100,61 +99,92 @@ function decodeToolRef(toolRef) {
|
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
//#endregion
|
|
103
|
-
//#region src/
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
//#region src/zod-schema-loader.ts
|
|
103
|
+
const unsupportedFeatures = new Set([
|
|
104
|
+
"contains",
|
|
105
|
+
"dependentSchemas",
|
|
106
|
+
"else",
|
|
107
|
+
"if",
|
|
108
|
+
"not",
|
|
109
|
+
"then",
|
|
110
|
+
"unevaluatedProperties",
|
|
111
|
+
"uniqueItems"
|
|
112
|
+
]);
|
|
113
|
+
function isJsonObject(value) {
|
|
114
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
108
115
|
}
|
|
109
|
-
function
|
|
110
|
-
|
|
116
|
+
function findUnsupportedFeature(value, path = []) {
|
|
117
|
+
if (Array.isArray(value)) {
|
|
118
|
+
for (const [index, childValue] of value.entries()) {
|
|
119
|
+
const childUnsupported = findUnsupportedFeature(childValue, [...path, index]);
|
|
120
|
+
if (childUnsupported) return childUnsupported;
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
if (!isJsonObject(value)) return null;
|
|
125
|
+
for (const [key, childValue] of Object.entries(value)) {
|
|
126
|
+
if (unsupportedFeatures.has(key)) return {
|
|
127
|
+
feature: key,
|
|
128
|
+
path: [...path, key]
|
|
129
|
+
};
|
|
130
|
+
const childUnsupported = findUnsupportedFeature(childValue, [...path, key]);
|
|
131
|
+
if (childUnsupported) return childUnsupported;
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
111
134
|
}
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
-
|
|
135
|
+
function unavailableError(feature, path) {
|
|
136
|
+
return {
|
|
137
|
+
feature,
|
|
138
|
+
kind: "schema_validation_unavailable",
|
|
139
|
+
message: `JSON Schema feature "${feature}" is not supported by the portal validator.`,
|
|
140
|
+
path
|
|
141
|
+
};
|
|
115
142
|
}
|
|
116
|
-
function
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
143
|
+
function toValidationIssue(issue) {
|
|
144
|
+
return {
|
|
145
|
+
code: issue.code,
|
|
146
|
+
message: issue.message,
|
|
147
|
+
path: issue.path.map((pathPart) => typeof pathPart === "symbol" ? String(pathPart) : pathPart)
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function buildZodValidatorFromJsonSchema(jsonSchema) {
|
|
151
|
+
const unsupported = findUnsupportedFeature(jsonSchema);
|
|
152
|
+
if (unsupported) return {
|
|
153
|
+
error: unavailableError(unsupported.feature, unsupported.path),
|
|
154
|
+
ok: false
|
|
155
|
+
};
|
|
156
|
+
try {
|
|
157
|
+
const zodSchema = z.fromJSONSchema(jsonSchema);
|
|
158
|
+
return {
|
|
159
|
+
ok: true,
|
|
160
|
+
validate(value) {
|
|
161
|
+
const parsed = zodSchema.safeParse(value);
|
|
162
|
+
if (parsed.success) return {
|
|
163
|
+
ok: true,
|
|
164
|
+
value: parsed.data
|
|
165
|
+
};
|
|
166
|
+
return {
|
|
167
|
+
error: {
|
|
168
|
+
kind: "input_validation",
|
|
169
|
+
issues: parsed.error.issues.map((issue) => toValidationIssue(issue))
|
|
170
|
+
},
|
|
171
|
+
ok: false
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
} catch (error) {
|
|
176
|
+
return {
|
|
177
|
+
error: {
|
|
178
|
+
feature: "conversion_failed",
|
|
179
|
+
kind: "schema_validation_unavailable",
|
|
180
|
+
message: error instanceof Error ? error.message : String(error),
|
|
181
|
+
path: []
|
|
182
|
+
},
|
|
183
|
+
ok: false
|
|
184
|
+
};
|
|
185
|
+
}
|
|
156
186
|
}
|
|
157
187
|
//#endregion
|
|
158
|
-
export { portalToolRecordSchema as a, isJsonObject as c, portalToolAnnotationsSchema as i, jsonObjectSchema as l, decodeToolRef as n, safeToolMetadataSchema as o, encodeToolRef as r, assertJsonObject as s,
|
|
188
|
+
export { portalToolRecordSchema as a, isJsonObject$1 as c, portalToolAnnotationsSchema as i, jsonObjectSchema as l, decodeToolRef as n, safeToolMetadataSchema as o, encodeToolRef as r, assertJsonObject as s, buildZodValidatorFromJsonSchema as t, jsonValueSchema as u };
|
|
159
189
|
|
|
160
|
-
//# sourceMappingURL=
|
|
190
|
+
//# sourceMappingURL=zod-schema-loader-yNekKNpm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod-schema-loader-yNekKNpm.js","names":["isJsonObject"],"sources":["../src/json-schema.ts","../src/catalog-types.ts","../src/tool-ref.ts","../src/zod-schema-loader.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport type JsonPrimitive = boolean | null | number | string;\nexport type JsonArray = JsonValue[];\nexport type JsonObject = { [key: string]: JsonValue };\nexport type JsonValue = JsonArray | JsonObject | JsonPrimitive;\n\nexport const jsonValueSchema: z.ZodType<JsonValue> = z.lazy(() =>\n\tz.union([\n\t\tz.string(),\n\t\tz.number().finite(),\n\t\tz.boolean(),\n\t\tz.null(),\n\t\tz.array(jsonValueSchema),\n\t\tjsonObjectSchema,\n\t]),\n);\n\nexport const jsonObjectSchema: z.ZodType<JsonObject> = z.record(z.string(), jsonValueSchema);\n\nexport function isJsonObject(value: unknown): value is JsonObject {\n\treturn typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function assertJsonObject(value: unknown, label: string): JsonObject {\n\tif (!isJsonObject(value)) {\n\t\tthrow new Error(`${label} must be a JSON object.`);\n\t}\n\n\treturn jsonObjectSchema.parse(value);\n}\n","import { z } from 'zod';\n\nimport { jsonObjectSchema, type JsonObject, type JsonValue } from './json-schema.js';\n\nconst forbiddenMetadataKeys = new Set([\n\t'agentid',\n\t'authprofile',\n\t'bindingid',\n\t'runid',\n\t'sessionid',\n]);\n\nfunction findForbiddenMetadataKey(value: JsonObject): string | null {\n\tconst stack: JsonValue[] = [value];\n\n\twhile (stack.length > 0) {\n\t\tconst current = stack.pop();\n\t\tif (!current) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (Array.isArray(current)) {\n\t\t\tstack.push(...current);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (typeof current !== 'object' || current === null) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const [key, childValue] of Object.entries(current)) {\n\t\t\tif (forbiddenMetadataKeys.has(key.toLowerCase())) {\n\t\t\t\treturn key;\n\t\t\t}\n\t\t\tif (typeof childValue === 'object' && childValue !== null) {\n\t\t\t\tstack.push(childValue);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\nexport const portalToolAnnotationsSchema = z\n\t.object({\n\t\tdestructiveHint: z.boolean().optional(),\n\t\tidempotentHint: z.boolean().optional(),\n\t\topenWorldHint: z.boolean().optional(),\n\t\treadOnlyHint: z.boolean().optional(),\n\t\ttitle: z.string().optional(),\n\t})\n\t.catchall(jsonObjectSchema.or(z.string()).or(z.number()).or(z.boolean()).or(z.null()))\n\t.optional();\n\nexport const safeToolMetadataSchema = jsonObjectSchema\n\t.optional()\n\t.superRefine((metadata, context) => {\n\t\tif (!metadata) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst forbiddenKey = findForbiddenMetadataKey(metadata);\n\t\tif (forbiddenKey) {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: 'custom',\n\t\t\t\tmessage: `metadata contains forbidden key \"${forbiddenKey}\"`,\n\t\t\t});\n\t\t}\n\t});\n\nexport const portalToolRecordSchema = z\n\t.object({\n\t\tannotations: portalToolAnnotationsSchema,\n\t\tdescription: z.string().optional(),\n\t\tinputSchema: jsonObjectSchema,\n\t\tmetadata: safeToolMetadataSchema,\n\t\tnamespace: z.string().min(1),\n\t\toutputSchema: jsonObjectSchema.optional(),\n\t\ttitle: z.string().optional(),\n\t\ttoolName: z.string().min(1),\n\t})\n\t.strict();\n\nexport type PortalToolRecord = z.infer<typeof portalToolRecordSchema>;\nexport type PortalToolAnnotations = z.infer<typeof portalToolAnnotationsSchema>;\n","import { z } from 'zod';\n\nexport interface ToolIdentity {\n\treadonly namespace: string;\n\treadonly toolName: string;\n}\n\nconst toolIdentitySchema = z\n\t.object({\n\t\tnamespace: z.string().min(1),\n\t\ttoolName: z.string().min(1),\n\t})\n\t.strict();\nconst toolRefSchema = z.string().startsWith('mcp:').brand<'ToolRef'>();\n\nexport type ToolRef = z.infer<typeof toolRefSchema>;\n\nfunction decodeToolRefSegment(segment: string): string {\n\tif (!/^[A-Za-z0-9_-]+$/.test(segment)) {\n\t\tthrow new Error('Invalid MCP toolRef.');\n\t}\n\n\tconst decoded = Buffer.from(segment, 'base64url').toString('utf-8');\n\tconst canonicalSegment = Buffer.from(decoded, 'utf-8').toString('base64url');\n\tif (canonicalSegment !== segment) {\n\t\tthrow new Error('Invalid MCP toolRef.');\n\t}\n\n\treturn decoded;\n}\n\nexport function encodeToolRef(identity: ToolIdentity): ToolRef {\n\tconst parsed = toolIdentitySchema.parse(identity);\n\tconst encodedNamespace = Buffer.from(parsed.namespace, 'utf-8').toString('base64url');\n\tconst encodedToolName = Buffer.from(parsed.toolName, 'utf-8').toString('base64url');\n\n\treturn toolRefSchema.parse(`mcp:${encodedNamespace}:${encodedToolName}`);\n}\n\nexport function decodeToolRef(toolRef: string | ToolRef): ToolIdentity {\n\tconst [scheme, encodedNamespace, encodedToolName, ...extraParts] = toolRef.split(':');\n\tif (scheme !== 'mcp' || !encodedNamespace || !encodedToolName || extraParts.length > 0) {\n\t\tthrow new Error('Invalid MCP toolRef.');\n\t}\n\n\ttry {\n\t\treturn toolIdentitySchema.parse({\n\t\t\tnamespace: decodeToolRefSegment(encodedNamespace),\n\t\t\ttoolName: decodeToolRefSegment(encodedToolName),\n\t\t});\n\t} catch {\n\t\tthrow new Error('Invalid MCP toolRef.');\n\t}\n}\n","import { z } from 'zod';\n\nimport type { JsonObject, JsonValue } from './json-schema.js';\n\nexport interface InputValidationIssue {\n\treadonly code: string;\n\treadonly message: string;\n\treadonly path: readonly (number | string)[];\n}\n\nexport interface InputValidationError {\n\treadonly kind: 'input_validation';\n\treadonly issues: readonly InputValidationIssue[];\n}\n\nexport interface SchemaValidationUnavailableError {\n\treadonly feature: string;\n\treadonly kind: 'schema_validation_unavailable';\n\treadonly message: string;\n\treadonly path: readonly (number | string)[];\n}\n\nexport type PortalValidationResult =\n\t| { readonly ok: true; readonly value: unknown }\n\t| { readonly error: InputValidationError; readonly ok: false };\n\nexport type BuiltZodValidator =\n\t| {\n\t\t\treadonly ok: true;\n\t\t\treadonly validate: (value: unknown) => PortalValidationResult;\n\t }\n\t| {\n\t\t\treadonly error: SchemaValidationUnavailableError;\n\t\t\treadonly ok: false;\n\t };\n\ninterface UnsupportedFeature {\n\treadonly feature: string;\n\treadonly path: readonly (number | string)[];\n}\n\nconst unsupportedFeatures = new Set([\n\t'contains',\n\t'dependentSchemas',\n\t'else',\n\t'if',\n\t'not',\n\t'then',\n\t'unevaluatedProperties',\n\t'uniqueItems',\n]);\n\nfunction isJsonObject(value: JsonValue): value is JsonObject {\n\treturn typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction findUnsupportedFeature(\n\tvalue: JsonValue,\n\tpath: readonly (number | string)[] = [],\n): UnsupportedFeature | null {\n\tif (Array.isArray(value)) {\n\t\tfor (const [index, childValue] of value.entries()) {\n\t\t\tconst childUnsupported = findUnsupportedFeature(childValue, [...path, index]);\n\t\t\tif (childUnsupported) {\n\t\t\t\treturn childUnsupported;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tif (!isJsonObject(value)) {\n\t\treturn null;\n\t}\n\n\tfor (const [key, childValue] of Object.entries(value)) {\n\t\tif (unsupportedFeatures.has(key)) {\n\t\t\treturn { feature: key, path: [...path, key] };\n\t\t}\n\t\tconst childUnsupported = findUnsupportedFeature(childValue, [...path, key]);\n\t\tif (childUnsupported) {\n\t\t\treturn childUnsupported;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction unavailableError(\n\tfeature: string,\n\tpath: readonly (number | string)[],\n): SchemaValidationUnavailableError {\n\treturn {\n\t\tfeature,\n\t\tkind: 'schema_validation_unavailable',\n\t\tmessage: `JSON Schema feature \"${feature}\" is not supported by the portal validator.`,\n\t\tpath,\n\t};\n}\n\nfunction toValidationIssue(issue: z.core.$ZodIssue): InputValidationIssue {\n\treturn {\n\t\tcode: issue.code,\n\t\tmessage: issue.message,\n\t\tpath: issue.path.map((pathPart) =>\n\t\t\ttypeof pathPart === 'symbol' ? String(pathPart) : pathPart,\n\t\t),\n\t};\n}\n\nexport function buildZodValidatorFromJsonSchema(jsonSchema: JsonObject): BuiltZodValidator {\n\tconst unsupported = findUnsupportedFeature(jsonSchema);\n\tif (unsupported) {\n\t\treturn {\n\t\t\terror: unavailableError(unsupported.feature, unsupported.path),\n\t\t\tok: false,\n\t\t};\n\t}\n\n\ttry {\n\t\tconst zodSchema = z.fromJSONSchema(jsonSchema);\n\n\t\treturn {\n\t\t\tok: true,\n\t\t\tvalidate(value: unknown): PortalValidationResult {\n\t\t\t\tconst parsed = zodSchema.safeParse(value);\n\t\t\t\tif (parsed.success) {\n\t\t\t\t\treturn { ok: true, value: parsed.data };\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\terror: {\n\t\t\t\t\t\tkind: 'input_validation',\n\t\t\t\t\t\tissues: parsed.error.issues.map((issue) => toValidationIssue(issue)),\n\t\t\t\t\t},\n\t\t\t\t\tok: false,\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\terror: {\n\t\t\t\tfeature: 'conversion_failed',\n\t\t\t\tkind: 'schema_validation_unavailable',\n\t\t\t\tmessage: error instanceof Error ? error.message : String(error),\n\t\t\t\tpath: [],\n\t\t\t},\n\t\t\tok: false,\n\t\t};\n\t}\n}\n"],"mappings":";;AAOA,MAAa,kBAAwC,EAAE,WACtD,EAAE,MAAM;CACP,EAAE,QAAQ;CACV,EAAE,QAAQ,CAAC,QAAQ;CACnB,EAAE,SAAS;CACX,EAAE,MAAM;CACR,EAAE,MAAM,gBAAgB;CACxB;CACA,CAAC,CACF;AAED,MAAa,mBAA0C,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB;AAE5F,SAAgBA,eAAa,OAAqC;CACjE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;;AAG5E,SAAgB,iBAAiB,OAAgB,OAA2B;CAC3E,IAAI,CAACA,eAAa,MAAM,EACvB,MAAM,IAAI,MAAM,GAAG,MAAM,yBAAyB;CAGnD,OAAO,iBAAiB,MAAM,MAAM;;;;ACzBrC,MAAM,wBAAwB,IAAI,IAAI;CACrC;CACA;CACA;CACA;CACA;CACA,CAAC;AAEF,SAAS,yBAAyB,OAAkC;CACnE,MAAM,QAAqB,CAAC,MAAM;CAElC,OAAO,MAAM,SAAS,GAAG;EACxB,MAAM,UAAU,MAAM,KAAK;EAC3B,IAAI,CAAC,SACJ;EAGD,IAAI,MAAM,QAAQ,QAAQ,EAAE;GAC3B,MAAM,KAAK,GAAG,QAAQ;GACtB;;EAGD,IAAI,OAAO,YAAY,YAAY,YAAY,MAC9C;EAGD,KAAK,MAAM,CAAC,KAAK,eAAe,OAAO,QAAQ,QAAQ,EAAE;G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.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-vm/mcp-portal",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.71",
|
|
4
4
|
"description": "Agent-scoped MCP Portal server and TypeScript helpers for composable upstream MCP tools.",
|
|
5
5
|
"homepage": "https://github.com/ShravanSunder/agent-vm#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
"directory": "packages/mcp-portal"
|
|
15
15
|
},
|
|
16
16
|
"bin": {
|
|
17
|
-
"
|
|
18
|
-
"agent-vm-mcp-portal-server": "./dist/bin/portal-server.js"
|
|
17
|
+
"mcp-portal": "./dist/bin/mcp-portal.js"
|
|
19
18
|
},
|
|
20
19
|
"files": [
|
|
21
20
|
"dist"
|
|
@@ -28,17 +27,33 @@
|
|
|
28
27
|
"types": "./dist/index.d.ts",
|
|
29
28
|
"import": "./dist/index.js"
|
|
30
29
|
},
|
|
31
|
-
"./
|
|
32
|
-
"types": "./dist/
|
|
33
|
-
"import": "./dist/
|
|
30
|
+
"./core": {
|
|
31
|
+
"types": "./dist/core/index.d.ts",
|
|
32
|
+
"import": "./dist/core/index.js"
|
|
34
33
|
},
|
|
35
|
-
"./
|
|
36
|
-
"types": "./dist/
|
|
37
|
-
"import": "./dist/
|
|
34
|
+
"./mcp-proxy": {
|
|
35
|
+
"types": "./dist/mcp-proxy/index.d.ts",
|
|
36
|
+
"import": "./dist/mcp-proxy/index.js"
|
|
38
37
|
},
|
|
39
|
-
"./
|
|
40
|
-
"types": "./dist/
|
|
41
|
-
"import": "./dist/
|
|
38
|
+
"./cli": {
|
|
39
|
+
"types": "./dist/cli/index.d.ts",
|
|
40
|
+
"import": "./dist/cli/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./portal-config": {
|
|
43
|
+
"types": "./dist/portal-config/index.d.ts",
|
|
44
|
+
"import": "./dist/portal-config/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./portal-auth/hmac-token": {
|
|
47
|
+
"types": "./dist/portal-auth/hmac-token.d.ts",
|
|
48
|
+
"import": "./dist/portal-auth/hmac-token.js"
|
|
49
|
+
},
|
|
50
|
+
"./portal-auth/hmac-env": {
|
|
51
|
+
"types": "./dist/portal-auth/hmac-env.d.ts",
|
|
52
|
+
"import": "./dist/portal-auth/hmac-env.js"
|
|
53
|
+
},
|
|
54
|
+
"./portal-auth/agent-bearer-token": {
|
|
55
|
+
"types": "./dist/portal-auth/agent-bearer-token.d.ts",
|
|
56
|
+
"import": "./dist/portal-auth/agent-bearer-token.js"
|
|
42
57
|
},
|
|
43
58
|
"./testing/fake-upstream-mcp-server": {
|
|
44
59
|
"types": "./dist/testing/fake-upstream-mcp-server.d.ts",
|
|
@@ -49,11 +64,13 @@
|
|
|
49
64
|
"access": "public"
|
|
50
65
|
},
|
|
51
66
|
"dependencies": {
|
|
67
|
+
"@hono/mcp": "^0.3.0",
|
|
52
68
|
"@hono/node-server": "^2.0.2",
|
|
53
69
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
54
70
|
"hono": "^4.12.18",
|
|
55
71
|
"zod": "^4.4.3",
|
|
56
|
-
"@agent-vm/config-contracts": "0.0.
|
|
72
|
+
"@agent-vm/config-contracts": "0.0.71",
|
|
73
|
+
"@agent-vm/secret-management": "0.0.71"
|
|
57
74
|
},
|
|
58
75
|
"devDependencies": {
|
|
59
76
|
"vitest": "^4.1.5"
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { n as PortalToolRecord } from "../catalog-types--gUGFPpN.js";
|
|
2
|
-
|
|
3
|
-
//#region src/bin/agent-vm-mcp-portal.d.ts
|
|
4
|
-
interface PortalCatalogFile {
|
|
5
|
-
readonly tools: readonly PortalToolRecord[];
|
|
6
|
-
}
|
|
7
|
-
declare function runAgentVmMcpPortal(args: readonly string[]): Promise<number>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { PortalCatalogFile, runAgentVmMcpPortal };
|
|
10
|
-
//# sourceMappingURL=agent-vm-mcp-portal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-vm-mcp-portal.d.ts","names":[],"sources":["../../src/bin/agent-vm-mcp-portal.ts"],"mappings":";;;UAgBiB,iBAAA;EAAA,SACP,KAAA,WAAgB,gBAAA;AAAA;AAAA,iBAyBJ,mBAAA,CAAoB,IAAA,sBAA0B,OAAA"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { a as portalToolRecordSchema, t as generateTypescriptCatalogArtifact } from "../typescript-artifact-BqU8okQy.js";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
5
|
-
import { join } from "node:path";
|
|
6
|
-
//#region src/bin/agent-vm-mcp-portal.ts
|
|
7
|
-
const catalogFileSchema = z.object({ tools: z.array(portalToolRecordSchema) }).strict();
|
|
8
|
-
async function readCatalogFile(catalogPath) {
|
|
9
|
-
const rawCatalog = await readFile(catalogPath, "utf-8");
|
|
10
|
-
const parsedJson = JSON.parse(rawCatalog);
|
|
11
|
-
return catalogFileSchema.parse(parsedJson);
|
|
12
|
-
}
|
|
13
|
-
function parseOutputDirectory(args) {
|
|
14
|
-
const outputFlagIndex = args.indexOf("--out");
|
|
15
|
-
if (outputFlagIndex === -1) return null;
|
|
16
|
-
return args[outputFlagIndex + 1] ?? null;
|
|
17
|
-
}
|
|
18
|
-
function printUsage() {
|
|
19
|
-
process.stderr.write("Usage: agent-vm-mcp-portal validate <catalog.json>\n");
|
|
20
|
-
process.stderr.write("Usage: agent-vm-mcp-portal generate-helper <catalog.json> --out <directory>\n");
|
|
21
|
-
}
|
|
22
|
-
async function runAgentVmMcpPortal(args) {
|
|
23
|
-
const [command, catalogPath, ...restArgs] = args;
|
|
24
|
-
if (!command || !catalogPath) {
|
|
25
|
-
printUsage();
|
|
26
|
-
return 1;
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
const catalog = await readCatalogFile(catalogPath);
|
|
30
|
-
switch (command) {
|
|
31
|
-
case "validate": return 0;
|
|
32
|
-
case "generate-helper": {
|
|
33
|
-
const outputDirectory = parseOutputDirectory(restArgs);
|
|
34
|
-
if (!outputDirectory) {
|
|
35
|
-
printUsage();
|
|
36
|
-
return 1;
|
|
37
|
-
}
|
|
38
|
-
await mkdir(outputDirectory, { recursive: true });
|
|
39
|
-
await writeFile(join(outputDirectory, "catalog.json"), JSON.stringify(catalog, null, " "));
|
|
40
|
-
await writeFile(join(outputDirectory, "catalog.ts"), generateTypescriptCatalogArtifact(catalog));
|
|
41
|
-
return 0;
|
|
42
|
-
}
|
|
43
|
-
default:
|
|
44
|
-
printUsage();
|
|
45
|
-
return 1;
|
|
46
|
-
}
|
|
47
|
-
} catch (error) {
|
|
48
|
-
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
49
|
-
return 1;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (process.argv[1]?.endsWith("agent-vm-mcp-portal.js")) process.exitCode = await runAgentVmMcpPortal(process.argv.slice(2));
|
|
53
|
-
//#endregion
|
|
54
|
-
export { runAgentVmMcpPortal };
|
|
55
|
-
|
|
56
|
-
//# sourceMappingURL=agent-vm-mcp-portal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-vm-mcp-portal.js","names":[],"sources":["../../src/bin/agent-vm-mcp-portal.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nimport { z } from 'zod';\n\nimport { portalToolRecordSchema, type PortalToolRecord } from '../catalog-types.js';\nimport { generateTypescriptCatalogArtifact } from '../tool-vm/typescript-artifact.js';\n\nconst catalogFileSchema = z\n\t.object({\n\t\ttools: z.array(portalToolRecordSchema),\n\t})\n\t.strict();\n\nexport interface PortalCatalogFile {\n\treadonly tools: readonly PortalToolRecord[];\n}\n\nasync function readCatalogFile(catalogPath: string): Promise<PortalCatalogFile> {\n\tconst rawCatalog = await readFile(catalogPath, 'utf-8');\n\tconst parsedJson = JSON.parse(rawCatalog) as unknown;\n\treturn catalogFileSchema.parse(parsedJson);\n}\n\nfunction parseOutputDirectory(args: readonly string[]): string | null {\n\tconst outputFlagIndex = args.indexOf('--out');\n\tif (outputFlagIndex === -1) {\n\t\treturn null;\n\t}\n\n\treturn args[outputFlagIndex + 1] ?? null;\n}\n\nfunction printUsage(): void {\n\tprocess.stderr.write('Usage: agent-vm-mcp-portal validate <catalog.json>\\n');\n\tprocess.stderr.write(\n\t\t'Usage: agent-vm-mcp-portal generate-helper <catalog.json> --out <directory>\\n',\n\t);\n}\n\nexport async function runAgentVmMcpPortal(args: readonly string[]): Promise<number> {\n\tconst [command, catalogPath, ...restArgs] = args;\n\tif (!command || !catalogPath) {\n\t\tprintUsage();\n\t\treturn 1;\n\t}\n\n\ttry {\n\t\tconst catalog = await readCatalogFile(catalogPath);\n\t\tswitch (command) {\n\t\t\tcase 'validate':\n\t\t\t\treturn 0;\n\t\t\tcase 'generate-helper': {\n\t\t\t\tconst outputDirectory = parseOutputDirectory(restArgs);\n\t\t\t\tif (!outputDirectory) {\n\t\t\t\t\tprintUsage();\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n\t\t\t\tawait mkdir(outputDirectory, { recursive: true });\n\t\t\t\tawait writeFile(join(outputDirectory, 'catalog.json'), JSON.stringify(catalog, null, '\\t'));\n\t\t\t\tawait writeFile(\n\t\t\t\t\tjoin(outputDirectory, 'catalog.ts'),\n\t\t\t\t\tgenerateTypescriptCatalogArtifact(catalog),\n\t\t\t\t);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tprintUsage();\n\t\t\t\treturn 1;\n\t\t}\n\t} catch (error) {\n\t\tprocess.stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`);\n\t\treturn 1;\n\t}\n}\n\nif (process.argv[1]?.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IAAI,QAAQ,KAAK,IAAI,SAAS,yBAAyB,EACtD,QAAQ,WAAW,MAAM,oBAAoB,QAAQ,KAAK,MAAM,EAAE,CAAC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { McpPortalAgentConfig, SecretValue } from "@agent-vm/config-contracts";
|
|
2
|
-
import { serve } from "@hono/node-server";
|
|
3
|
-
|
|
4
|
-
//#region src/bin/portal-server.d.ts
|
|
5
|
-
type PortalServeFunction = typeof serve;
|
|
6
|
-
type PortalServerLogEvent = {
|
|
7
|
-
readonly agentId: string;
|
|
8
|
-
readonly conservativeCallCount: number;
|
|
9
|
-
readonly event: 'conservative_approval_fallback';
|
|
10
|
-
readonly level: 'warn';
|
|
11
|
-
readonly primaryReason: string;
|
|
12
|
-
readonly strictCallCount: number;
|
|
13
|
-
readonly toolRefs: readonly string[];
|
|
14
|
-
} | {
|
|
15
|
-
readonly event: 'server_error';
|
|
16
|
-
readonly level: 'error';
|
|
17
|
-
readonly message: string;
|
|
18
|
-
readonly stack?: string;
|
|
19
|
-
};
|
|
20
|
-
interface PortalServerLogger {
|
|
21
|
-
readonly log: (event: PortalServerLogEvent) => void;
|
|
22
|
-
}
|
|
23
|
-
interface PortalServerCliArgs {
|
|
24
|
-
readonly agentOverrides: readonly string[];
|
|
25
|
-
readonly configDir: string;
|
|
26
|
-
readonly port?: number;
|
|
27
|
-
}
|
|
28
|
-
interface StartPortalServerProps {
|
|
29
|
-
readonly args: PortalServerCliArgs;
|
|
30
|
-
readonly env: Readonly<Record<string, string | undefined>>;
|
|
31
|
-
readonly logger?: PortalServerLogger;
|
|
32
|
-
readonly resolveSecret?: (secret: SecretValue) => Promise<string>;
|
|
33
|
-
readonly serveFn?: PortalServeFunction;
|
|
34
|
-
}
|
|
35
|
-
declare function parsePortalServerCliArgs(argv: readonly string[]): PortalServerCliArgs;
|
|
36
|
-
declare function applyAgentOverrides(agents: Readonly<Record<string, McpPortalAgentConfig>>, overrides: readonly string[]): Readonly<Record<string, McpPortalAgentConfig>>;
|
|
37
|
-
interface DeferredPort {
|
|
38
|
-
readonly promise: Promise<number>;
|
|
39
|
-
readonly reject: (error: Error) => void;
|
|
40
|
-
readonly resolve: (port: number) => void;
|
|
41
|
-
}
|
|
42
|
-
declare function handlePortalServerError(props: {
|
|
43
|
-
readonly error: Error;
|
|
44
|
-
readonly hasListened: boolean;
|
|
45
|
-
readonly listeningPort: DeferredPort;
|
|
46
|
-
readonly logger: PortalServerLogger;
|
|
47
|
-
}): void;
|
|
48
|
-
declare function startPortalServer(props: StartPortalServerProps): Promise<{
|
|
49
|
-
readonly close: () => Promise<void>;
|
|
50
|
-
readonly port: number;
|
|
51
|
-
}>;
|
|
52
|
-
declare function isPortalServerEntrypoint(importMetaUrl: string, argvEntryPath: string | undefined, realpathFn?: (targetPath: string) => Promise<string>): Promise<boolean>;
|
|
53
|
-
//#endregion
|
|
54
|
-
export { DeferredPort, PortalServerCliArgs, PortalServerLogEvent, PortalServerLogger, StartPortalServerProps, applyAgentOverrides, handlePortalServerError, isPortalServerEntrypoint, parsePortalServerCliArgs, startPortalServer };
|
|
55
|
-
//# sourceMappingURL=portal-server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"portal-server.d.ts","names":[],"sources":["../../src/bin/portal-server.ts"],"mappings":";;;;KAqCK,mBAAA,UAA6B,KAAA;AAAA,KAEtB,oBAAA;EAAA,SAEA,OAAA;EAAA,SACA,qBAAA;EAAA,SACA,KAAA;EAAA,SACA,KAAA;EAAA,SACA,aAAA;EAAA,SACA,eAAA;EAAA,SACA,QAAA;AAAA;EAAA,SAGA,KAAA;EAAA,SACA,KAAA;EAAA,SACA,OAAA;EAAA,SACA,KAAA;AAAA;AAAA,UAGK,kBAAA;EAAA,SACP,GAAA,GAAM,KAAA,EAAO,oBAAA;AAAA;AAAA,UAGN,mBAAA;EAAA,SACP,cAAA;EAAA,SACA,SAAA;EAAA,SACA,IAAA;AAAA;AAAA,UAGO,sBAAA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