@yawlabs/mcph 0.47.2 → 0.47.3
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 +0 -4
- package/dist/index.js +49 -212
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -302,10 +302,6 @@ When both exist, the project guide is appended after the user guide with a `---`
|
|
|
302
302
|
|
|
303
303
|
When a server fails to start with stderr like `GITHUB_TOKEN is required` and your client advertises the MCP [elicitation](https://modelcontextprotocol.io/specification/server/elicitation) capability, mcph prompts you for the missing value inline and retries the load. Values stay in-memory for the current mcph session only — persist them in the mcp.hosting dashboard if you want them across restarts.
|
|
304
304
|
|
|
305
|
-
### Test from the dashboard
|
|
306
|
-
|
|
307
|
-
The `/dashboard/connect` page in mcp.hosting has a **Test** button per server that loads it through your running mcph and shows pass/fail inline — no LLM round-trip needed. Useful when you've just added a server and want to confirm the token works without prompting your AI.
|
|
308
|
-
|
|
309
305
|
### Errors come with deep-links
|
|
310
306
|
|
|
311
307
|
When a load fails (missing token, runtime not on PATH, server crashes on init), mcph emits a message ending with `→ Edit at https://mcp.hosting/dashboard/connect#server-<id>`. Most LLMs render that as a clickable link, and the dashboard scrolls to and highlights the matching card so you find the right server in one click.
|
package/dist/index.js
CHANGED
|
@@ -292,11 +292,11 @@ async function readConfigAt(path5, scope, warnings) {
|
|
|
292
292
|
`${path5}: schema version ${version} is newer than this mcph (${CURRENT_SCHEMA_VERSION}); upgrade with \`npm i -g @yawlabs/mcph@latest\`. Loading best-effort.`
|
|
293
293
|
);
|
|
294
294
|
}
|
|
295
|
-
const
|
|
295
|
+
const token5 = typeof obj.token === "string" && obj.token.length > 0 ? obj.token : void 0;
|
|
296
296
|
const apiBase = typeof obj.apiBase === "string" && obj.apiBase.length > 0 ? obj.apiBase : void 0;
|
|
297
297
|
const servers = Array.isArray(obj.servers) ? obj.servers.filter((v) => typeof v === "string") : void 0;
|
|
298
298
|
const blocked = Array.isArray(obj.blocked) ? obj.blocked.filter((v) => typeof v === "string") : void 0;
|
|
299
|
-
if (
|
|
299
|
+
if (token5) {
|
|
300
300
|
if (scope === "project") {
|
|
301
301
|
warnings.push(
|
|
302
302
|
`${path5}: 'token' should not appear in a project-shared file. Move it to ${CONFIG_DIRNAME}/${LOCAL_CONFIG_FILENAME} (gitignored) or ~/${CONFIG_DIRNAME}/${CONFIG_FILENAME}.`
|
|
@@ -304,7 +304,7 @@ async function readConfigAt(path5, scope, warnings) {
|
|
|
304
304
|
}
|
|
305
305
|
await checkPermissions(path5, warnings);
|
|
306
306
|
}
|
|
307
|
-
return { path: path5, scope, version, token:
|
|
307
|
+
return { path: path5, scope, version, token: token5, apiBase, servers, blocked };
|
|
308
308
|
}
|
|
309
309
|
async function checkPermissions(path5, warnings) {
|
|
310
310
|
if (process.platform === "win32") return;
|
|
@@ -361,16 +361,16 @@ async function loadMcphConfig(opts = {}) {
|
|
|
361
361
|
if (project) loadedFiles.push(project);
|
|
362
362
|
const global = await readConfigAt(globalPath, "global", warnings);
|
|
363
363
|
if (global) loadedFiles.push(global);
|
|
364
|
-
let
|
|
364
|
+
let token5 = null;
|
|
365
365
|
let tokenSource = "missing";
|
|
366
366
|
if (typeof env.MCPH_TOKEN === "string" && env.MCPH_TOKEN.length > 0) {
|
|
367
|
-
|
|
367
|
+
token5 = env.MCPH_TOKEN;
|
|
368
368
|
tokenSource = "env";
|
|
369
369
|
} else if (local?.token) {
|
|
370
|
-
|
|
370
|
+
token5 = local.token;
|
|
371
371
|
tokenSource = "local";
|
|
372
372
|
} else if (global?.token) {
|
|
373
|
-
|
|
373
|
+
token5 = global.token;
|
|
374
374
|
tokenSource = "global";
|
|
375
375
|
}
|
|
376
376
|
let apiBase = DEFAULT_API_BASE;
|
|
@@ -389,7 +389,7 @@ async function loadMcphConfig(opts = {}) {
|
|
|
389
389
|
apiBaseSource = "global";
|
|
390
390
|
}
|
|
391
391
|
return {
|
|
392
|
-
token:
|
|
392
|
+
token: token5,
|
|
393
393
|
tokenSource,
|
|
394
394
|
apiBase,
|
|
395
395
|
apiBaseSource,
|
|
@@ -400,10 +400,10 @@ async function loadMcphConfig(opts = {}) {
|
|
|
400
400
|
warnings
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
|
-
function tokenFingerprint(
|
|
404
|
-
if (!
|
|
405
|
-
if (
|
|
406
|
-
return `${
|
|
403
|
+
function tokenFingerprint(token5) {
|
|
404
|
+
if (!token5) return "(none)";
|
|
405
|
+
if (token5.length <= 8) return `***${token5.slice(-2)}`;
|
|
406
|
+
return `${token5.slice(0, 8)}\u2026${token5.slice(-4)}`;
|
|
407
407
|
}
|
|
408
408
|
function toProfile(config) {
|
|
409
409
|
if (config.servers === void 0 && config.blocked === void 0) return null;
|
|
@@ -442,10 +442,10 @@ function profileAllows(profile, namespace) {
|
|
|
442
442
|
|
|
443
443
|
// src/config.ts
|
|
444
444
|
import { request } from "undici";
|
|
445
|
-
async function fetchConfig(
|
|
446
|
-
const url = `${
|
|
445
|
+
async function fetchConfig(apiUrl5, token5, currentVersion) {
|
|
446
|
+
const url = `${apiUrl5.replace(/\/$/, "")}/api/connect/config`;
|
|
447
447
|
const headers = {
|
|
448
|
-
Authorization: `Bearer ${
|
|
448
|
+
Authorization: `Bearer ${token5}`,
|
|
449
449
|
Accept: "application/json"
|
|
450
450
|
};
|
|
451
451
|
if (currentVersion) {
|
|
@@ -466,7 +466,7 @@ async function fetchConfig(apiUrl6, token6, currentVersion) {
|
|
|
466
466
|
await res.body.text().catch(() => {
|
|
467
467
|
});
|
|
468
468
|
throw new ConfigError(
|
|
469
|
-
`Token rejected (HTTP 401) \u2014 the token ${tokenFingerprint(
|
|
469
|
+
`Token rejected (HTTP 401) \u2014 the token ${tokenFingerprint(token5)} is invalid or revoked.
|
|
470
470
|
Generate a new token at https://mcp.hosting/dashboard/settings/tokens,
|
|
471
471
|
then re-run \`mcph install <client> --token mcp_pat_...\` or set MCPH_TOKEN.`,
|
|
472
472
|
true
|
|
@@ -476,7 +476,7 @@ async function fetchConfig(apiUrl6, token6, currentVersion) {
|
|
|
476
476
|
await res.body.text().catch(() => {
|
|
477
477
|
});
|
|
478
478
|
throw new ConfigError(
|
|
479
|
-
`Access denied (HTTP 403) \u2014 the token ${tokenFingerprint(
|
|
479
|
+
`Access denied (HTTP 403) \u2014 the token ${tokenFingerprint(token5)} was accepted but lacks permission to read this account's servers.
|
|
480
480
|
The account may be suspended or the token scope reduced \u2014 check
|
|
481
481
|
https://mcp.hosting/dashboard/settings/tokens, or reach support@mcp.hosting.`,
|
|
482
482
|
true
|
|
@@ -900,12 +900,12 @@ async function runComplianceCommand(argv) {
|
|
|
900
900
|
);
|
|
901
901
|
return 1;
|
|
902
902
|
}
|
|
903
|
-
const
|
|
903
|
+
const apiUrl5 = process.env.MCPH_URL ?? "https://mcp.hosting";
|
|
904
904
|
const report = await runTest(args);
|
|
905
905
|
if (!report) return 1;
|
|
906
906
|
printSummary(report);
|
|
907
907
|
if (publish) {
|
|
908
|
-
const result = await publishReport(
|
|
908
|
+
const result = await publishReport(apiUrl5, report);
|
|
909
909
|
if (!result) return 1;
|
|
910
910
|
process.stdout.write(`
|
|
911
911
|
Published: ${result.reportUrl}
|
|
@@ -965,9 +965,9 @@ Target: ${url}
|
|
|
965
965
|
`
|
|
966
966
|
);
|
|
967
967
|
}
|
|
968
|
-
async function publishReport(
|
|
968
|
+
async function publishReport(apiUrl5, report) {
|
|
969
969
|
try {
|
|
970
|
-
const res = await request2(`${
|
|
970
|
+
const res = await request2(`${apiUrl5.replace(/\/$/, "")}/api/compliance/ext`, {
|
|
971
971
|
method: "POST",
|
|
972
972
|
headers: { "Content-Type": "application/json" },
|
|
973
973
|
body: JSON.stringify(report)
|
|
@@ -1650,7 +1650,7 @@ function selectFlakyNamespaces(entries, limit) {
|
|
|
1650
1650
|
}
|
|
1651
1651
|
|
|
1652
1652
|
// src/doctor-cmd.ts
|
|
1653
|
-
var VERSION = true ? "0.47.
|
|
1653
|
+
var VERSION = true ? "0.47.3" : "dev";
|
|
1654
1654
|
async function runDoctor(opts = {}) {
|
|
1655
1655
|
if (opts.json) return runDoctorJson(opts);
|
|
1656
1656
|
const lines = [];
|
|
@@ -2348,12 +2348,12 @@ ${USAGE}`);
|
|
|
2348
2348
|
}
|
|
2349
2349
|
log2(`Target: ${target.label} (${scope})`);
|
|
2350
2350
|
log2(`File: ${resolved.absolute}`);
|
|
2351
|
-
let
|
|
2352
|
-
if (!
|
|
2351
|
+
let token5 = opts.token ?? null;
|
|
2352
|
+
if (!token5) {
|
|
2353
2353
|
const cfg = await loadMcphConfig({ home: opts.home, cwd: process.cwd(), env: {} });
|
|
2354
|
-
|
|
2354
|
+
token5 = cfg.token;
|
|
2355
2355
|
}
|
|
2356
|
-
if (!
|
|
2356
|
+
if (!token5) {
|
|
2357
2357
|
err(
|
|
2358
2358
|
"\nmcph install: no token available.\n Pass one with --token mcp_pat_\u2026, or run `mcph install` with --token once to seed ~/.mcph/config.json,\n or create the token at https://mcp.hosting \u2192 Settings \u2192 API Tokens."
|
|
2359
2359
|
);
|
|
@@ -2423,7 +2423,7 @@ ${USAGE}`);
|
|
|
2423
2423
|
const writeMcphConfig = !opts.skipMcphConfig;
|
|
2424
2424
|
const home = opts.home ?? homedir5();
|
|
2425
2425
|
const mcphConfigPath = join5(home, CONFIG_DIRNAME, CONFIG_FILENAME);
|
|
2426
|
-
const mcphConfigComposed = await composeMcphConfig(mcphConfigPath,
|
|
2426
|
+
const mcphConfigComposed = await composeMcphConfig(mcphConfigPath, token5);
|
|
2427
2427
|
if (mcphConfigComposed.backupPath) {
|
|
2428
2428
|
log2(
|
|
2429
2429
|
`mcph install: existing ${mcphConfigPath} was malformed; original bytes backed up to ${mcphConfigComposed.backupPath} before overwriting.`
|
|
@@ -2579,7 +2579,7 @@ function mergeClientConfig(existing, containerPath, entry) {
|
|
|
2579
2579
|
parent[leafKey] = container;
|
|
2580
2580
|
return out;
|
|
2581
2581
|
}
|
|
2582
|
-
async function composeMcphConfig(path5,
|
|
2582
|
+
async function composeMcphConfig(path5, token5) {
|
|
2583
2583
|
let existing = {};
|
|
2584
2584
|
let backupPath;
|
|
2585
2585
|
if (existsSync2(path5)) {
|
|
@@ -2606,7 +2606,7 @@ async function composeMcphConfig(path5, token6) {
|
|
|
2606
2606
|
}
|
|
2607
2607
|
}
|
|
2608
2608
|
const next = { version: CURRENT_SCHEMA_VERSION, ...existing };
|
|
2609
|
-
next.token =
|
|
2609
|
+
next.token = token5;
|
|
2610
2610
|
if (typeof next.version !== "number") next.version = CURRENT_SCHEMA_VERSION;
|
|
2611
2611
|
return { json: `${JSON.stringify(next, null, 2)}
|
|
2612
2612
|
`, backupPath };
|
|
@@ -2903,7 +2903,7 @@ import {
|
|
|
2903
2903
|
ListToolsRequestSchema,
|
|
2904
2904
|
ReadResourceRequestSchema
|
|
2905
2905
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
2906
|
-
import { request as
|
|
2906
|
+
import { request as request8 } from "undici";
|
|
2907
2907
|
|
|
2908
2908
|
// src/compliance.ts
|
|
2909
2909
|
var GRADE_ORDER = {
|
|
@@ -3944,9 +3944,9 @@ var PackDetector = class {
|
|
|
3944
3944
|
|
|
3945
3945
|
// src/progress.ts
|
|
3946
3946
|
function createProgressReporter(extra) {
|
|
3947
|
-
const
|
|
3947
|
+
const token5 = extra?._meta?.progressToken;
|
|
3948
3948
|
const send = extra?.sendNotification;
|
|
3949
|
-
if (
|
|
3949
|
+
if (token5 === void 0 || token5 === null || !send) {
|
|
3950
3950
|
return () => {
|
|
3951
3951
|
};
|
|
3952
3952
|
}
|
|
@@ -3954,7 +3954,7 @@ function createProgressReporter(extra) {
|
|
|
3954
3954
|
return (message, progress, total) => {
|
|
3955
3955
|
step += 1;
|
|
3956
3956
|
const params = {
|
|
3957
|
-
progressToken:
|
|
3957
|
+
progressToken: token5,
|
|
3958
3958
|
progress: progress ?? step,
|
|
3959
3959
|
message
|
|
3960
3960
|
};
|
|
@@ -4727,9 +4727,6 @@ function evaluateServerCap(namespace, loaded, cap) {
|
|
|
4727
4727
|
};
|
|
4728
4728
|
}
|
|
4729
4729
|
|
|
4730
|
-
// src/test-runner.ts
|
|
4731
|
-
import { request as request8 } from "undici";
|
|
4732
|
-
|
|
4733
4730
|
// src/upstream.ts
|
|
4734
4731
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
4735
4732
|
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
@@ -4974,7 +4971,7 @@ function categorizeSpawnError(err) {
|
|
|
4974
4971
|
}
|
|
4975
4972
|
async function connectToUpstream(config, onDisconnect, onListChanged) {
|
|
4976
4973
|
const client = new Client(
|
|
4977
|
-
{ name: "mcph", version: true ? "0.47.
|
|
4974
|
+
{ name: "mcph", version: true ? "0.47.3" : "dev" },
|
|
4978
4975
|
{ capabilities: {} }
|
|
4979
4976
|
);
|
|
4980
4977
|
let transport;
|
|
@@ -5199,163 +5196,6 @@ async function fetchToolsFromUpstream(client, namespace) {
|
|
|
5199
5196
|
}));
|
|
5200
5197
|
}
|
|
5201
5198
|
|
|
5202
|
-
// src/test-runner.ts
|
|
5203
|
-
var POLL_INTERVAL_MS = 3e4;
|
|
5204
|
-
var REQUEST_TIMEOUT_MS = 1e4;
|
|
5205
|
-
var CONSECUTIVE_404_LIMIT = 10;
|
|
5206
|
-
var apiUrl5 = "";
|
|
5207
|
-
var token5 = "";
|
|
5208
|
-
var pollTimer = null;
|
|
5209
|
-
var running = false;
|
|
5210
|
-
var consecutive404 = 0;
|
|
5211
|
-
var configRef = () => null;
|
|
5212
|
-
function initTestRunner(url, tok, getConfig) {
|
|
5213
|
-
apiUrl5 = url;
|
|
5214
|
-
token5 = tok;
|
|
5215
|
-
configRef = getConfig;
|
|
5216
|
-
}
|
|
5217
|
-
function startTestRunner() {
|
|
5218
|
-
if (running) return;
|
|
5219
|
-
running = true;
|
|
5220
|
-
consecutive404 = 0;
|
|
5221
|
-
schedule();
|
|
5222
|
-
}
|
|
5223
|
-
function stopTestRunner() {
|
|
5224
|
-
running = false;
|
|
5225
|
-
consecutive404 = 0;
|
|
5226
|
-
if (pollTimer) {
|
|
5227
|
-
clearTimeout(pollTimer);
|
|
5228
|
-
pollTimer = null;
|
|
5229
|
-
}
|
|
5230
|
-
}
|
|
5231
|
-
function schedule() {
|
|
5232
|
-
pollTimer = setTimeout(async () => {
|
|
5233
|
-
try {
|
|
5234
|
-
await pollOnce();
|
|
5235
|
-
} catch (err) {
|
|
5236
|
-
log("warn", "Test runner poll failed", { error: err?.message });
|
|
5237
|
-
}
|
|
5238
|
-
if (running) schedule();
|
|
5239
|
-
}, POLL_INTERVAL_MS);
|
|
5240
|
-
pollTimer.unref?.();
|
|
5241
|
-
}
|
|
5242
|
-
async function pollOnce() {
|
|
5243
|
-
if (!apiUrl5 || !token5) return;
|
|
5244
|
-
const list = await fetchPending();
|
|
5245
|
-
if (list.length === 0) return;
|
|
5246
|
-
for (const pending2 of list) {
|
|
5247
|
-
if (!running) return;
|
|
5248
|
-
await runOne(pending2).catch((err) => {
|
|
5249
|
-
log("warn", "Test execution failed", { requestId: pending2.requestId, error: err?.message });
|
|
5250
|
-
});
|
|
5251
|
-
}
|
|
5252
|
-
}
|
|
5253
|
-
async function fetchPending() {
|
|
5254
|
-
try {
|
|
5255
|
-
const res = await request8(`${apiUrl5.replace(/\/$/, "")}/api/connect/test-requests`, {
|
|
5256
|
-
method: "GET",
|
|
5257
|
-
headers: { Authorization: `Bearer ${token5}` },
|
|
5258
|
-
headersTimeout: REQUEST_TIMEOUT_MS,
|
|
5259
|
-
bodyTimeout: REQUEST_TIMEOUT_MS
|
|
5260
|
-
});
|
|
5261
|
-
if (res.statusCode === 404) {
|
|
5262
|
-
await res.body.text().catch(() => {
|
|
5263
|
-
});
|
|
5264
|
-
consecutive404++;
|
|
5265
|
-
if (consecutive404 === 1) {
|
|
5266
|
-
log("warn", "Test runner endpoint returned 404; will retry", { url: `${apiUrl5}/api/connect/test-requests` });
|
|
5267
|
-
}
|
|
5268
|
-
if (consecutive404 >= CONSECUTIVE_404_LIMIT) {
|
|
5269
|
-
log("warn", "Test runner endpoint persistently 404; stopping poller", {
|
|
5270
|
-
consecutive: consecutive404
|
|
5271
|
-
});
|
|
5272
|
-
stopTestRunner();
|
|
5273
|
-
}
|
|
5274
|
-
return [];
|
|
5275
|
-
}
|
|
5276
|
-
if (res.statusCode !== 200) {
|
|
5277
|
-
await res.body.text().catch(() => {
|
|
5278
|
-
});
|
|
5279
|
-
consecutive404 = 0;
|
|
5280
|
-
return [];
|
|
5281
|
-
}
|
|
5282
|
-
consecutive404 = 0;
|
|
5283
|
-
const body = await res.body.json();
|
|
5284
|
-
return Array.isArray(body?.requests) ? body.requests : [];
|
|
5285
|
-
} catch {
|
|
5286
|
-
return [];
|
|
5287
|
-
}
|
|
5288
|
-
}
|
|
5289
|
-
async function runOne(pending2) {
|
|
5290
|
-
const config = configRef();
|
|
5291
|
-
const serverConfig = config?.servers.find((s) => s.id === pending2.serverId);
|
|
5292
|
-
if (!serverConfig) {
|
|
5293
|
-
await postResult(pending2.requestId, {
|
|
5294
|
-
status: "failed",
|
|
5295
|
-
message: `Server "${pending2.serverId}" is not in this mcph's current config \u2014 restart mcph or refresh the dashboard.`,
|
|
5296
|
-
errorCategory: "not_in_config"
|
|
5297
|
-
});
|
|
5298
|
-
return;
|
|
5299
|
-
}
|
|
5300
|
-
if (!serverConfig.isActive) {
|
|
5301
|
-
await postResult(pending2.requestId, {
|
|
5302
|
-
status: "failed",
|
|
5303
|
-
message: `Server "${serverConfig.namespace}" is disabled in the dashboard \u2014 re-enable it before testing.`,
|
|
5304
|
-
errorCategory: "disabled"
|
|
5305
|
-
});
|
|
5306
|
-
return;
|
|
5307
|
-
}
|
|
5308
|
-
let connection = null;
|
|
5309
|
-
try {
|
|
5310
|
-
connection = await connectToUpstream(serverConfig);
|
|
5311
|
-
await postResult(pending2.requestId, {
|
|
5312
|
-
status: "passed",
|
|
5313
|
-
toolCount: connection.tools.length,
|
|
5314
|
-
message: `Connected \u2014 ${connection.tools.length} tool${connection.tools.length === 1 ? "" : "s"} available.`
|
|
5315
|
-
});
|
|
5316
|
-
} catch (err) {
|
|
5317
|
-
if (err instanceof ActivationError) {
|
|
5318
|
-
await postResult(pending2.requestId, {
|
|
5319
|
-
status: "failed",
|
|
5320
|
-
message: err.message,
|
|
5321
|
-
errorCategory: err.category
|
|
5322
|
-
});
|
|
5323
|
-
} else {
|
|
5324
|
-
await postResult(pending2.requestId, {
|
|
5325
|
-
status: "failed",
|
|
5326
|
-
message: err instanceof Error ? err.message : String(err),
|
|
5327
|
-
errorCategory: "unknown"
|
|
5328
|
-
});
|
|
5329
|
-
}
|
|
5330
|
-
} finally {
|
|
5331
|
-
if (connection) {
|
|
5332
|
-
await disconnectFromUpstream(connection).catch(() => {
|
|
5333
|
-
});
|
|
5334
|
-
}
|
|
5335
|
-
}
|
|
5336
|
-
}
|
|
5337
|
-
async function postResult(requestId, result) {
|
|
5338
|
-
try {
|
|
5339
|
-
const res = await request8(
|
|
5340
|
-
`${apiUrl5.replace(/\/$/, "")}/api/connect/test-requests/${encodeURIComponent(requestId)}/result`,
|
|
5341
|
-
{
|
|
5342
|
-
method: "POST",
|
|
5343
|
-
headers: {
|
|
5344
|
-
Authorization: `Bearer ${token5}`,
|
|
5345
|
-
"Content-Type": "application/json"
|
|
5346
|
-
},
|
|
5347
|
-
body: JSON.stringify(result),
|
|
5348
|
-
headersTimeout: REQUEST_TIMEOUT_MS,
|
|
5349
|
-
bodyTimeout: REQUEST_TIMEOUT_MS
|
|
5350
|
-
}
|
|
5351
|
-
);
|
|
5352
|
-
await res.body.text().catch(() => {
|
|
5353
|
-
});
|
|
5354
|
-
} catch (err) {
|
|
5355
|
-
log("warn", "Posting test result failed", { requestId, error: err?.message });
|
|
5356
|
-
}
|
|
5357
|
-
}
|
|
5358
|
-
|
|
5359
5199
|
// src/server.ts
|
|
5360
5200
|
var DEFAULT_POLL_INTERVAL_MS = 6e4;
|
|
5361
5201
|
function resolvePollIntervalMs() {
|
|
@@ -5435,11 +5275,11 @@ function computeToolOverlaps(connections) {
|
|
|
5435
5275
|
return overlaps;
|
|
5436
5276
|
}
|
|
5437
5277
|
var ConnectServer = class _ConnectServer {
|
|
5438
|
-
constructor(
|
|
5439
|
-
this.apiUrl =
|
|
5440
|
-
this.token =
|
|
5278
|
+
constructor(apiUrl5, token5) {
|
|
5279
|
+
this.apiUrl = apiUrl5;
|
|
5280
|
+
this.token = token5;
|
|
5441
5281
|
this.server = new Server(
|
|
5442
|
-
{ name: "mcph", version: true ? "0.47.
|
|
5282
|
+
{ name: "mcph", version: true ? "0.47.3" : "dev" },
|
|
5443
5283
|
{
|
|
5444
5284
|
capabilities: {
|
|
5445
5285
|
tools: { listChanged: true },
|
|
@@ -5580,23 +5420,23 @@ var ConnectServer = class _ConnectServer {
|
|
|
5580
5420
|
this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
5581
5421
|
tools: buildToolList(this.connections, this.getDeferredServers(), this.toolFilters)
|
|
5582
5422
|
}));
|
|
5583
|
-
this.server.setRequestHandler(CallToolRequestSchema, async (
|
|
5584
|
-
const { name, arguments: args } =
|
|
5423
|
+
this.server.setRequestHandler(CallToolRequestSchema, async (request9, extra) => {
|
|
5424
|
+
const { name, arguments: args } = request9.params;
|
|
5585
5425
|
return this.handleToolCall(name, args ?? {}, extra);
|
|
5586
5426
|
});
|
|
5587
5427
|
this.server.setRequestHandler(ListResourcesRequestSchema, async () => ({
|
|
5588
5428
|
resources: buildResourceList(this.connections, this.getBuiltinResources())
|
|
5589
5429
|
}));
|
|
5590
|
-
this.server.setRequestHandler(ReadResourceRequestSchema, async (
|
|
5591
|
-
return routeResourceRead(
|
|
5430
|
+
this.server.setRequestHandler(ReadResourceRequestSchema, async (request9) => {
|
|
5431
|
+
return routeResourceRead(request9.params.uri, this.resourceRoutes, this.connections, this.getBuiltinResourceMap());
|
|
5592
5432
|
});
|
|
5593
5433
|
this.server.setRequestHandler(ListPromptsRequestSchema, async () => ({
|
|
5594
5434
|
prompts: buildPromptList(this.connections)
|
|
5595
5435
|
}));
|
|
5596
|
-
this.server.setRequestHandler(GetPromptRequestSchema, async (
|
|
5436
|
+
this.server.setRequestHandler(GetPromptRequestSchema, async (request9) => {
|
|
5597
5437
|
return routePromptGet(
|
|
5598
|
-
|
|
5599
|
-
|
|
5438
|
+
request9.params.name,
|
|
5439
|
+
request9.params.arguments,
|
|
5600
5440
|
this.promptRoutes,
|
|
5601
5441
|
this.connections
|
|
5602
5442
|
);
|
|
@@ -5701,12 +5541,10 @@ var ConnectServer = class _ConnectServer {
|
|
|
5701
5541
|
initToolReport(this.apiUrl, this.token);
|
|
5702
5542
|
initRerank(this.apiUrl, this.token);
|
|
5703
5543
|
initRuntimeDetect(this.apiUrl, this.token);
|
|
5704
|
-
initTestRunner(this.apiUrl, this.token, () => this.config);
|
|
5705
5544
|
reportRuntimes().catch((err) => log("warn", "reportRuntimes failed", { error: err?.message }));
|
|
5706
5545
|
if (this.config?.servers.some((s) => s.command === "uv" || s.command === "uvx")) {
|
|
5707
5546
|
ensureUv().catch((err) => log("warn", "uv prewarm failed", { error: err?.message }));
|
|
5708
5547
|
}
|
|
5709
|
-
startTestRunner();
|
|
5710
5548
|
const transport = new StdioServerTransport();
|
|
5711
5549
|
await this.server.connect(transport);
|
|
5712
5550
|
this.startPolling();
|
|
@@ -6943,7 +6781,7 @@ ${activeCount} loaded in this session, ${totalTools} tools in context${tokenSumm
|
|
|
6943
6781
|
nsToKeys.set(s.namespace, existing);
|
|
6944
6782
|
}
|
|
6945
6783
|
const collisions = [...nsToKeys.entries()].filter(([, keys]) => keys.length > 1);
|
|
6946
|
-
const res = await
|
|
6784
|
+
const res = await request8(`${this.apiUrl.replace(/\/$/, "")}/api/connect/import`, {
|
|
6947
6785
|
method: "POST",
|
|
6948
6786
|
headers: {
|
|
6949
6787
|
Authorization: `Bearer ${this.token}`,
|
|
@@ -7004,7 +6842,7 @@ Use mcp_connect_discover to see imported servers.`
|
|
|
7004
6842
|
}
|
|
7005
6843
|
const payload = built.payload;
|
|
7006
6844
|
try {
|
|
7007
|
-
const res = await
|
|
6845
|
+
const res = await request8(`${this.apiUrl.replace(/\/$/, "")}/api/connect/servers`, {
|
|
7008
6846
|
method: "POST",
|
|
7009
6847
|
headers: {
|
|
7010
6848
|
Authorization: `Bearer ${this.token}`,
|
|
@@ -7468,7 +7306,6 @@ To load the top pack in one step, call \`mcp_connect_activate\` with namespaces=
|
|
|
7468
7306
|
if (this.persistenceReady) {
|
|
7469
7307
|
await this.flushStateSave();
|
|
7470
7308
|
}
|
|
7471
|
-
stopTestRunner();
|
|
7472
7309
|
await shutdownAnalytics();
|
|
7473
7310
|
const disconnects = Array.from(this.connections.values()).map((conn) => disconnectFromUpstream(conn));
|
|
7474
7311
|
await Promise.allSettled(disconnects);
|
|
@@ -7803,7 +7640,7 @@ Or re-run with --run to upgrade in place.`);
|
|
|
7803
7640
|
return { exitCode: 3, lines };
|
|
7804
7641
|
}
|
|
7805
7642
|
function readCurrentVersion() {
|
|
7806
|
-
return true ? "0.47.
|
|
7643
|
+
return true ? "0.47.3" : "dev";
|
|
7807
7644
|
}
|
|
7808
7645
|
|
|
7809
7646
|
// src/index.ts
|
|
@@ -7971,7 +7808,7 @@ if (subcommand === "compliance") {
|
|
|
7971
7808
|
`);
|
|
7972
7809
|
process.exit(0);
|
|
7973
7810
|
} else if (subcommand === "--version" || subcommand === "-V") {
|
|
7974
|
-
process.stdout.write(`mcph ${true ? "0.47.
|
|
7811
|
+
process.stdout.write(`mcph ${true ? "0.47.3" : "dev"}
|
|
7975
7812
|
`);
|
|
7976
7813
|
process.exit(0);
|
|
7977
7814
|
} else if (subcommand && !subcommand.startsWith("-")) {
|
package/package.json
CHANGED