@kwonye/mcpx 0.1.104 → 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.
- package/dist/adapters/codex.d.ts +2 -0
- package/dist/adapters/index.d.ts +2 -1
- package/dist/adapters/json.d.ts +26 -0
- package/dist/adapters/pi.d.ts +9 -0
- package/dist/chunk-0xt563m1.js +126 -0
- package/dist/{chunk-s9v1epnk.js → chunk-1mrkz29t.js} +71 -56
- package/dist/{chunk-31brdz5s.js → chunk-1v66g9d6.js} +4 -3
- package/dist/chunk-1yq3yb66.js +126 -0
- package/dist/chunk-27mq4agf.js +33 -0
- package/dist/{chunk-941dqsx2.js → chunk-4aafp444.js} +8175 -8066
- package/dist/chunk-4xym942z.js +36 -0
- package/dist/{chunk-tnhekcpv.js → chunk-56z18csx.js} +1 -1
- package/dist/{chunk-bnbz55g6.js → chunk-65kshh9w.js} +1 -1
- package/dist/{chunk-xydajvzg.js → chunk-7ky3rsw9.js} +1 -1
- package/dist/chunk-7rq88hb3.js +563 -0
- package/dist/chunk-8v13hqrp.js +825 -0
- package/dist/chunk-a2gen8bn.js +730 -0
- package/dist/{chunk-wq4zd3t7.js → chunk-brxwa30j.js} +130 -111
- package/dist/chunk-chaj8a8b.js +45 -0
- package/dist/chunk-e96643mj.js +26 -0
- package/dist/{chunk-02r7k4ax.js → chunk-ew06e41w.js} +12 -6
- package/dist/chunk-ezk8txcy.js +23 -0
- package/dist/{chunk-cqenqnxk.js → chunk-grkz21sq.js} +35 -3
- package/dist/{chunk-12vgqm89.js → chunk-gvjxpk98.js} +1 -1
- package/dist/chunk-h9kp47rp.js +18 -0
- package/dist/chunk-hahs24dv.js +127 -0
- package/dist/{chunk-z34m83m4.js → chunk-jv0s0cp6.js} +5 -3
- package/dist/{chunk-enzmq965.js → chunk-n0462d52.js} +1 -1
- package/dist/chunk-nh6hhv29.js +138 -0
- package/dist/chunk-p7yzyt87.js +19426 -0
- package/dist/chunk-q86c5s6r.js +7 -0
- package/dist/chunk-qf8bj9y7.js +254 -0
- package/dist/chunk-t20f49g3.js +30 -0
- package/dist/{chunk-b58zsdp4.js → chunk-v041118a.js} +17 -5
- package/dist/{chunk-91vcwk5m.js → chunk-v14bg5yp.js} +1 -1
- package/dist/chunk-wvzap0na.js +18166 -0
- package/dist/chunk-wztmp5b4.js +30479 -0
- package/dist/chunk-xvqr1q9b.js +14 -0
- package/dist/{chunk-0xhdyt4z.js → chunk-yj7mpczw.js} +17 -5
- package/dist/chunk-yr0txkw0.js +31 -0
- package/dist/cli.js +3977 -1045
- package/dist/core/adoption.d.ts +62 -0
- package/dist/core/analytics.d.ts +17 -0
- package/dist/core/consumers.d.ts +8 -0
- package/dist/core/control.d.ts +12 -0
- package/dist/core/daemon.d.ts +2 -2
- package/dist/core/file-state.d.ts +5 -0
- package/dist/core/harnesses.d.ts +25 -0
- package/dist/core/index.d.ts +17 -7
- package/dist/core/index.js +128 -62
- package/dist/core/managed-index-lock.d.ts +1 -1
- package/dist/core/management.d.ts +32 -0
- package/dist/core/native-document.d.ts +4 -0
- package/dist/core/operations.d.ts +52 -0
- package/dist/core/paths.d.ts +2 -0
- package/dist/core/plugin-manager.d.ts +4 -1
- package/dist/core/plugin-projections.d.ts +1 -0
- package/dist/core/runtime-entry.d.ts +6 -0
- package/dist/core/runtime-snapshot.d.ts +6 -0
- package/dist/core/secret-keychain.d.ts +31 -0
- package/dist/core/secrets.d.ts +12 -2
- package/dist/core/served-skills.d.ts +62 -0
- package/dist/core/share.d.ts +71 -0
- package/dist/core/skills.d.ts +7 -0
- package/dist/core/status.d.ts +1 -0
- package/dist/core/sync-plan.d.ts +14 -0
- package/dist/core/sync.d.ts +3 -0
- package/dist/core/telemetry.d.ts +2 -2
- package/dist/core/tui.d.ts +20 -0
- package/dist/core/verify-upstreams.d.ts +4 -0
- package/dist/core/work-limiter.d.ts +10 -0
- package/dist/gateway/server.d.ts +2 -0
- package/dist/types.d.ts +72 -1
- package/dist/util/fs.d.ts +2 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/adapters/opencode.d.ts +0 -11
- package/dist/chunk-cz8cdmw1.js +0 -344
- package/dist/chunk-z1k63fa3.js +0 -3760
package/dist/adapters/codex.d.ts
CHANGED
|
@@ -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
|
}
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
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-
|
|
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 =
|
|
35
|
-
name:
|
|
36
|
-
email:
|
|
37
|
-
url:
|
|
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 =
|
|
40
|
-
name:
|
|
41
|
-
displayName:
|
|
42
|
-
description:
|
|
43
|
-
version:
|
|
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:
|
|
46
|
-
category:
|
|
47
|
-
tags:
|
|
48
|
-
keywords:
|
|
49
|
-
source:
|
|
50
|
-
skills:
|
|
51
|
-
commands:
|
|
52
|
-
agents:
|
|
53
|
-
hooks:
|
|
54
|
-
mcpServers:
|
|
55
|
-
lspServers:
|
|
56
|
-
apps:
|
|
57
|
-
settings:
|
|
58
|
-
outputStyles:
|
|
59
|
-
dependencies:
|
|
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 =
|
|
62
|
-
name:
|
|
68
|
+
var claudeCatalogSchema = exports_external.object({
|
|
69
|
+
name: exports_external.string().min(1),
|
|
63
70
|
owner: authorSchema,
|
|
64
|
-
plugins:
|
|
71
|
+
plugins: exports_external.array(claudeEntrySchema)
|
|
65
72
|
}).passthrough();
|
|
66
|
-
var codexEntrySchema =
|
|
67
|
-
name:
|
|
68
|
-
source:
|
|
69
|
-
category:
|
|
70
|
-
policy:
|
|
71
|
-
installation:
|
|
72
|
-
authentication:
|
|
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 =
|
|
76
|
-
name:
|
|
77
|
-
interface:
|
|
78
|
-
plugins:
|
|
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 =
|
|
237
|
-
source:
|
|
238
|
-
repo:
|
|
239
|
-
url:
|
|
240
|
-
path:
|
|
241
|
-
ref:
|
|
242
|
-
sha:
|
|
243
|
-
package:
|
|
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,16 +536,20 @@ async function installMarketplacePlugin(id) {
|
|
|
527
536
|
approvals[capability] = true;
|
|
528
537
|
}
|
|
529
538
|
const manager = new PluginManager;
|
|
530
|
-
|
|
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];
|
|
538
549
|
if (!plugin?.marketplace)
|
|
539
550
|
throw new Error(`Plugin ${pluginId} is not marketplace-managed`);
|
|
551
|
+
if (plugin.pinned)
|
|
552
|
+
throw new Error(`Plugin ${pluginId} is pinned; unpin it before updating`);
|
|
540
553
|
const qualified = `${plugin.marketplace.pluginName}@${plugin.marketplace.name}`;
|
|
541
554
|
try {
|
|
542
555
|
const detail = await inspectMarketplacePlugin(qualified);
|
|
@@ -552,7 +565,9 @@ async function updateMarketplaceInstalledPlugin(pluginId, sync = true) {
|
|
|
552
565
|
if (!entry)
|
|
553
566
|
throw new Error(`Plugin ${qualified} is no longer listed`);
|
|
554
567
|
const source = resolveMarketplacePluginSource(catalog, entry);
|
|
555
|
-
|
|
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;
|
|
556
571
|
} catch (error) {
|
|
557
572
|
await mutateConfig((config) => {
|
|
558
573
|
const current = config.plugins?.[pluginId];
|
|
@@ -578,7 +593,7 @@ async function refreshMarketplaceWithPlugins(name) {
|
|
|
578
593
|
}
|
|
579
594
|
}
|
|
580
595
|
if (updated.length > 0) {
|
|
581
|
-
const { pluginSync } = await import("./chunk-
|
|
596
|
+
const { pluginSync } = await import("./chunk-v041118a.js");
|
|
582
597
|
await pluginSync();
|
|
583
598
|
}
|
|
584
599
|
return { marketplace, updated, errors };
|
|
@@ -600,4 +615,4 @@ async function refreshAutoUpdateMarketplaces() {
|
|
|
600
615
|
|
|
601
616
|
export { resolveMarketplacePluginSource, listMarketplaces, addMarketplace, refreshMarketplace, setMarketplaceAutoUpdate, removeMarketplace, listMarketplacePlugins, inspectMarketplacePlugin, installMarketplacePlugin, updateMarketplaceInstalledPlugin, refreshMarketplaceWithPlugins, refreshAutoUpdateMarketplaces };
|
|
602
617
|
|
|
603
|
-
//# debugId=
|
|
618
|
+
//# debugId=CA752DBB3B8B9C7764756E2164756E21
|
|
@@ -8,8 +8,9 @@ import {
|
|
|
8
8
|
resolveActiveConfig,
|
|
9
9
|
saveConfig,
|
|
10
10
|
saveProjectConfig
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import"./chunk-
|
|
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=
|
|
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
|