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/MCPRemote.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;
|
|
@@ -1286,20 +1212,28 @@ var MCPRemote = class extends MCPBase {
|
|
|
1286
1212
|
this.marketDataPrices,
|
|
1287
1213
|
this.MAX_PRICE_HISTORY
|
|
1288
1214
|
);
|
|
1289
|
-
this.logger?.log({
|
|
1290
|
-
level: "info",
|
|
1291
|
-
message: `Market Data Prices TEST: ${JSON.stringify(this.marketDataPrices)}`
|
|
1292
|
-
});
|
|
1293
1215
|
}
|
|
1294
1216
|
});
|
|
1295
1217
|
this.httpServer = (0, import_node_http.createServer)(async (req, res) => {
|
|
1218
|
+
this.logger?.log({
|
|
1219
|
+
level: "info",
|
|
1220
|
+
message: `Incoming request: ${req.method} ${req.url}`
|
|
1221
|
+
});
|
|
1296
1222
|
if (!req.url || !req.method) {
|
|
1223
|
+
this.logger?.log({
|
|
1224
|
+
level: "error",
|
|
1225
|
+
message: "Invalid request: missing URL or method"
|
|
1226
|
+
});
|
|
1297
1227
|
res.writeHead(400);
|
|
1298
1228
|
res.end("Bad Request");
|
|
1299
1229
|
return;
|
|
1300
1230
|
}
|
|
1301
1231
|
if (req.url === "/mcp") {
|
|
1302
1232
|
const sessionId = req.headers["mcp-session-id"];
|
|
1233
|
+
this.logger?.log({
|
|
1234
|
+
level: "info",
|
|
1235
|
+
message: `MCP request received. Session ID: ${sessionId || "none"}, headers: ${req.headers}`
|
|
1236
|
+
});
|
|
1303
1237
|
if (req.method === "POST") {
|
|
1304
1238
|
const bodyChunks = [];
|
|
1305
1239
|
req.on("data", (chunk) => {
|
|
@@ -1310,23 +1244,47 @@ var MCPRemote = class extends MCPBase {
|
|
|
1310
1244
|
const body = Buffer.concat(bodyChunks).toString();
|
|
1311
1245
|
try {
|
|
1312
1246
|
parsed = JSON.parse(body);
|
|
1247
|
+
this.logger?.log({
|
|
1248
|
+
level: "info",
|
|
1249
|
+
message: `Parsed request body: ${JSON.stringify(parsed)}`
|
|
1250
|
+
});
|
|
1313
1251
|
} catch (err) {
|
|
1252
|
+
this.logger?.log({
|
|
1253
|
+
level: "error",
|
|
1254
|
+
message: `Failed to parse JSON body: ${err}`
|
|
1255
|
+
});
|
|
1314
1256
|
res.writeHead(400);
|
|
1315
1257
|
res.end(JSON.stringify({ error: "Invalid JSON" }));
|
|
1316
1258
|
return;
|
|
1317
1259
|
}
|
|
1318
1260
|
let transport;
|
|
1319
1261
|
if (sessionId && transports[sessionId]) {
|
|
1262
|
+
this.logger?.log({
|
|
1263
|
+
level: "info",
|
|
1264
|
+
message: `Using existing transport for session: ${sessionId}`
|
|
1265
|
+
});
|
|
1320
1266
|
transport = transports[sessionId];
|
|
1321
1267
|
} else if (!sessionId && req.method === "POST" && (0, import_types.isInitializeRequest)(parsed)) {
|
|
1268
|
+
this.logger?.log({
|
|
1269
|
+
level: "info",
|
|
1270
|
+
message: "Creating new transport for initialization request"
|
|
1271
|
+
});
|
|
1322
1272
|
transport = new import_streamableHttp.StreamableHTTPServerTransport({
|
|
1323
1273
|
sessionIdGenerator: () => (0, import_node_crypto.randomUUID)(),
|
|
1324
1274
|
onsessioninitialized: (sessionId2) => {
|
|
1275
|
+
this.logger?.log({
|
|
1276
|
+
level: "info",
|
|
1277
|
+
message: `New session initialized: ${sessionId2}`
|
|
1278
|
+
});
|
|
1325
1279
|
transports[sessionId2] = transport;
|
|
1326
1280
|
}
|
|
1327
1281
|
});
|
|
1328
1282
|
transport.onclose = () => {
|
|
1329
1283
|
if (transport.sessionId) {
|
|
1284
|
+
this.logger?.log({
|
|
1285
|
+
level: "info",
|
|
1286
|
+
message: `Session closed: ${transport.sessionId}`
|
|
1287
|
+
});
|
|
1330
1288
|
delete transports[transport.sessionId];
|
|
1331
1289
|
}
|
|
1332
1290
|
};
|
|
@@ -1337,6 +1295,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1337
1295
|
this.setupTools();
|
|
1338
1296
|
await this.mcpServer.connect(transport);
|
|
1339
1297
|
} else {
|
|
1298
|
+
this.logger?.log({
|
|
1299
|
+
level: "error",
|
|
1300
|
+
message: "Invalid request: No valid session ID provided"
|
|
1301
|
+
});
|
|
1340
1302
|
res.writeHead(400, { "Content-Type": "application/json" });
|
|
1341
1303
|
res.end(
|
|
1342
1304
|
JSON.stringify({
|
|
@@ -1352,6 +1314,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1352
1314
|
}
|
|
1353
1315
|
try {
|
|
1354
1316
|
await transport.handleRequest(req, res, parsed);
|
|
1317
|
+
this.logger?.log({
|
|
1318
|
+
level: "info",
|
|
1319
|
+
message: "Request handled successfully"
|
|
1320
|
+
});
|
|
1355
1321
|
} catch (error) {
|
|
1356
1322
|
this.logger?.log({
|
|
1357
1323
|
level: "error",
|
|
@@ -1362,6 +1328,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1362
1328
|
});
|
|
1363
1329
|
} else if (req.method === "GET" || req.method === "DELETE") {
|
|
1364
1330
|
if (!sessionId || !transports[sessionId]) {
|
|
1331
|
+
this.logger?.log({
|
|
1332
|
+
level: "error",
|
|
1333
|
+
message: `Invalid session ID for ${req.method} request: ${sessionId}`
|
|
1334
|
+
});
|
|
1365
1335
|
res.writeHead(400);
|
|
1366
1336
|
res.end("Invalid or missing session ID");
|
|
1367
1337
|
return;
|
|
@@ -1369,6 +1339,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1369
1339
|
const transport = transports[sessionId];
|
|
1370
1340
|
try {
|
|
1371
1341
|
await transport.handleRequest(req, res);
|
|
1342
|
+
this.logger?.log({
|
|
1343
|
+
level: "info",
|
|
1344
|
+
message: `${req.method} request handled successfully for session: ${sessionId}`
|
|
1345
|
+
});
|
|
1372
1346
|
} catch (error) {
|
|
1373
1347
|
this.logger?.log({
|
|
1374
1348
|
level: "error",
|
|
@@ -1385,6 +1359,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1385
1359
|
res.end("Method Not Allowed");
|
|
1386
1360
|
}
|
|
1387
1361
|
} else {
|
|
1362
|
+
this.logger?.log({
|
|
1363
|
+
level: "error",
|
|
1364
|
+
message: `Not found: ${req.url}`
|
|
1365
|
+
});
|
|
1388
1366
|
res.writeHead(404);
|
|
1389
1367
|
res.end("Not Found");
|
|
1390
1368
|
}
|