fixparser-plugin-mcp 9.1.7-c213f7c6 → 9.1.7-c415bb75
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/build/cjs/MCPLocal.js +4 -78
- package/build/cjs/MCPLocal.js.map +2 -2
- package/build/cjs/MCPRemote.js +60 -82
- package/build/cjs/MCPRemote.js.map +2 -2
- package/build/cjs/index.js +60 -82
- package/build/cjs/index.js.map +2 -2
- package/build/esm/MCPLocal.mjs +4 -78
- package/build/esm/MCPLocal.mjs.map +2 -2
- package/build/esm/MCPRemote.mjs +60 -82
- package/build/esm/MCPRemote.mjs.map +2 -2
- package/build/esm/index.mjs +60 -82
- package/build/esm/index.mjs.map +2 -2
- package/build-examples/cjs/example_mcp_local.js +6 -6
- package/build-examples/cjs/example_mcp_local.js.map +3 -3
- package/build-examples/cjs/example_mcp_remote.js +3 -3
- package/build-examples/cjs/example_mcp_remote.js.map +3 -3
- package/build-examples/esm/example_mcp_local.mjs +6 -6
- package/build-examples/esm/example_mcp_local.mjs.map +3 -3
- package/build-examples/esm/example_mcp_remote.mjs +7 -7
- package/build-examples/esm/example_mcp_remote.mjs.map +3 -3
- package/package.json +1 -1
- package/types/MCPRemote.d.ts +1 -1
- package/types/schemas/index.d.ts +0 -1
- package/types/tools/index.d.ts +11 -2
- package/types/tools/marketData.d.ts +24 -3
package/build/esm/index.mjs
CHANGED
|
@@ -413,9 +413,6 @@ var createGetStockGraphHandler = (marketDataPrices) => {
|
|
|
413
413
|
const offerData = priceHistory.map((point) => point.offer);
|
|
414
414
|
const spreadData = priceHistory.map((point) => point.spread);
|
|
415
415
|
const volumeData = priceHistory.map((point) => point.volume);
|
|
416
|
-
const tradeData = priceHistory.map((point) => point.trade);
|
|
417
|
-
const vwapData = priceHistory.map((point) => point.vwap);
|
|
418
|
-
const twapData = priceHistory.map((point) => point.twap);
|
|
419
416
|
const config = {
|
|
420
417
|
type: "line",
|
|
421
418
|
data: {
|
|
@@ -445,30 +442,6 @@ var createGetStockGraphHandler = (marketDataPrices) => {
|
|
|
445
442
|
fill: false,
|
|
446
443
|
tension: 0.4
|
|
447
444
|
},
|
|
448
|
-
{
|
|
449
|
-
label: "Trade",
|
|
450
|
-
data: tradeData,
|
|
451
|
-
borderColor: "#ffc107",
|
|
452
|
-
backgroundColor: "rgba(255, 193, 7, 0.1)",
|
|
453
|
-
fill: false,
|
|
454
|
-
tension: 0.4
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
label: "VWAP",
|
|
458
|
-
data: vwapData,
|
|
459
|
-
borderColor: "#17a2b8",
|
|
460
|
-
backgroundColor: "rgba(23, 162, 184, 0.1)",
|
|
461
|
-
fill: false,
|
|
462
|
-
tension: 0.4
|
|
463
|
-
},
|
|
464
|
-
{
|
|
465
|
-
label: "TWAP",
|
|
466
|
-
data: twapData,
|
|
467
|
-
borderColor: "#6610f2",
|
|
468
|
-
backgroundColor: "rgba(102, 16, 242, 0.1)",
|
|
469
|
-
fill: false,
|
|
470
|
-
tension: 0.4
|
|
471
|
-
},
|
|
472
445
|
{
|
|
473
446
|
label: "Volume",
|
|
474
447
|
data: volumeData,
|
|
@@ -514,7 +487,7 @@ var createGetStockGraphHandler = (marketDataPrices) => {
|
|
|
514
487
|
content: [
|
|
515
488
|
{
|
|
516
489
|
type: "text",
|
|
517
|
-
text: `Error: ${error instanceof Error ? error.message : "Failed to generate
|
|
490
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to generate chart"}`,
|
|
518
491
|
uri: "getStockGraph"
|
|
519
492
|
}
|
|
520
493
|
],
|
|
@@ -552,48 +525,7 @@ var createGetStockPriceHistoryHandler = (marketDataPrices) => {
|
|
|
552
525
|
bid: point.bid,
|
|
553
526
|
offer: point.offer,
|
|
554
527
|
spread: point.spread,
|
|
555
|
-
volume: point.volume
|
|
556
|
-
trade: point.trade,
|
|
557
|
-
indexValue: point.indexValue,
|
|
558
|
-
openingPrice: point.openingPrice,
|
|
559
|
-
closingPrice: point.closingPrice,
|
|
560
|
-
settlementPrice: point.settlementPrice,
|
|
561
|
-
tradingSessionHighPrice: point.tradingSessionHighPrice,
|
|
562
|
-
tradingSessionLowPrice: point.tradingSessionLowPrice,
|
|
563
|
-
vwap: point.vwap,
|
|
564
|
-
imbalance: point.imbalance,
|
|
565
|
-
openInterest: point.openInterest,
|
|
566
|
-
compositeUnderlyingPrice: point.compositeUnderlyingPrice,
|
|
567
|
-
simulatedSellPrice: point.simulatedSellPrice,
|
|
568
|
-
simulatedBuyPrice: point.simulatedBuyPrice,
|
|
569
|
-
marginRate: point.marginRate,
|
|
570
|
-
midPrice: point.midPrice,
|
|
571
|
-
emptyBook: point.emptyBook,
|
|
572
|
-
settleHighPrice: point.settleHighPrice,
|
|
573
|
-
settleLowPrice: point.settleLowPrice,
|
|
574
|
-
priorSettlePrice: point.priorSettlePrice,
|
|
575
|
-
sessionHighBid: point.sessionHighBid,
|
|
576
|
-
sessionLowOffer: point.sessionLowOffer,
|
|
577
|
-
earlyPrices: point.earlyPrices,
|
|
578
|
-
auctionClearingPrice: point.auctionClearingPrice,
|
|
579
|
-
swapValueFactor: point.swapValueFactor,
|
|
580
|
-
dailyValueAdjustmentForLongPositions: point.dailyValueAdjustmentForLongPositions,
|
|
581
|
-
cumulativeValueAdjustmentForLongPositions: point.cumulativeValueAdjustmentForLongPositions,
|
|
582
|
-
dailyValueAdjustmentForShortPositions: point.dailyValueAdjustmentForShortPositions,
|
|
583
|
-
cumulativeValueAdjustmentForShortPositions: point.cumulativeValueAdjustmentForShortPositions,
|
|
584
|
-
fixingPrice: point.fixingPrice,
|
|
585
|
-
cashRate: point.cashRate,
|
|
586
|
-
recoveryRate: point.recoveryRate,
|
|
587
|
-
recoveryRateForLong: point.recoveryRateForLong,
|
|
588
|
-
recoveryRateForShort: point.recoveryRateForShort,
|
|
589
|
-
marketBid: point.marketBid,
|
|
590
|
-
marketOffer: point.marketOffer,
|
|
591
|
-
shortSaleMinPrice: point.shortSaleMinPrice,
|
|
592
|
-
previousClosingPrice: point.previousClosingPrice,
|
|
593
|
-
thresholdLimitPriceBanding: point.thresholdLimitPriceBanding,
|
|
594
|
-
dailyFinancingValue: point.dailyFinancingValue,
|
|
595
|
-
accruedFinancingValue: point.accruedFinancingValue,
|
|
596
|
-
twap: point.twap
|
|
528
|
+
volume: point.volume
|
|
597
529
|
}))
|
|
598
530
|
},
|
|
599
531
|
null,
|
|
@@ -608,7 +540,7 @@ var createGetStockPriceHistoryHandler = (marketDataPrices) => {
|
|
|
608
540
|
content: [
|
|
609
541
|
{
|
|
610
542
|
type: "text",
|
|
611
|
-
text: `Error: ${error instanceof Error ? error.message : "Failed to get price history"}`,
|
|
543
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to get stock price history"}`,
|
|
612
544
|
uri: "getStockPriceHistory"
|
|
613
545
|
}
|
|
614
546
|
],
|
|
@@ -716,7 +648,7 @@ Parameters verified:
|
|
|
716
648
|
- Symbol: ${args.symbol}
|
|
717
649
|
- TimeInForce: ${args.timeInForce} (${timeInForceNames[args.timeInForce]})
|
|
718
650
|
|
|
719
|
-
To execute this order, call the executeOrder tool with these exact same parameters
|
|
651
|
+
To execute this order, call the executeOrder tool with these exact same parameters.`,
|
|
720
652
|
uri: "verifyOrder"
|
|
721
653
|
}
|
|
722
654
|
]
|
|
@@ -979,12 +911,6 @@ function handleMessage(message, parser, pendingRequests, marketDataPrices, maxPr
|
|
|
979
911
|
const entryType = entry.MDEntryType;
|
|
980
912
|
const price = entry.MDEntryPx ? Number.parseFloat(entry.MDEntryPx) : 0;
|
|
981
913
|
const size = entry.MDEntrySize ? Number.parseFloat(entry.MDEntrySize) : 0;
|
|
982
|
-
if (entryType === MDEntryType2.Bid || entryType === MDEntryType2.Offer || entryType === MDEntryType2.TradeVolume) {
|
|
983
|
-
parser.logger.log({
|
|
984
|
-
level: "info",
|
|
985
|
-
message: `Market Data Entry - Type: ${entryType}, Price: ${price}, Size: ${size}`
|
|
986
|
-
});
|
|
987
|
-
}
|
|
988
914
|
switch (entryType) {
|
|
989
915
|
case MDEntryType2.Bid:
|
|
990
916
|
data.bid = price;
|
|
@@ -1374,20 +1300,28 @@ var MCPRemote = class extends MCPBase {
|
|
|
1374
1300
|
this.marketDataPrices,
|
|
1375
1301
|
this.MAX_PRICE_HISTORY
|
|
1376
1302
|
);
|
|
1377
|
-
this.logger?.log({
|
|
1378
|
-
level: "info",
|
|
1379
|
-
message: `Market Data Prices TEST: ${JSON.stringify(this.marketDataPrices)}`
|
|
1380
|
-
});
|
|
1381
1303
|
}
|
|
1382
1304
|
});
|
|
1383
1305
|
this.httpServer = createServer(async (req, res) => {
|
|
1306
|
+
this.logger?.log({
|
|
1307
|
+
level: "info",
|
|
1308
|
+
message: `Incoming request: ${req.method} ${req.url}`
|
|
1309
|
+
});
|
|
1384
1310
|
if (!req.url || !req.method) {
|
|
1311
|
+
this.logger?.log({
|
|
1312
|
+
level: "error",
|
|
1313
|
+
message: "Invalid request: missing URL or method"
|
|
1314
|
+
});
|
|
1385
1315
|
res.writeHead(400);
|
|
1386
1316
|
res.end("Bad Request");
|
|
1387
1317
|
return;
|
|
1388
1318
|
}
|
|
1389
1319
|
if (req.url === "/mcp") {
|
|
1390
1320
|
const sessionId = req.headers["mcp-session-id"];
|
|
1321
|
+
this.logger?.log({
|
|
1322
|
+
level: "info",
|
|
1323
|
+
message: `MCP request received. Session ID: ${sessionId || "none"}, headers: ${req.headers}`
|
|
1324
|
+
});
|
|
1391
1325
|
if (req.method === "POST") {
|
|
1392
1326
|
const bodyChunks = [];
|
|
1393
1327
|
req.on("data", (chunk) => {
|
|
@@ -1398,23 +1332,47 @@ var MCPRemote = class extends MCPBase {
|
|
|
1398
1332
|
const body = Buffer.concat(bodyChunks).toString();
|
|
1399
1333
|
try {
|
|
1400
1334
|
parsed = JSON.parse(body);
|
|
1335
|
+
this.logger?.log({
|
|
1336
|
+
level: "info",
|
|
1337
|
+
message: `Parsed request body: ${JSON.stringify(parsed)}`
|
|
1338
|
+
});
|
|
1401
1339
|
} catch (err) {
|
|
1340
|
+
this.logger?.log({
|
|
1341
|
+
level: "error",
|
|
1342
|
+
message: `Failed to parse JSON body: ${err}`
|
|
1343
|
+
});
|
|
1402
1344
|
res.writeHead(400);
|
|
1403
1345
|
res.end(JSON.stringify({ error: "Invalid JSON" }));
|
|
1404
1346
|
return;
|
|
1405
1347
|
}
|
|
1406
1348
|
let transport;
|
|
1407
1349
|
if (sessionId && transports[sessionId]) {
|
|
1350
|
+
this.logger?.log({
|
|
1351
|
+
level: "info",
|
|
1352
|
+
message: `Using existing transport for session: ${sessionId}`
|
|
1353
|
+
});
|
|
1408
1354
|
transport = transports[sessionId];
|
|
1409
1355
|
} else if (!sessionId && req.method === "POST" && isInitializeRequest(parsed)) {
|
|
1356
|
+
this.logger?.log({
|
|
1357
|
+
level: "info",
|
|
1358
|
+
message: "Creating new transport for initialization request"
|
|
1359
|
+
});
|
|
1410
1360
|
transport = new StreamableHTTPServerTransport({
|
|
1411
1361
|
sessionIdGenerator: () => randomUUID(),
|
|
1412
1362
|
onsessioninitialized: (sessionId2) => {
|
|
1363
|
+
this.logger?.log({
|
|
1364
|
+
level: "info",
|
|
1365
|
+
message: `New session initialized: ${sessionId2}`
|
|
1366
|
+
});
|
|
1413
1367
|
transports[sessionId2] = transport;
|
|
1414
1368
|
}
|
|
1415
1369
|
});
|
|
1416
1370
|
transport.onclose = () => {
|
|
1417
1371
|
if (transport.sessionId) {
|
|
1372
|
+
this.logger?.log({
|
|
1373
|
+
level: "info",
|
|
1374
|
+
message: `Session closed: ${transport.sessionId}`
|
|
1375
|
+
});
|
|
1418
1376
|
delete transports[transport.sessionId];
|
|
1419
1377
|
}
|
|
1420
1378
|
};
|
|
@@ -1425,6 +1383,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1425
1383
|
this.setupTools();
|
|
1426
1384
|
await this.mcpServer.connect(transport);
|
|
1427
1385
|
} else {
|
|
1386
|
+
this.logger?.log({
|
|
1387
|
+
level: "error",
|
|
1388
|
+
message: "Invalid request: No valid session ID provided"
|
|
1389
|
+
});
|
|
1428
1390
|
res.writeHead(400, { "Content-Type": "application/json" });
|
|
1429
1391
|
res.end(
|
|
1430
1392
|
JSON.stringify({
|
|
@@ -1440,6 +1402,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1440
1402
|
}
|
|
1441
1403
|
try {
|
|
1442
1404
|
await transport.handleRequest(req, res, parsed);
|
|
1405
|
+
this.logger?.log({
|
|
1406
|
+
level: "info",
|
|
1407
|
+
message: "Request handled successfully"
|
|
1408
|
+
});
|
|
1443
1409
|
} catch (error) {
|
|
1444
1410
|
this.logger?.log({
|
|
1445
1411
|
level: "error",
|
|
@@ -1450,6 +1416,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1450
1416
|
});
|
|
1451
1417
|
} else if (req.method === "GET" || req.method === "DELETE") {
|
|
1452
1418
|
if (!sessionId || !transports[sessionId]) {
|
|
1419
|
+
this.logger?.log({
|
|
1420
|
+
level: "error",
|
|
1421
|
+
message: `Invalid session ID for ${req.method} request: ${sessionId}`
|
|
1422
|
+
});
|
|
1453
1423
|
res.writeHead(400);
|
|
1454
1424
|
res.end("Invalid or missing session ID");
|
|
1455
1425
|
return;
|
|
@@ -1457,6 +1427,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1457
1427
|
const transport = transports[sessionId];
|
|
1458
1428
|
try {
|
|
1459
1429
|
await transport.handleRequest(req, res);
|
|
1430
|
+
this.logger?.log({
|
|
1431
|
+
level: "info",
|
|
1432
|
+
message: `${req.method} request handled successfully for session: ${sessionId}`
|
|
1433
|
+
});
|
|
1460
1434
|
} catch (error) {
|
|
1461
1435
|
this.logger?.log({
|
|
1462
1436
|
level: "error",
|
|
@@ -1473,6 +1447,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1473
1447
|
res.end("Method Not Allowed");
|
|
1474
1448
|
}
|
|
1475
1449
|
} else {
|
|
1450
|
+
this.logger?.log({
|
|
1451
|
+
level: "error",
|
|
1452
|
+
message: `Not found: ${req.url}`
|
|
1453
|
+
});
|
|
1476
1454
|
res.writeHead(404);
|
|
1477
1455
|
res.end("Not Found");
|
|
1478
1456
|
}
|