fixparser-plugin-mcp 9.1.7-b8fd1147 → 9.1.7-edd3725d
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
${n[0].messageTypeDescription}`}]}}catch(t){return{isError:!0,content:[{type:"text",text:`Error: ${t instanceof Error?t.message:"Failed to parse FIX string"}`}]}}case"parseToJSON":try{let{fixString:t}=
|
|
4
|
-
`)}}]}}case"marketDataRequest":{let{mdUpdateType:t,symbol:n,mdReqID:
|
|
5
|
-
`)}}]}}default:throw new Error(`Unknown prompt: ${
|
|
2
|
+
"use strict";var r=require("fixparser");var F=require("@modelcontextprotocol/sdk/server/index.js"),w=require("@modelcontextprotocol/sdk/server/stdio.js"),c=require("@modelcontextprotocol/sdk/types.js"),e=require("fixparser"),y={type:"object",properties:{fixString:{type:"string",description:"FIX message string to parse"}},required:["fixString"]},S={type:"object",properties:{fixString:{type:"string",description:"FIX message string to parse"}},required:["fixString"]},T={type:"object",properties:{clOrdID:{type:"string",description:"Client Order ID"},handlInst:{type:"string",enum:["1","2","3"],default:e.HandlInst.AutomatedExecutionNoIntervention,description:'Handling instruction (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "1" for Manual, "2" for Automated, "3" for AutomatedNoIntervention)'},quantity:{type:"number",description:"Order quantity"},price:{type:"number",description:"Order price"},ordType:{type:"string",enum:["1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","P","Q","R","S"],default:e.OrdType.Market,description:'Order type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "1" for Market, "2" for Limit, "3" for Stop)'},side:{type:"string",enum:["1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H"],description:'Order side (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "1" for Buy, "2" for Sell, "3" for BuyMinus, "4" for SellPlus, "5" for SellShort, "6" for SellShortExempt, "7" for Undisclosed, "8" for Cross, "9" for CrossShort, "A" for CrossShortExempt, "B" for AsDefined, "C" for Opposite, "D" for Subscribe, "E" for Redeem, "F" for Lend, "G" for Borrow, "H" for SellUndisclosed)'},symbol:{type:"string",description:"Trading symbol"},timeInForce:{type:"string",enum:["0","1","2","3","4","5","6","7","8","9","A","B","C"],default:e.TimeInForce.Day,description:'Time in force (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for Day, "1" for Good Till Cancel, "2" for At Opening, "3" for Immediate or Cancel, "4" for Fill or Kill, "5" for Good Till Crossing, "6" for Good Till Date)'}},required:["clOrdID","quantity","price","side","symbol"]},I={type:"object",properties:{mdUpdateType:{type:"string",enum:["0","1"],default:"0",description:'Market data update type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for FullRefresh, "1" for IncrementalRefresh)'},symbol:{type:"string",description:"Trading symbol"},mdReqID:{type:"string",description:"Market data request ID"},subscriptionRequestType:{type:"string",enum:["0","1","2"],default:e.SubscriptionRequestType.SnapshotAndUpdates,description:'Subscription request type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for Snapshot + Updates, "1" for Snapshot, "2" for Unsubscribe)'},mdEntryType:{type:"string",enum:["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","S","R","T","U","V","W","X","Y","Z","a","b","c","d","e","g","h","i","t"],default:e.MDEntryType.Bid,description:'Market data entry type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for Bid, "1" for Offer, "2" for Trade, "3" for Index Value, "4" for Opening Price)'}},required:["symbol","mdReqID"]},M=class{logger;parser;server=new F.Server({name:"fixparser",version:"1.0.0"},{capabilities:{tools:{},prompts:{},resources:{}}});transport=new w.StdioServerTransport;onReady=void 0;pendingRequests=new Map;constructor({logger:s,onReady:i}){s&&!s.silent&&(this.logger=s),i&&(this.onReady=i)}async register(s){this.parser=s,s.logger&&!s.logger.silent&&(this.logger=s.logger),this.parser.addOnMessageCallback(i=>{let d=i.messageType;if(d===e.Messages.MarketDataSnapshotFullRefresh||d===e.Messages.ExecutionReport){let o=d===e.Messages.MarketDataSnapshotFullRefresh?i.getField(e.Fields.MDReqID):i.getField(e.Fields.ClOrdID);if(o){let t=o.value;if(typeof t=="string"||typeof t=="number"){let n=this.pendingRequests.get(String(t));n&&(n(i),this.pendingRequests.delete(String(t)))}}}}),this.addWorkflows(),await this.server.connect(this.transport),this.onReady&&this.onReady()}addWorkflows(){if(!this.parser){this.logger?.log({level:"error",message:"FIXParser (MCP): -- FIXParser instance not initialized. Ignoring setup of workflows..."});return}if(!this.server){this.logger?.log({level:"error",message:"FIXParser (MCP): -- MCP Server not initialized. Ignoring setup of workflows..."});return}let s=(i,d)=>{let o={};for(let[t,n]of Object.entries(d.properties||{})){let a=n,p=i?.[t];if(a.required&&p==null)throw new Error(`Required property '${t}' is missing`);p!==void 0?o[t]=p:a.default!==void 0&&(o[t]=a.default)}return o};this.server.setRequestHandler(c.ListResourcesRequestSchema,async()=>({resources:[]})),this.server.setRequestHandler(c.ListToolsRequestSchema,async()=>({tools:[{name:"parse",description:"Parses a FIX message and describes it in plain language",inputSchema:y},{name:"parseToJSON",description:"Parses a FIX message into JSON",inputSchema:S},{name:"newOrderSingle",description:"Creates and sends a New Order Single",inputSchema:T},{name:"marketDataRequest",description:"Sends a request for Market Data with the given symbol",inputSchema:I}]})),this.server.setRequestHandler(c.CallToolRequestSchema,async i=>{let{name:d,arguments:o}=i.params;switch(d){case"parse":try{let{fixString:t}=s(o,y),n=this.parser?.parse(t);return!n||n.length===0?{isError:!0,content:[{type:"text",text:"Error: Failed to parse FIX string"}]}:{content:[{type:"text",text:`${n[0].description}
|
|
3
|
+
${n[0].messageTypeDescription}`}]}}catch(t){return{isError:!0,content:[{type:"text",text:`Error: ${t instanceof Error?t.message:"Failed to parse FIX string"}`}]}}case"parseToJSON":try{let{fixString:t}=s(o,S),n=this.parser?.parse(t);return!n||n.length===0?{isError:!0,content:[{type:"text",text:"Error: Failed to parse FIX string"}]}:{content:[{type:"text",text:`${n[0].toFIXJSON()}`}]}}catch(t){return{isError:!0,content:[{type:"text",text:`Error: ${t instanceof Error?t.message:"Failed to parse FIX string"}`}]}}case"newOrderSingle":try{let{clOrdID:t,handlInst:n,quantity:a,price:p,ordType:l,side:u,symbol:m,timeInForce:g}=s(o,T),h=new Promise(x=>{this.pendingRequests.set(t,x)}),f=this.parser?.createMessage(new e.Field(e.Fields.MsgType,e.Messages.NewOrderSingle),new e.Field(e.Fields.MsgSeqNum,this.parser?.getNextTargetMsgSeqNum()),new e.Field(e.Fields.SenderCompID,this.parser?.sender),new e.Field(e.Fields.TargetCompID,this.parser?.target),new e.Field(e.Fields.SendingTime,this.parser?.getTimestamp()),new e.Field(e.Fields.ClOrdID,t),new e.Field(e.Fields.Side,u),new e.Field(e.Fields.Symbol,m),new e.Field(e.Fields.OrderQty,a),new e.Field(e.Fields.Price,p),new e.Field(e.Fields.OrdType,l),new e.Field(e.Fields.HandlInst,n),new e.Field(e.Fields.TimeInForce,g),new e.Field(e.Fields.TransactTime,this.parser?.getTimestamp()));if(!this.parser?.connected)return this.logger?.log({level:"error",message:"FIXParser (MCP): -- Not connected. Ignoring message."}),{isError:!0,content:[{type:"text",text:"Error: Not connected. Ignoring message."}]};this.parser?.send(f),this.logger?.log({level:"info",message:`FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${f?.description}`});let R=await h;return{content:[{type:"text",text:`Execution Report for order ${t}: ${JSON.stringify(R.toFIXJSON())}`}]}}catch(t){return{isError:!0,content:[{type:"text",text:`Error: ${t instanceof Error?t.message:"Failed to create order"}`}]}}case"marketDataRequest":try{let{mdUpdateType:t,symbol:n,mdReqID:a,subscriptionRequestType:p,mdEntryType:l}=s(o,I),u=new Promise(h=>{this.pendingRequests.set(a,h)}),m=this.parser?.createMessage(new e.Field(e.Fields.MsgType,e.Messages.MarketDataRequest),new e.Field(e.Fields.SenderCompID,this.parser?.sender),new e.Field(e.Fields.MsgSeqNum,this.parser?.getNextTargetMsgSeqNum()),new e.Field(e.Fields.TargetCompID,this.parser?.target),new e.Field(e.Fields.SendingTime,this.parser?.getTimestamp()),new e.Field(e.Fields.MarketDepth,0),new e.Field(e.Fields.MDUpdateType,t),new e.Field(e.Fields.NoRelatedSym,1),new e.Field(e.Fields.Symbol,n),new e.Field(e.Fields.MDReqID,a),new e.Field(e.Fields.SubscriptionRequestType,p),new e.Field(e.Fields.NoMDEntryTypes,1),new e.Field(e.Fields.MDEntryType,l));if(!this.parser?.connected)return this.logger?.log({level:"error",message:"FIXParser (MCP): -- Not connected. Ignoring message."}),{isError:!0,content:[{type:"text",text:"Error: Not connected. Ignoring message."}]};this.parser?.send(m),this.logger?.log({level:"info",message:`FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${m?.description}`});let g=await u;return{content:[{type:"text",text:`Market data for ${n}: ${JSON.stringify(g.toFIXJSON())}`}]}}catch(t){return{isError:!0,content:[{type:"text",text:`Error: ${t instanceof Error?t.message:"Failed to request market data"}`}]}}default:throw new Error(`Unknown tool: ${d}`)}}),this.server.setRequestHandler(c.ListPromptsRequestSchema,async()=>({prompts:[{name:"parse",description:"Parses a FIX message and describes it in plain language",arguments:[{name:"fixString",description:"FIX message string to parse",required:!0}]},{name:"parseToJSON",description:"Parses a FIX message into JSON",arguments:[{name:"fixString",description:"FIX message string to parse",required:!0}]},{name:"newOrderSingle",description:"Creates and sends a New Order Single",arguments:[{name:"clOrdID",description:"Client Order ID",required:!0},{name:"handlInst",description:"Handling instruction",required:!1},{name:"quantity",description:"Order quantity",required:!0},{name:"price",description:"Order price",required:!0},{name:"ordType",description:"Order type",required:!1},{name:"side",description:"Order side (1=Buy, 2=Sell, 3=BuyMinus, 4=SellPlus, 5=SellShort, 6=SellShortExempt, 7=Undisclosed, 8=Cross, 9=CrossShort, A=CrossShortExempt, B=AsDefined, C=Opposite, D=Subscribe, E=Redeem, F=Lend, G=Borrow, H=SellUndisclosed)",required:!0},{name:"symbol",description:"Trading symbol",required:!0},{name:"timeInForce",description:"Time in force",required:!1}]},{name:"marketDataRequest",description:"Sends a request for Market Data with the given symbol",arguments:[{name:"mdUpdateType",description:"Market data update type",required:!1},{name:"symbol",description:"Trading symbol",required:!0},{name:"mdReqID",description:"Market data request ID",required:!0},{name:"subscriptionRequestType",description:"Subscription request type",required:!1},{name:"mdEntryType",description:"Market data entry type",required:!1}]}]})),this.server.setRequestHandler(c.GetPromptRequestSchema,async i=>{let{name:d,arguments:o}=i.params;switch(d){case"parse":return{messages:[{role:"user",content:{type:"text",text:`Please parse and explain this FIX message: ${o?.fixString||""}`}}]};case"parseToJSON":return{messages:[{role:"user",content:{type:"text",text:`Please parse the FIX message to JSON: ${o?.fixString||""}`}}]};case"newOrderSingle":{let{clOrdID:t,handlInst:n,quantity:a,price:p,ordType:l,side:u,symbol:m,timeInForce:g}=o||{};return{messages:[{role:"user",content:{type:"text",text:["Create a New Order Single FIX message with the following parameters:",`- ClOrdID: ${t}`,`- HandlInst: ${n??"3"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Manual, '2' for Automated, '3' for AutomatedNoIntervention)`,`- Quantity: ${a}`,`- Price: ${p}`,`- OrdType: ${l??"1"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Market, '2' for Limit, '3' for Stop)`,`- Side: ${u} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Buy, '2' for Sell)`,`- Symbol: ${m}`,`- TimeInForce: ${g??"0"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Day, '1' for Good Till Cancel, '2' for At Opening, '3' for Immediate or Cancel, '4' for Fill or Kill, '5' for Good Till Crossing, '6' for Good Till Date)`,"","Format the response as a JSON object with FIX tag numbers as keys and their corresponding values.","",'Note: For the Side parameter, always use the numeric/alphabetic value (e.g., "1" for Buy, "2" for Sell) as defined in the FIX protocol, not the descriptive name.','Note: For the HandlInst parameter, always use the numeric/alphabetic value (e.g., "1" for Manual, "2" for Automated, "3" for AutomatedNoIntervention) as defined in the FIX protocol, not the descriptive name.','Note: For the OrdType parameter, always use the numeric/alphabetic value (e.g., "1" for Market, "2" for Limit, "3" for Stop) as defined in the FIX protocol, not the descriptive name.','Note: For the TimeInForce parameter, always use the numeric/alphabetic value (e.g., "0" for Day, "1" for Good Till Cancel, "2" for At Opening) as defined in the FIX protocol, not the descriptive name.'].join(`
|
|
4
|
+
`)}}]}}case"marketDataRequest":{let{mdUpdateType:t,symbol:n,mdReqID:a,subscriptionRequestType:p,mdEntryType:l}=o||{};return{messages:[{role:"user",content:{type:"text",text:["Create a Market Data Request FIX message with the following parameters:",`- MDUpdateType: ${t??"0"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for FullRefresh, '1' for IncrementalRefresh)`,`- Symbol: ${n}`,`- MDReqID: ${a}`,`- SubscriptionRequestType: ${p??"0"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Snapshot + Updates, '1' for Snapshot, '2' for Unsubscribe)`,`- MDEntryType: ${l??"0"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Bid, '1' for Offer, '2' for Trade, '3' for Index Value, '4' for Opening Price)`,"","Format the response as a JSON object with FIX tag numbers as keys and their corresponding values.","",'Note: For the MDUpdateType parameter, always use the numeric/alphabetic value (e.g., "0" for FullRefresh, "1" for IncrementalRefresh) as defined in the FIX protocol, not the descriptive name.','Note: For the SubscriptionRequestType parameter, always use the numeric/alphabetic value (e.g., "0" for Snapshot + Updates, "1" for Snapshot, "2" for Unsubscribe) as defined in the FIX protocol, not the descriptive name.','Note: For the MDEntryType parameter, always use the numeric/alphabetic value (e.g., "0" for Bid, "1" for Offer, "2" for Trade, "3" for Index Value, "4" for Opening Price) as defined in the FIX protocol, not the descriptive name.'].join(`
|
|
5
|
+
`)}}]}}default:throw new Error(`Unknown prompt: ${d}`)}}),process.on("SIGINT",async()=>{await this.server.close(),process.exit(0)})}};var q="CLIENT2",v="EXECUTOR",O=async()=>{await r.LicenseManager.setLicenseKey(process.env.FIXPARSER_LICENSE_KEY);let s=new r.FIXParser({logging:!1,plugins:[new M({port:3099,onReady:()=>{}})]}),i=()=>{let t=s.createMessage(new r.Field(r.Fields.MsgType,r.Messages.Logon),new r.Field(r.Fields.MsgSeqNum,s.getNextTargetMsgSeqNum()),new r.Field(r.Fields.SenderCompID,q),new r.Field(r.Fields.SendingTime,s.getTimestamp()),new r.Field(r.Fields.TargetCompID,v),new r.Field(r.Fields.ResetSeqNumFlag,r.ResetSeqNumFlag.Yes),new r.Field(r.Fields.EncryptMethod,r.EncryptMethod.None),new r.Field(r.Fields.HeartBtInt,10));s.send(t)},d=()=>{let t=s.parse("8=FIX.4.4|9=138|35=D|34=3|49=CLIENT2|56=EXECUTOR|52=20250531-15:26:58.415|11=NFLXSELLS|54=2|55=NFLX|38=300|44=410|40=1|21=1|59=0|60=20250531-15:26:58.415|10=107|");if(t){let n=new r.Field(r.Fields.MsgSeqNum,s.getNextTargetMsgSeqNum());t[0].setField(n);let a=new r.Field(r.Fields.SendingTime,s.getTimestamp());t[0].setField(a);let p=new r.Field(r.Fields.TransactTime,s.getTimestamp());t[0].setField(p),t[0].recalculateMessageLengths(),s.send(t[0])}},o={host:"10.0.1.42",port:5001,protocol:"tcp",sender:q,target:v,fixVersion:"FIX.4.4",onOpen:()=>{i(),setTimeout(()=>{d()},1e3)},onMessage:t=>{},onClose:()=>{setTimeout(()=>{s.connect(o)},1e3)}};s.connect(o)};O().catch(s=>console.error("Error initializing server:",s));
|
|
6
6
|
//# sourceMappingURL=example_mcp_local.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../examples/example_mcp_local.ts", "../../
|
|
4
|
-
"sourcesContent": ["import {\n EncryptMethod,\n FIXParser,\n Field,\n Fields,\n LicenseManager,\n type Message,\n Messages,\n type Options,\n ResetSeqNumFlag,\n} from 'fixparser';\nimport { ConsoleLogTransport } from 'fixparser-plugin-log-console';\nimport { MCPLocal } from 'fixparser-plugin-mcp';\n\nconst SENDER = 'CLIENT2';\nconst TARGET = 'EXECUTOR';\n\nconst initializeServer = async () => {\n await LicenseManager.setLicenseKey(process.env.FIXPARSER_LICENSE_KEY);\n\n const fixParser: FIXParser = new FIXParser({\n logging: true,\n logOptions: {\n name: SENDER,\n level: 'info',\n format: 'jsonrpc',\n transport: new ConsoleLogTransport({ format: 'jsonrpc' }),\n },\n plugins: [new MCPLocal({ port: 3099, onReady: () => {} })],\n });\n\n const sendLogon = () => {\n const logon = fixParser.createMessage(\n new Field(Fields.MsgType, Messages.Logon),\n new Field(Fields.MsgSeqNum, fixParser.getNextTargetMsgSeqNum()),\n new Field(Fields.SenderCompID, SENDER),\n new Field(Fields.SendingTime, fixParser.getTimestamp()),\n new Field(Fields.TargetCompID, TARGET),\n new Field(Fields.ResetSeqNumFlag, ResetSeqNumFlag.Yes),\n new Field(Fields.EncryptMethod, EncryptMethod.None),\n new Field(Fields.HeartBtInt, 10),\n );\n fixParser.send(logon);\n };\n const sendOrder = () => {\n const orderMessage = fixParser.parse(\n '8=FIX.4.4|9=138|35=D|34=3|49=CLIENT2|56=EXECUTOR|52=20250531-15:26:58.415|11=NFLXSELLS|54=2|55=NFLX|38=300|44=410|40=1|21=1|59=0|60=20250531-15:26:58.415|10=107|',\n );\n if (orderMessage) {\n const msgSeq = new Field(Fields.MsgSeqNum, fixParser.getNextTargetMsgSeqNum());\n orderMessage[0].setField(msgSeq);\n\n const sendingTimeField = new Field(Fields.SendingTime, fixParser.getTimestamp());\n orderMessage[0].setField(sendingTimeField);\n\n const transactTimeField = new Field(Fields.TransactTime, fixParser.getTimestamp());\n orderMessage[0].setField(transactTimeField);\n\n orderMessage[0].recalculateMessageLengths();\n\n fixParser.send(orderMessage[0]);\n }\n };\n\n const CONNECT_PARAMS: Options = {\n host: '10.0.1.42',\n port: 5001,\n protocol: 'tcp',\n sender: SENDER,\n target: TARGET,\n fixVersion: 'FIX.4.4',\n onOpen: () => {\n sendLogon();\n setTimeout(() => {\n sendOrder();\n }, 1000);\n },\n onMessage: (message: Message) => {},\n onClose: () => {\n console.log(\n JSON.stringify(\n {\n event: 'FIX Connection closed',\n action: 'Attempting to reconnect in 1 second',\n },\n null,\n 2,\n ),\n );\n setTimeout(() => {\n console.log(\n JSON.stringify(\n {\n event: 'Reconnecting',\n },\n null,\n 2,\n ),\n );\n fixParser.connect(CONNECT_PARAMS);\n }, 1000);\n },\n };\n\n fixParser.connect(CONNECT_PARAMS);\n};\n\ninitializeServer().catch((err) => console.error('Error initializing server:', err));\n", "import type { ILogTransporter, LogMessage } from 'fixparser-common';\n\n/**\n * Logger output format options.\n *\n * - 'console': Output log in plain text format\n * - 'json': Output log in JSON format\n * - 'jsonrpc': Output log in JSON-RPC 2.0 format\n *\n * @public\n */\nexport type ConsoleFormat = 'console' | 'json' | 'jsonrpc';\n\n/**\n * A LogTransporter implementation for logging to the console.\n * It supports text (console), JSON, and JSON-RPC 2.0 formats.\n */\nexport class ConsoleLogTransport implements ILogTransporter {\n private format: ConsoleFormat;\n\n constructor({ format = 'json' }: { format: ConsoleFormat }) {\n this.format = format;\n }\n\n /**\n * Configures the format for console logging (either 'console' for text, 'json', or 'jsonrpc').\n */\n configure(config: { format: 'console' | 'json' | 'jsonrpc' }): void {\n this.format = config.format || 'json';\n }\n\n /**\n * Sends the log message to the console in the configured format.\n */\n async send(log: LogMessage): Promise<void> {\n if (this.format === 'json') {\n console.log(JSON.stringify(log));\n } else if (this.format === 'jsonrpc') {\n const { message, ...rest } = log;\n const jsonrpcMessage = {\n jsonrpc: '2.0',\n method: log.level,\n params: {\n message,\n ...rest,\n },\n id: log.id || Date.now(),\n };\n console.log(JSON.stringify(jsonrpcMessage));\n } else {\n const { name, id, message, level, ...additionalProperties } = log;\n const kv = Object.entries(additionalProperties).map(([key, value]) => `${key}: ${value}`);\n let logMessage = '';\n if (name) {\n logMessage += `${name} `;\n }\n logMessage += `${id}: ${message}`;\n void kv;\n console.log(logMessage, kv.join(', '));\n }\n }\n\n /**\n * Flushes the log buffer (if any buffering mechanism exists).\n */\n async flush(): Promise<void> {\n // No flushing needed for console transport\n }\n\n /**\n * Closes the transport (not needed for console, but keeping the method for consistency).\n */\n async close(): Promise<void> {\n // No close logic needed for console transport\n }\n\n /**\n * Returns the status of the transport (always \"connected\" for console).\n */\n status(): string {\n return 'connected';\n }\n}\n", "import { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport {\n CallToolRequestSchema,\n GetPromptRequestSchema,\n ListPromptsRequestSchema,\n ListResourcesRequestSchema,\n ListToolsRequestSchema,\n} from '@modelcontextprotocol/sdk/types.js';\n\nimport {\n Field,\n Fields,\n HandlInst,\n type IFIXParser,\n type Logger,\n MDEntryType,\n type Message,\n Messages,\n OrdType,\n SubscriptionRequestType,\n TimeInForce,\n} from 'fixparser';\nimport type { IPlugin } from 'fixparser-common';\nimport type { PluginOptions } from './PluginOptions';\n\n// Define JSON Schemas\nconst parseInputSchema = {\n type: 'object',\n properties: {\n fixString: {\n type: 'string',\n description: 'FIX message string to parse',\n },\n },\n required: ['fixString'],\n};\n\nconst parseToJSONInputSchema = {\n type: 'object',\n properties: {\n fixString: {\n type: 'string',\n description: 'FIX message string to parse',\n },\n },\n required: ['fixString'],\n};\n\nconst newOrderSingleInputSchema = {\n type: 'object',\n properties: {\n clOrdID: {\n type: 'string',\n description: 'Client Order ID',\n },\n handlInst: {\n type: 'string',\n enum: ['1', '2', '3'],\n default: HandlInst.AutomatedExecutionNoIntervention,\n description:\n 'Handling instruction (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"1\" for Manual, \"2\" for Automated, \"3\" for AutomatedNoIntervention)',\n },\n quantity: {\n type: 'number',\n description: 'Order quantity',\n },\n price: {\n type: 'number',\n description: 'Order price',\n },\n ordType: {\n type: 'string',\n enum: [\n '1',\n '2',\n '3',\n '4',\n '5',\n '6',\n '7',\n '8',\n '9',\n 'A',\n 'B',\n 'C',\n 'D',\n 'E',\n 'F',\n 'G',\n 'H',\n 'I',\n 'J',\n 'K',\n 'L',\n 'M',\n 'P',\n 'Q',\n 'R',\n 'S',\n ],\n default: OrdType.Market,\n description:\n 'Order type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"1\" for Market, \"2\" for Limit, \"3\" for Stop)',\n },\n side: {\n type: 'string',\n enum: ['1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'],\n description:\n 'Order side (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"1\" for Buy, \"2\" for Sell, \"3\" for BuyMinus, \"4\" for SellPlus, \"5\" for SellShort, \"6\" for SellShortExempt, \"7\" for Undisclosed, \"8\" for Cross, \"9\" for CrossShort, \"A\" for CrossShortExempt, \"B\" for AsDefined, \"C\" for Opposite, \"D\" for Subscribe, \"E\" for Redeem, \"F\" for Lend, \"G\" for Borrow, \"H\" for SellUndisclosed)',\n },\n symbol: {\n type: 'string',\n description: 'Trading symbol',\n },\n timeInForce: {\n type: 'string',\n enum: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C'],\n default: TimeInForce.Day,\n description:\n 'Time in force (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for Day, \"1\" for Good Till Cancel, \"2\" for At Opening, \"3\" for Immediate or Cancel, \"4\" for Fill or Kill, \"5\" for Good Till Crossing, \"6\" for Good Till Date)',\n },\n },\n required: ['clOrdID', 'quantity', 'price', 'side', 'symbol'],\n};\n\nconst marketDataRequestInputSchema = {\n type: 'object',\n properties: {\n mdUpdateType: {\n type: 'string',\n enum: ['0', '1'],\n default: '0',\n description:\n 'Market data update type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for FullRefresh, \"1\" for IncrementalRefresh)',\n },\n symbol: {\n type: 'string',\n description: 'Trading symbol',\n },\n mdReqID: {\n type: 'string',\n description: 'Market data request ID',\n },\n subscriptionRequestType: {\n type: 'string',\n enum: ['0', '1', '2'],\n default: SubscriptionRequestType.SnapshotAndUpdates,\n description:\n 'Subscription request type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for Snapshot + Updates, \"1\" for Snapshot, \"2\" for Unsubscribe)',\n },\n mdEntryType: {\n type: 'string',\n enum: [\n '0',\n '1',\n '2',\n '3',\n '4',\n '5',\n '6',\n '7',\n '8',\n '9',\n 'A',\n 'B',\n 'C',\n 'D',\n 'E',\n 'F',\n 'G',\n 'H',\n 'J',\n 'K',\n 'L',\n 'M',\n 'N',\n 'O',\n 'P',\n 'Q',\n 'S',\n 'R',\n 'T',\n 'U',\n 'V',\n 'W',\n 'X',\n 'Y',\n 'Z',\n 'a',\n 'b',\n 'c',\n 'd',\n 'e',\n 'g',\n 'h',\n 'i',\n 't',\n ],\n default: MDEntryType.Bid,\n description:\n 'Market data entry type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for Bid, \"1\" for Offer, \"2\" for Trade, \"3\" for Index Value, \"4\" for Opening Price)',\n },\n },\n required: ['symbol', 'mdReqID'],\n};\n\nexport class MCPLocal implements IPlugin<IFIXParser> {\n private logger: Logger | undefined;\n private parser: IFIXParser | undefined;\n private server: Server = new Server(\n {\n name: 'fixparser',\n version: '1.0.0',\n },\n {\n capabilities: {\n tools: {},\n prompts: {},\n resources: {},\n },\n },\n );\n private transport: StdioServerTransport = new StdioServerTransport();\n private onReady: (() => void) | undefined = undefined;\n\n private pendingRequests: Map<string, (data: Message) => void> = new Map();\n\n constructor({ logger, onReady }: PluginOptions) {\n if (logger && !logger.silent) {\n this.logger = logger;\n }\n\n if (onReady) this.onReady = onReady;\n }\n\n public async register(parser: IFIXParser): Promise<void> {\n this.parser = parser;\n if (parser.logger && !parser.logger.silent) {\n this.logger = parser.logger;\n }\n this.parser.addOnMessageCallback((message: Message) => {\n // this.logger?.log({\n // level: 'info',\n // message: `FIXParser (MCP): (${parser.protocol?.toUpperCase()}): << received ${message.description}`,\n // });\n const msgType = message.messageType;\n if (msgType === Messages.MarketDataSnapshotFullRefresh || msgType === Messages.ExecutionReport) {\n const idField =\n msgType === Messages.MarketDataSnapshotFullRefresh\n ? message.getField(Fields.MDReqID)\n : message.getField(Fields.ClOrdID);\n if (idField) {\n const id = idField.value;\n if (typeof id === 'string' || typeof id === 'number') {\n const callback = this.pendingRequests.get(String(id));\n if (callback) {\n callback(message);\n this.pendingRequests.delete(String(id));\n }\n }\n }\n }\n });\n\n this.addWorkflows();\n\n await this.server.connect(this.transport);\n\n if (this.onReady) {\n this.onReady();\n }\n }\n\n private addWorkflows() {\n if (!this.parser) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- FIXParser instance not initialized. Ignoring setup of workflows...',\n });\n return;\n }\n\n if (!this.server) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- MCP Server not initialized. Ignoring setup of workflows...',\n });\n return;\n }\n\n // Helper function to validate and parse arguments\n const validateArgs = (args: any, schema: any): any => {\n // Basic validation - in a real implementation, you might want to use a proper JSON Schema validator\n const result: any = {};\n\n for (const [key, propSchema] of Object.entries(schema.properties || {})) {\n const prop = propSchema as any;\n const value = args?.[key];\n\n if (prop.required && (value === undefined || value === null)) {\n throw new Error(`Required property '${key}' is missing`);\n }\n\n if (value !== undefined) {\n // Apply defaults\n result[key] = value;\n } else if (prop.default !== undefined) {\n result[key] = prop.default;\n }\n }\n\n return result;\n };\n\n // Empty handler for resources\n this.server.setRequestHandler(ListResourcesRequestSchema, async () => {\n return {\n resources: [],\n };\n });\n\n // Handler for listing available tools\n this.server.setRequestHandler(ListToolsRequestSchema, async () => {\n return {\n tools: [\n {\n name: 'parse',\n description: 'Parses a FIX message and describes it in plain language',\n inputSchema: parseInputSchema,\n },\n {\n name: 'parseToJSON',\n description: 'Parses a FIX message into JSON',\n inputSchema: parseToJSONInputSchema,\n },\n {\n name: 'newOrderSingle',\n description: 'Creates and sends a New Order Single',\n inputSchema: newOrderSingleInputSchema,\n },\n {\n name: 'marketDataRequest',\n description: 'Sends a request for Market Data with the given symbol',\n inputSchema: marketDataRequestInputSchema,\n },\n ],\n };\n });\n\n // Handler for tool calls\n this.server.setRequestHandler(CallToolRequestSchema, async (request) => {\n const { name, arguments: args } = request.params;\n\n switch (name) {\n case 'parse': {\n try {\n const { fixString } = validateArgs(args, parseInputSchema);\n const parsedMessage: Message[] | undefined = this.parser?.parse(fixString);\n if (!parsedMessage || parsedMessage.length === 0) {\n return {\n isError: true,\n content: [{ type: 'text', text: 'Error: Failed to parse FIX string' }],\n };\n }\n\n return {\n content: [\n {\n type: 'text',\n text: `${parsedMessage[0].description}\n${parsedMessage[0].messageTypeDescription}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to parse FIX string'}`,\n },\n ],\n };\n }\n }\n\n case 'parseToJSON': {\n try {\n const { fixString } = validateArgs(args, parseToJSONInputSchema);\n const parsedMessage = this.parser?.parse(fixString);\n if (!parsedMessage || parsedMessage.length === 0) {\n return {\n isError: true,\n content: [{ type: 'text', text: 'Error: Failed to parse FIX string' }],\n };\n }\n\n return {\n content: [\n {\n type: 'text',\n text: `${parsedMessage[0].toFIXJSON()}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to parse FIX string'}`,\n },\n ],\n };\n }\n }\n\n case 'newOrderSingle': {\n try {\n const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } =\n validateArgs(args, newOrderSingleInputSchema);\n\n const response = new Promise((resolve) => {\n this.pendingRequests.set(clOrdID, resolve);\n });\n\n const order: Message | undefined = this.parser?.createMessage(\n new Field(Fields.MsgType, Messages.NewOrderSingle),\n new Field(Fields.MsgSeqNum, this.parser?.getNextTargetMsgSeqNum()),\n new Field(Fields.SenderCompID, this.parser?.sender),\n new Field(Fields.TargetCompID, this.parser?.target),\n new Field(Fields.SendingTime, this.parser?.getTimestamp()),\n new Field(Fields.ClOrdID, clOrdID),\n new Field(Fields.Side, side),\n new Field(Fields.Symbol, symbol),\n new Field(Fields.OrderQty, quantity),\n new Field(Fields.Price, price),\n new Field(Fields.OrdType, ordType),\n new Field(Fields.HandlInst, handlInst),\n new Field(Fields.TimeInForce, timeInForce),\n new Field(Fields.TransactTime, this.parser?.getTimestamp()),\n );\n\n if (!this.parser?.connected) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- Not connected. Ignoring message.',\n });\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: 'Error: Not connected. Ignoring message.',\n },\n ],\n };\n }\n\n this.parser?.send(order!);\n this.logger?.log({\n level: 'info',\n message: `FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${order?.description}`,\n });\n\n const fixData = await response;\n return {\n content: [\n {\n type: 'text',\n text: `Execution Report for order ${clOrdID}: ${JSON.stringify((fixData as Message).toFIXJSON())}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to create order'}`,\n },\n ],\n };\n }\n }\n\n case 'marketDataRequest': {\n try {\n const { mdUpdateType, symbol, mdReqID, subscriptionRequestType, mdEntryType } = validateArgs(\n args,\n marketDataRequestInputSchema,\n );\n\n const response = new Promise((resolve) => {\n this.pendingRequests.set(mdReqID, resolve);\n });\n\n const marketDataRequest = this.parser?.createMessage(\n new Field(Fields.MsgType, Messages.MarketDataRequest),\n new Field(Fields.SenderCompID, this.parser?.sender),\n new Field(Fields.MsgSeqNum, this.parser?.getNextTargetMsgSeqNum()),\n new Field(Fields.TargetCompID, this.parser?.target),\n new Field(Fields.SendingTime, this.parser?.getTimestamp()),\n new Field(Fields.MarketDepth, 0),\n new Field(Fields.MDUpdateType, mdUpdateType),\n new Field(Fields.NoRelatedSym, 1),\n new Field(Fields.Symbol, symbol),\n new Field(Fields.MDReqID, mdReqID),\n new Field(Fields.SubscriptionRequestType, subscriptionRequestType),\n new Field(Fields.NoMDEntryTypes, 1),\n new Field(Fields.MDEntryType, mdEntryType),\n );\n\n if (!this.parser?.connected) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- Not connected. Ignoring message.',\n });\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: 'Error: Not connected. Ignoring message.',\n },\n ],\n };\n }\n\n this.parser?.send(marketDataRequest!);\n this.logger?.log({\n level: 'info',\n message: `FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${marketDataRequest?.description}`,\n });\n\n const fixData = await response;\n\n return {\n content: [\n {\n type: 'text',\n text: `Market data for ${symbol}: ${JSON.stringify((fixData as Message).toFIXJSON())}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to request market data'}`,\n },\n ],\n };\n }\n }\n\n default:\n throw new Error(`Unknown tool: ${name}`);\n }\n });\n\n this.server.setRequestHandler(ListPromptsRequestSchema, async () => {\n return {\n prompts: [\n {\n name: 'parse',\n description: 'Parses a FIX message and describes it in plain language',\n arguments: [\n {\n name: 'fixString',\n description: 'FIX message string to parse',\n required: true,\n },\n ],\n },\n {\n name: 'parseToJSON',\n description: 'Parses a FIX message into JSON',\n arguments: [\n {\n name: 'fixString',\n description: 'FIX message string to parse',\n required: true,\n },\n ],\n },\n {\n name: 'newOrderSingle',\n description: 'Creates and sends a New Order Single',\n arguments: [\n {\n name: 'clOrdID',\n description: 'Client Order ID',\n required: true,\n },\n {\n name: 'handlInst',\n description: 'Handling instruction',\n required: false,\n },\n {\n name: 'quantity',\n description: 'Order quantity',\n required: true,\n },\n {\n name: 'price',\n description: 'Order price',\n required: true,\n },\n {\n name: 'ordType',\n description: 'Order type',\n required: false,\n },\n {\n name: 'side',\n description:\n 'Order side (1=Buy, 2=Sell, 3=BuyMinus, 4=SellPlus, 5=SellShort, 6=SellShortExempt, 7=Undisclosed, 8=Cross, 9=CrossShort, A=CrossShortExempt, B=AsDefined, C=Opposite, D=Subscribe, E=Redeem, F=Lend, G=Borrow, H=SellUndisclosed)',\n required: true,\n },\n {\n name: 'symbol',\n description: 'Trading symbol',\n required: true,\n },\n {\n name: 'timeInForce',\n description: 'Time in force',\n required: false,\n },\n ],\n },\n {\n name: 'marketDataRequest',\n description: 'Sends a request for Market Data with the given symbol',\n arguments: [\n {\n name: 'mdUpdateType',\n description: 'Market data update type',\n required: false,\n },\n {\n name: 'symbol',\n description: 'Trading symbol',\n required: true,\n },\n {\n name: 'mdReqID',\n description: 'Market data request ID',\n required: true,\n },\n {\n name: 'subscriptionRequestType',\n description: 'Subscription request type',\n required: false,\n },\n {\n name: 'mdEntryType',\n description: 'Market data entry type',\n required: false,\n },\n ],\n },\n ],\n };\n });\n\n // Handler for getting specific prompts\n this.server.setRequestHandler(GetPromptRequestSchema, async (request) => {\n const { name, arguments: args } = request.params;\n\n switch (name) {\n case 'parse': {\n const fixString = args?.fixString || '';\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Please parse and explain this FIX message: ${fixString}`,\n },\n },\n ],\n };\n }\n\n case 'parseToJSON': {\n const fixString = args?.fixString || '';\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Please parse the FIX message to JSON: ${fixString}`,\n },\n },\n ],\n };\n }\n\n case 'newOrderSingle': {\n const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } = args || {};\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: [\n 'Create a New Order Single FIX message with the following parameters:',\n `- ClOrdID: ${clOrdID}`,\n `- HandlInst: ${handlInst ?? '3'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Manual, '2' for Automated, '3' for AutomatedNoIntervention)`,\n `- Quantity: ${quantity}`,\n `- Price: ${price}`,\n `- OrdType: ${ordType ?? '1'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Market, '2' for Limit, '3' for Stop)`,\n `- Side: ${side} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Buy, '2' for Sell)`,\n `- Symbol: ${symbol}`,\n `- TimeInForce: ${timeInForce ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Day, '1' for Good Till Cancel, '2' for At Opening, '3' for Immediate or Cancel, '4' for Fill or Kill, '5' for Good Till Crossing, '6' for Good Till Date)`,\n '',\n 'Format the response as a JSON object with FIX tag numbers as keys and their corresponding values.',\n '',\n 'Note: For the Side parameter, always use the numeric/alphabetic value (e.g., \"1\" for Buy, \"2\" for Sell) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the HandlInst parameter, always use the numeric/alphabetic value (e.g., \"1\" for Manual, \"2\" for Automated, \"3\" for AutomatedNoIntervention) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the OrdType parameter, always use the numeric/alphabetic value (e.g., \"1\" for Market, \"2\" for Limit, \"3\" for Stop) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the TimeInForce parameter, always use the numeric/alphabetic value (e.g., \"0\" for Day, \"1\" for Good Till Cancel, \"2\" for At Opening) as defined in the FIX protocol, not the descriptive name.',\n ].join('\\n'),\n },\n },\n ],\n };\n }\n\n case 'marketDataRequest': {\n const { mdUpdateType, symbol, mdReqID, subscriptionRequestType, mdEntryType } = args || {};\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: [\n 'Create a Market Data Request FIX message with the following parameters:',\n `- MDUpdateType: ${mdUpdateType ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for FullRefresh, '1' for IncrementalRefresh)`,\n `- Symbol: ${symbol}`,\n `- MDReqID: ${mdReqID}`,\n `- SubscriptionRequestType: ${subscriptionRequestType ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Snapshot + Updates, '1' for Snapshot, '2' for Unsubscribe)`,\n `- MDEntryType: ${mdEntryType ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Bid, '1' for Offer, '2' for Trade, '3' for Index Value, '4' for Opening Price)`,\n '',\n 'Format the response as a JSON object with FIX tag numbers as keys and their corresponding values.',\n '',\n 'Note: For the MDUpdateType parameter, always use the numeric/alphabetic value (e.g., \"0\" for FullRefresh, \"1\" for IncrementalRefresh) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the SubscriptionRequestType parameter, always use the numeric/alphabetic value (e.g., \"0\" for Snapshot + Updates, \"1\" for Snapshot, \"2\" for Unsubscribe) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the MDEntryType parameter, always use the numeric/alphabetic value (e.g., \"0\" for Bid, \"1\" for Offer, \"2\" for Trade, \"3\" for Index Value, \"4\" for Opening Price) as defined in the FIX protocol, not the descriptive name.',\n ].join('\\n'),\n },\n },\n ],\n };\n }\n\n default:\n throw new Error(`Unknown prompt: ${name}`);\n }\n });\n\n process.on('SIGINT', async () => {\n await this.server.close();\n process.exit(0);\n });\n }\n}\n"],
|
|
5
|
-
"mappings": ";aAAA,IAAAA,EAUO,qBCOA,IAAMC,EAAN,KAAqD,CAChD,OAER,YAAY,CAAE,OAAAC,EAAS,MAAO,EAA8B,CACxD,KAAK,OAASA,CAClB,CAKA,UAAUC,EAA0D,CAChE,KAAK,OAASA,EAAO,QAAU,MACnC,CAKA,MAAM,KAAKC,EAAgC,CACvC,GAAI,KAAK,SAAW,OAChB,QAAQ,IAAI,KAAK,UAAUA,CAAG,CAAC,UACxB,KAAK,SAAW,UAAW,CAClC,GAAM,CAAE,QAAAC,EAAS,G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A,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,GACJ,EACA,QAAS,UAAQ,OACjB,YACI,kJACR,EACA,KAAM,CACF,KAAM,SACN,KAAM,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,GAAG,EAC1F,YACI,iaACR,EACA,OAAQ,CACJ,KAAM,SACN,YAAa,gBACjB,EACA,YAAa,CACT,KAAM,SACN,KAAM,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,GAAG,EACtE,QAAS,cAAY,IACrB,YACI,0QACR,CACJ,EACA,SAAU,CAAC,UAAW,WAAY,QAAS,OAAQ,QAAQ,CAC/D,EAEMC,EAA+B,CACjC,KAAM,SACN,WAAY,CACR,aAAc,CACV,KAAM,SACN,KAAM,CAAC,IAAK,GAAG,EACf,QAAS,IACT,YACI,mKACR,EACA,OAAQ,CACJ,KAAM,SACN,YAAa,gBACjB,EACA,QAAS,CACL,KAAM,SACN,YAAa,wBACjB,EACA,wBAAyB,CACrB,KAAM,SACN,KAAM,CAAC,IAAK,IAAK,GAAG,EACpB,QAAS,0BAAwB,mBACjC,YACI,uLACR,EACA,YAAa,CACT,KAAM,SACN,KAAM,CACF,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,GACJ,EACA,QAAS,cAAY,IACrB,YACI,wMACR,CACJ,EACA,SAAU,CAAC,SAAU,SAAS,CAClC,EAEaC,EAAN,KAA8C,CACzC,OACA,OACA,OA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,UAAW,CACP,CACI,KAAM,YACN,YAAa,8BACb,SAAU,EACd,CACJ,CACJ,EACA,CACI,KAAM,cACN,YAAa,iCACb,UAAW,CACP,CACI,KAAM,YACN,YAAa,8BACb,SAAU,EACd,CACJ,CACJ,EACA,CACI,KAAM,iBACN,YAAa,uCACb,UAAW,CACP,CACI,KAAM,UACN,YAAa,kBACb,SAAU,EACd,EACA,CACI,KAAM,YACN,YAAa,uBACb,SAAU,EACd,EACA,CACI,KAAM,WACN,YAAa,iBACb,SAAU,EACd,EACA,CACI,KAAM,QACN,YAAa,cACb,SAAU,EACd,EACA,CACI,KAAM,UACN,YAAa,aACb,SAAU,EACd,EACA,CACI,KAAM,OACN,YACI,oOACJ,SAAU,EACd,EACA,CACI,KAAM,SACN,YAAa,iBACb,SAAU,EACd,EACA,CACI,KAAM,cACN,YAAa,gBACb,SAAU,EACd,CACJ,CACJ,EACA,CACI,KAAM,oBACN,YAAa,wDACb,UAAW,CACP,CACI,KAAM,eACN,YAAa,0BACb,SAAU,EACd,EACA,CACI,KAAM,SACN,YAAa,iBACb,SAAU,EACd,EACA,CACI,KAAM,UACN,YAAa,yBACb,SAAU,EACd,EACA,CACI,KAAM,0BACN,YAAa,4BACb,SAAU,EACd,EACA,CACI,KAAM,cACN,YAAa,yBACb,SAAU,EACd,CACJ,CACJ,CACJ,CACJ,EACH,EAGD,KAAK,OAAO,kBAAkB,yBAAwB,MAAOD,GAAY,CACrE,GAAM,CAAE,KAAAC,EAAM,UAAWR,CAAK,EAAIO,EAAQ,OAE1C,OAAQC,EAAM,CACV,IAAK,QAED,MAAO,CACH,SAAU,CACN,CACI,KAAM,OACN,QAAS,CACL,KAAM,OACN,KAAM,8CAPJR,GAAM,WAAa,EAOwC,EACjE,CACJ,CACJ,CACJ,EAGJ,IAAK,cAED,MAAO,CACH,SAAU,CACN,CACI,KAAM,OACN,QAAS,CACL,KAAM,OACN,KAAM,yCAPJA,GAAM,WAAa,EAOmC,EAC5D,CACJ,CACJ,CACJ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,OAAQ,IAAM,CACVK,EAAU,EACV,WAAW,IAAM,CACbE,EAAU,CACd,EAAG,GAAI,CACX,EACA,UAAYM,GAAqB,CAAC,EAClC,QAAS,IAAM,CACX,QAAQ,IACJ,KAAK,UACD,CACI,MAAO,wBACP,OAAQ,qCACZ,EACA,KACA,CACJ,CACJ,EACA,WAAW,IAAM,CACb,QAAQ,IACJ,KAAK,UACD,CACI,MAAO,cACX,EACA,KACA,CACJ,CACJ,EACAX,EAAU,QAAQU,CAAc,CACpC,EAAG,GAAI,CACX,CACJ,EAEAV,EAAU,QAAQU,CAAc,CACpC,EAEAX,EAAiB,EAAE,MAAOa,GAAQ,QAAQ,MAAM,6BAA8BA,CAAG,CAAC",
|
|
6
|
-
"names": ["import_fixparser", "
|
|
3
|
+
"sources": ["../../examples/example_mcp_local.ts", "../../src/MCPLocal.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n EncryptMethod,\n FIXParser,\n Field,\n Fields,\n LicenseManager,\n type Message,\n Messages,\n type Options,\n ResetSeqNumFlag,\n} from 'fixparser';\nimport { ConsoleLogTransport } from 'fixparser-plugin-log-console';\nimport { MCPLocal } from 'fixparser-plugin-mcp';\n\nconst SENDER = 'CLIENT2';\nconst TARGET = 'EXECUTOR';\n\nconst initializeServer = async () => {\n await LicenseManager.setLicenseKey(process.env.FIXPARSER_LICENSE_KEY);\n\n const fixParser: FIXParser = new FIXParser({\n logging: false,\n // logOptions: {\n // name: SENDER,\n // level: 'info',\n // format: 'jsonrpc',\n // transport: new ConsoleLogTransport({ format: 'jsonrpc' }),\n // },\n plugins: [new MCPLocal({ port: 3099, onReady: () => {} })],\n });\n\n const sendLogon = () => {\n const logon = fixParser.createMessage(\n new Field(Fields.MsgType, Messages.Logon),\n new Field(Fields.MsgSeqNum, fixParser.getNextTargetMsgSeqNum()),\n new Field(Fields.SenderCompID, SENDER),\n new Field(Fields.SendingTime, fixParser.getTimestamp()),\n new Field(Fields.TargetCompID, TARGET),\n new Field(Fields.ResetSeqNumFlag, ResetSeqNumFlag.Yes),\n new Field(Fields.EncryptMethod, EncryptMethod.None),\n new Field(Fields.HeartBtInt, 10),\n );\n fixParser.send(logon);\n };\n const sendOrder = () => {\n const orderMessage = fixParser.parse(\n '8=FIX.4.4|9=138|35=D|34=3|49=CLIENT2|56=EXECUTOR|52=20250531-15:26:58.415|11=NFLXSELLS|54=2|55=NFLX|38=300|44=410|40=1|21=1|59=0|60=20250531-15:26:58.415|10=107|',\n );\n if (orderMessage) {\n const msgSeq = new Field(Fields.MsgSeqNum, fixParser.getNextTargetMsgSeqNum());\n orderMessage[0].setField(msgSeq);\n\n const sendingTimeField = new Field(Fields.SendingTime, fixParser.getTimestamp());\n orderMessage[0].setField(sendingTimeField);\n\n const transactTimeField = new Field(Fields.TransactTime, fixParser.getTimestamp());\n orderMessage[0].setField(transactTimeField);\n\n orderMessage[0].recalculateMessageLengths();\n\n fixParser.send(orderMessage[0]);\n }\n };\n\n const CONNECT_PARAMS: Options = {\n host: '10.0.1.42',\n port: 5001,\n protocol: 'tcp',\n sender: SENDER,\n target: TARGET,\n fixVersion: 'FIX.4.4',\n onOpen: () => {\n sendLogon();\n setTimeout(() => {\n sendOrder();\n }, 1000);\n },\n onMessage: (message: Message) => {},\n onClose: () => {\n // console.log(\n // JSON.stringify(\n // {\n // event: 'FIX Connection closed',\n // action: 'Attempting to reconnect in 1 second',\n // },\n // null,\n // 2,\n // ),\n // );\n setTimeout(() => {\n // console.log(\n // JSON.stringify(\n // {\n // event: 'Reconnecting',\n // },\n // null,\n // 2,\n // ),\n // );\n fixParser.connect(CONNECT_PARAMS);\n }, 1000);\n },\n };\n\n fixParser.connect(CONNECT_PARAMS);\n};\n\ninitializeServer().catch((err) => console.error('Error initializing server:', err));\n", "import { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport {\n CallToolRequestSchema,\n GetPromptRequestSchema,\n ListPromptsRequestSchema,\n ListResourcesRequestSchema,\n ListToolsRequestSchema,\n} from '@modelcontextprotocol/sdk/types.js';\n\nimport {\n Field,\n Fields,\n HandlInst,\n type IFIXParser,\n type Logger,\n MDEntryType,\n type Message,\n Messages,\n OrdType,\n SubscriptionRequestType,\n TimeInForce,\n} from 'fixparser';\nimport type { IPlugin } from 'fixparser-common';\nimport type { PluginOptions } from './PluginOptions';\n\n// Define JSON Schemas\nconst parseInputSchema = {\n type: 'object',\n properties: {\n fixString: {\n type: 'string',\n description: 'FIX message string to parse',\n },\n },\n required: ['fixString'],\n};\n\nconst parseToJSONInputSchema = {\n type: 'object',\n properties: {\n fixString: {\n type: 'string',\n description: 'FIX message string to parse',\n },\n },\n required: ['fixString'],\n};\n\nconst newOrderSingleInputSchema = {\n type: 'object',\n properties: {\n clOrdID: {\n type: 'string',\n description: 'Client Order ID',\n },\n handlInst: {\n type: 'string',\n enum: ['1', '2', '3'],\n default: HandlInst.AutomatedExecutionNoIntervention,\n description:\n 'Handling instruction (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"1\" for Manual, \"2\" for Automated, \"3\" for AutomatedNoIntervention)',\n },\n quantity: {\n type: 'number',\n description: 'Order quantity',\n },\n price: {\n type: 'number',\n description: 'Order price',\n },\n ordType: {\n type: 'string',\n enum: [\n '1',\n '2',\n '3',\n '4',\n '5',\n '6',\n '7',\n '8',\n '9',\n 'A',\n 'B',\n 'C',\n 'D',\n 'E',\n 'F',\n 'G',\n 'H',\n 'I',\n 'J',\n 'K',\n 'L',\n 'M',\n 'P',\n 'Q',\n 'R',\n 'S',\n ],\n default: OrdType.Market,\n description:\n 'Order type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"1\" for Market, \"2\" for Limit, \"3\" for Stop)',\n },\n side: {\n type: 'string',\n enum: ['1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'],\n description:\n 'Order side (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"1\" for Buy, \"2\" for Sell, \"3\" for BuyMinus, \"4\" for SellPlus, \"5\" for SellShort, \"6\" for SellShortExempt, \"7\" for Undisclosed, \"8\" for Cross, \"9\" for CrossShort, \"A\" for CrossShortExempt, \"B\" for AsDefined, \"C\" for Opposite, \"D\" for Subscribe, \"E\" for Redeem, \"F\" for Lend, \"G\" for Borrow, \"H\" for SellUndisclosed)',\n },\n symbol: {\n type: 'string',\n description: 'Trading symbol',\n },\n timeInForce: {\n type: 'string',\n enum: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C'],\n default: TimeInForce.Day,\n description:\n 'Time in force (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for Day, \"1\" for Good Till Cancel, \"2\" for At Opening, \"3\" for Immediate or Cancel, \"4\" for Fill or Kill, \"5\" for Good Till Crossing, \"6\" for Good Till Date)',\n },\n },\n required: ['clOrdID', 'quantity', 'price', 'side', 'symbol'],\n};\n\nconst marketDataRequestInputSchema = {\n type: 'object',\n properties: {\n mdUpdateType: {\n type: 'string',\n enum: ['0', '1'],\n default: '0',\n description:\n 'Market data update type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for FullRefresh, \"1\" for IncrementalRefresh)',\n },\n symbol: {\n type: 'string',\n description: 'Trading symbol',\n },\n mdReqID: {\n type: 'string',\n description: 'Market data request ID',\n },\n subscriptionRequestType: {\n type: 'string',\n enum: ['0', '1', '2'],\n default: SubscriptionRequestType.SnapshotAndUpdates,\n description:\n 'Subscription request type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for Snapshot + Updates, \"1\" for Snapshot, \"2\" for Unsubscribe)',\n },\n mdEntryType: {\n type: 'string',\n enum: [\n '0',\n '1',\n '2',\n '3',\n '4',\n '5',\n '6',\n '7',\n '8',\n '9',\n 'A',\n 'B',\n 'C',\n 'D',\n 'E',\n 'F',\n 'G',\n 'H',\n 'J',\n 'K',\n 'L',\n 'M',\n 'N',\n 'O',\n 'P',\n 'Q',\n 'S',\n 'R',\n 'T',\n 'U',\n 'V',\n 'W',\n 'X',\n 'Y',\n 'Z',\n 'a',\n 'b',\n 'c',\n 'd',\n 'e',\n 'g',\n 'h',\n 'i',\n 't',\n ],\n default: MDEntryType.Bid,\n description:\n 'Market data entry type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for Bid, \"1\" for Offer, \"2\" for Trade, \"3\" for Index Value, \"4\" for Opening Price)',\n },\n },\n required: ['symbol', 'mdReqID'],\n};\n\nexport class MCPLocal implements IPlugin<IFIXParser> {\n private logger: Logger | undefined;\n private parser: IFIXParser | undefined;\n private server: Server = new Server(\n {\n name: 'fixparser',\n version: '1.0.0',\n },\n {\n capabilities: {\n tools: {},\n prompts: {},\n resources: {},\n },\n },\n );\n private transport: StdioServerTransport = new StdioServerTransport();\n private onReady: (() => void) | undefined = undefined;\n\n private pendingRequests: Map<string, (data: Message) => void> = new Map();\n\n constructor({ logger, onReady }: PluginOptions) {\n if (logger && !logger.silent) {\n this.logger = logger;\n }\n\n if (onReady) this.onReady = onReady;\n }\n\n public async register(parser: IFIXParser): Promise<void> {\n this.parser = parser;\n if (parser.logger && !parser.logger.silent) {\n this.logger = parser.logger;\n }\n this.parser.addOnMessageCallback((message: Message) => {\n // this.logger?.log({\n // level: 'info',\n // message: `FIXParser (MCP): (${parser.protocol?.toUpperCase()}): << received ${message.description}`,\n // });\n const msgType = message.messageType;\n if (msgType === Messages.MarketDataSnapshotFullRefresh || msgType === Messages.ExecutionReport) {\n const idField =\n msgType === Messages.MarketDataSnapshotFullRefresh\n ? message.getField(Fields.MDReqID)\n : message.getField(Fields.ClOrdID);\n if (idField) {\n const id = idField.value;\n if (typeof id === 'string' || typeof id === 'number') {\n const callback = this.pendingRequests.get(String(id));\n if (callback) {\n callback(message);\n this.pendingRequests.delete(String(id));\n }\n }\n }\n }\n });\n\n this.addWorkflows();\n\n await this.server.connect(this.transport);\n\n if (this.onReady) {\n this.onReady();\n }\n }\n\n private addWorkflows() {\n if (!this.parser) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- FIXParser instance not initialized. Ignoring setup of workflows...',\n });\n return;\n }\n\n if (!this.server) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- MCP Server not initialized. Ignoring setup of workflows...',\n });\n return;\n }\n\n // Helper function to validate and parse arguments\n const validateArgs = (args: any, schema: any): any => {\n // Basic validation - in a real implementation, you might want to use a proper JSON Schema validator\n const result: any = {};\n\n for (const [key, propSchema] of Object.entries(schema.properties || {})) {\n const prop = propSchema as any;\n const value = args?.[key];\n\n if (prop.required && (value === undefined || value === null)) {\n throw new Error(`Required property '${key}' is missing`);\n }\n\n if (value !== undefined) {\n // Apply defaults\n result[key] = value;\n } else if (prop.default !== undefined) {\n result[key] = prop.default;\n }\n }\n\n return result;\n };\n\n // Empty handler for resources\n this.server.setRequestHandler(ListResourcesRequestSchema, async () => {\n return {\n resources: [],\n };\n });\n\n // Handler for listing available tools\n this.server.setRequestHandler(ListToolsRequestSchema, async () => {\n return {\n tools: [\n {\n name: 'parse',\n description: 'Parses a FIX message and describes it in plain language',\n inputSchema: parseInputSchema,\n },\n {\n name: 'parseToJSON',\n description: 'Parses a FIX message into JSON',\n inputSchema: parseToJSONInputSchema,\n },\n {\n name: 'newOrderSingle',\n description: 'Creates and sends a New Order Single',\n inputSchema: newOrderSingleInputSchema,\n },\n {\n name: 'marketDataRequest',\n description: 'Sends a request for Market Data with the given symbol',\n inputSchema: marketDataRequestInputSchema,\n },\n ],\n };\n });\n\n // Handler for tool calls\n this.server.setRequestHandler(CallToolRequestSchema, async (request) => {\n const { name, arguments: args } = request.params;\n\n switch (name) {\n case 'parse': {\n try {\n const { fixString } = validateArgs(args, parseInputSchema);\n const parsedMessage: Message[] | undefined = this.parser?.parse(fixString);\n if (!parsedMessage || parsedMessage.length === 0) {\n return {\n isError: true,\n content: [{ type: 'text', text: 'Error: Failed to parse FIX string' }],\n };\n }\n\n return {\n content: [\n {\n type: 'text',\n text: `${parsedMessage[0].description}\n${parsedMessage[0].messageTypeDescription}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to parse FIX string'}`,\n },\n ],\n };\n }\n }\n\n case 'parseToJSON': {\n try {\n const { fixString } = validateArgs(args, parseToJSONInputSchema);\n const parsedMessage = this.parser?.parse(fixString);\n if (!parsedMessage || parsedMessage.length === 0) {\n return {\n isError: true,\n content: [{ type: 'text', text: 'Error: Failed to parse FIX string' }],\n };\n }\n\n return {\n content: [\n {\n type: 'text',\n text: `${parsedMessage[0].toFIXJSON()}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to parse FIX string'}`,\n },\n ],\n };\n }\n }\n\n case 'newOrderSingle': {\n try {\n const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } =\n validateArgs(args, newOrderSingleInputSchema);\n\n const response = new Promise((resolve) => {\n this.pendingRequests.set(clOrdID, resolve);\n });\n\n const order: Message | undefined = this.parser?.createMessage(\n new Field(Fields.MsgType, Messages.NewOrderSingle),\n new Field(Fields.MsgSeqNum, this.parser?.getNextTargetMsgSeqNum()),\n new Field(Fields.SenderCompID, this.parser?.sender),\n new Field(Fields.TargetCompID, this.parser?.target),\n new Field(Fields.SendingTime, this.parser?.getTimestamp()),\n new Field(Fields.ClOrdID, clOrdID),\n new Field(Fields.Side, side),\n new Field(Fields.Symbol, symbol),\n new Field(Fields.OrderQty, quantity),\n new Field(Fields.Price, price),\n new Field(Fields.OrdType, ordType),\n new Field(Fields.HandlInst, handlInst),\n new Field(Fields.TimeInForce, timeInForce),\n new Field(Fields.TransactTime, this.parser?.getTimestamp()),\n );\n\n if (!this.parser?.connected) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- Not connected. Ignoring message.',\n });\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: 'Error: Not connected. Ignoring message.',\n },\n ],\n };\n }\n\n this.parser?.send(order!);\n this.logger?.log({\n level: 'info',\n message: `FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${order?.description}`,\n });\n\n const fixData = await response;\n return {\n content: [\n {\n type: 'text',\n text: `Execution Report for order ${clOrdID}: ${JSON.stringify((fixData as Message).toFIXJSON())}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to create order'}`,\n },\n ],\n };\n }\n }\n\n case 'marketDataRequest': {\n try {\n const { mdUpdateType, symbol, mdReqID, subscriptionRequestType, mdEntryType } = validateArgs(\n args,\n marketDataRequestInputSchema,\n );\n\n const response = new Promise((resolve) => {\n this.pendingRequests.set(mdReqID, resolve);\n });\n\n const marketDataRequest = this.parser?.createMessage(\n new Field(Fields.MsgType, Messages.MarketDataRequest),\n new Field(Fields.SenderCompID, this.parser?.sender),\n new Field(Fields.MsgSeqNum, this.parser?.getNextTargetMsgSeqNum()),\n new Field(Fields.TargetCompID, this.parser?.target),\n new Field(Fields.SendingTime, this.parser?.getTimestamp()),\n new Field(Fields.MarketDepth, 0),\n new Field(Fields.MDUpdateType, mdUpdateType),\n new Field(Fields.NoRelatedSym, 1),\n new Field(Fields.Symbol, symbol),\n new Field(Fields.MDReqID, mdReqID),\n new Field(Fields.SubscriptionRequestType, subscriptionRequestType),\n new Field(Fields.NoMDEntryTypes, 1),\n new Field(Fields.MDEntryType, mdEntryType),\n );\n\n if (!this.parser?.connected) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- Not connected. Ignoring message.',\n });\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: 'Error: Not connected. Ignoring message.',\n },\n ],\n };\n }\n\n this.parser?.send(marketDataRequest!);\n this.logger?.log({\n level: 'info',\n message: `FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${marketDataRequest?.description}`,\n });\n\n const fixData = await response;\n\n return {\n content: [\n {\n type: 'text',\n text: `Market data for ${symbol}: ${JSON.stringify((fixData as Message).toFIXJSON())}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to request market data'}`,\n },\n ],\n };\n }\n }\n\n default:\n throw new Error(`Unknown tool: ${name}`);\n }\n });\n\n this.server.setRequestHandler(ListPromptsRequestSchema, async () => {\n return {\n prompts: [\n {\n name: 'parse',\n description: 'Parses a FIX message and describes it in plain language',\n arguments: [\n {\n name: 'fixString',\n description: 'FIX message string to parse',\n required: true,\n },\n ],\n },\n {\n name: 'parseToJSON',\n description: 'Parses a FIX message into JSON',\n arguments: [\n {\n name: 'fixString',\n description: 'FIX message string to parse',\n required: true,\n },\n ],\n },\n {\n name: 'newOrderSingle',\n description: 'Creates and sends a New Order Single',\n arguments: [\n {\n name: 'clOrdID',\n description: 'Client Order ID',\n required: true,\n },\n {\n name: 'handlInst',\n description: 'Handling instruction',\n required: false,\n },\n {\n name: 'quantity',\n description: 'Order quantity',\n required: true,\n },\n {\n name: 'price',\n description: 'Order price',\n required: true,\n },\n {\n name: 'ordType',\n description: 'Order type',\n required: false,\n },\n {\n name: 'side',\n description:\n 'Order side (1=Buy, 2=Sell, 3=BuyMinus, 4=SellPlus, 5=SellShort, 6=SellShortExempt, 7=Undisclosed, 8=Cross, 9=CrossShort, A=CrossShortExempt, B=AsDefined, C=Opposite, D=Subscribe, E=Redeem, F=Lend, G=Borrow, H=SellUndisclosed)',\n required: true,\n },\n {\n name: 'symbol',\n description: 'Trading symbol',\n required: true,\n },\n {\n name: 'timeInForce',\n description: 'Time in force',\n required: false,\n },\n ],\n },\n {\n name: 'marketDataRequest',\n description: 'Sends a request for Market Data with the given symbol',\n arguments: [\n {\n name: 'mdUpdateType',\n description: 'Market data update type',\n required: false,\n },\n {\n name: 'symbol',\n description: 'Trading symbol',\n required: true,\n },\n {\n name: 'mdReqID',\n description: 'Market data request ID',\n required: true,\n },\n {\n name: 'subscriptionRequestType',\n description: 'Subscription request type',\n required: false,\n },\n {\n name: 'mdEntryType',\n description: 'Market data entry type',\n required: false,\n },\n ],\n },\n ],\n };\n });\n\n // Handler for getting specific prompts\n this.server.setRequestHandler(GetPromptRequestSchema, async (request) => {\n const { name, arguments: args } = request.params;\n\n switch (name) {\n case 'parse': {\n const fixString = args?.fixString || '';\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Please parse and explain this FIX message: ${fixString}`,\n },\n },\n ],\n };\n }\n\n case 'parseToJSON': {\n const fixString = args?.fixString || '';\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Please parse the FIX message to JSON: ${fixString}`,\n },\n },\n ],\n };\n }\n\n case 'newOrderSingle': {\n const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } = args || {};\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: [\n 'Create a New Order Single FIX message with the following parameters:',\n `- ClOrdID: ${clOrdID}`,\n `- HandlInst: ${handlInst ?? '3'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Manual, '2' for Automated, '3' for AutomatedNoIntervention)`,\n `- Quantity: ${quantity}`,\n `- Price: ${price}`,\n `- OrdType: ${ordType ?? '1'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Market, '2' for Limit, '3' for Stop)`,\n `- Side: ${side} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Buy, '2' for Sell)`,\n `- Symbol: ${symbol}`,\n `- TimeInForce: ${timeInForce ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Day, '1' for Good Till Cancel, '2' for At Opening, '3' for Immediate or Cancel, '4' for Fill or Kill, '5' for Good Till Crossing, '6' for Good Till Date)`,\n '',\n 'Format the response as a JSON object with FIX tag numbers as keys and their corresponding values.',\n '',\n 'Note: For the Side parameter, always use the numeric/alphabetic value (e.g., \"1\" for Buy, \"2\" for Sell) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the HandlInst parameter, always use the numeric/alphabetic value (e.g., \"1\" for Manual, \"2\" for Automated, \"3\" for AutomatedNoIntervention) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the OrdType parameter, always use the numeric/alphabetic value (e.g., \"1\" for Market, \"2\" for Limit, \"3\" for Stop) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the TimeInForce parameter, always use the numeric/alphabetic value (e.g., \"0\" for Day, \"1\" for Good Till Cancel, \"2\" for At Opening) as defined in the FIX protocol, not the descriptive name.',\n ].join('\\n'),\n },\n },\n ],\n };\n }\n\n case 'marketDataRequest': {\n const { mdUpdateType, symbol, mdReqID, subscriptionRequestType, mdEntryType } = args || {};\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: [\n 'Create a Market Data Request FIX message with the following parameters:',\n `- MDUpdateType: ${mdUpdateType ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for FullRefresh, '1' for IncrementalRefresh)`,\n `- Symbol: ${symbol}`,\n `- MDReqID: ${mdReqID}`,\n `- SubscriptionRequestType: ${subscriptionRequestType ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Snapshot + Updates, '1' for Snapshot, '2' for Unsubscribe)`,\n `- MDEntryType: ${mdEntryType ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Bid, '1' for Offer, '2' for Trade, '3' for Index Value, '4' for Opening Price)`,\n '',\n 'Format the response as a JSON object with FIX tag numbers as keys and their corresponding values.',\n '',\n 'Note: For the MDUpdateType parameter, always use the numeric/alphabetic value (e.g., \"0\" for FullRefresh, \"1\" for IncrementalRefresh) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the SubscriptionRequestType parameter, always use the numeric/alphabetic value (e.g., \"0\" for Snapshot + Updates, \"1\" for Snapshot, \"2\" for Unsubscribe) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the MDEntryType parameter, always use the numeric/alphabetic value (e.g., \"0\" for Bid, \"1\" for Offer, \"2\" for Trade, \"3\" for Index Value, \"4\" for Opening Price) as defined in the FIX protocol, not the descriptive name.',\n ].join('\\n'),\n },\n },\n ],\n };\n }\n\n default:\n throw new Error(`Unknown prompt: ${name}`);\n }\n });\n\n process.on('SIGINT', async () => {\n await this.server.close();\n process.exit(0);\n });\n }\n}\n"],
|
|
5
|
+
"mappings": ";aAAA,IAAAA,EAUO,qBCVP,IAAAC,EAAuB,qDACvBC,EAAqC,qDACrCC,EAMO,8CAEPC,EAYO,qBAKDC,EAAmB,CACrB,KAAM,SACN,WAAY,CACR,UAAW,CACP,KAAM,SACN,YAAa,6BACjB,CACJ,EACA,SAAU,CAAC,WAAW,CAC1B,EAEMC,EAAyB,CAC3B,KAAM,SACN,WAAY,CACR,UAAW,CACP,KAAM,SACN,YAAa,6BACjB,CACJ,EACA,SAAU,CAAC,WAAW,CAC1B,EAEMC,EAA4B,CAC9B,KAAM,SACN,WAAY,CACR,QAAS,CACL,KAAM,SACN,YAAa,iBACjB,EACA,UAAW,CACP,KAAM,SACN,KAAM,CAAC,IAAK,IAAK,GAAG,EACpB,QAAS,YAAU,iCACnB,YACI,mLACR,EACA,SAAU,CACN,KAAM,SACN,YAAa,gBACjB,EACA,MAAO,CACH,KAAM,SACN,YAAa,aACjB,EACA,QAAS,CACL,KAAM,SACN,KAAM,CACF,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,GACJ,EACA,QAAS,UAAQ,OACjB,YACI,kJACR,EACA,KAAM,CACF,KAAM,SACN,KAAM,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IA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Schema", "parseToJSONInputSchema", "newOrderSingleInputSchema", "marketDataRequestInputSchema", "MCPLocal", "logger", "onReady", "parser", "message", "msgType", "idField", "id", "callback", "validateArgs", "args", "schema", "result", "key", "propSchema", "prop", "value", "request", "name", "fixString", "parsedMessage", "error", "clOrdID", "handlInst", "quantity", "price", "ordType", "side", "symbol", "timeInForce", "response", "resolve", "order", "fixData", "mdUpdateType", "mdReqID", "subscriptionRequestType", "mdEntryType", "marketDataRequest", "SENDER", "TARGET", "initializeServer", "fixParser", "MCPLocal", "sendLogon", "logon", "sendOrder", "orderMessage", "msgSeq", "sendingTimeField", "transactTimeField", "CONNECT_PARAMS", "message", "err"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{EncryptMethod as
|
|
3
|
-
${n[0].messageTypeDescription}`}]}}catch(e){return{isError:!0,content:[{type:"text",text:`Error: ${e instanceof Error?e.message:"Failed to parse FIX string"}`}]}}case"parseToJSON":try{let{fixString:e}=
|
|
4
|
-
`)}}]}}case"marketDataRequest":{let{mdUpdateType:e,symbol:n,mdReqID:
|
|
5
|
-
`)}}]}}default:throw new Error(`Unknown prompt: ${
|
|
2
|
+
import{EncryptMethod as L,FIXParser as B,Field as c,Fields as l,LicenseManager as H,Messages as J,ResetSeqNumFlag as G}from"fixparser";import{Server as O}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as b}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as N,GetPromptRequestSchema as D,ListPromptsRequestSchema as E,ListResourcesRequestSchema as C,ListToolsRequestSchema as P}from"@modelcontextprotocol/sdk/types.js";import{Field as s,Fields as t,HandlInst as X,MDEntryType as U,Messages as f,OrdType as A,SubscriptionRequestType as k,TimeInForce as $}from"fixparser";var T={type:"object",properties:{fixString:{type:"string",description:"FIX message string to parse"}},required:["fixString"]},I={type:"object",properties:{fixString:{type:"string",description:"FIX message string to parse"}},required:["fixString"]},F={type:"object",properties:{clOrdID:{type:"string",description:"Client Order ID"},handlInst:{type:"string",enum:["1","2","3"],default:X.AutomatedExecutionNoIntervention,description:'Handling instruction (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "1" for Manual, "2" for Automated, "3" for AutomatedNoIntervention)'},quantity:{type:"number",description:"Order quantity"},price:{type:"number",description:"Order price"},ordType:{type:"string",enum:["1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","P","Q","R","S"],default:A.Market,description:'Order type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "1" for Market, "2" for Limit, "3" for Stop)'},side:{type:"string",enum:["1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H"],description:'Order side (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "1" for Buy, "2" for Sell, "3" for BuyMinus, "4" for SellPlus, "5" for SellShort, "6" for SellShortExempt, "7" for Undisclosed, "8" for Cross, "9" for CrossShort, "A" for CrossShortExempt, "B" for AsDefined, "C" for Opposite, "D" for Subscribe, "E" for Redeem, "F" for Lend, "G" for Borrow, "H" for SellUndisclosed)'},symbol:{type:"string",description:"Trading symbol"},timeInForce:{type:"string",enum:["0","1","2","3","4","5","6","7","8","9","A","B","C"],default:$.Day,description:'Time in force (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for Day, "1" for Good Till Cancel, "2" for At Opening, "3" for Immediate or Cancel, "4" for Fill or Kill, "5" for Good Till Crossing, "6" for Good Till Date)'}},required:["clOrdID","quantity","price","side","symbol"]},w={type:"object",properties:{mdUpdateType:{type:"string",enum:["0","1"],default:"0",description:'Market data update type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for FullRefresh, "1" for IncrementalRefresh)'},symbol:{type:"string",description:"Trading symbol"},mdReqID:{type:"string",description:"Market data request ID"},subscriptionRequestType:{type:"string",enum:["0","1","2"],default:k.SnapshotAndUpdates,description:'Subscription request type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for Snapshot + Updates, "1" for Snapshot, "2" for Unsubscribe)'},mdEntryType:{type:"string",enum:["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","S","R","T","U","V","W","X","Y","Z","a","b","c","d","e","g","h","i","t"],default:U.Bid,description:'Market data entry type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for Bid, "1" for Offer, "2" for Trade, "3" for Index Value, "4" for Opening Price)'}},required:["symbol","mdReqID"]},M=class{logger;parser;server=new O({name:"fixparser",version:"1.0.0"},{capabilities:{tools:{},prompts:{},resources:{}}});transport=new b;onReady=void 0;pendingRequests=new Map;constructor({logger:r,onReady:i}){r&&!r.silent&&(this.logger=r),i&&(this.onReady=i)}async register(r){this.parser=r,r.logger&&!r.logger.silent&&(this.logger=r.logger),this.parser.addOnMessageCallback(i=>{let d=i.messageType;if(d===f.MarketDataSnapshotFullRefresh||d===f.ExecutionReport){let o=d===f.MarketDataSnapshotFullRefresh?i.getField(t.MDReqID):i.getField(t.ClOrdID);if(o){let e=o.value;if(typeof e=="string"||typeof e=="number"){let n=this.pendingRequests.get(String(e));n&&(n(i),this.pendingRequests.delete(String(e)))}}}}),this.addWorkflows(),await this.server.connect(this.transport),this.onReady&&this.onReady()}addWorkflows(){if(!this.parser){this.logger?.log({level:"error",message:"FIXParser (MCP): -- FIXParser instance not initialized. Ignoring setup of workflows..."});return}if(!this.server){this.logger?.log({level:"error",message:"FIXParser (MCP): -- MCP Server not initialized. Ignoring setup of workflows..."});return}let r=(i,d)=>{let o={};for(let[e,n]of Object.entries(d.properties||{})){let a=n,p=i?.[e];if(a.required&&p==null)throw new Error(`Required property '${e}' is missing`);p!==void 0?o[e]=p:a.default!==void 0&&(o[e]=a.default)}return o};this.server.setRequestHandler(C,async()=>({resources:[]})),this.server.setRequestHandler(P,async()=>({tools:[{name:"parse",description:"Parses a FIX message and describes it in plain language",inputSchema:T},{name:"parseToJSON",description:"Parses a FIX message into JSON",inputSchema:I},{name:"newOrderSingle",description:"Creates and sends a New Order Single",inputSchema:F},{name:"marketDataRequest",description:"Sends a request for Market Data with the given symbol",inputSchema:w}]})),this.server.setRequestHandler(N,async i=>{let{name:d,arguments:o}=i.params;switch(d){case"parse":try{let{fixString:e}=r(o,T),n=this.parser?.parse(e);return!n||n.length===0?{isError:!0,content:[{type:"text",text:"Error: Failed to parse FIX string"}]}:{content:[{type:"text",text:`${n[0].description}
|
|
3
|
+
${n[0].messageTypeDescription}`}]}}catch(e){return{isError:!0,content:[{type:"text",text:`Error: ${e instanceof Error?e.message:"Failed to parse FIX string"}`}]}}case"parseToJSON":try{let{fixString:e}=r(o,I),n=this.parser?.parse(e);return!n||n.length===0?{isError:!0,content:[{type:"text",text:"Error: Failed to parse FIX string"}]}:{content:[{type:"text",text:`${n[0].toFIXJSON()}`}]}}catch(e){return{isError:!0,content:[{type:"text",text:`Error: ${e instanceof Error?e.message:"Failed to parse FIX string"}`}]}}case"newOrderSingle":try{let{clOrdID:e,handlInst:n,quantity:a,price:p,ordType:m,side:g,symbol:u,timeInForce:h}=r(o,F),y=new Promise(x=>{this.pendingRequests.set(e,x)}),S=this.parser?.createMessage(new s(t.MsgType,f.NewOrderSingle),new s(t.MsgSeqNum,this.parser?.getNextTargetMsgSeqNum()),new s(t.SenderCompID,this.parser?.sender),new s(t.TargetCompID,this.parser?.target),new s(t.SendingTime,this.parser?.getTimestamp()),new s(t.ClOrdID,e),new s(t.Side,g),new s(t.Symbol,u),new s(t.OrderQty,a),new s(t.Price,p),new s(t.OrdType,m),new s(t.HandlInst,n),new s(t.TimeInForce,h),new s(t.TransactTime,this.parser?.getTimestamp()));if(!this.parser?.connected)return this.logger?.log({level:"error",message:"FIXParser (MCP): -- Not connected. Ignoring message."}),{isError:!0,content:[{type:"text",text:"Error: Not connected. Ignoring message."}]};this.parser?.send(S),this.logger?.log({level:"info",message:`FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${S?.description}`});let R=await y;return{content:[{type:"text",text:`Execution Report for order ${e}: ${JSON.stringify(R.toFIXJSON())}`}]}}catch(e){return{isError:!0,content:[{type:"text",text:`Error: ${e instanceof Error?e.message:"Failed to create order"}`}]}}case"marketDataRequest":try{let{mdUpdateType:e,symbol:n,mdReqID:a,subscriptionRequestType:p,mdEntryType:m}=r(o,w),g=new Promise(y=>{this.pendingRequests.set(a,y)}),u=this.parser?.createMessage(new s(t.MsgType,f.MarketDataRequest),new s(t.SenderCompID,this.parser?.sender),new s(t.MsgSeqNum,this.parser?.getNextTargetMsgSeqNum()),new s(t.TargetCompID,this.parser?.target),new s(t.SendingTime,this.parser?.getTimestamp()),new s(t.MarketDepth,0),new s(t.MDUpdateType,e),new s(t.NoRelatedSym,1),new s(t.Symbol,n),new s(t.MDReqID,a),new s(t.SubscriptionRequestType,p),new s(t.NoMDEntryTypes,1),new s(t.MDEntryType,m));if(!this.parser?.connected)return this.logger?.log({level:"error",message:"FIXParser (MCP): -- Not connected. Ignoring message."}),{isError:!0,content:[{type:"text",text:"Error: Not connected. Ignoring message."}]};this.parser?.send(u),this.logger?.log({level:"info",message:`FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${u?.description}`});let h=await g;return{content:[{type:"text",text:`Market data for ${n}: ${JSON.stringify(h.toFIXJSON())}`}]}}catch(e){return{isError:!0,content:[{type:"text",text:`Error: ${e instanceof Error?e.message:"Failed to request market data"}`}]}}default:throw new Error(`Unknown tool: ${d}`)}}),this.server.setRequestHandler(E,async()=>({prompts:[{name:"parse",description:"Parses a FIX message and describes it in plain language",arguments:[{name:"fixString",description:"FIX message string to parse",required:!0}]},{name:"parseToJSON",description:"Parses a FIX message into JSON",arguments:[{name:"fixString",description:"FIX message string to parse",required:!0}]},{name:"newOrderSingle",description:"Creates and sends a New Order Single",arguments:[{name:"clOrdID",description:"Client Order ID",required:!0},{name:"handlInst",description:"Handling instruction",required:!1},{name:"quantity",description:"Order quantity",required:!0},{name:"price",description:"Order price",required:!0},{name:"ordType",description:"Order type",required:!1},{name:"side",description:"Order side (1=Buy, 2=Sell, 3=BuyMinus, 4=SellPlus, 5=SellShort, 6=SellShortExempt, 7=Undisclosed, 8=Cross, 9=CrossShort, A=CrossShortExempt, B=AsDefined, C=Opposite, D=Subscribe, E=Redeem, F=Lend, G=Borrow, H=SellUndisclosed)",required:!0},{name:"symbol",description:"Trading symbol",required:!0},{name:"timeInForce",description:"Time in force",required:!1}]},{name:"marketDataRequest",description:"Sends a request for Market Data with the given symbol",arguments:[{name:"mdUpdateType",description:"Market data update type",required:!1},{name:"symbol",description:"Trading symbol",required:!0},{name:"mdReqID",description:"Market data request ID",required:!0},{name:"subscriptionRequestType",description:"Subscription request type",required:!1},{name:"mdEntryType",description:"Market data entry type",required:!1}]}]})),this.server.setRequestHandler(D,async i=>{let{name:d,arguments:o}=i.params;switch(d){case"parse":return{messages:[{role:"user",content:{type:"text",text:`Please parse and explain this FIX message: ${o?.fixString||""}`}}]};case"parseToJSON":return{messages:[{role:"user",content:{type:"text",text:`Please parse the FIX message to JSON: ${o?.fixString||""}`}}]};case"newOrderSingle":{let{clOrdID:e,handlInst:n,quantity:a,price:p,ordType:m,side:g,symbol:u,timeInForce:h}=o||{};return{messages:[{role:"user",content:{type:"text",text:["Create a New Order Single FIX message with the following parameters:",`- ClOrdID: ${e}`,`- HandlInst: ${n??"3"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Manual, '2' for Automated, '3' for AutomatedNoIntervention)`,`- Quantity: ${a}`,`- Price: ${p}`,`- OrdType: ${m??"1"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Market, '2' for Limit, '3' for Stop)`,`- Side: ${g} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Buy, '2' for Sell)`,`- Symbol: ${u}`,`- TimeInForce: ${h??"0"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Day, '1' for Good Till Cancel, '2' for At Opening, '3' for Immediate or Cancel, '4' for Fill or Kill, '5' for Good Till Crossing, '6' for Good Till Date)`,"","Format the response as a JSON object with FIX tag numbers as keys and their corresponding values.","",'Note: For the Side parameter, always use the numeric/alphabetic value (e.g., "1" for Buy, "2" for Sell) as defined in the FIX protocol, not the descriptive name.','Note: For the HandlInst parameter, always use the numeric/alphabetic value (e.g., "1" for Manual, "2" for Automated, "3" for AutomatedNoIntervention) as defined in the FIX protocol, not the descriptive name.','Note: For the OrdType parameter, always use the numeric/alphabetic value (e.g., "1" for Market, "2" for Limit, "3" for Stop) as defined in the FIX protocol, not the descriptive name.','Note: For the TimeInForce parameter, always use the numeric/alphabetic value (e.g., "0" for Day, "1" for Good Till Cancel, "2" for At Opening) as defined in the FIX protocol, not the descriptive name.'].join(`
|
|
4
|
+
`)}}]}}case"marketDataRequest":{let{mdUpdateType:e,symbol:n,mdReqID:a,subscriptionRequestType:p,mdEntryType:m}=o||{};return{messages:[{role:"user",content:{type:"text",text:["Create a Market Data Request FIX message with the following parameters:",`- MDUpdateType: ${e??"0"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for FullRefresh, '1' for IncrementalRefresh)`,`- Symbol: ${n}`,`- MDReqID: ${a}`,`- SubscriptionRequestType: ${p??"0"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Snapshot + Updates, '1' for Snapshot, '2' for Unsubscribe)`,`- MDEntryType: ${m??"0"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Bid, '1' for Offer, '2' for Trade, '3' for Index Value, '4' for Opening Price)`,"","Format the response as a JSON object with FIX tag numbers as keys and their corresponding values.","",'Note: For the MDUpdateType parameter, always use the numeric/alphabetic value (e.g., "0" for FullRefresh, "1" for IncrementalRefresh) as defined in the FIX protocol, not the descriptive name.','Note: For the SubscriptionRequestType parameter, always use the numeric/alphabetic value (e.g., "0" for Snapshot + Updates, "1" for Snapshot, "2" for Unsubscribe) as defined in the FIX protocol, not the descriptive name.','Note: For the MDEntryType parameter, always use the numeric/alphabetic value (e.g., "0" for Bid, "1" for Offer, "2" for Trade, "3" for Index Value, "4" for Opening Price) as defined in the FIX protocol, not the descriptive name.'].join(`
|
|
5
|
+
`)}}]}}default:throw new Error(`Unknown prompt: ${d}`)}}),process.on("SIGINT",async()=>{await this.server.close(),process.exit(0)})}};var q="CLIENT2",v="EXECUTOR",j=async()=>{await H.setLicenseKey(process.env.FIXPARSER_LICENSE_KEY);let r=new B({logging:!1,plugins:[new M({port:3099,onReady:()=>{}})]}),i=()=>{let e=r.createMessage(new c(l.MsgType,J.Logon),new c(l.MsgSeqNum,r.getNextTargetMsgSeqNum()),new c(l.SenderCompID,q),new c(l.SendingTime,r.getTimestamp()),new c(l.TargetCompID,v),new c(l.ResetSeqNumFlag,G.Yes),new c(l.EncryptMethod,L.None),new c(l.HeartBtInt,10));r.send(e)},d=()=>{let e=r.parse("8=FIX.4.4|9=138|35=D|34=3|49=CLIENT2|56=EXECUTOR|52=20250531-15:26:58.415|11=NFLXSELLS|54=2|55=NFLX|38=300|44=410|40=1|21=1|59=0|60=20250531-15:26:58.415|10=107|");if(e){let n=new c(l.MsgSeqNum,r.getNextTargetMsgSeqNum());e[0].setField(n);let a=new c(l.SendingTime,r.getTimestamp());e[0].setField(a);let p=new c(l.TransactTime,r.getTimestamp());e[0].setField(p),e[0].recalculateMessageLengths(),r.send(e[0])}},o={host:"10.0.1.42",port:5001,protocol:"tcp",sender:q,target:v,fixVersion:"FIX.4.4",onOpen:()=>{i(),setTimeout(()=>{d()},1e3)},onMessage:e=>{},onClose:()=>{setTimeout(()=>{r.connect(o)},1e3)}};r.connect(o)};j().catch(r=>console.error("Error initializing server:",r));
|
|
6
6
|
//# sourceMappingURL=example_mcp_local.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../examples/example_mcp_local.ts", "../../
|
|
4
|
-
"sourcesContent": ["import {\n EncryptMethod,\n FIXParser,\n Field,\n Fields,\n LicenseManager,\n type Message,\n Messages,\n type Options,\n ResetSeqNumFlag,\n} from 'fixparser';\nimport { ConsoleLogTransport } from 'fixparser-plugin-log-console';\nimport { MCPLocal } from 'fixparser-plugin-mcp';\n\nconst SENDER = 'CLIENT2';\nconst TARGET = 'EXECUTOR';\n\nconst initializeServer = async () => {\n await LicenseManager.setLicenseKey(process.env.FIXPARSER_LICENSE_KEY);\n\n const fixParser: FIXParser = new FIXParser({\n logging: true,\n logOptions: {\n name: SENDER,\n level: 'info',\n format: 'jsonrpc',\n transport: new ConsoleLogTransport({ format: 'jsonrpc' }),\n },\n plugins: [new MCPLocal({ port: 3099, onReady: () => {} })],\n });\n\n const sendLogon = () => {\n const logon = fixParser.createMessage(\n new Field(Fields.MsgType, Messages.Logon),\n new Field(Fields.MsgSeqNum, fixParser.getNextTargetMsgSeqNum()),\n new Field(Fields.SenderCompID, SENDER),\n new Field(Fields.SendingTime, fixParser.getTimestamp()),\n new Field(Fields.TargetCompID, TARGET),\n new Field(Fields.ResetSeqNumFlag, ResetSeqNumFlag.Yes),\n new Field(Fields.EncryptMethod, EncryptMethod.None),\n new Field(Fields.HeartBtInt, 10),\n );\n fixParser.send(logon);\n };\n const sendOrder = () => {\n const orderMessage = fixParser.parse(\n '8=FIX.4.4|9=138|35=D|34=3|49=CLIENT2|56=EXECUTOR|52=20250531-15:26:58.415|11=NFLXSELLS|54=2|55=NFLX|38=300|44=410|40=1|21=1|59=0|60=20250531-15:26:58.415|10=107|',\n );\n if (orderMessage) {\n const msgSeq = new Field(Fields.MsgSeqNum, fixParser.getNextTargetMsgSeqNum());\n orderMessage[0].setField(msgSeq);\n\n const sendingTimeField = new Field(Fields.SendingTime, fixParser.getTimestamp());\n orderMessage[0].setField(sendingTimeField);\n\n const transactTimeField = new Field(Fields.TransactTime, fixParser.getTimestamp());\n orderMessage[0].setField(transactTimeField);\n\n orderMessage[0].recalculateMessageLengths();\n\n fixParser.send(orderMessage[0]);\n }\n };\n\n const CONNECT_PARAMS: Options = {\n host: '10.0.1.42',\n port: 5001,\n protocol: 'tcp',\n sender: SENDER,\n target: TARGET,\n fixVersion: 'FIX.4.4',\n onOpen: () => {\n sendLogon();\n setTimeout(() => {\n sendOrder();\n }, 1000);\n },\n onMessage: (message: Message) => {},\n onClose: () => {\n console.log(\n JSON.stringify(\n {\n event: 'FIX Connection closed',\n action: 'Attempting to reconnect in 1 second',\n },\n null,\n 2,\n ),\n );\n setTimeout(() => {\n console.log(\n JSON.stringify(\n {\n event: 'Reconnecting',\n },\n null,\n 2,\n ),\n );\n fixParser.connect(CONNECT_PARAMS);\n }, 1000);\n },\n };\n\n fixParser.connect(CONNECT_PARAMS);\n};\n\ninitializeServer().catch((err) => console.error('Error initializing server:', err));\n", "import type { ILogTransporter, LogMessage } from 'fixparser-common';\n\n/**\n * Logger output format options.\n *\n * - 'console': Output log in plain text format\n * - 'json': Output log in JSON format\n * - 'jsonrpc': Output log in JSON-RPC 2.0 format\n *\n * @public\n */\nexport type ConsoleFormat = 'console' | 'json' | 'jsonrpc';\n\n/**\n * A LogTransporter implementation for logging to the console.\n * It supports text (console), JSON, and JSON-RPC 2.0 formats.\n */\nexport class ConsoleLogTransport implements ILogTransporter {\n private format: ConsoleFormat;\n\n constructor({ format = 'json' }: { format: ConsoleFormat }) {\n this.format = format;\n }\n\n /**\n * Configures the format for console logging (either 'console' for text, 'json', or 'jsonrpc').\n */\n configure(config: { format: 'console' | 'json' | 'jsonrpc' }): void {\n this.format = config.format || 'json';\n }\n\n /**\n * Sends the log message to the console in the configured format.\n */\n async send(log: LogMessage): Promise<void> {\n if (this.format === 'json') {\n console.log(JSON.stringify(log));\n } else if (this.format === 'jsonrpc') {\n const { message, ...rest } = log;\n const jsonrpcMessage = {\n jsonrpc: '2.0',\n method: log.level,\n params: {\n message,\n ...rest,\n },\n id: log.id || Date.now(),\n };\n console.log(JSON.stringify(jsonrpcMessage));\n } else {\n const { name, id, message, level, ...additionalProperties } = log;\n const kv = Object.entries(additionalProperties).map(([key, value]) => `${key}: ${value}`);\n let logMessage = '';\n if (name) {\n logMessage += `${name} `;\n }\n logMessage += `${id}: ${message}`;\n void kv;\n console.log(logMessage, kv.join(', '));\n }\n }\n\n /**\n * Flushes the log buffer (if any buffering mechanism exists).\n */\n async flush(): Promise<void> {\n // No flushing needed for console transport\n }\n\n /**\n * Closes the transport (not needed for console, but keeping the method for consistency).\n */\n async close(): Promise<void> {\n // No close logic needed for console transport\n }\n\n /**\n * Returns the status of the transport (always \"connected\" for console).\n */\n status(): string {\n return 'connected';\n }\n}\n", "import { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport {\n CallToolRequestSchema,\n GetPromptRequestSchema,\n ListPromptsRequestSchema,\n ListResourcesRequestSchema,\n ListToolsRequestSchema,\n} from '@modelcontextprotocol/sdk/types.js';\n\nimport {\n Field,\n Fields,\n HandlInst,\n type IFIXParser,\n type Logger,\n MDEntryType,\n type Message,\n Messages,\n OrdType,\n SubscriptionRequestType,\n TimeInForce,\n} from 'fixparser';\nimport type { IPlugin } from 'fixparser-common';\nimport type { PluginOptions } from './PluginOptions';\n\n// Define JSON Schemas\nconst parseInputSchema = {\n type: 'object',\n properties: {\n fixString: {\n type: 'string',\n description: 'FIX message string to parse',\n },\n },\n required: ['fixString'],\n};\n\nconst parseToJSONInputSchema = {\n type: 'object',\n properties: {\n fixString: {\n type: 'string',\n description: 'FIX message string to parse',\n },\n },\n required: ['fixString'],\n};\n\nconst newOrderSingleInputSchema = {\n type: 'object',\n properties: {\n clOrdID: {\n type: 'string',\n description: 'Client Order ID',\n },\n handlInst: {\n type: 'string',\n enum: ['1', '2', '3'],\n default: HandlInst.AutomatedExecutionNoIntervention,\n description:\n 'Handling instruction (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"1\" for Manual, \"2\" for Automated, \"3\" for AutomatedNoIntervention)',\n },\n quantity: {\n type: 'number',\n description: 'Order quantity',\n },\n price: {\n type: 'number',\n description: 'Order price',\n },\n ordType: {\n type: 'string',\n enum: [\n '1',\n '2',\n '3',\n '4',\n '5',\n '6',\n '7',\n '8',\n '9',\n 'A',\n 'B',\n 'C',\n 'D',\n 'E',\n 'F',\n 'G',\n 'H',\n 'I',\n 'J',\n 'K',\n 'L',\n 'M',\n 'P',\n 'Q',\n 'R',\n 'S',\n ],\n default: OrdType.Market,\n description:\n 'Order type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"1\" for Market, \"2\" for Limit, \"3\" for Stop)',\n },\n side: {\n type: 'string',\n enum: ['1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'],\n description:\n 'Order side (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"1\" for Buy, \"2\" for Sell, \"3\" for BuyMinus, \"4\" for SellPlus, \"5\" for SellShort, \"6\" for SellShortExempt, \"7\" for Undisclosed, \"8\" for Cross, \"9\" for CrossShort, \"A\" for CrossShortExempt, \"B\" for AsDefined, \"C\" for Opposite, \"D\" for Subscribe, \"E\" for Redeem, \"F\" for Lend, \"G\" for Borrow, \"H\" for SellUndisclosed)',\n },\n symbol: {\n type: 'string',\n description: 'Trading symbol',\n },\n timeInForce: {\n type: 'string',\n enum: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C'],\n default: TimeInForce.Day,\n description:\n 'Time in force (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for Day, \"1\" for Good Till Cancel, \"2\" for At Opening, \"3\" for Immediate or Cancel, \"4\" for Fill or Kill, \"5\" for Good Till Crossing, \"6\" for Good Till Date)',\n },\n },\n required: ['clOrdID', 'quantity', 'price', 'side', 'symbol'],\n};\n\nconst marketDataRequestInputSchema = {\n type: 'object',\n properties: {\n mdUpdateType: {\n type: 'string',\n enum: ['0', '1'],\n default: '0',\n description:\n 'Market data update type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for FullRefresh, \"1\" for IncrementalRefresh)',\n },\n symbol: {\n type: 'string',\n description: 'Trading symbol',\n },\n mdReqID: {\n type: 'string',\n description: 'Market data request ID',\n },\n subscriptionRequestType: {\n type: 'string',\n enum: ['0', '1', '2'],\n default: SubscriptionRequestType.SnapshotAndUpdates,\n description:\n 'Subscription request type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for Snapshot + Updates, \"1\" for Snapshot, \"2\" for Unsubscribe)',\n },\n mdEntryType: {\n type: 'string',\n enum: [\n '0',\n '1',\n '2',\n '3',\n '4',\n '5',\n '6',\n '7',\n '8',\n '9',\n 'A',\n 'B',\n 'C',\n 'D',\n 'E',\n 'F',\n 'G',\n 'H',\n 'J',\n 'K',\n 'L',\n 'M',\n 'N',\n 'O',\n 'P',\n 'Q',\n 'S',\n 'R',\n 'T',\n 'U',\n 'V',\n 'W',\n 'X',\n 'Y',\n 'Z',\n 'a',\n 'b',\n 'c',\n 'd',\n 'e',\n 'g',\n 'h',\n 'i',\n 't',\n ],\n default: MDEntryType.Bid,\n description:\n 'Market data entry type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for Bid, \"1\" for Offer, \"2\" for Trade, \"3\" for Index Value, \"4\" for Opening Price)',\n },\n },\n required: ['symbol', 'mdReqID'],\n};\n\nexport class MCPLocal implements IPlugin<IFIXParser> {\n private logger: Logger | undefined;\n private parser: IFIXParser | undefined;\n private server: Server = new Server(\n {\n name: 'fixparser',\n version: '1.0.0',\n },\n {\n capabilities: {\n tools: {},\n prompts: {},\n resources: {},\n },\n },\n );\n private transport: StdioServerTransport = new StdioServerTransport();\n private onReady: (() => void) | undefined = undefined;\n\n private pendingRequests: Map<string, (data: Message) => void> = new Map();\n\n constructor({ logger, onReady }: PluginOptions) {\n if (logger && !logger.silent) {\n this.logger = logger;\n }\n\n if (onReady) this.onReady = onReady;\n }\n\n public async register(parser: IFIXParser): Promise<void> {\n this.parser = parser;\n if (parser.logger && !parser.logger.silent) {\n this.logger = parser.logger;\n }\n this.parser.addOnMessageCallback((message: Message) => {\n // this.logger?.log({\n // level: 'info',\n // message: `FIXParser (MCP): (${parser.protocol?.toUpperCase()}): << received ${message.description}`,\n // });\n const msgType = message.messageType;\n if (msgType === Messages.MarketDataSnapshotFullRefresh || msgType === Messages.ExecutionReport) {\n const idField =\n msgType === Messages.MarketDataSnapshotFullRefresh\n ? message.getField(Fields.MDReqID)\n : message.getField(Fields.ClOrdID);\n if (idField) {\n const id = idField.value;\n if (typeof id === 'string' || typeof id === 'number') {\n const callback = this.pendingRequests.get(String(id));\n if (callback) {\n callback(message);\n this.pendingRequests.delete(String(id));\n }\n }\n }\n }\n });\n\n this.addWorkflows();\n\n await this.server.connect(this.transport);\n\n if (this.onReady) {\n this.onReady();\n }\n }\n\n private addWorkflows() {\n if (!this.parser) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- FIXParser instance not initialized. Ignoring setup of workflows...',\n });\n return;\n }\n\n if (!this.server) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- MCP Server not initialized. Ignoring setup of workflows...',\n });\n return;\n }\n\n // Helper function to validate and parse arguments\n const validateArgs = (args: any, schema: any): any => {\n // Basic validation - in a real implementation, you might want to use a proper JSON Schema validator\n const result: any = {};\n\n for (const [key, propSchema] of Object.entries(schema.properties || {})) {\n const prop = propSchema as any;\n const value = args?.[key];\n\n if (prop.required && (value === undefined || value === null)) {\n throw new Error(`Required property '${key}' is missing`);\n }\n\n if (value !== undefined) {\n // Apply defaults\n result[key] = value;\n } else if (prop.default !== undefined) {\n result[key] = prop.default;\n }\n }\n\n return result;\n };\n\n // Empty handler for resources\n this.server.setRequestHandler(ListResourcesRequestSchema, async () => {\n return {\n resources: [],\n };\n });\n\n // Handler for listing available tools\n this.server.setRequestHandler(ListToolsRequestSchema, async () => {\n return {\n tools: [\n {\n name: 'parse',\n description: 'Parses a FIX message and describes it in plain language',\n inputSchema: parseInputSchema,\n },\n {\n name: 'parseToJSON',\n description: 'Parses a FIX message into JSON',\n inputSchema: parseToJSONInputSchema,\n },\n {\n name: 'newOrderSingle',\n description: 'Creates and sends a New Order Single',\n inputSchema: newOrderSingleInputSchema,\n },\n {\n name: 'marketDataRequest',\n description: 'Sends a request for Market Data with the given symbol',\n inputSchema: marketDataRequestInputSchema,\n },\n ],\n };\n });\n\n // Handler for tool calls\n this.server.setRequestHandler(CallToolRequestSchema, async (request) => {\n const { name, arguments: args } = request.params;\n\n switch (name) {\n case 'parse': {\n try {\n const { fixString } = validateArgs(args, parseInputSchema);\n const parsedMessage: Message[] | undefined = this.parser?.parse(fixString);\n if (!parsedMessage || parsedMessage.length === 0) {\n return {\n isError: true,\n content: [{ type: 'text', text: 'Error: Failed to parse FIX string' }],\n };\n }\n\n return {\n content: [\n {\n type: 'text',\n text: `${parsedMessage[0].description}\n${parsedMessage[0].messageTypeDescription}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to parse FIX string'}`,\n },\n ],\n };\n }\n }\n\n case 'parseToJSON': {\n try {\n const { fixString } = validateArgs(args, parseToJSONInputSchema);\n const parsedMessage = this.parser?.parse(fixString);\n if (!parsedMessage || parsedMessage.length === 0) {\n return {\n isError: true,\n content: [{ type: 'text', text: 'Error: Failed to parse FIX string' }],\n };\n }\n\n return {\n content: [\n {\n type: 'text',\n text: `${parsedMessage[0].toFIXJSON()}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to parse FIX string'}`,\n },\n ],\n };\n }\n }\n\n case 'newOrderSingle': {\n try {\n const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } =\n validateArgs(args, newOrderSingleInputSchema);\n\n const response = new Promise((resolve) => {\n this.pendingRequests.set(clOrdID, resolve);\n });\n\n const order: Message | undefined = this.parser?.createMessage(\n new Field(Fields.MsgType, Messages.NewOrderSingle),\n new Field(Fields.MsgSeqNum, this.parser?.getNextTargetMsgSeqNum()),\n new Field(Fields.SenderCompID, this.parser?.sender),\n new Field(Fields.TargetCompID, this.parser?.target),\n new Field(Fields.SendingTime, this.parser?.getTimestamp()),\n new Field(Fields.ClOrdID, clOrdID),\n new Field(Fields.Side, side),\n new Field(Fields.Symbol, symbol),\n new Field(Fields.OrderQty, quantity),\n new Field(Fields.Price, price),\n new Field(Fields.OrdType, ordType),\n new Field(Fields.HandlInst, handlInst),\n new Field(Fields.TimeInForce, timeInForce),\n new Field(Fields.TransactTime, this.parser?.getTimestamp()),\n );\n\n if (!this.parser?.connected) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- Not connected. Ignoring message.',\n });\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: 'Error: Not connected. Ignoring message.',\n },\n ],\n };\n }\n\n this.parser?.send(order!);\n this.logger?.log({\n level: 'info',\n message: `FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${order?.description}`,\n });\n\n const fixData = await response;\n return {\n content: [\n {\n type: 'text',\n text: `Execution Report for order ${clOrdID}: ${JSON.stringify((fixData as Message).toFIXJSON())}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to create order'}`,\n },\n ],\n };\n }\n }\n\n case 'marketDataRequest': {\n try {\n const { mdUpdateType, symbol, mdReqID, subscriptionRequestType, mdEntryType } = validateArgs(\n args,\n marketDataRequestInputSchema,\n );\n\n const response = new Promise((resolve) => {\n this.pendingRequests.set(mdReqID, resolve);\n });\n\n const marketDataRequest = this.parser?.createMessage(\n new Field(Fields.MsgType, Messages.MarketDataRequest),\n new Field(Fields.SenderCompID, this.parser?.sender),\n new Field(Fields.MsgSeqNum, this.parser?.getNextTargetMsgSeqNum()),\n new Field(Fields.TargetCompID, this.parser?.target),\n new Field(Fields.SendingTime, this.parser?.getTimestamp()),\n new Field(Fields.MarketDepth, 0),\n new Field(Fields.MDUpdateType, mdUpdateType),\n new Field(Fields.NoRelatedSym, 1),\n new Field(Fields.Symbol, symbol),\n new Field(Fields.MDReqID, mdReqID),\n new Field(Fields.SubscriptionRequestType, subscriptionRequestType),\n new Field(Fields.NoMDEntryTypes, 1),\n new Field(Fields.MDEntryType, mdEntryType),\n );\n\n if (!this.parser?.connected) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- Not connected. Ignoring message.',\n });\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: 'Error: Not connected. Ignoring message.',\n },\n ],\n };\n }\n\n this.parser?.send(marketDataRequest!);\n this.logger?.log({\n level: 'info',\n message: `FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${marketDataRequest?.description}`,\n });\n\n const fixData = await response;\n\n return {\n content: [\n {\n type: 'text',\n text: `Market data for ${symbol}: ${JSON.stringify((fixData as Message).toFIXJSON())}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to request market data'}`,\n },\n ],\n };\n }\n }\n\n default:\n throw new Error(`Unknown tool: ${name}`);\n }\n });\n\n this.server.setRequestHandler(ListPromptsRequestSchema, async () => {\n return {\n prompts: [\n {\n name: 'parse',\n description: 'Parses a FIX message and describes it in plain language',\n arguments: [\n {\n name: 'fixString',\n description: 'FIX message string to parse',\n required: true,\n },\n ],\n },\n {\n name: 'parseToJSON',\n description: 'Parses a FIX message into JSON',\n arguments: [\n {\n name: 'fixString',\n description: 'FIX message string to parse',\n required: true,\n },\n ],\n },\n {\n name: 'newOrderSingle',\n description: 'Creates and sends a New Order Single',\n arguments: [\n {\n name: 'clOrdID',\n description: 'Client Order ID',\n required: true,\n },\n {\n name: 'handlInst',\n description: 'Handling instruction',\n required: false,\n },\n {\n name: 'quantity',\n description: 'Order quantity',\n required: true,\n },\n {\n name: 'price',\n description: 'Order price',\n required: true,\n },\n {\n name: 'ordType',\n description: 'Order type',\n required: false,\n },\n {\n name: 'side',\n description:\n 'Order side (1=Buy, 2=Sell, 3=BuyMinus, 4=SellPlus, 5=SellShort, 6=SellShortExempt, 7=Undisclosed, 8=Cross, 9=CrossShort, A=CrossShortExempt, B=AsDefined, C=Opposite, D=Subscribe, E=Redeem, F=Lend, G=Borrow, H=SellUndisclosed)',\n required: true,\n },\n {\n name: 'symbol',\n description: 'Trading symbol',\n required: true,\n },\n {\n name: 'timeInForce',\n description: 'Time in force',\n required: false,\n },\n ],\n },\n {\n name: 'marketDataRequest',\n description: 'Sends a request for Market Data with the given symbol',\n arguments: [\n {\n name: 'mdUpdateType',\n description: 'Market data update type',\n required: false,\n },\n {\n name: 'symbol',\n description: 'Trading symbol',\n required: true,\n },\n {\n name: 'mdReqID',\n description: 'Market data request ID',\n required: true,\n },\n {\n name: 'subscriptionRequestType',\n description: 'Subscription request type',\n required: false,\n },\n {\n name: 'mdEntryType',\n description: 'Market data entry type',\n required: false,\n },\n ],\n },\n ],\n };\n });\n\n // Handler for getting specific prompts\n this.server.setRequestHandler(GetPromptRequestSchema, async (request) => {\n const { name, arguments: args } = request.params;\n\n switch (name) {\n case 'parse': {\n const fixString = args?.fixString || '';\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Please parse and explain this FIX message: ${fixString}`,\n },\n },\n ],\n };\n }\n\n case 'parseToJSON': {\n const fixString = args?.fixString || '';\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Please parse the FIX message to JSON: ${fixString}`,\n },\n },\n ],\n };\n }\n\n case 'newOrderSingle': {\n const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } = args || {};\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: [\n 'Create a New Order Single FIX message with the following parameters:',\n `- ClOrdID: ${clOrdID}`,\n `- HandlInst: ${handlInst ?? '3'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Manual, '2' for Automated, '3' for AutomatedNoIntervention)`,\n `- Quantity: ${quantity}`,\n `- Price: ${price}`,\n `- OrdType: ${ordType ?? '1'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Market, '2' for Limit, '3' for Stop)`,\n `- Side: ${side} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Buy, '2' for Sell)`,\n `- Symbol: ${symbol}`,\n `- TimeInForce: ${timeInForce ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Day, '1' for Good Till Cancel, '2' for At Opening, '3' for Immediate or Cancel, '4' for Fill or Kill, '5' for Good Till Crossing, '6' for Good Till Date)`,\n '',\n 'Format the response as a JSON object with FIX tag numbers as keys and their corresponding values.',\n '',\n 'Note: For the Side parameter, always use the numeric/alphabetic value (e.g., \"1\" for Buy, \"2\" for Sell) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the HandlInst parameter, always use the numeric/alphabetic value (e.g., \"1\" for Manual, \"2\" for Automated, \"3\" for AutomatedNoIntervention) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the OrdType parameter, always use the numeric/alphabetic value (e.g., \"1\" for Market, \"2\" for Limit, \"3\" for Stop) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the TimeInForce parameter, always use the numeric/alphabetic value (e.g., \"0\" for Day, \"1\" for Good Till Cancel, \"2\" for At Opening) as defined in the FIX protocol, not the descriptive name.',\n ].join('\\n'),\n },\n },\n ],\n };\n }\n\n case 'marketDataRequest': {\n const { mdUpdateType, symbol, mdReqID, subscriptionRequestType, mdEntryType } = args || {};\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: [\n 'Create a Market Data Request FIX message with the following parameters:',\n `- MDUpdateType: ${mdUpdateType ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for FullRefresh, '1' for IncrementalRefresh)`,\n `- Symbol: ${symbol}`,\n `- MDReqID: ${mdReqID}`,\n `- SubscriptionRequestType: ${subscriptionRequestType ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Snapshot + Updates, '1' for Snapshot, '2' for Unsubscribe)`,\n `- MDEntryType: ${mdEntryType ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Bid, '1' for Offer, '2' for Trade, '3' for Index Value, '4' for Opening Price)`,\n '',\n 'Format the response as a JSON object with FIX tag numbers as keys and their corresponding values.',\n '',\n 'Note: For the MDUpdateType parameter, always use the numeric/alphabetic value (e.g., \"0\" for FullRefresh, \"1\" for IncrementalRefresh) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the SubscriptionRequestType parameter, always use the numeric/alphabetic value (e.g., \"0\" for Snapshot + Updates, \"1\" for Snapshot, \"2\" for Unsubscribe) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the MDEntryType parameter, always use the numeric/alphabetic value (e.g., \"0\" for Bid, \"1\" for Offer, \"2\" for Trade, \"3\" for Index Value, \"4\" for Opening Price) as defined in the FIX protocol, not the descriptive name.',\n ].join('\\n'),\n },\n },\n ],\n };\n }\n\n default:\n throw new Error(`Unknown prompt: ${name}`);\n }\n });\n\n process.on('SIGINT', async () => {\n await this.server.close();\n process.exit(0);\n });\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,OACI,iBAAAA,EACA,aAAAC,EACA,SAAAC,EACA,UAAAC,EACA,kBAAAC,EAEA,YAAAC,EAEA,mBAAAC,MACG,YCOA,IAAMC,EAAN,KAAqD,CAChD,OAER,YAAY,CAAE,OAAAC,EAAS,MAAO,EAA8B,CACxD,KAAK,OAASA,CAClB,CAKA,UAAUC,EAA0D,CAChE,KAAK,OAASA,EAAO,QAAU,MACnC,CAKA,MAAM,KAAKC,EAAgC,CACvC,GAAI,KAAK,SAAW,OAChB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AA4B,CAC9B,KAAM,SACN,WAAY,CACR,QAAS,CACL,KAAM,SACN,YAAa,iBACjB,EACA,UAAW,CACP,KAAM,SACN,KAAM,CAAC,IAAK,IAAK,GAAG,EACpB,QAASR,EAAU,iCACnB,YACI,mLACR,EACA,SAAU,CACN,KAAM,SACN,YAAa,gBACjB,EACA,MAAO,CACH,KAAM,SACN,YAAa,aACjB,EACA,QAAS,CACL,KAAM,SACN,KAAM,CACF,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,GACJ,EACA,QAASG,EAAQ,OACjB,YACI,kJACR,EACA,KAAM,CACF,KAAM,SACN,KAAM,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,GAAG,EAC1F,YACI,iaACR,EACA,OAAQ,CACJ,KAAM,SACN,YAAa,gBACjB,EACA,YAAa,CACT,KAAM,SACN,KAAM,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,GAAG,EACtE,QAASE,EAAY,IACrB,YACI,0QACR,CACJ,EACA,SAAU,CAAC,UAAW,WAAY,QAAS,OAAQ,QAAQ,CAC/D,EAEMI,EAA+B,CACjC,KAAM,SACN,WAAY,CACR,aAAc,CACV,KAAM,SACN,KAAM,CAAC,IAAK,GAAG,EACf,QAAS,IACT,YACI,mKACR,EACA,OAAQ,CACJ,KAAM,SACN,YAAa,gBACjB,EACA,QAAS,CACL,KAAM,SACN,YAAa,wBACjB,EACA,wBAAyB,CACrB,KAAM,SACN,KAAM,CAAC,IAAK,IAAK,GAAG,EACpB,QAASL,EAAwB,mBACjC,YACI,uLACR,EACA,YAAa,CACT,KAAM,SACN,KAAM,CACF,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA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E,SAASC,CAAM,EAE/B,IAAMC,EAAmB,IAAIR,EAAMC,EAAO,YAAaP,EAAU,aAAa,CAAC,EAC/EY,EAAa,CAAC,EAAE,SAASE,CAAgB,EAEzC,IAAMC,EAAoB,IAAIT,EAAMC,EAAO,aAAcP,EAAU,aAAa,CAAC,EACjFY,EAAa,CAAC,EAAE,SAASG,CAAiB,EAE1CH,EAAa,CAAC,EAAE,0BAA0B,EAE1CZ,EAAU,KAAKY,EAAa,CAAC,CAAC,CAClC,CACJ,EAEMI,EAA0B,CAC5B,KAAM,YACN,KAAM,KACN,SAAU,MACV,OAAQpB,EACR,OAAQC,EACR,WAAY,UACZ,OAAQ,IAAM,CACVO,EAAU,EACV,WAAW,IAAM,CACbO,EAAU,CACd,EAAG,GAAI,CACX,EACA,UAAYM,GAAqB,CAAC,EAClC,QAAS,IAAM,CACX,QAAQ,IACJ,KAAK,UACD,CACI,MAAO,wBACP,OAAQ,qCACZ,EACA,KACA,CACJ,CACJ,EACA,WAAW,IAAM,CACb,QAAQ,IACJ,KAAK,UACD,CACI,MAAO,cACX,EACA,KACA,CACJ,CACJ,EACAjB,EAAU,QAAQgB,CAAc,CACpC,EAAG,GAAI,CACX,CACJ,EAEAhB,EAAU,QAAQgB,CAAc,CACpC,EAEAlB,EAAiB,EAAE,MAAOoB,GAAQ,QAAQ,MAAM,6BAA8BA,CAAG,CAAC",
|
|
6
|
-
"names": ["EncryptMethod", "FIXParser", "Field", "Fields", "LicenseManager", "Messages", "ResetSeqNumFlag", "
|
|
3
|
+
"sources": ["../../examples/example_mcp_local.ts", "../../src/MCPLocal.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n EncryptMethod,\n FIXParser,\n Field,\n Fields,\n LicenseManager,\n type Message,\n Messages,\n type Options,\n ResetSeqNumFlag,\n} from 'fixparser';\nimport { ConsoleLogTransport } from 'fixparser-plugin-log-console';\nimport { MCPLocal } from 'fixparser-plugin-mcp';\n\nconst SENDER = 'CLIENT2';\nconst TARGET = 'EXECUTOR';\n\nconst initializeServer = async () => {\n await LicenseManager.setLicenseKey(process.env.FIXPARSER_LICENSE_KEY);\n\n const fixParser: FIXParser = new FIXParser({\n logging: false,\n // logOptions: {\n // name: SENDER,\n // level: 'info',\n // format: 'jsonrpc',\n // transport: new ConsoleLogTransport({ format: 'jsonrpc' }),\n // },\n plugins: [new MCPLocal({ port: 3099, onReady: () => {} })],\n });\n\n const sendLogon = () => {\n const logon = fixParser.createMessage(\n new Field(Fields.MsgType, Messages.Logon),\n new Field(Fields.MsgSeqNum, fixParser.getNextTargetMsgSeqNum()),\n new Field(Fields.SenderCompID, SENDER),\n new Field(Fields.SendingTime, fixParser.getTimestamp()),\n new Field(Fields.TargetCompID, TARGET),\n new Field(Fields.ResetSeqNumFlag, ResetSeqNumFlag.Yes),\n new Field(Fields.EncryptMethod, EncryptMethod.None),\n new Field(Fields.HeartBtInt, 10),\n );\n fixParser.send(logon);\n };\n const sendOrder = () => {\n const orderMessage = fixParser.parse(\n '8=FIX.4.4|9=138|35=D|34=3|49=CLIENT2|56=EXECUTOR|52=20250531-15:26:58.415|11=NFLXSELLS|54=2|55=NFLX|38=300|44=410|40=1|21=1|59=0|60=20250531-15:26:58.415|10=107|',\n );\n if (orderMessage) {\n const msgSeq = new Field(Fields.MsgSeqNum, fixParser.getNextTargetMsgSeqNum());\n orderMessage[0].setField(msgSeq);\n\n const sendingTimeField = new Field(Fields.SendingTime, fixParser.getTimestamp());\n orderMessage[0].setField(sendingTimeField);\n\n const transactTimeField = new Field(Fields.TransactTime, fixParser.getTimestamp());\n orderMessage[0].setField(transactTimeField);\n\n orderMessage[0].recalculateMessageLengths();\n\n fixParser.send(orderMessage[0]);\n }\n };\n\n const CONNECT_PARAMS: Options = {\n host: '10.0.1.42',\n port: 5001,\n protocol: 'tcp',\n sender: SENDER,\n target: TARGET,\n fixVersion: 'FIX.4.4',\n onOpen: () => {\n sendLogon();\n setTimeout(() => {\n sendOrder();\n }, 1000);\n },\n onMessage: (message: Message) => {},\n onClose: () => {\n // console.log(\n // JSON.stringify(\n // {\n // event: 'FIX Connection closed',\n // action: 'Attempting to reconnect in 1 second',\n // },\n // null,\n // 2,\n // ),\n // );\n setTimeout(() => {\n // console.log(\n // JSON.stringify(\n // {\n // event: 'Reconnecting',\n // },\n // null,\n // 2,\n // ),\n // );\n fixParser.connect(CONNECT_PARAMS);\n }, 1000);\n },\n };\n\n fixParser.connect(CONNECT_PARAMS);\n};\n\ninitializeServer().catch((err) => console.error('Error initializing server:', err));\n", "import { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport {\n CallToolRequestSchema,\n GetPromptRequestSchema,\n ListPromptsRequestSchema,\n ListResourcesRequestSchema,\n ListToolsRequestSchema,\n} from '@modelcontextprotocol/sdk/types.js';\n\nimport {\n Field,\n Fields,\n HandlInst,\n type IFIXParser,\n type Logger,\n MDEntryType,\n type Message,\n Messages,\n OrdType,\n SubscriptionRequestType,\n TimeInForce,\n} from 'fixparser';\nimport type { IPlugin } from 'fixparser-common';\nimport type { PluginOptions } from './PluginOptions';\n\n// Define JSON Schemas\nconst parseInputSchema = {\n type: 'object',\n properties: {\n fixString: {\n type: 'string',\n description: 'FIX message string to parse',\n },\n },\n required: ['fixString'],\n};\n\nconst parseToJSONInputSchema = {\n type: 'object',\n properties: {\n fixString: {\n type: 'string',\n description: 'FIX message string to parse',\n },\n },\n required: ['fixString'],\n};\n\nconst newOrderSingleInputSchema = {\n type: 'object',\n properties: {\n clOrdID: {\n type: 'string',\n description: 'Client Order ID',\n },\n handlInst: {\n type: 'string',\n enum: ['1', '2', '3'],\n default: HandlInst.AutomatedExecutionNoIntervention,\n description:\n 'Handling instruction (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"1\" for Manual, \"2\" for Automated, \"3\" for AutomatedNoIntervention)',\n },\n quantity: {\n type: 'number',\n description: 'Order quantity',\n },\n price: {\n type: 'number',\n description: 'Order price',\n },\n ordType: {\n type: 'string',\n enum: [\n '1',\n '2',\n '3',\n '4',\n '5',\n '6',\n '7',\n '8',\n '9',\n 'A',\n 'B',\n 'C',\n 'D',\n 'E',\n 'F',\n 'G',\n 'H',\n 'I',\n 'J',\n 'K',\n 'L',\n 'M',\n 'P',\n 'Q',\n 'R',\n 'S',\n ],\n default: OrdType.Market,\n description:\n 'Order type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"1\" for Market, \"2\" for Limit, \"3\" for Stop)',\n },\n side: {\n type: 'string',\n enum: ['1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'],\n description:\n 'Order side (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"1\" for Buy, \"2\" for Sell, \"3\" for BuyMinus, \"4\" for SellPlus, \"5\" for SellShort, \"6\" for SellShortExempt, \"7\" for Undisclosed, \"8\" for Cross, \"9\" for CrossShort, \"A\" for CrossShortExempt, \"B\" for AsDefined, \"C\" for Opposite, \"D\" for Subscribe, \"E\" for Redeem, \"F\" for Lend, \"G\" for Borrow, \"H\" for SellUndisclosed)',\n },\n symbol: {\n type: 'string',\n description: 'Trading symbol',\n },\n timeInForce: {\n type: 'string',\n enum: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C'],\n default: TimeInForce.Day,\n description:\n 'Time in force (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for Day, \"1\" for Good Till Cancel, \"2\" for At Opening, \"3\" for Immediate or Cancel, \"4\" for Fill or Kill, \"5\" for Good Till Crossing, \"6\" for Good Till Date)',\n },\n },\n required: ['clOrdID', 'quantity', 'price', 'side', 'symbol'],\n};\n\nconst marketDataRequestInputSchema = {\n type: 'object',\n properties: {\n mdUpdateType: {\n type: 'string',\n enum: ['0', '1'],\n default: '0',\n description:\n 'Market data update type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for FullRefresh, \"1\" for IncrementalRefresh)',\n },\n symbol: {\n type: 'string',\n description: 'Trading symbol',\n },\n mdReqID: {\n type: 'string',\n description: 'Market data request ID',\n },\n subscriptionRequestType: {\n type: 'string',\n enum: ['0', '1', '2'],\n default: SubscriptionRequestType.SnapshotAndUpdates,\n description:\n 'Subscription request type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for Snapshot + Updates, \"1\" for Snapshot, \"2\" for Unsubscribe)',\n },\n mdEntryType: {\n type: 'string',\n enum: [\n '0',\n '1',\n '2',\n '3',\n '4',\n '5',\n '6',\n '7',\n '8',\n '9',\n 'A',\n 'B',\n 'C',\n 'D',\n 'E',\n 'F',\n 'G',\n 'H',\n 'J',\n 'K',\n 'L',\n 'M',\n 'N',\n 'O',\n 'P',\n 'Q',\n 'S',\n 'R',\n 'T',\n 'U',\n 'V',\n 'W',\n 'X',\n 'Y',\n 'Z',\n 'a',\n 'b',\n 'c',\n 'd',\n 'e',\n 'g',\n 'h',\n 'i',\n 't',\n ],\n default: MDEntryType.Bid,\n description:\n 'Market data entry type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use \"0\" for Bid, \"1\" for Offer, \"2\" for Trade, \"3\" for Index Value, \"4\" for Opening Price)',\n },\n },\n required: ['symbol', 'mdReqID'],\n};\n\nexport class MCPLocal implements IPlugin<IFIXParser> {\n private logger: Logger | undefined;\n private parser: IFIXParser | undefined;\n private server: Server = new Server(\n {\n name: 'fixparser',\n version: '1.0.0',\n },\n {\n capabilities: {\n tools: {},\n prompts: {},\n resources: {},\n },\n },\n );\n private transport: StdioServerTransport = new StdioServerTransport();\n private onReady: (() => void) | undefined = undefined;\n\n private pendingRequests: Map<string, (data: Message) => void> = new Map();\n\n constructor({ logger, onReady }: PluginOptions) {\n if (logger && !logger.silent) {\n this.logger = logger;\n }\n\n if (onReady) this.onReady = onReady;\n }\n\n public async register(parser: IFIXParser): Promise<void> {\n this.parser = parser;\n if (parser.logger && !parser.logger.silent) {\n this.logger = parser.logger;\n }\n this.parser.addOnMessageCallback((message: Message) => {\n // this.logger?.log({\n // level: 'info',\n // message: `FIXParser (MCP): (${parser.protocol?.toUpperCase()}): << received ${message.description}`,\n // });\n const msgType = message.messageType;\n if (msgType === Messages.MarketDataSnapshotFullRefresh || msgType === Messages.ExecutionReport) {\n const idField =\n msgType === Messages.MarketDataSnapshotFullRefresh\n ? message.getField(Fields.MDReqID)\n : message.getField(Fields.ClOrdID);\n if (idField) {\n const id = idField.value;\n if (typeof id === 'string' || typeof id === 'number') {\n const callback = this.pendingRequests.get(String(id));\n if (callback) {\n callback(message);\n this.pendingRequests.delete(String(id));\n }\n }\n }\n }\n });\n\n this.addWorkflows();\n\n await this.server.connect(this.transport);\n\n if (this.onReady) {\n this.onReady();\n }\n }\n\n private addWorkflows() {\n if (!this.parser) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- FIXParser instance not initialized. Ignoring setup of workflows...',\n });\n return;\n }\n\n if (!this.server) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- MCP Server not initialized. Ignoring setup of workflows...',\n });\n return;\n }\n\n // Helper function to validate and parse arguments\n const validateArgs = (args: any, schema: any): any => {\n // Basic validation - in a real implementation, you might want to use a proper JSON Schema validator\n const result: any = {};\n\n for (const [key, propSchema] of Object.entries(schema.properties || {})) {\n const prop = propSchema as any;\n const value = args?.[key];\n\n if (prop.required && (value === undefined || value === null)) {\n throw new Error(`Required property '${key}' is missing`);\n }\n\n if (value !== undefined) {\n // Apply defaults\n result[key] = value;\n } else if (prop.default !== undefined) {\n result[key] = prop.default;\n }\n }\n\n return result;\n };\n\n // Empty handler for resources\n this.server.setRequestHandler(ListResourcesRequestSchema, async () => {\n return {\n resources: [],\n };\n });\n\n // Handler for listing available tools\n this.server.setRequestHandler(ListToolsRequestSchema, async () => {\n return {\n tools: [\n {\n name: 'parse',\n description: 'Parses a FIX message and describes it in plain language',\n inputSchema: parseInputSchema,\n },\n {\n name: 'parseToJSON',\n description: 'Parses a FIX message into JSON',\n inputSchema: parseToJSONInputSchema,\n },\n {\n name: 'newOrderSingle',\n description: 'Creates and sends a New Order Single',\n inputSchema: newOrderSingleInputSchema,\n },\n {\n name: 'marketDataRequest',\n description: 'Sends a request for Market Data with the given symbol',\n inputSchema: marketDataRequestInputSchema,\n },\n ],\n };\n });\n\n // Handler for tool calls\n this.server.setRequestHandler(CallToolRequestSchema, async (request) => {\n const { name, arguments: args } = request.params;\n\n switch (name) {\n case 'parse': {\n try {\n const { fixString } = validateArgs(args, parseInputSchema);\n const parsedMessage: Message[] | undefined = this.parser?.parse(fixString);\n if (!parsedMessage || parsedMessage.length === 0) {\n return {\n isError: true,\n content: [{ type: 'text', text: 'Error: Failed to parse FIX string' }],\n };\n }\n\n return {\n content: [\n {\n type: 'text',\n text: `${parsedMessage[0].description}\n${parsedMessage[0].messageTypeDescription}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to parse FIX string'}`,\n },\n ],\n };\n }\n }\n\n case 'parseToJSON': {\n try {\n const { fixString } = validateArgs(args, parseToJSONInputSchema);\n const parsedMessage = this.parser?.parse(fixString);\n if (!parsedMessage || parsedMessage.length === 0) {\n return {\n isError: true,\n content: [{ type: 'text', text: 'Error: Failed to parse FIX string' }],\n };\n }\n\n return {\n content: [\n {\n type: 'text',\n text: `${parsedMessage[0].toFIXJSON()}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to parse FIX string'}`,\n },\n ],\n };\n }\n }\n\n case 'newOrderSingle': {\n try {\n const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } =\n validateArgs(args, newOrderSingleInputSchema);\n\n const response = new Promise((resolve) => {\n this.pendingRequests.set(clOrdID, resolve);\n });\n\n const order: Message | undefined = this.parser?.createMessage(\n new Field(Fields.MsgType, Messages.NewOrderSingle),\n new Field(Fields.MsgSeqNum, this.parser?.getNextTargetMsgSeqNum()),\n new Field(Fields.SenderCompID, this.parser?.sender),\n new Field(Fields.TargetCompID, this.parser?.target),\n new Field(Fields.SendingTime, this.parser?.getTimestamp()),\n new Field(Fields.ClOrdID, clOrdID),\n new Field(Fields.Side, side),\n new Field(Fields.Symbol, symbol),\n new Field(Fields.OrderQty, quantity),\n new Field(Fields.Price, price),\n new Field(Fields.OrdType, ordType),\n new Field(Fields.HandlInst, handlInst),\n new Field(Fields.TimeInForce, timeInForce),\n new Field(Fields.TransactTime, this.parser?.getTimestamp()),\n );\n\n if (!this.parser?.connected) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- Not connected. Ignoring message.',\n });\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: 'Error: Not connected. Ignoring message.',\n },\n ],\n };\n }\n\n this.parser?.send(order!);\n this.logger?.log({\n level: 'info',\n message: `FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${order?.description}`,\n });\n\n const fixData = await response;\n return {\n content: [\n {\n type: 'text',\n text: `Execution Report for order ${clOrdID}: ${JSON.stringify((fixData as Message).toFIXJSON())}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to create order'}`,\n },\n ],\n };\n }\n }\n\n case 'marketDataRequest': {\n try {\n const { mdUpdateType, symbol, mdReqID, subscriptionRequestType, mdEntryType } = validateArgs(\n args,\n marketDataRequestInputSchema,\n );\n\n const response = new Promise((resolve) => {\n this.pendingRequests.set(mdReqID, resolve);\n });\n\n const marketDataRequest = this.parser?.createMessage(\n new Field(Fields.MsgType, Messages.MarketDataRequest),\n new Field(Fields.SenderCompID, this.parser?.sender),\n new Field(Fields.MsgSeqNum, this.parser?.getNextTargetMsgSeqNum()),\n new Field(Fields.TargetCompID, this.parser?.target),\n new Field(Fields.SendingTime, this.parser?.getTimestamp()),\n new Field(Fields.MarketDepth, 0),\n new Field(Fields.MDUpdateType, mdUpdateType),\n new Field(Fields.NoRelatedSym, 1),\n new Field(Fields.Symbol, symbol),\n new Field(Fields.MDReqID, mdReqID),\n new Field(Fields.SubscriptionRequestType, subscriptionRequestType),\n new Field(Fields.NoMDEntryTypes, 1),\n new Field(Fields.MDEntryType, mdEntryType),\n );\n\n if (!this.parser?.connected) {\n this.logger?.log({\n level: 'error',\n message: 'FIXParser (MCP): -- Not connected. Ignoring message.',\n });\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: 'Error: Not connected. Ignoring message.',\n },\n ],\n };\n }\n\n this.parser?.send(marketDataRequest!);\n this.logger?.log({\n level: 'info',\n message: `FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${marketDataRequest?.description}`,\n });\n\n const fixData = await response;\n\n return {\n content: [\n {\n type: 'text',\n text: `Market data for ${symbol}: ${JSON.stringify((fixData as Message).toFIXJSON())}`,\n },\n ],\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Error: ${error instanceof Error ? error.message : 'Failed to request market data'}`,\n },\n ],\n };\n }\n }\n\n default:\n throw new Error(`Unknown tool: ${name}`);\n }\n });\n\n this.server.setRequestHandler(ListPromptsRequestSchema, async () => {\n return {\n prompts: [\n {\n name: 'parse',\n description: 'Parses a FIX message and describes it in plain language',\n arguments: [\n {\n name: 'fixString',\n description: 'FIX message string to parse',\n required: true,\n },\n ],\n },\n {\n name: 'parseToJSON',\n description: 'Parses a FIX message into JSON',\n arguments: [\n {\n name: 'fixString',\n description: 'FIX message string to parse',\n required: true,\n },\n ],\n },\n {\n name: 'newOrderSingle',\n description: 'Creates and sends a New Order Single',\n arguments: [\n {\n name: 'clOrdID',\n description: 'Client Order ID',\n required: true,\n },\n {\n name: 'handlInst',\n description: 'Handling instruction',\n required: false,\n },\n {\n name: 'quantity',\n description: 'Order quantity',\n required: true,\n },\n {\n name: 'price',\n description: 'Order price',\n required: true,\n },\n {\n name: 'ordType',\n description: 'Order type',\n required: false,\n },\n {\n name: 'side',\n description:\n 'Order side (1=Buy, 2=Sell, 3=BuyMinus, 4=SellPlus, 5=SellShort, 6=SellShortExempt, 7=Undisclosed, 8=Cross, 9=CrossShort, A=CrossShortExempt, B=AsDefined, C=Opposite, D=Subscribe, E=Redeem, F=Lend, G=Borrow, H=SellUndisclosed)',\n required: true,\n },\n {\n name: 'symbol',\n description: 'Trading symbol',\n required: true,\n },\n {\n name: 'timeInForce',\n description: 'Time in force',\n required: false,\n },\n ],\n },\n {\n name: 'marketDataRequest',\n description: 'Sends a request for Market Data with the given symbol',\n arguments: [\n {\n name: 'mdUpdateType',\n description: 'Market data update type',\n required: false,\n },\n {\n name: 'symbol',\n description: 'Trading symbol',\n required: true,\n },\n {\n name: 'mdReqID',\n description: 'Market data request ID',\n required: true,\n },\n {\n name: 'subscriptionRequestType',\n description: 'Subscription request type',\n required: false,\n },\n {\n name: 'mdEntryType',\n description: 'Market data entry type',\n required: false,\n },\n ],\n },\n ],\n };\n });\n\n // Handler for getting specific prompts\n this.server.setRequestHandler(GetPromptRequestSchema, async (request) => {\n const { name, arguments: args } = request.params;\n\n switch (name) {\n case 'parse': {\n const fixString = args?.fixString || '';\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Please parse and explain this FIX message: ${fixString}`,\n },\n },\n ],\n };\n }\n\n case 'parseToJSON': {\n const fixString = args?.fixString || '';\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Please parse the FIX message to JSON: ${fixString}`,\n },\n },\n ],\n };\n }\n\n case 'newOrderSingle': {\n const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } = args || {};\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: [\n 'Create a New Order Single FIX message with the following parameters:',\n `- ClOrdID: ${clOrdID}`,\n `- HandlInst: ${handlInst ?? '3'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Manual, '2' for Automated, '3' for AutomatedNoIntervention)`,\n `- Quantity: ${quantity}`,\n `- Price: ${price}`,\n `- OrdType: ${ordType ?? '1'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Market, '2' for Limit, '3' for Stop)`,\n `- Side: ${side} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Buy, '2' for Sell)`,\n `- Symbol: ${symbol}`,\n `- TimeInForce: ${timeInForce ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Day, '1' for Good Till Cancel, '2' for At Opening, '3' for Immediate or Cancel, '4' for Fill or Kill, '5' for Good Till Crossing, '6' for Good Till Date)`,\n '',\n 'Format the response as a JSON object with FIX tag numbers as keys and their corresponding values.',\n '',\n 'Note: For the Side parameter, always use the numeric/alphabetic value (e.g., \"1\" for Buy, \"2\" for Sell) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the HandlInst parameter, always use the numeric/alphabetic value (e.g., \"1\" for Manual, \"2\" for Automated, \"3\" for AutomatedNoIntervention) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the OrdType parameter, always use the numeric/alphabetic value (e.g., \"1\" for Market, \"2\" for Limit, \"3\" for Stop) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the TimeInForce parameter, always use the numeric/alphabetic value (e.g., \"0\" for Day, \"1\" for Good Till Cancel, \"2\" for At Opening) as defined in the FIX protocol, not the descriptive name.',\n ].join('\\n'),\n },\n },\n ],\n };\n }\n\n case 'marketDataRequest': {\n const { mdUpdateType, symbol, mdReqID, subscriptionRequestType, mdEntryType } = args || {};\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: [\n 'Create a Market Data Request FIX message with the following parameters:',\n `- MDUpdateType: ${mdUpdateType ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for FullRefresh, '1' for IncrementalRefresh)`,\n `- Symbol: ${symbol}`,\n `- MDReqID: ${mdReqID}`,\n `- SubscriptionRequestType: ${subscriptionRequestType ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Snapshot + Updates, '1' for Snapshot, '2' for Unsubscribe)`,\n `- MDEntryType: ${mdEntryType ?? '0'} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Bid, '1' for Offer, '2' for Trade, '3' for Index Value, '4' for Opening Price)`,\n '',\n 'Format the response as a JSON object with FIX tag numbers as keys and their corresponding values.',\n '',\n 'Note: For the MDUpdateType parameter, always use the numeric/alphabetic value (e.g., \"0\" for FullRefresh, \"1\" for IncrementalRefresh) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the SubscriptionRequestType parameter, always use the numeric/alphabetic value (e.g., \"0\" for Snapshot + Updates, \"1\" for Snapshot, \"2\" for Unsubscribe) as defined in the FIX protocol, not the descriptive name.',\n 'Note: For the MDEntryType parameter, always use the numeric/alphabetic value (e.g., \"0\" for Bid, \"1\" for Offer, \"2\" for Trade, \"3\" for Index Value, \"4\" for Opening Price) as defined in the FIX protocol, not the descriptive name.',\n ].join('\\n'),\n },\n },\n ],\n };\n }\n\n default:\n throw new Error(`Unknown prompt: ${name}`);\n }\n });\n\n process.on('SIGINT', async () => {\n await this.server.close();\n process.exit(0);\n });\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OACI,iBAAAA,EACA,aAAAC,EACA,SAAAC,EACA,UAAAC,EACA,kBAAAC,EAEA,YAAAC,EAEA,mBAAAC,MACG,YCVP,OAAS,UAAAC,MAAc,4CACvB,OAAS,wBAAAC,MAA4B,4CACrC,OACI,yBAAAC,EACA,0BAAAC,EACA,4BAAAC,EACA,8BAAAC,EACA,0BAAAC,MACG,qCAEP,OACI,SAAAC,EACA,UAAAC,EACA,aAAAC,EAGA,eAAAC,EAEA,YAAAC,EACA,WAAAC,EACA,2BAAAC,EACA,eAAAC,MACG,YAKP,IAAMC,EAAmB,CACrB,KAAM,SACN,WAAY,CACR,UAAW,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d,IAAMC,EAAS,IAAIP,EAAMC,EAAO,UAAWN,EAAU,uBAAuB,CAAC,EAC7EW,EAAa,CAAC,EAAE,SAASC,CAAM,EAE/B,IAAMC,EAAmB,IAAIR,EAAMC,EAAO,YAAaN,EAAU,aAAa,CAAC,EAC/EW,EAAa,CAAC,EAAE,SAASE,CAAgB,EAEzC,IAAMC,EAAoB,IAAIT,EAAMC,EAAO,aAAcN,EAAU,aAAa,CAAC,EACjFW,EAAa,CAAC,EAAE,SAASG,CAAiB,EAE1CH,EAAa,CAAC,EAAE,0BAA0B,EAE1CX,EAAU,KAAKW,EAAa,CAAC,CAAC,CAClC,CACJ,EAEMI,EAA0B,CAC5B,KAAM,YACN,KAAM,KACN,SAAU,MACV,OAAQnB,EACR,OAAQC,EACR,WAAY,UACZ,OAAQ,IAAM,CACVM,EAAU,EACV,WAAW,IAAM,CACbO,EAAU,CACd,EAAG,GAAI,CACX,EACA,UAAYM,GAAqB,CAAC,EAClC,QAAS,IAAM,CAWX,WAAW,IAAM,CAUbhB,EAAU,QAAQe,CAAc,CACpC,EAAG,GAAI,CACX,CACJ,EAEAf,EAAU,QAAQe,CAAc,CACpC,EAEAjB,EAAiB,EAAE,MAAOmB,GAAQ,QAAQ,MAAM,6BAA8BA,CAAG,CAAC",
|
|
6
|
+
"names": ["EncryptMethod", "FIXParser", "Field", "Fields", "LicenseManager", "Messages", "ResetSeqNumFlag", "Server", "StdioServerTransport", "CallToolRequestSchema", "GetPromptRequestSchema", "ListPromptsRequestSchema", "ListResourcesRequestSchema", "ListToolsRequestSchema", "Field", "Fields", "HandlInst", "MDEntryType", "Messages", "OrdType", "SubscriptionRequestType", "TimeInForce", "parseInputSchema", "parseToJSONInputSchema", "newOrderSingleInputSchema", "marketDataRequestInputSchema", "MCPLocal", "logger", "onReady", "parser", "message", "msgType", "idField", "id", "callback", "validateArgs", "args", "schema", "result", "key", "propSchema", "prop", "value", "request", "name", "fixString", "parsedMessage", "error", "clOrdID", "handlInst", "quantity", "price", "ordType", "side", "symbol", "timeInForce", "response", "resolve", "order", "fixData", "mdUpdateType", "mdReqID", "subscriptionRequestType", "mdEntryType", "marketDataRequest", "SENDER", "TARGET", "initializeServer", "LicenseManager", "fixParser", "FIXParser", "MCPLocal", "sendLogon", "logon", "Field", "Fields", "Messages", "ResetSeqNumFlag", "EncryptMethod", "sendOrder", "orderMessage", "msgSeq", "sendingTimeField", "transactTimeField", "CONNECT_PARAMS", "message", "err"]
|
|
7
7
|
}
|
package/package.json
CHANGED