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/cjs/index.js
CHANGED
|
@@ -450,9 +450,6 @@ var createGetStockGraphHandler = (marketDataPrices) => {
|
|
|
450
450
|
const offerData = priceHistory.map((point) => point.offer);
|
|
451
451
|
const spreadData = priceHistory.map((point) => point.spread);
|
|
452
452
|
const volumeData = priceHistory.map((point) => point.volume);
|
|
453
|
-
const tradeData = priceHistory.map((point) => point.trade);
|
|
454
|
-
const vwapData = priceHistory.map((point) => point.vwap);
|
|
455
|
-
const twapData = priceHistory.map((point) => point.twap);
|
|
456
453
|
const config = {
|
|
457
454
|
type: "line",
|
|
458
455
|
data: {
|
|
@@ -482,30 +479,6 @@ var createGetStockGraphHandler = (marketDataPrices) => {
|
|
|
482
479
|
fill: false,
|
|
483
480
|
tension: 0.4
|
|
484
481
|
},
|
|
485
|
-
{
|
|
486
|
-
label: "Trade",
|
|
487
|
-
data: tradeData,
|
|
488
|
-
borderColor: "#ffc107",
|
|
489
|
-
backgroundColor: "rgba(255, 193, 7, 0.1)",
|
|
490
|
-
fill: false,
|
|
491
|
-
tension: 0.4
|
|
492
|
-
},
|
|
493
|
-
{
|
|
494
|
-
label: "VWAP",
|
|
495
|
-
data: vwapData,
|
|
496
|
-
borderColor: "#17a2b8",
|
|
497
|
-
backgroundColor: "rgba(23, 162, 184, 0.1)",
|
|
498
|
-
fill: false,
|
|
499
|
-
tension: 0.4
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
label: "TWAP",
|
|
503
|
-
data: twapData,
|
|
504
|
-
borderColor: "#6610f2",
|
|
505
|
-
backgroundColor: "rgba(102, 16, 242, 0.1)",
|
|
506
|
-
fill: false,
|
|
507
|
-
tension: 0.4
|
|
508
|
-
},
|
|
509
482
|
{
|
|
510
483
|
label: "Volume",
|
|
511
484
|
data: volumeData,
|
|
@@ -551,7 +524,7 @@ var createGetStockGraphHandler = (marketDataPrices) => {
|
|
|
551
524
|
content: [
|
|
552
525
|
{
|
|
553
526
|
type: "text",
|
|
554
|
-
text: `Error: ${error instanceof Error ? error.message : "Failed to generate
|
|
527
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to generate chart"}`,
|
|
555
528
|
uri: "getStockGraph"
|
|
556
529
|
}
|
|
557
530
|
],
|
|
@@ -589,48 +562,7 @@ var createGetStockPriceHistoryHandler = (marketDataPrices) => {
|
|
|
589
562
|
bid: point.bid,
|
|
590
563
|
offer: point.offer,
|
|
591
564
|
spread: point.spread,
|
|
592
|
-
volume: point.volume
|
|
593
|
-
trade: point.trade,
|
|
594
|
-
indexValue: point.indexValue,
|
|
595
|
-
openingPrice: point.openingPrice,
|
|
596
|
-
closingPrice: point.closingPrice,
|
|
597
|
-
settlementPrice: point.settlementPrice,
|
|
598
|
-
tradingSessionHighPrice: point.tradingSessionHighPrice,
|
|
599
|
-
tradingSessionLowPrice: point.tradingSessionLowPrice,
|
|
600
|
-
vwap: point.vwap,
|
|
601
|
-
imbalance: point.imbalance,
|
|
602
|
-
openInterest: point.openInterest,
|
|
603
|
-
compositeUnderlyingPrice: point.compositeUnderlyingPrice,
|
|
604
|
-
simulatedSellPrice: point.simulatedSellPrice,
|
|
605
|
-
simulatedBuyPrice: point.simulatedBuyPrice,
|
|
606
|
-
marginRate: point.marginRate,
|
|
607
|
-
midPrice: point.midPrice,
|
|
608
|
-
emptyBook: point.emptyBook,
|
|
609
|
-
settleHighPrice: point.settleHighPrice,
|
|
610
|
-
settleLowPrice: point.settleLowPrice,
|
|
611
|
-
priorSettlePrice: point.priorSettlePrice,
|
|
612
|
-
sessionHighBid: point.sessionHighBid,
|
|
613
|
-
sessionLowOffer: point.sessionLowOffer,
|
|
614
|
-
earlyPrices: point.earlyPrices,
|
|
615
|
-
auctionClearingPrice: point.auctionClearingPrice,
|
|
616
|
-
swapValueFactor: point.swapValueFactor,
|
|
617
|
-
dailyValueAdjustmentForLongPositions: point.dailyValueAdjustmentForLongPositions,
|
|
618
|
-
cumulativeValueAdjustmentForLongPositions: point.cumulativeValueAdjustmentForLongPositions,
|
|
619
|
-
dailyValueAdjustmentForShortPositions: point.dailyValueAdjustmentForShortPositions,
|
|
620
|
-
cumulativeValueAdjustmentForShortPositions: point.cumulativeValueAdjustmentForShortPositions,
|
|
621
|
-
fixingPrice: point.fixingPrice,
|
|
622
|
-
cashRate: point.cashRate,
|
|
623
|
-
recoveryRate: point.recoveryRate,
|
|
624
|
-
recoveryRateForLong: point.recoveryRateForLong,
|
|
625
|
-
recoveryRateForShort: point.recoveryRateForShort,
|
|
626
|
-
marketBid: point.marketBid,
|
|
627
|
-
marketOffer: point.marketOffer,
|
|
628
|
-
shortSaleMinPrice: point.shortSaleMinPrice,
|
|
629
|
-
previousClosingPrice: point.previousClosingPrice,
|
|
630
|
-
thresholdLimitPriceBanding: point.thresholdLimitPriceBanding,
|
|
631
|
-
dailyFinancingValue: point.dailyFinancingValue,
|
|
632
|
-
accruedFinancingValue: point.accruedFinancingValue,
|
|
633
|
-
twap: point.twap
|
|
565
|
+
volume: point.volume
|
|
634
566
|
}))
|
|
635
567
|
},
|
|
636
568
|
null,
|
|
@@ -645,7 +577,7 @@ var createGetStockPriceHistoryHandler = (marketDataPrices) => {
|
|
|
645
577
|
content: [
|
|
646
578
|
{
|
|
647
579
|
type: "text",
|
|
648
|
-
text: `Error: ${error instanceof Error ? error.message : "Failed to get price history"}`,
|
|
580
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to get stock price history"}`,
|
|
649
581
|
uri: "getStockPriceHistory"
|
|
650
582
|
}
|
|
651
583
|
],
|
|
@@ -753,7 +685,7 @@ Parameters verified:
|
|
|
753
685
|
- Symbol: ${args.symbol}
|
|
754
686
|
- TimeInForce: ${args.timeInForce} (${timeInForceNames[args.timeInForce]})
|
|
755
687
|
|
|
756
|
-
To execute this order, call the executeOrder tool with these exact same parameters
|
|
688
|
+
To execute this order, call the executeOrder tool with these exact same parameters.`,
|
|
757
689
|
uri: "verifyOrder"
|
|
758
690
|
}
|
|
759
691
|
]
|
|
@@ -1016,12 +948,6 @@ function handleMessage(message, parser, pendingRequests, marketDataPrices, maxPr
|
|
|
1016
948
|
const entryType = entry.MDEntryType;
|
|
1017
949
|
const price = entry.MDEntryPx ? Number.parseFloat(entry.MDEntryPx) : 0;
|
|
1018
950
|
const size = entry.MDEntrySize ? Number.parseFloat(entry.MDEntrySize) : 0;
|
|
1019
|
-
if (entryType === import_fixparser3.MDEntryType.Bid || entryType === import_fixparser3.MDEntryType.Offer || entryType === import_fixparser3.MDEntryType.TradeVolume) {
|
|
1020
|
-
parser.logger.log({
|
|
1021
|
-
level: "info",
|
|
1022
|
-
message: `Market Data Entry - Type: ${entryType}, Price: ${price}, Size: ${size}`
|
|
1023
|
-
});
|
|
1024
|
-
}
|
|
1025
951
|
switch (entryType) {
|
|
1026
952
|
case import_fixparser3.MDEntryType.Bid:
|
|
1027
953
|
data.bid = price;
|
|
@@ -1411,20 +1337,28 @@ var MCPRemote = class extends MCPBase {
|
|
|
1411
1337
|
this.marketDataPrices,
|
|
1412
1338
|
this.MAX_PRICE_HISTORY
|
|
1413
1339
|
);
|
|
1414
|
-
this.logger?.log({
|
|
1415
|
-
level: "info",
|
|
1416
|
-
message: `Market Data Prices TEST: ${JSON.stringify(this.marketDataPrices)}`
|
|
1417
|
-
});
|
|
1418
1340
|
}
|
|
1419
1341
|
});
|
|
1420
1342
|
this.httpServer = (0, import_node_http.createServer)(async (req, res) => {
|
|
1343
|
+
this.logger?.log({
|
|
1344
|
+
level: "info",
|
|
1345
|
+
message: `Incoming request: ${req.method} ${req.url}`
|
|
1346
|
+
});
|
|
1421
1347
|
if (!req.url || !req.method) {
|
|
1348
|
+
this.logger?.log({
|
|
1349
|
+
level: "error",
|
|
1350
|
+
message: "Invalid request: missing URL or method"
|
|
1351
|
+
});
|
|
1422
1352
|
res.writeHead(400);
|
|
1423
1353
|
res.end("Bad Request");
|
|
1424
1354
|
return;
|
|
1425
1355
|
}
|
|
1426
1356
|
if (req.url === "/mcp") {
|
|
1427
1357
|
const sessionId = req.headers["mcp-session-id"];
|
|
1358
|
+
this.logger?.log({
|
|
1359
|
+
level: "info",
|
|
1360
|
+
message: `MCP request received. Session ID: ${sessionId || "none"}, headers: ${req.headers}`
|
|
1361
|
+
});
|
|
1428
1362
|
if (req.method === "POST") {
|
|
1429
1363
|
const bodyChunks = [];
|
|
1430
1364
|
req.on("data", (chunk) => {
|
|
@@ -1435,23 +1369,47 @@ var MCPRemote = class extends MCPBase {
|
|
|
1435
1369
|
const body = Buffer.concat(bodyChunks).toString();
|
|
1436
1370
|
try {
|
|
1437
1371
|
parsed = JSON.parse(body);
|
|
1372
|
+
this.logger?.log({
|
|
1373
|
+
level: "info",
|
|
1374
|
+
message: `Parsed request body: ${JSON.stringify(parsed)}`
|
|
1375
|
+
});
|
|
1438
1376
|
} catch (err) {
|
|
1377
|
+
this.logger?.log({
|
|
1378
|
+
level: "error",
|
|
1379
|
+
message: `Failed to parse JSON body: ${err}`
|
|
1380
|
+
});
|
|
1439
1381
|
res.writeHead(400);
|
|
1440
1382
|
res.end(JSON.stringify({ error: "Invalid JSON" }));
|
|
1441
1383
|
return;
|
|
1442
1384
|
}
|
|
1443
1385
|
let transport;
|
|
1444
1386
|
if (sessionId && transports[sessionId]) {
|
|
1387
|
+
this.logger?.log({
|
|
1388
|
+
level: "info",
|
|
1389
|
+
message: `Using existing transport for session: ${sessionId}`
|
|
1390
|
+
});
|
|
1445
1391
|
transport = transports[sessionId];
|
|
1446
1392
|
} else if (!sessionId && req.method === "POST" && (0, import_types.isInitializeRequest)(parsed)) {
|
|
1393
|
+
this.logger?.log({
|
|
1394
|
+
level: "info",
|
|
1395
|
+
message: "Creating new transport for initialization request"
|
|
1396
|
+
});
|
|
1447
1397
|
transport = new import_streamableHttp.StreamableHTTPServerTransport({
|
|
1448
1398
|
sessionIdGenerator: () => (0, import_node_crypto.randomUUID)(),
|
|
1449
1399
|
onsessioninitialized: (sessionId2) => {
|
|
1400
|
+
this.logger?.log({
|
|
1401
|
+
level: "info",
|
|
1402
|
+
message: `New session initialized: ${sessionId2}`
|
|
1403
|
+
});
|
|
1450
1404
|
transports[sessionId2] = transport;
|
|
1451
1405
|
}
|
|
1452
1406
|
});
|
|
1453
1407
|
transport.onclose = () => {
|
|
1454
1408
|
if (transport.sessionId) {
|
|
1409
|
+
this.logger?.log({
|
|
1410
|
+
level: "info",
|
|
1411
|
+
message: `Session closed: ${transport.sessionId}`
|
|
1412
|
+
});
|
|
1455
1413
|
delete transports[transport.sessionId];
|
|
1456
1414
|
}
|
|
1457
1415
|
};
|
|
@@ -1462,6 +1420,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1462
1420
|
this.setupTools();
|
|
1463
1421
|
await this.mcpServer.connect(transport);
|
|
1464
1422
|
} else {
|
|
1423
|
+
this.logger?.log({
|
|
1424
|
+
level: "error",
|
|
1425
|
+
message: "Invalid request: No valid session ID provided"
|
|
1426
|
+
});
|
|
1465
1427
|
res.writeHead(400, { "Content-Type": "application/json" });
|
|
1466
1428
|
res.end(
|
|
1467
1429
|
JSON.stringify({
|
|
@@ -1477,6 +1439,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1477
1439
|
}
|
|
1478
1440
|
try {
|
|
1479
1441
|
await transport.handleRequest(req, res, parsed);
|
|
1442
|
+
this.logger?.log({
|
|
1443
|
+
level: "info",
|
|
1444
|
+
message: "Request handled successfully"
|
|
1445
|
+
});
|
|
1480
1446
|
} catch (error) {
|
|
1481
1447
|
this.logger?.log({
|
|
1482
1448
|
level: "error",
|
|
@@ -1487,6 +1453,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1487
1453
|
});
|
|
1488
1454
|
} else if (req.method === "GET" || req.method === "DELETE") {
|
|
1489
1455
|
if (!sessionId || !transports[sessionId]) {
|
|
1456
|
+
this.logger?.log({
|
|
1457
|
+
level: "error",
|
|
1458
|
+
message: `Invalid session ID for ${req.method} request: ${sessionId}`
|
|
1459
|
+
});
|
|
1490
1460
|
res.writeHead(400);
|
|
1491
1461
|
res.end("Invalid or missing session ID");
|
|
1492
1462
|
return;
|
|
@@ -1494,6 +1464,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1494
1464
|
const transport = transports[sessionId];
|
|
1495
1465
|
try {
|
|
1496
1466
|
await transport.handleRequest(req, res);
|
|
1467
|
+
this.logger?.log({
|
|
1468
|
+
level: "info",
|
|
1469
|
+
message: `${req.method} request handled successfully for session: ${sessionId}`
|
|
1470
|
+
});
|
|
1497
1471
|
} catch (error) {
|
|
1498
1472
|
this.logger?.log({
|
|
1499
1473
|
level: "error",
|
|
@@ -1510,6 +1484,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1510
1484
|
res.end("Method Not Allowed");
|
|
1511
1485
|
}
|
|
1512
1486
|
} else {
|
|
1487
|
+
this.logger?.log({
|
|
1488
|
+
level: "error",
|
|
1489
|
+
message: `Not found: ${req.url}`
|
|
1490
|
+
});
|
|
1513
1491
|
res.writeHead(404);
|
|
1514
1492
|
res.end("Not Found");
|
|
1515
1493
|
}
|