dynmcp 0.3.0 → 0.3.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.cjs +44 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +44 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { Command } from "commander";
|
|
|
7
7
|
// package.json
|
|
8
8
|
var package_default = {
|
|
9
9
|
name: "dynmcp",
|
|
10
|
-
version: "0.3.
|
|
10
|
+
version: "0.3.1",
|
|
11
11
|
description: "Dynamic MCP context management tool for AI MCP-enabled agents and clients.",
|
|
12
12
|
author: "Brandon Burrus <brandon@burrus.io>",
|
|
13
13
|
license: "MIT",
|
|
@@ -1440,6 +1440,31 @@ var ProxyServer = class {
|
|
|
1440
1440
|
await this.sdkServer.sendPromptListChanged();
|
|
1441
1441
|
}
|
|
1442
1442
|
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Builds per-call options for a request handler. Extracts the host's
|
|
1445
|
+
* `progressToken` from `_meta` (if any) and wires an `onprogress` callback that
|
|
1446
|
+
* re-emits progress notifications back to the host under that same token. This
|
|
1447
|
+
* is the single seam where progress translation lives — every forward-direction
|
|
1448
|
+
* handler routes through here.
|
|
1449
|
+
*/
|
|
1450
|
+
buildCallOptions(request, extra) {
|
|
1451
|
+
const options = { signal: extra.signal };
|
|
1452
|
+
const progressToken = request.params._meta?.progressToken;
|
|
1453
|
+
if (progressToken !== void 0) {
|
|
1454
|
+
options.onprogress = (progress) => {
|
|
1455
|
+
void extra.sendNotification({
|
|
1456
|
+
method: "notifications/progress",
|
|
1457
|
+
params: {
|
|
1458
|
+
progressToken,
|
|
1459
|
+
progress: progress.progress,
|
|
1460
|
+
total: progress.total,
|
|
1461
|
+
message: progress.message
|
|
1462
|
+
}
|
|
1463
|
+
});
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
return options;
|
|
1467
|
+
}
|
|
1443
1468
|
registerToolHandlers(server) {
|
|
1444
1469
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
1445
1470
|
tools: [
|
|
@@ -1473,7 +1498,11 @@ var ProxyServer = class {
|
|
|
1473
1498
|
content: [{ type: "text", text: catalog.getToolDetails(args.tool_name) }]
|
|
1474
1499
|
};
|
|
1475
1500
|
}
|
|
1476
|
-
return await this.callTool(
|
|
1501
|
+
return await this.callTool(
|
|
1502
|
+
args.tool_name,
|
|
1503
|
+
args.tool_input,
|
|
1504
|
+
this.buildCallOptions(request, extra)
|
|
1505
|
+
);
|
|
1477
1506
|
}
|
|
1478
1507
|
return {
|
|
1479
1508
|
isError: true,
|
|
@@ -1498,15 +1527,18 @@ var ProxyServer = class {
|
|
|
1498
1527
|
server.setRequestHandler(
|
|
1499
1528
|
ReadResourceRequestSchema,
|
|
1500
1529
|
async (request, extra) => {
|
|
1501
|
-
return callbacks.readResource(request.params.uri,
|
|
1530
|
+
return callbacks.readResource(request.params.uri, this.buildCallOptions(request, extra));
|
|
1502
1531
|
}
|
|
1503
1532
|
);
|
|
1504
1533
|
server.setRequestHandler(SubscribeRequestSchema, async (request, extra) => {
|
|
1505
|
-
await callbacks.subscribeResource(request.params.uri,
|
|
1534
|
+
await callbacks.subscribeResource(request.params.uri, this.buildCallOptions(request, extra));
|
|
1506
1535
|
return {};
|
|
1507
1536
|
});
|
|
1508
1537
|
server.setRequestHandler(UnsubscribeRequestSchema, async (request, extra) => {
|
|
1509
|
-
await callbacks.unsubscribeResource(
|
|
1538
|
+
await callbacks.unsubscribeResource(
|
|
1539
|
+
request.params.uri,
|
|
1540
|
+
this.buildCallOptions(request, extra)
|
|
1541
|
+
);
|
|
1510
1542
|
return {};
|
|
1511
1543
|
});
|
|
1512
1544
|
}
|
|
@@ -1520,9 +1552,11 @@ var ProxyServer = class {
|
|
|
1520
1552
|
server.setRequestHandler(
|
|
1521
1553
|
GetPromptRequestSchema,
|
|
1522
1554
|
async (request, extra) => {
|
|
1523
|
-
return callbacks.getPrompt(
|
|
1524
|
-
|
|
1525
|
-
|
|
1555
|
+
return callbacks.getPrompt(
|
|
1556
|
+
request.params.name,
|
|
1557
|
+
request.params.arguments,
|
|
1558
|
+
this.buildCallOptions(request, extra)
|
|
1559
|
+
);
|
|
1526
1560
|
}
|
|
1527
1561
|
);
|
|
1528
1562
|
}
|
|
@@ -1530,13 +1564,13 @@ var ProxyServer = class {
|
|
|
1530
1564
|
server.setRequestHandler(
|
|
1531
1565
|
CompleteRequestSchema,
|
|
1532
1566
|
async (request, extra) => {
|
|
1533
|
-
return callback(request.params,
|
|
1567
|
+
return callback(request.params, this.buildCallOptions(request, extra));
|
|
1534
1568
|
}
|
|
1535
1569
|
);
|
|
1536
1570
|
}
|
|
1537
1571
|
registerLoggingHandler(server, callback) {
|
|
1538
1572
|
server.setRequestHandler(SetLevelRequestSchema, async (request, extra) => {
|
|
1539
|
-
await callback(request.params.level,
|
|
1573
|
+
await callback(request.params.level, this.buildCallOptions(request, extra));
|
|
1540
1574
|
return {};
|
|
1541
1575
|
});
|
|
1542
1576
|
}
|