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/MCPRemote.mjs
CHANGED
|
@@ -416,9 +416,6 @@ var createGetStockGraphHandler = (marketDataPrices) => {
|
|
|
416
416
|
const offerData = priceHistory.map((point) => point.offer);
|
|
417
417
|
const spreadData = priceHistory.map((point) => point.spread);
|
|
418
418
|
const volumeData = priceHistory.map((point) => point.volume);
|
|
419
|
-
const tradeData = priceHistory.map((point) => point.trade);
|
|
420
|
-
const vwapData = priceHistory.map((point) => point.vwap);
|
|
421
|
-
const twapData = priceHistory.map((point) => point.twap);
|
|
422
419
|
const config = {
|
|
423
420
|
type: "line",
|
|
424
421
|
data: {
|
|
@@ -448,30 +445,6 @@ var createGetStockGraphHandler = (marketDataPrices) => {
|
|
|
448
445
|
fill: false,
|
|
449
446
|
tension: 0.4
|
|
450
447
|
},
|
|
451
|
-
{
|
|
452
|
-
label: "Trade",
|
|
453
|
-
data: tradeData,
|
|
454
|
-
borderColor: "#ffc107",
|
|
455
|
-
backgroundColor: "rgba(255, 193, 7, 0.1)",
|
|
456
|
-
fill: false,
|
|
457
|
-
tension: 0.4
|
|
458
|
-
},
|
|
459
|
-
{
|
|
460
|
-
label: "VWAP",
|
|
461
|
-
data: vwapData,
|
|
462
|
-
borderColor: "#17a2b8",
|
|
463
|
-
backgroundColor: "rgba(23, 162, 184, 0.1)",
|
|
464
|
-
fill: false,
|
|
465
|
-
tension: 0.4
|
|
466
|
-
},
|
|
467
|
-
{
|
|
468
|
-
label: "TWAP",
|
|
469
|
-
data: twapData,
|
|
470
|
-
borderColor: "#6610f2",
|
|
471
|
-
backgroundColor: "rgba(102, 16, 242, 0.1)",
|
|
472
|
-
fill: false,
|
|
473
|
-
tension: 0.4
|
|
474
|
-
},
|
|
475
448
|
{
|
|
476
449
|
label: "Volume",
|
|
477
450
|
data: volumeData,
|
|
@@ -517,7 +490,7 @@ var createGetStockGraphHandler = (marketDataPrices) => {
|
|
|
517
490
|
content: [
|
|
518
491
|
{
|
|
519
492
|
type: "text",
|
|
520
|
-
text: `Error: ${error instanceof Error ? error.message : "Failed to generate
|
|
493
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to generate chart"}`,
|
|
521
494
|
uri: "getStockGraph"
|
|
522
495
|
}
|
|
523
496
|
],
|
|
@@ -555,48 +528,7 @@ var createGetStockPriceHistoryHandler = (marketDataPrices) => {
|
|
|
555
528
|
bid: point.bid,
|
|
556
529
|
offer: point.offer,
|
|
557
530
|
spread: point.spread,
|
|
558
|
-
volume: point.volume
|
|
559
|
-
trade: point.trade,
|
|
560
|
-
indexValue: point.indexValue,
|
|
561
|
-
openingPrice: point.openingPrice,
|
|
562
|
-
closingPrice: point.closingPrice,
|
|
563
|
-
settlementPrice: point.settlementPrice,
|
|
564
|
-
tradingSessionHighPrice: point.tradingSessionHighPrice,
|
|
565
|
-
tradingSessionLowPrice: point.tradingSessionLowPrice,
|
|
566
|
-
vwap: point.vwap,
|
|
567
|
-
imbalance: point.imbalance,
|
|
568
|
-
openInterest: point.openInterest,
|
|
569
|
-
compositeUnderlyingPrice: point.compositeUnderlyingPrice,
|
|
570
|
-
simulatedSellPrice: point.simulatedSellPrice,
|
|
571
|
-
simulatedBuyPrice: point.simulatedBuyPrice,
|
|
572
|
-
marginRate: point.marginRate,
|
|
573
|
-
midPrice: point.midPrice,
|
|
574
|
-
emptyBook: point.emptyBook,
|
|
575
|
-
settleHighPrice: point.settleHighPrice,
|
|
576
|
-
settleLowPrice: point.settleLowPrice,
|
|
577
|
-
priorSettlePrice: point.priorSettlePrice,
|
|
578
|
-
sessionHighBid: point.sessionHighBid,
|
|
579
|
-
sessionLowOffer: point.sessionLowOffer,
|
|
580
|
-
earlyPrices: point.earlyPrices,
|
|
581
|
-
auctionClearingPrice: point.auctionClearingPrice,
|
|
582
|
-
swapValueFactor: point.swapValueFactor,
|
|
583
|
-
dailyValueAdjustmentForLongPositions: point.dailyValueAdjustmentForLongPositions,
|
|
584
|
-
cumulativeValueAdjustmentForLongPositions: point.cumulativeValueAdjustmentForLongPositions,
|
|
585
|
-
dailyValueAdjustmentForShortPositions: point.dailyValueAdjustmentForShortPositions,
|
|
586
|
-
cumulativeValueAdjustmentForShortPositions: point.cumulativeValueAdjustmentForShortPositions,
|
|
587
|
-
fixingPrice: point.fixingPrice,
|
|
588
|
-
cashRate: point.cashRate,
|
|
589
|
-
recoveryRate: point.recoveryRate,
|
|
590
|
-
recoveryRateForLong: point.recoveryRateForLong,
|
|
591
|
-
recoveryRateForShort: point.recoveryRateForShort,
|
|
592
|
-
marketBid: point.marketBid,
|
|
593
|
-
marketOffer: point.marketOffer,
|
|
594
|
-
shortSaleMinPrice: point.shortSaleMinPrice,
|
|
595
|
-
previousClosingPrice: point.previousClosingPrice,
|
|
596
|
-
thresholdLimitPriceBanding: point.thresholdLimitPriceBanding,
|
|
597
|
-
dailyFinancingValue: point.dailyFinancingValue,
|
|
598
|
-
accruedFinancingValue: point.accruedFinancingValue,
|
|
599
|
-
twap: point.twap
|
|
531
|
+
volume: point.volume
|
|
600
532
|
}))
|
|
601
533
|
},
|
|
602
534
|
null,
|
|
@@ -611,7 +543,7 @@ var createGetStockPriceHistoryHandler = (marketDataPrices) => {
|
|
|
611
543
|
content: [
|
|
612
544
|
{
|
|
613
545
|
type: "text",
|
|
614
|
-
text: `Error: ${error instanceof Error ? error.message : "Failed to get price history"}`,
|
|
546
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to get stock price history"}`,
|
|
615
547
|
uri: "getStockPriceHistory"
|
|
616
548
|
}
|
|
617
549
|
],
|
|
@@ -719,7 +651,7 @@ Parameters verified:
|
|
|
719
651
|
- Symbol: ${args.symbol}
|
|
720
652
|
- TimeInForce: ${args.timeInForce} (${timeInForceNames[args.timeInForce]})
|
|
721
653
|
|
|
722
|
-
To execute this order, call the executeOrder tool with these exact same parameters
|
|
654
|
+
To execute this order, call the executeOrder tool with these exact same parameters.`,
|
|
723
655
|
uri: "verifyOrder"
|
|
724
656
|
}
|
|
725
657
|
]
|
|
@@ -982,12 +914,6 @@ function handleMessage(message, parser, pendingRequests, marketDataPrices, maxPr
|
|
|
982
914
|
const entryType = entry.MDEntryType;
|
|
983
915
|
const price = entry.MDEntryPx ? Number.parseFloat(entry.MDEntryPx) : 0;
|
|
984
916
|
const size = entry.MDEntrySize ? Number.parseFloat(entry.MDEntrySize) : 0;
|
|
985
|
-
if (entryType === MDEntryType2.Bid || entryType === MDEntryType2.Offer || entryType === MDEntryType2.TradeVolume) {
|
|
986
|
-
parser.logger.log({
|
|
987
|
-
level: "info",
|
|
988
|
-
message: `Market Data Entry - Type: ${entryType}, Price: ${price}, Size: ${size}`
|
|
989
|
-
});
|
|
990
|
-
}
|
|
991
917
|
switch (entryType) {
|
|
992
918
|
case MDEntryType2.Bid:
|
|
993
919
|
data.bid = price;
|
|
@@ -1252,20 +1178,28 @@ var MCPRemote = class extends MCPBase {
|
|
|
1252
1178
|
this.marketDataPrices,
|
|
1253
1179
|
this.MAX_PRICE_HISTORY
|
|
1254
1180
|
);
|
|
1255
|
-
this.logger?.log({
|
|
1256
|
-
level: "info",
|
|
1257
|
-
message: `Market Data Prices TEST: ${JSON.stringify(this.marketDataPrices)}`
|
|
1258
|
-
});
|
|
1259
1181
|
}
|
|
1260
1182
|
});
|
|
1261
1183
|
this.httpServer = createServer(async (req, res) => {
|
|
1184
|
+
this.logger?.log({
|
|
1185
|
+
level: "info",
|
|
1186
|
+
message: `Incoming request: ${req.method} ${req.url}`
|
|
1187
|
+
});
|
|
1262
1188
|
if (!req.url || !req.method) {
|
|
1189
|
+
this.logger?.log({
|
|
1190
|
+
level: "error",
|
|
1191
|
+
message: "Invalid request: missing URL or method"
|
|
1192
|
+
});
|
|
1263
1193
|
res.writeHead(400);
|
|
1264
1194
|
res.end("Bad Request");
|
|
1265
1195
|
return;
|
|
1266
1196
|
}
|
|
1267
1197
|
if (req.url === "/mcp") {
|
|
1268
1198
|
const sessionId = req.headers["mcp-session-id"];
|
|
1199
|
+
this.logger?.log({
|
|
1200
|
+
level: "info",
|
|
1201
|
+
message: `MCP request received. Session ID: ${sessionId || "none"}, headers: ${req.headers}`
|
|
1202
|
+
});
|
|
1269
1203
|
if (req.method === "POST") {
|
|
1270
1204
|
const bodyChunks = [];
|
|
1271
1205
|
req.on("data", (chunk) => {
|
|
@@ -1276,23 +1210,47 @@ var MCPRemote = class extends MCPBase {
|
|
|
1276
1210
|
const body = Buffer.concat(bodyChunks).toString();
|
|
1277
1211
|
try {
|
|
1278
1212
|
parsed = JSON.parse(body);
|
|
1213
|
+
this.logger?.log({
|
|
1214
|
+
level: "info",
|
|
1215
|
+
message: `Parsed request body: ${JSON.stringify(parsed)}`
|
|
1216
|
+
});
|
|
1279
1217
|
} catch (err) {
|
|
1218
|
+
this.logger?.log({
|
|
1219
|
+
level: "error",
|
|
1220
|
+
message: `Failed to parse JSON body: ${err}`
|
|
1221
|
+
});
|
|
1280
1222
|
res.writeHead(400);
|
|
1281
1223
|
res.end(JSON.stringify({ error: "Invalid JSON" }));
|
|
1282
1224
|
return;
|
|
1283
1225
|
}
|
|
1284
1226
|
let transport;
|
|
1285
1227
|
if (sessionId && transports[sessionId]) {
|
|
1228
|
+
this.logger?.log({
|
|
1229
|
+
level: "info",
|
|
1230
|
+
message: `Using existing transport for session: ${sessionId}`
|
|
1231
|
+
});
|
|
1286
1232
|
transport = transports[sessionId];
|
|
1287
1233
|
} else if (!sessionId && req.method === "POST" && isInitializeRequest(parsed)) {
|
|
1234
|
+
this.logger?.log({
|
|
1235
|
+
level: "info",
|
|
1236
|
+
message: "Creating new transport for initialization request"
|
|
1237
|
+
});
|
|
1288
1238
|
transport = new StreamableHTTPServerTransport({
|
|
1289
1239
|
sessionIdGenerator: () => randomUUID(),
|
|
1290
1240
|
onsessioninitialized: (sessionId2) => {
|
|
1241
|
+
this.logger?.log({
|
|
1242
|
+
level: "info",
|
|
1243
|
+
message: `New session initialized: ${sessionId2}`
|
|
1244
|
+
});
|
|
1291
1245
|
transports[sessionId2] = transport;
|
|
1292
1246
|
}
|
|
1293
1247
|
});
|
|
1294
1248
|
transport.onclose = () => {
|
|
1295
1249
|
if (transport.sessionId) {
|
|
1250
|
+
this.logger?.log({
|
|
1251
|
+
level: "info",
|
|
1252
|
+
message: `Session closed: ${transport.sessionId}`
|
|
1253
|
+
});
|
|
1296
1254
|
delete transports[transport.sessionId];
|
|
1297
1255
|
}
|
|
1298
1256
|
};
|
|
@@ -1303,6 +1261,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1303
1261
|
this.setupTools();
|
|
1304
1262
|
await this.mcpServer.connect(transport);
|
|
1305
1263
|
} else {
|
|
1264
|
+
this.logger?.log({
|
|
1265
|
+
level: "error",
|
|
1266
|
+
message: "Invalid request: No valid session ID provided"
|
|
1267
|
+
});
|
|
1306
1268
|
res.writeHead(400, { "Content-Type": "application/json" });
|
|
1307
1269
|
res.end(
|
|
1308
1270
|
JSON.stringify({
|
|
@@ -1318,6 +1280,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1318
1280
|
}
|
|
1319
1281
|
try {
|
|
1320
1282
|
await transport.handleRequest(req, res, parsed);
|
|
1283
|
+
this.logger?.log({
|
|
1284
|
+
level: "info",
|
|
1285
|
+
message: "Request handled successfully"
|
|
1286
|
+
});
|
|
1321
1287
|
} catch (error) {
|
|
1322
1288
|
this.logger?.log({
|
|
1323
1289
|
level: "error",
|
|
@@ -1328,6 +1294,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1328
1294
|
});
|
|
1329
1295
|
} else if (req.method === "GET" || req.method === "DELETE") {
|
|
1330
1296
|
if (!sessionId || !transports[sessionId]) {
|
|
1297
|
+
this.logger?.log({
|
|
1298
|
+
level: "error",
|
|
1299
|
+
message: `Invalid session ID for ${req.method} request: ${sessionId}`
|
|
1300
|
+
});
|
|
1331
1301
|
res.writeHead(400);
|
|
1332
1302
|
res.end("Invalid or missing session ID");
|
|
1333
1303
|
return;
|
|
@@ -1335,6 +1305,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1335
1305
|
const transport = transports[sessionId];
|
|
1336
1306
|
try {
|
|
1337
1307
|
await transport.handleRequest(req, res);
|
|
1308
|
+
this.logger?.log({
|
|
1309
|
+
level: "info",
|
|
1310
|
+
message: `${req.method} request handled successfully for session: ${sessionId}`
|
|
1311
|
+
});
|
|
1338
1312
|
} catch (error) {
|
|
1339
1313
|
this.logger?.log({
|
|
1340
1314
|
level: "error",
|
|
@@ -1351,6 +1325,10 @@ var MCPRemote = class extends MCPBase {
|
|
|
1351
1325
|
res.end("Method Not Allowed");
|
|
1352
1326
|
}
|
|
1353
1327
|
} else {
|
|
1328
|
+
this.logger?.log({
|
|
1329
|
+
level: "error",
|
|
1330
|
+
message: `Not found: ${req.url}`
|
|
1331
|
+
});
|
|
1354
1332
|
res.writeHead(404);
|
|
1355
1333
|
res.end("Not Found");
|
|
1356
1334
|
}
|