@yawlabs/mcp 0.74.3 → 0.75.1
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/index.js +47 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4817,7 +4817,7 @@ async function runUpgrade(opts = {}) {
|
|
|
4817
4817
|
return { exitCode: 3, lines };
|
|
4818
4818
|
}
|
|
4819
4819
|
function readCurrentVersion() {
|
|
4820
|
-
return true ? "0.
|
|
4820
|
+
return true ? "0.75.1" : "dev";
|
|
4821
4821
|
}
|
|
4822
4822
|
|
|
4823
4823
|
// src/learning.ts
|
|
@@ -5051,7 +5051,7 @@ function foldBundleWarnings(warnings, probe) {
|
|
|
5051
5051
|
const prefix = `${probe.path}:`;
|
|
5052
5052
|
return warnings.filter((w) => !w.startsWith(prefix));
|
|
5053
5053
|
}
|
|
5054
|
-
var VERSION = true ? "0.
|
|
5054
|
+
var VERSION = true ? "0.75.1" : "dev";
|
|
5055
5055
|
async function runDoctor(opts = {}) {
|
|
5056
5056
|
if (opts.json) return runDoctorJson(opts);
|
|
5057
5057
|
const lines = [];
|
|
@@ -8571,7 +8571,7 @@ function defaultSpawn2(cmd, args) {
|
|
|
8571
8571
|
async function maybeAutoUpgrade(deps = {}) {
|
|
8572
8572
|
const optOut = process.env.YAW_MCP_AUTO_UPGRADE;
|
|
8573
8573
|
if (optOut === "0" || optOut?.toLowerCase() === "false") return;
|
|
8574
|
-
const current = deps.currentVersion ?? (true ? "0.
|
|
8574
|
+
const current = deps.currentVersion ?? (true ? "0.75.1" : "dev");
|
|
8575
8575
|
if (current === "dev") return;
|
|
8576
8576
|
const method = (deps.isSeaImpl ? await deps.isSeaImpl() : await detectSea()) ? "binary" : detectInstallMethod(deps.argvPath ?? process.argv[1]);
|
|
8577
8577
|
const latest = await (deps.fetchLatestImpl ?? fetchLatestVersion)();
|
|
@@ -9664,7 +9664,7 @@ function deferredDescription(server, cachedDesc) {
|
|
|
9664
9664
|
|
|
9665
9665
|
${suffix}` : suffix;
|
|
9666
9666
|
}
|
|
9667
|
-
function buildToolList(activeConnections, inactiveWithCache = [], toolFilters) {
|
|
9667
|
+
function buildToolList(activeConnections, inactiveWithCache = [], toolFilters, exposure = "full", exposedNamespaces) {
|
|
9668
9668
|
const tools = [];
|
|
9669
9669
|
const seen = /* @__PURE__ */ new Set();
|
|
9670
9670
|
for (const meta of Object.values(META_TOOLS)) {
|
|
@@ -9677,6 +9677,7 @@ function buildToolList(activeConnections, inactiveWithCache = [], toolFilters) {
|
|
|
9677
9677
|
seen.add(meta.name);
|
|
9678
9678
|
}
|
|
9679
9679
|
for (const conn of activeConnections.values()) {
|
|
9680
|
+
if (exposure === "gateway" && !exposedNamespaces?.has(conn.config.namespace)) continue;
|
|
9680
9681
|
const filter = toolFilters?.get(conn.config.namespace);
|
|
9681
9682
|
for (const tool of conn.tools) {
|
|
9682
9683
|
if (filter && !filter.has(tool.name)) continue;
|
|
@@ -9693,6 +9694,7 @@ function buildToolList(activeConnections, inactiveWithCache = [], toolFilters) {
|
|
|
9693
9694
|
for (const server of inactiveWithCache) {
|
|
9694
9695
|
if (activeConnections.has(server.namespace)) continue;
|
|
9695
9696
|
if (!server.toolCache || server.toolCache.length === 0) continue;
|
|
9697
|
+
if (exposure === "gateway") continue;
|
|
9696
9698
|
const filter = toolFilters?.get(server.namespace);
|
|
9697
9699
|
for (const cached of server.toolCache) {
|
|
9698
9700
|
if (filter && !filter.has(cached.name)) continue;
|
|
@@ -9752,12 +9754,13 @@ function buildToolRoutes(activeConnections, inactiveWithCache = []) {
|
|
|
9752
9754
|
}
|
|
9753
9755
|
return routes;
|
|
9754
9756
|
}
|
|
9755
|
-
function buildResourceList(activeConnections, builtins = []) {
|
|
9757
|
+
function buildResourceList(activeConnections, builtins = [], exposure = "full", exposedNamespaces) {
|
|
9756
9758
|
const resources = [];
|
|
9757
9759
|
for (const b of builtins) {
|
|
9758
9760
|
resources.push({ uri: b.uri, name: b.name, description: b.description, mimeType: b.mimeType });
|
|
9759
9761
|
}
|
|
9760
9762
|
for (const conn of activeConnections.values()) {
|
|
9763
|
+
if (exposure === "gateway" && !exposedNamespaces?.has(conn.config.namespace)) continue;
|
|
9761
9764
|
for (const r of conn.resources) {
|
|
9762
9765
|
resources.push({
|
|
9763
9766
|
uri: r.namespacedUri,
|
|
@@ -9778,10 +9781,11 @@ function buildResourceRoutes(activeConnections) {
|
|
|
9778
9781
|
}
|
|
9779
9782
|
return routes;
|
|
9780
9783
|
}
|
|
9781
|
-
function buildPromptList(activeConnections) {
|
|
9784
|
+
function buildPromptList(activeConnections, exposure = "full", exposedNamespaces) {
|
|
9782
9785
|
const prompts = [];
|
|
9783
9786
|
const seen = /* @__PURE__ */ new Set();
|
|
9784
9787
|
for (const conn of activeConnections.values()) {
|
|
9788
|
+
if (exposure === "gateway" && !exposedNamespaces?.has(conn.config.namespace)) continue;
|
|
9785
9789
|
for (const p of conn.prompts) {
|
|
9786
9790
|
if (seen.has(p.namespacedName)) continue;
|
|
9787
9791
|
prompts.push({
|
|
@@ -10911,7 +10915,7 @@ async function connectToUpstream(config, onDisconnect, onListChanged) {
|
|
|
10911
10915
|
}
|
|
10912
10916
|
async function connectToUpstreamOnce(config, onDisconnect, onListChanged, attempt, disableOamRewrite) {
|
|
10913
10917
|
const client = new Client(
|
|
10914
|
-
{ name: "yaw-mcp", version: true ? "0.
|
|
10918
|
+
{ name: "yaw-mcp", version: true ? "0.75.1" : "dev" },
|
|
10915
10919
|
{ capabilities: {} }
|
|
10916
10920
|
);
|
|
10917
10921
|
let transport;
|
|
@@ -11213,6 +11217,13 @@ function isAutoLoadEnabled() {
|
|
|
11213
11217
|
if (raw === void 0 || raw === "") return false;
|
|
11214
11218
|
return raw === "1" || raw.toLowerCase() === "true";
|
|
11215
11219
|
}
|
|
11220
|
+
function resolveToolExposure() {
|
|
11221
|
+
const raw = process.env.YAW_MCP_TOOL_EXPOSURE?.trim().toLowerCase();
|
|
11222
|
+
if (raw === "full") return "full";
|
|
11223
|
+
if (raw === void 0 || raw === "" || raw === "gateway") return "gateway";
|
|
11224
|
+
log("warn", `unrecognized YAW_MCP_TOOL_EXPOSURE "${raw}"; using "gateway"`, { raw });
|
|
11225
|
+
return "gateway";
|
|
11226
|
+
}
|
|
11216
11227
|
var DEFAULT_IDLE_CALL_THRESHOLD = 10;
|
|
11217
11228
|
function resolveIdleThreshold() {
|
|
11218
11229
|
const current = process.env.YAW_MCP_IDLE_THRESHOLD;
|
|
@@ -11339,6 +11350,14 @@ var ConnectServer = class _ConnectServer {
|
|
|
11339
11350
|
// still reach unlisted tools. Cleared on activate-without-tools of the
|
|
11340
11351
|
// same namespace, on deactivate, and on config reconcile.
|
|
11341
11352
|
toolFilters = /* @__PURE__ */ new Map();
|
|
11353
|
+
// Namespaces the CLIENT explicitly activated this session. In gateway mode
|
|
11354
|
+
// (the default) this is the entire surface tools/list advertises beyond the
|
|
11355
|
+
// meta-tools. Deliberately NOT the same question as "is it connected":
|
|
11356
|
+
// prewarmDormantServers spawns dormant servers on its own, so keying on
|
|
11357
|
+
// connectedness would re-advertise the whole catalog and defeat the mode.
|
|
11358
|
+
// Session-scoped on purpose -- it is not persisted, so a new session starts
|
|
11359
|
+
// at the meta-tools again and the client re-asks for what it needs.
|
|
11360
|
+
sessionActivated = /* @__PURE__ */ new Set();
|
|
11342
11361
|
profile = null;
|
|
11343
11362
|
// Shadow-driven install-nudge gate. Resolved once at start() from the
|
|
11344
11363
|
// env override (YAW_MCP_INSTALL_NUDGE=1) OR config (installNudge: true);
|
|
@@ -11465,7 +11484,7 @@ var ConnectServer = class _ConnectServer {
|
|
|
11465
11484
|
static SHUTDOWN_DRAIN_MS = 2e3;
|
|
11466
11485
|
constructor() {
|
|
11467
11486
|
this.server = new Server(
|
|
11468
|
-
{ name: "yaw-mcp", version: true ? "0.
|
|
11487
|
+
{ name: "yaw-mcp", version: true ? "0.75.1" : "dev" },
|
|
11469
11488
|
{
|
|
11470
11489
|
capabilities: {
|
|
11471
11490
|
tools: { listChanged: true },
|
|
@@ -11505,20 +11524,31 @@ var ConnectServer = class _ConnectServer {
|
|
|
11505
11524
|
}
|
|
11506
11525
|
setupHandlers() {
|
|
11507
11526
|
this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
11508
|
-
tools: buildToolList(
|
|
11527
|
+
tools: buildToolList(
|
|
11528
|
+
this.connections,
|
|
11529
|
+
this.getDeferredServers(),
|
|
11530
|
+
this.toolFilters,
|
|
11531
|
+
resolveToolExposure(),
|
|
11532
|
+
this.sessionActivated
|
|
11533
|
+
)
|
|
11509
11534
|
}));
|
|
11510
11535
|
this.server.setRequestHandler(CallToolRequestSchema, async (request2, extra) => {
|
|
11511
11536
|
const { name, arguments: args } = request2.params;
|
|
11512
11537
|
return this.handleToolCall(name, args ?? {}, extra);
|
|
11513
11538
|
});
|
|
11514
11539
|
this.server.setRequestHandler(ListResourcesRequestSchema, async () => ({
|
|
11515
|
-
resources: buildResourceList(
|
|
11540
|
+
resources: buildResourceList(
|
|
11541
|
+
this.connections,
|
|
11542
|
+
this.getBuiltinResources(),
|
|
11543
|
+
resolveToolExposure(),
|
|
11544
|
+
this.sessionActivated
|
|
11545
|
+
)
|
|
11516
11546
|
}));
|
|
11517
11547
|
this.server.setRequestHandler(ReadResourceRequestSchema, async (request2) => {
|
|
11518
11548
|
return routeResourceRead(request2.params.uri, this.resourceRoutes, this.connections, this.getBuiltinResourceMap());
|
|
11519
11549
|
});
|
|
11520
11550
|
this.server.setRequestHandler(ListPromptsRequestSchema, async () => ({
|
|
11521
|
-
prompts: buildPromptList(this.connections)
|
|
11551
|
+
prompts: buildPromptList(this.connections, resolveToolExposure(), this.sessionActivated)
|
|
11522
11552
|
}));
|
|
11523
11553
|
this.server.setRequestHandler(GetPromptRequestSchema, async (request2) => {
|
|
11524
11554
|
return routePromptGet(
|
|
@@ -12671,6 +12701,7 @@ ${activeCount} loaded in this session, ${totalTools} tools in context${tokenSumm
|
|
|
12671
12701
|
const r = await this.activateOne(namespace, progress);
|
|
12672
12702
|
results.push(r.message);
|
|
12673
12703
|
if (r.isChanged) anyChanged = true;
|
|
12704
|
+
if (r.ok) this.sessionActivated.add(namespace);
|
|
12674
12705
|
if (!r.ok) {
|
|
12675
12706
|
if (r.capped) anyCapped = true;
|
|
12676
12707
|
else anyError = true;
|
|
@@ -12854,6 +12885,7 @@ ${activeCount} loaded in this session, ${totalTools} tools in context${tokenSumm
|
|
|
12854
12885
|
this.idleCallCounts.delete(namespace);
|
|
12855
12886
|
this.adaptiveSkipLogged.delete(namespace);
|
|
12856
12887
|
this.toolFilters.delete(namespace);
|
|
12888
|
+
this.sessionActivated.delete(namespace);
|
|
12857
12889
|
anyChanged = true;
|
|
12858
12890
|
results.push(`Unloaded "${namespace}". Tools removed from context.`);
|
|
12859
12891
|
}
|
|
@@ -12914,6 +12946,7 @@ ${activeCount} loaded in this session, ${totalTools} tools in context${tokenSumm
|
|
|
12914
12946
|
this.idleCallCounts.delete(ns);
|
|
12915
12947
|
this.adaptiveSkipLogged.delete(ns);
|
|
12916
12948
|
this.toolFilters.delete(ns);
|
|
12949
|
+
this.sessionActivated.delete(ns);
|
|
12917
12950
|
deactivated++;
|
|
12918
12951
|
}
|
|
12919
12952
|
if (deactivated > 0) {
|
|
@@ -12932,6 +12965,7 @@ ${activeCount} loaded in this session, ${totalTools} tools in context${tokenSumm
|
|
|
12932
12965
|
this.idleCallCounts.delete(namespace);
|
|
12933
12966
|
this.adaptiveSkipLogged.delete(namespace);
|
|
12934
12967
|
this.toolFilters.delete(namespace);
|
|
12968
|
+
this.sessionActivated.delete(namespace);
|
|
12935
12969
|
this.elicitedEnv.delete(namespace);
|
|
12936
12970
|
changed = true;
|
|
12937
12971
|
continue;
|
|
@@ -12944,6 +12978,7 @@ ${activeCount} loaded in this session, ${totalTools} tools in context${tokenSumm
|
|
|
12944
12978
|
this.idleCallCounts.delete(namespace);
|
|
12945
12979
|
this.adaptiveSkipLogged.delete(namespace);
|
|
12946
12980
|
this.toolFilters.delete(namespace);
|
|
12981
|
+
this.sessionActivated.delete(namespace);
|
|
12947
12982
|
this.elicitedEnv.delete(namespace);
|
|
12948
12983
|
changed = true;
|
|
12949
12984
|
}
|
|
@@ -13855,7 +13890,7 @@ if (subcommand === "compliance") {
|
|
|
13855
13890
|
`);
|
|
13856
13891
|
process.exitCode = 0;
|
|
13857
13892
|
} else if (subcommand === "--version" || subcommand === "-V") {
|
|
13858
|
-
process.stdout.write(`yaw-mcp ${true ? "0.
|
|
13893
|
+
process.stdout.write(`yaw-mcp ${true ? "0.75.1" : "dev"}
|
|
13859
13894
|
`);
|
|
13860
13895
|
process.exitCode = 0;
|
|
13861
13896
|
} else if (subcommand && !subcommand.startsWith("-")) {
|
package/package.json
CHANGED