@kwonye/mcpx 0.1.105 → 0.1.106

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.
Files changed (75) hide show
  1. package/dist/adapters/codex.d.ts +2 -0
  2. package/dist/adapters/index.d.ts +2 -1
  3. package/dist/adapters/json.d.ts +26 -0
  4. package/dist/adapters/pi.d.ts +9 -0
  5. package/dist/chunk-0xt563m1.js +126 -0
  6. package/dist/{chunk-btbww96n.js → chunk-1mrkz29t.js} +69 -56
  7. package/dist/{chunk-6mxr34tc.js → chunk-1v66g9d6.js} +4 -3
  8. package/dist/chunk-1yq3yb66.js +126 -0
  9. package/dist/chunk-27mq4agf.js +33 -0
  10. package/dist/{chunk-t4hqf6yh.js → chunk-4aafp444.js} +8136 -8262
  11. package/dist/chunk-4xym942z.js +36 -0
  12. package/dist/{chunk-tnhekcpv.js → chunk-56z18csx.js} +1 -1
  13. package/dist/{chunk-bnbz55g6.js → chunk-65kshh9w.js} +1 -1
  14. package/dist/{chunk-xydajvzg.js → chunk-7ky3rsw9.js} +1 -1
  15. package/dist/chunk-7rq88hb3.js +563 -0
  16. package/dist/chunk-8v13hqrp.js +825 -0
  17. package/dist/chunk-a2gen8bn.js +730 -0
  18. package/dist/{chunk-01s7rhx3.js → chunk-brxwa30j.js} +130 -113
  19. package/dist/chunk-chaj8a8b.js +45 -0
  20. package/dist/chunk-e96643mj.js +26 -0
  21. package/dist/{chunk-d2v9rxy0.js → chunk-ew06e41w.js} +12 -6
  22. package/dist/chunk-ezk8txcy.js +23 -0
  23. package/dist/{chunk-4y0t0tfj.js → chunk-grkz21sq.js} +29 -3
  24. package/dist/{chunk-12vgqm89.js → chunk-gvjxpk98.js} +1 -1
  25. package/dist/chunk-h9kp47rp.js +18 -0
  26. package/dist/chunk-hahs24dv.js +127 -0
  27. package/dist/{chunk-y9a1rx7j.js → chunk-jv0s0cp6.js} +5 -3
  28. package/dist/{chunk-enzmq965.js → chunk-n0462d52.js} +1 -1
  29. package/dist/chunk-nh6hhv29.js +138 -0
  30. package/dist/chunk-p7yzyt87.js +19426 -0
  31. package/dist/chunk-q86c5s6r.js +7 -0
  32. package/dist/chunk-qf8bj9y7.js +254 -0
  33. package/dist/chunk-t20f49g3.js +30 -0
  34. package/dist/{chunk-am903qjk.js → chunk-v041118a.js} +11 -5
  35. package/dist/{chunk-91vcwk5m.js → chunk-v14bg5yp.js} +1 -1
  36. package/dist/chunk-wvzap0na.js +18166 -0
  37. package/dist/chunk-wztmp5b4.js +30479 -0
  38. package/dist/chunk-xvqr1q9b.js +14 -0
  39. package/dist/{chunk-h158rkts.js → chunk-yj7mpczw.js} +17 -5
  40. package/dist/chunk-yr0txkw0.js +31 -0
  41. package/dist/cli.js +3879 -1061
  42. package/dist/core/adoption.d.ts +62 -0
  43. package/dist/core/analytics.d.ts +17 -0
  44. package/dist/core/consumers.d.ts +8 -0
  45. package/dist/core/control.d.ts +12 -0
  46. package/dist/core/daemon.d.ts +2 -2
  47. package/dist/core/file-state.d.ts +5 -0
  48. package/dist/core/harnesses.d.ts +25 -0
  49. package/dist/core/index.d.ts +12 -4
  50. package/dist/core/index.js +109 -71
  51. package/dist/core/managed-index-lock.d.ts +1 -1
  52. package/dist/core/management.d.ts +32 -0
  53. package/dist/core/native-document.d.ts +4 -0
  54. package/dist/core/operations.d.ts +52 -0
  55. package/dist/core/plugin-projections.d.ts +1 -0
  56. package/dist/core/runtime-entry.d.ts +6 -0
  57. package/dist/core/runtime-snapshot.d.ts +6 -0
  58. package/dist/core/secret-keychain.d.ts +31 -0
  59. package/dist/core/secrets.d.ts +12 -2
  60. package/dist/core/served-skills.d.ts +62 -0
  61. package/dist/core/status.d.ts +1 -0
  62. package/dist/core/sync-plan.d.ts +14 -0
  63. package/dist/core/sync.d.ts +3 -0
  64. package/dist/core/telemetry.d.ts +2 -2
  65. package/dist/core/tui.d.ts +20 -0
  66. package/dist/core/verify-upstreams.d.ts +4 -0
  67. package/dist/core/work-limiter.d.ts +10 -0
  68. package/dist/gateway/server.d.ts +2 -0
  69. package/dist/types.d.ts +62 -1
  70. package/dist/util/fs.d.ts +2 -0
  71. package/dist/version.d.ts +1 -1
  72. package/package.json +1 -1
  73. package/dist/adapters/opencode.d.ts +0 -11
  74. package/dist/chunk-56whm3hm.js +0 -4055
  75. package/dist/chunk-fw8dyt89.js +0 -344
@@ -5,6 +5,8 @@ export declare class CodexAdapter implements ClientAdapter {
5
5
  supportsHttp(): boolean;
6
6
  syncPlugins(plugins: PluginSyncInput[]): PluginSyncResult;
7
7
  syncSkills(skills: Skill[]): void;
8
+ skillDirectory(): string;
9
+ additionalSkillDirectories(): string[];
8
10
  scanForImports(_config: McpxConfig, managedIndex: ManagedIndex): import("../types.js").ClientImportScanResult;
9
11
  syncGateway(_config: McpxConfig, options: SyncClientOptions): SyncResult;
10
12
  }
@@ -1,3 +1,4 @@
1
- import type { ClientAdapter } from "../types.js";
1
+ import type { ClientAdapter, HarnessDescriptor } from "../types.js";
2
+ export declare function registerHarness(id: string, factory: () => ClientAdapter, descriptor?: HarnessDescriptor): void;
2
3
  export declare function getAdapters(): ClientAdapter[];
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,26 @@
1
+ import type { ClientAdapter, ManagedIndex, McpxConfig, SyncClientOptions, SyncResult, Skill, PluginSyncInput } from "../types.js";
2
+ export declare function readNativeJson(file: string): Record<string, any>;
3
+ export interface JsonHarnessOptions {
4
+ id: string;
5
+ configPath: () => string;
6
+ skillsPath: () => string;
7
+ format?: "opencode" | "standard";
8
+ }
9
+ /** Shared codec; a new JSON harness supplies paths and its native format. */
10
+ export declare class JsonHarnessAdapter implements ClientAdapter {
11
+ readonly options: JsonHarnessOptions;
12
+ readonly id: string;
13
+ constructor(options: JsonHarnessOptions);
14
+ detectConfigPath(): string;
15
+ supportsHttp(): boolean;
16
+ skillDirectory(): string;
17
+ syncSkills(skills: Skill[]): void;
18
+ syncPlugins(plugins: PluginSyncInput[]): import("../types.js").PluginSyncResult;
19
+ private get key();
20
+ scanForImports(_config: McpxConfig, index: ManagedIndex): import("../types.js").ClientImportScanResult;
21
+ syncGateway(_config: McpxConfig, options: SyncClientOptions): SyncResult;
22
+ }
23
+ export declare class OpenCodeAdapter extends JsonHarnessAdapter {
24
+ constructor();
25
+ }
26
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { JsonHarnessAdapter } from "./json.js";
2
+ import type { McpxConfig, SyncClientOptions, SyncResult } from "../types.js";
3
+ export declare class PiAdapter extends JsonHarnessAdapter {
4
+ constructor(projectPath?: string);
5
+ additionalSkillDirectories(): string[];
6
+ managedName(name: string): string;
7
+ syncGateway(config: McpxConfig, options: SyncClientOptions): SyncResult;
8
+ }
9
+ //# sourceMappingURL=pi.d.ts.map
@@ -0,0 +1,126 @@
1
+ // src/core/server-auth.ts
2
+ function normalizeNamePart(value) {
3
+ return value.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "_").replace(/^_+|_+$/g, "") || "value";
4
+ }
5
+ function requireNonEmpty(value, label) {
6
+ const normalized = value?.trim();
7
+ if (!normalized) {
8
+ throw new Error(`${label} must be non-empty.`);
9
+ }
10
+ return normalized;
11
+ }
12
+ function toSecretRef(secretName) {
13
+ return `secret://${secretName}`;
14
+ }
15
+ function secretRefName(ref) {
16
+ if (!ref.startsWith("secret://")) {
17
+ return null;
18
+ }
19
+ const name = ref.slice("secret://".length).trim();
20
+ return name.length > 0 ? name : null;
21
+ }
22
+ function defaultAuthSecretName(serverName, target) {
23
+ return `auth_${normalizeNamePart(serverName)}_${target.kind}_${normalizeNamePart(target.key)}`;
24
+ }
25
+ function resolveAuthTarget(spec, header, env) {
26
+ if (spec.transport === "http") {
27
+ if (env) {
28
+ throw new Error("--env is only valid for stdio upstreams.");
29
+ }
30
+ return {
31
+ kind: "header",
32
+ key: requireNonEmpty(header ?? "Authorization", "Header name")
33
+ };
34
+ }
35
+ if (header) {
36
+ throw new Error("--header is only valid for HTTP upstreams.");
37
+ }
38
+ return {
39
+ kind: "env",
40
+ key: requireEnvName(env)
41
+ };
42
+ }
43
+ function requireEnvName(value) {
44
+ const name = requireNonEmpty(value, "Env var name");
45
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name))
46
+ throw new Error("Invalid environment variable name.");
47
+ return name;
48
+ }
49
+ function applyAuthReference(spec, target, secretRef) {
50
+ if (target.kind === "header") {
51
+ if (spec.transport !== "http") {
52
+ throw new Error(`Cannot set header auth on ${spec.transport} upstream.`);
53
+ }
54
+ const headers = { ...spec.headers ?? {} };
55
+ for (const key of Object.keys(headers)) {
56
+ if (key.toLowerCase() === target.key.toLowerCase())
57
+ delete headers[key];
58
+ }
59
+ headers[target.key] = secretRef;
60
+ spec.headers = headers;
61
+ return;
62
+ }
63
+ if (spec.transport !== "stdio") {
64
+ throw new Error(`Cannot set env auth on ${spec.transport} upstream.`);
65
+ }
66
+ const env = { ...spec.env ?? {} };
67
+ env[target.key] = secretRef;
68
+ spec.env = env;
69
+ }
70
+ function removeAuthReference(spec, target) {
71
+ if (target.kind === "header") {
72
+ if (spec.transport !== "http") {
73
+ throw new Error(`Cannot remove header auth from ${spec.transport} upstream.`);
74
+ }
75
+ if (!spec.headers || !(target.key in spec.headers)) {
76
+ return null;
77
+ }
78
+ const previous2 = spec.headers[target.key] ?? null;
79
+ const next2 = { ...spec.headers };
80
+ delete next2[target.key];
81
+ spec.headers = Object.keys(next2).length > 0 ? next2 : undefined;
82
+ return previous2;
83
+ }
84
+ if (spec.transport !== "stdio") {
85
+ throw new Error(`Cannot remove env auth from ${spec.transport} upstream.`);
86
+ }
87
+ if (!spec.env || !(target.key in spec.env)) {
88
+ return null;
89
+ }
90
+ const previous = spec.env[target.key] ?? null;
91
+ const next = { ...spec.env };
92
+ delete next[target.key];
93
+ spec.env = Object.keys(next).length > 0 ? next : undefined;
94
+ return previous;
95
+ }
96
+ function listAuthBindings(spec) {
97
+ if (spec.transport === "http") {
98
+ return Object.entries(spec.headers ?? {}).map(([key, value]) => ({
99
+ kind: "header",
100
+ key,
101
+ value
102
+ }));
103
+ }
104
+ return Object.entries(spec.env ?? {}).map(([key, value]) => ({
105
+ kind: "env",
106
+ key,
107
+ value
108
+ }));
109
+ }
110
+ var TOKEN68 = /^[A-Za-z0-9\-._~+/]+=*$/;
111
+ function maybePrefixBearer(target, value, raw = false) {
112
+ if (raw || target.kind !== "header" || target.key.toLowerCase() !== "authorization") {
113
+ return value;
114
+ }
115
+ if (/^\S+\s+\S+/.test(value)) {
116
+ return value;
117
+ }
118
+ if (TOKEN68.test(value)) {
119
+ return `Bearer ${value}`;
120
+ }
121
+ return value;
122
+ }
123
+
124
+ export { toSecretRef, secretRefName, defaultAuthSecretName, resolveAuthTarget, applyAuthReference, removeAuthReference, listAuthBindings, maybePrefixBearer };
125
+
126
+ //# debugId=DF42F5BEBE285FB064756E2164756E21
@@ -1,19 +1,27 @@
1
1
  import {
2
- PluginCache,
3
2
  PluginManager,
3
+ capture,
4
4
  discoverComponents,
5
5
  hasManifest,
6
- mutateConfig,
7
6
  readManifest,
8
7
  uninstallPlugin
9
- } from "./chunk-56whm3hm.js";
8
+ } from "./chunk-4aafp444.js";
9
+ import {
10
+ mutateConfig
11
+ } from "./chunk-hahs24dv.js";
12
+ import {
13
+ PluginCache
14
+ } from "./chunk-7rq88hb3.js";
10
15
  import {
11
16
  loadConfig
12
- } from "./chunk-01s7rhx3.js";
17
+ } from "./chunk-brxwa30j.js";
18
+ import {
19
+ exports_external
20
+ } from "./chunk-p7yzyt87.js";
13
21
  import {
14
22
  ensureDir,
15
23
  getMarketplaceCacheRoot
16
- } from "./chunk-4y0t0tfj.js";
24
+ } from "./chunk-grkz21sq.js";
17
25
  import {
18
26
  __require
19
27
  } from "./chunk-wj4tjacg.js";
@@ -25,57 +33,56 @@ import os from "node:os";
25
33
  import path from "node:path";
26
34
  import { execFile } from "node:child_process";
27
35
  import { promisify } from "node:util";
28
- import { z } from "zod";
29
36
  var execFileAsync = promisify(execFile);
30
37
  var CLAUDE_MANIFEST = ".claude-plugin/marketplace.json";
31
38
  var CODEX_MANIFEST = ".agents/plugins/marketplace.json";
32
39
  var SUPPORTED = new Set(["skills", "commands", "agents", "hooks", "mcpServers"]);
33
40
  var UNSUPPORTED = new Set(["apps", "lspServers", "settings", "outputStyles", "dependencies"]);
34
- var authorSchema = z.object({
35
- name: z.string(),
36
- email: z.string().optional(),
37
- url: z.string().optional()
41
+ var authorSchema = exports_external.object({
42
+ name: exports_external.string(),
43
+ email: exports_external.string().optional(),
44
+ url: exports_external.string().optional()
38
45
  }).passthrough();
39
- var claudeEntrySchema = z.object({
40
- name: z.string().min(1),
41
- displayName: z.string().optional(),
42
- description: z.string().optional(),
43
- version: z.string().optional(),
46
+ var claudeEntrySchema = exports_external.object({
47
+ name: exports_external.string().min(1),
48
+ displayName: exports_external.string().optional(),
49
+ description: exports_external.string().optional(),
50
+ version: exports_external.string().optional(),
44
51
  author: authorSchema.optional(),
45
- homepage: z.string().optional(),
46
- category: z.string().optional(),
47
- tags: z.array(z.string()).optional(),
48
- keywords: z.array(z.string()).optional(),
49
- source: z.unknown(),
50
- skills: z.unknown().optional(),
51
- commands: z.unknown().optional(),
52
- agents: z.unknown().optional(),
53
- hooks: z.unknown().optional(),
54
- mcpServers: z.unknown().optional(),
55
- lspServers: z.unknown().optional(),
56
- apps: z.unknown().optional(),
57
- settings: z.unknown().optional(),
58
- outputStyles: z.unknown().optional(),
59
- dependencies: z.unknown().optional()
52
+ homepage: exports_external.string().optional(),
53
+ category: exports_external.string().optional(),
54
+ tags: exports_external.array(exports_external.string()).optional(),
55
+ keywords: exports_external.array(exports_external.string()).optional(),
56
+ source: exports_external.unknown(),
57
+ skills: exports_external.unknown().optional(),
58
+ commands: exports_external.unknown().optional(),
59
+ agents: exports_external.unknown().optional(),
60
+ hooks: exports_external.unknown().optional(),
61
+ mcpServers: exports_external.unknown().optional(),
62
+ lspServers: exports_external.unknown().optional(),
63
+ apps: exports_external.unknown().optional(),
64
+ settings: exports_external.unknown().optional(),
65
+ outputStyles: exports_external.unknown().optional(),
66
+ dependencies: exports_external.unknown().optional()
60
67
  }).passthrough();
61
- var claudeCatalogSchema = z.object({
62
- name: z.string().min(1),
68
+ var claudeCatalogSchema = exports_external.object({
69
+ name: exports_external.string().min(1),
63
70
  owner: authorSchema,
64
- plugins: z.array(claudeEntrySchema)
71
+ plugins: exports_external.array(claudeEntrySchema)
65
72
  }).passthrough();
66
- var codexEntrySchema = z.object({
67
- name: z.string().min(1),
68
- source: z.unknown(),
69
- category: z.string().optional(),
70
- policy: z.object({
71
- installation: z.string().optional(),
72
- authentication: z.string().optional()
73
+ var codexEntrySchema = exports_external.object({
74
+ name: exports_external.string().min(1),
75
+ source: exports_external.unknown(),
76
+ category: exports_external.string().optional(),
77
+ policy: exports_external.object({
78
+ installation: exports_external.string().optional(),
79
+ authentication: exports_external.string().optional()
73
80
  }).passthrough().optional()
74
81
  }).passthrough();
75
- var codexCatalogSchema = z.object({
76
- name: z.string().min(1),
77
- interface: z.object({ displayName: z.string().optional() }).passthrough().optional(),
78
- plugins: z.array(codexEntrySchema)
82
+ var codexCatalogSchema = exports_external.object({
83
+ name: exports_external.string().min(1),
84
+ interface: exports_external.object({ displayName: exports_external.string().optional() }).passthrough().optional(),
85
+ plugins: exports_external.array(codexEntrySchema)
79
86
  }).passthrough();
80
87
  function sourceKey(source) {
81
88
  return crypto.createHash("sha256").update(source).digest("hex").slice(0, 20);
@@ -233,14 +240,14 @@ function resolveMarketplacePluginSource(catalog, entry) {
233
240
  throw new Error(`Unsupported marketplace plugin source: ${value}`);
234
241
  return { type: "local", original: resolveContained(catalog.root, value) };
235
242
  }
236
- const source = z.object({
237
- source: z.string(),
238
- repo: z.string().optional(),
239
- url: z.string().optional(),
240
- path: z.string().optional(),
241
- ref: z.string().optional(),
242
- sha: z.string().optional(),
243
- package: z.string().optional()
243
+ const source = exports_external.object({
244
+ source: exports_external.string(),
245
+ repo: exports_external.string().optional(),
246
+ url: exports_external.string().optional(),
247
+ path: exports_external.string().optional(),
248
+ ref: exports_external.string().optional(),
249
+ sha: exports_external.string().optional(),
250
+ package: exports_external.string().optional()
244
251
  }).passthrough().parse(value);
245
252
  if (source.source === "local") {
246
253
  if (!source.path)
@@ -387,6 +394,7 @@ async function addMarketplace(source, manifestPath) {
387
394
  throw new Error(`Built-in marketplace ${catalog.name} cannot be replaced`);
388
395
  fresh.marketplaces[catalog.name] = marketplace;
389
396
  });
397
+ capture("marketplace_added", { source_type: marketplace.sourceType, format: marketplace.format });
390
398
  return marketplace;
391
399
  }
392
400
  async function refreshMarketplace(name) {
@@ -451,6 +459,7 @@ async function removeMarketplace(name) {
451
459
  await mutateConfig((fresh) => {
452
460
  delete fresh.marketplaces?.[name];
453
461
  });
462
+ capture("marketplace_removed", { source_type: marketplace.sourceType, installed_plugin_count: installed.length });
454
463
  }
455
464
  async function listMarketplacePlugins(query) {
456
465
  const initial = await listMarketplaces();
@@ -527,11 +536,13 @@ async function installMarketplacePlugin(id) {
527
536
  approvals[capability] = true;
528
537
  }
529
538
  const manager = new PluginManager;
530
- return manager.installResolvedPlugin(source, {
539
+ const installed = await manager.installResolvedPlugin(source, {
531
540
  name: pluginName,
532
541
  approvals,
533
542
  marketplace: { name: marketplaceName, pluginName, sourceFingerprint: detail.sourceFingerprint }
534
543
  });
544
+ capture("plugin_installed", { marketplace: marketplaceName, capabilities: detail.supportedCapabilities });
545
+ return installed;
535
546
  }
536
547
  async function updateMarketplaceInstalledPlugin(pluginId, sync = true) {
537
548
  const plugin = loadConfig().plugins?.[pluginId];
@@ -554,7 +565,9 @@ async function updateMarketplaceInstalledPlugin(pluginId, sync = true) {
554
565
  if (!entry)
555
566
  throw new Error(`Plugin ${qualified} is no longer listed`);
556
567
  const source = resolveMarketplacePluginSource(catalog, entry);
557
- return await new PluginManager().updateResolvedPlugin(pluginId, source, detail.sourceFingerprint, sync);
568
+ const updated = await new PluginManager().updateResolvedPlugin(pluginId, source, detail.sourceFingerprint, sync);
569
+ capture("plugin_updated", { marketplace: plugin.marketplace.name, plugin_name: plugin.marketplace.pluginName });
570
+ return updated;
558
571
  } catch (error) {
559
572
  await mutateConfig((config) => {
560
573
  const current = config.plugins?.[pluginId];
@@ -580,7 +593,7 @@ async function refreshMarketplaceWithPlugins(name) {
580
593
  }
581
594
  }
582
595
  if (updated.length > 0) {
583
- const { pluginSync } = await import("./chunk-am903qjk.js");
596
+ const { pluginSync } = await import("./chunk-v041118a.js");
584
597
  await pluginSync();
585
598
  }
586
599
  return { marketplace, updated, errors };
@@ -602,4 +615,4 @@ async function refreshAutoUpdateMarketplaces() {
602
615
 
603
616
  export { resolveMarketplacePluginSource, listMarketplaces, addMarketplace, refreshMarketplace, setMarketplaceAutoUpdate, removeMarketplace, listMarketplacePlugins, inspectMarketplacePlugin, installMarketplacePlugin, updateMarketplaceInstalledPlugin, refreshMarketplaceWithPlugins, refreshAutoUpdateMarketplaces };
604
617
 
605
- //# debugId=347C06BDB5A3194064756E2164756E21
618
+ //# debugId=CA752DBB3B8B9C7764756E2164756E21
@@ -8,8 +8,9 @@ import {
8
8
  resolveActiveConfig,
9
9
  saveConfig,
10
10
  saveProjectConfig
11
- } from "./chunk-01s7rhx3.js";
12
- import"./chunk-4y0t0tfj.js";
11
+ } from "./chunk-brxwa30j.js";
12
+ import"./chunk-p7yzyt87.js";
13
+ import"./chunk-grkz21sq.js";
13
14
  import"./chunk-bjw71y54.js";
14
15
  import"./chunk-wj4tjacg.js";
15
16
  export {
@@ -24,4 +25,4 @@ export {
24
25
  saveProjectConfig
25
26
  };
26
27
 
27
- //# debugId=D849CB34D71D1D5364756E2164756E21
28
+ //# debugId=A8828D397F34F54064756E2164756E21
@@ -0,0 +1,126 @@
1
+ // src/core/registry-client.ts
2
+ var REGISTRY_BASE = "https://registry.modelcontextprotocol.io";
3
+ async function fetchRegistryServerDetail(name) {
4
+ const encoded = encodeURIComponent(name);
5
+ const response = await fetch(`${REGISTRY_BASE}/v0.1/servers/${encoded}/versions/latest`, {
6
+ headers: { accept: "application/json" }
7
+ });
8
+ if (!response.ok) {
9
+ throw new Error(`Registry API error: ${response.status}`);
10
+ }
11
+ const data = await response.json();
12
+ return data.server;
13
+ }
14
+ var PACKAGE_PRIORITY = {
15
+ npm: 1,
16
+ pypi: 2,
17
+ nuget: 3,
18
+ oci: 4,
19
+ mcpb: 5
20
+ };
21
+ var RUNTIME_HINT = {
22
+ npm: "npx",
23
+ pypi: "uvx",
24
+ nuget: "dnx"
25
+ };
26
+ function selectBestPackage(packages = [], remotes = []) {
27
+ const stdioPkgs = packages.filter((p) => p.transport.type === "stdio").sort((a, b) => (PACKAGE_PRIORITY[a.registryType] ?? 99) - (PACKAGE_PRIORITY[b.registryType] ?? 99));
28
+ if (stdioPkgs.length > 0) {
29
+ return { kind: "package", package: stdioPkgs[0] };
30
+ }
31
+ const httpRemotes = remotes.filter((r) => r.type === "streamable-http");
32
+ if (httpRemotes.length > 0) {
33
+ return { kind: "remote", remote: httpRemotes[0] };
34
+ }
35
+ if (packages.length > 0) {
36
+ return { kind: "package", package: packages[0] };
37
+ }
38
+ if (remotes.length > 0) {
39
+ throw new Error("Server has no MCP v2-compatible streamable HTTP remote");
40
+ }
41
+ throw new Error("Server has no packages or remotes");
42
+ }
43
+ function extractRequiredInputs(option) {
44
+ const inputs = [];
45
+ if (option.kind === "package" && option.package?.environmentVariables) {
46
+ for (const env of option.package.environmentVariables) {
47
+ if (env.isRequired && !env.default) {
48
+ inputs.push({
49
+ name: env.name,
50
+ description: env.description,
51
+ isSecret: env.isSecret ?? false,
52
+ kind: "env"
53
+ });
54
+ }
55
+ }
56
+ for (const arg of option.package.packageArguments ?? []) {
57
+ if (arg.isRequired && !arg.value && !arg.default) {
58
+ inputs.push({
59
+ name: arg.name ?? arg.valueHint ?? "arg",
60
+ description: arg.description,
61
+ isSecret: false,
62
+ kind: "arg"
63
+ });
64
+ }
65
+ }
66
+ }
67
+ if (option.kind === "remote" && option.remote?.headers) {
68
+ for (const header of option.remote.headers) {
69
+ if (header.isRequired && !header.default) {
70
+ inputs.push({
71
+ name: header.name,
72
+ description: header.description,
73
+ isSecret: header.isSecret ?? false,
74
+ kind: "header"
75
+ });
76
+ }
77
+ }
78
+ }
79
+ return inputs;
80
+ }
81
+ function mapRegistryToSpec(_name, option, resolvedValues) {
82
+ if (option.kind === "remote") {
83
+ const headers = {};
84
+ for (const header of option.remote?.headers ?? []) {
85
+ const value = resolvedValues[header.name] ?? header.default;
86
+ if (value)
87
+ headers[header.name] = value;
88
+ }
89
+ return {
90
+ transport: "http",
91
+ url: option.remote.url,
92
+ ...Object.keys(headers).length > 0 ? { headers } : {}
93
+ };
94
+ }
95
+ const pkg = option.package;
96
+ const runtime = pkg.runtimeHint ?? RUNTIME_HINT[pkg.registryType] ?? "npx";
97
+ const args = [];
98
+ const identifier = pkg.version ? `${pkg.identifier}@${pkg.version}` : pkg.identifier;
99
+ args.push(identifier);
100
+ for (const arg of pkg.packageArguments ?? []) {
101
+ const value = arg.value ?? resolvedValues[arg.name ?? arg.valueHint ?? ""] ?? arg.default;
102
+ if (!value)
103
+ continue;
104
+ if (arg.type === "named" && arg.name) {
105
+ args.push(arg.name, value);
106
+ } else {
107
+ args.push(value);
108
+ }
109
+ }
110
+ const env = {};
111
+ for (const envVar of pkg.environmentVariables ?? []) {
112
+ const value = resolvedValues[envVar.name] ?? envVar.default;
113
+ if (value)
114
+ env[envVar.name] = value;
115
+ }
116
+ return {
117
+ transport: "stdio",
118
+ command: runtime,
119
+ args,
120
+ ...Object.keys(env).length > 0 ? { env } : {}
121
+ };
122
+ }
123
+
124
+ export { fetchRegistryServerDetail, selectBestPackage, extractRequiredInputs, mapRegistryToSpec };
125
+
126
+ //# debugId=E7449C596396DD3864756E2164756E21
@@ -0,0 +1,33 @@
1
+ import {
2
+ customizeSkill,
3
+ deleteSkill,
4
+ getSkill,
5
+ installSkillFromSource,
6
+ listSkills,
7
+ pinSkill,
8
+ rollbackSkill,
9
+ saveSkill,
10
+ unpinSkill,
11
+ updateSkill,
12
+ validateSkillPackage
13
+ } from "./chunk-7rq88hb3.js";
14
+ import"./chunk-brxwa30j.js";
15
+ import"./chunk-p7yzyt87.js";
16
+ import"./chunk-grkz21sq.js";
17
+ import"./chunk-bjw71y54.js";
18
+ import"./chunk-wj4tjacg.js";
19
+ export {
20
+ customizeSkill,
21
+ deleteSkill,
22
+ getSkill,
23
+ installSkillFromSource,
24
+ listSkills,
25
+ pinSkill,
26
+ rollbackSkill,
27
+ saveSkill,
28
+ unpinSkill,
29
+ updateSkill,
30
+ validateSkillPackage
31
+ };
32
+
33
+ //# debugId=BC52D079DB4EE42C64756E2164756E21