logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

tradovate-mcp-gateway

Interface with the Tradovate trading infrastructure to facilitate order execution, account administration, and real-time market data retrieval via a dedicated Model Context Protocol (MCP) server.

Author

tradovate-mcp-gateway logo

alexanimal

MIT License

Quick Info

GitHub GitHub Stars 1
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

apiapistradovatetradovate apiapis httpapi manage

Tradovate MCP Server Interface

smithery badge codecov License: MIT

An implementation of a Model Context Protocol (MCP) backend designed specifically for seamless interaction with the Tradovate trading platform's proprietary Application Programming Interface (API). This service exposes abstracted functions for comprehensive trading lifecycle management, including position oversight, order creation/amendment, account status retrieval, and market data streaming.

Core Capabilities

  • Securely handles all authentication handshakes with the Tradovate remote service.
  • Implements mechanisms for immediate data retrieval augmented with internal caching to minimize redundant API calls.
  • Provides discrete toolsets for managing contract specifications, open positions, submitted orders, and account metrics.
  • Includes a contingency mechanism to serve synthetic/simulated data if the primary Tradovate endpoint becomes temporarily unreachable.

Deployment Instructions

  1. Obtain a local copy of the source repository:

bash git clone [repository-url] cd tradovate-mcp-server

  1. Resolve project dependencies:

bash npm install

  1. Configure environment variables in a .env file using your specific Tradovate access parameters:

bash TRADOVATE_API_ENVIRONMENT=demo TRADOVATE_USERNAME=your_user_id TRADOVATE_PASSWORD=your_secret_key TRADOVATE_APP_ID=AppIdentifier TRADOVATE_APP_VERSION=1.0.0 TRADOVATE_CID=client_identifier TRADOVATE_SEC=security_token

Execution

To initiate the MCP server:

bash npm start

To interact via the dedicated MCP inspection utility:

bash npm run inspector

Development & Architecture

Directory Layout

  • src/index.ts - The primary executable script initializing the server process.
  • src/auth.ts - Logic dedicated to token acquisition and validation.
  • src/data.ts - Handles all data acquisition, transformation, and caching strategies.
  • src/tools.ts - Defines the exposed MCP operations.
  • src/types.ts - TypeScript interface definitions for strict typing.
  • tests/ - Unit and integration test suites.

Building Artifacts

Compilation step:

bash npm run build

Quality Assurance

Execute the full test suite:

bash npm test

Run tests while generating execution metrics:

bash npm run test:coverage

Update the code coverage reporting badge:

bash npm run coverage:badge

Exposed Toolset

The following primitives are accessible via the MCP interface:

  1. get_contract_details - Retrieves granular attributes for a given market instrument symbol.
  2. list_positions - Fetches a summary of all current net exposures associated with an account.
  3. place_order - Submits a new trading instruction to the broker.
  4. modify_order - Updates parameters of a previously submitted, open order.
  5. cancel_order - Revokes a pending order from the exchange.
  6. liquidate_position - Executes an immediate closing trade for an existing holding.
  7. get_account_summary - Pulls high-level financial metrics for the designated account.
  8. get_market_data - Retrieves current pricing snapshots, Depth of Market (DOM) levels, or historical chart data streams.

Tradovate API Interaction Map

The server utilizes the following distinct resource paths on the external API:

Authentication Flows

  • /auth/accessTokenRequest - Initiates the primary token grant process.
  • /auth/renewAccessToken - Refreshes an expired session token.

Instrument Definitions

  • /contract/list - Returns the complete universe of tradeable items.
  • /contract/find - Locates the definition for a specific contract identifier.

Position Management

  • /position/list - Enumerates all active risk positions.

Trade Execution Control

  • /order/list - Views the history and status of all orders.
  • /order/placeOrder - Endpoint for order submission.
  • /order/modifyOrder - Endpoint for order modification.
  • /order/cancelOrder - Endpoint for order cancellation.
  • /order/liquidatePosition - Specialized endpoint for position closure.

Account Metrics

  • /account/list - Retrieves all associated user accounts.
  • /account/find - Searches for a specific account entity.
  • /cashBalance/getCashBalanceSnapshot - Fetches the latest margin and cash settlement data.

Real-Time Data Feeds

  • /md/getQuote - Fetches the current bid/ask prices.
  • /md/getDOM - Retrieves the order book structure.
  • /md/getChart - Requests time-series data for charting applications.

Licensing Information

This software is distributed under the terms of the MIT License. Consult the LICENSE file for full details.

== XMLHttpRequest Deep Dive ==

The XMLHttpRequest (XHR) object serves as a crucial Application Programming Interface (API) within JavaScript environments, enabling the dispatch of HyperText Transfer Protocol (HTTP) requests between a running web browser instance and a remote web server. Its key utility lies in permitting asynchronous data exchange subsequent to the initial page load. This capability forms the foundation of Asynchronous JavaScript and XML (Ajax) programming paradigms. Before XHR's widespread adoption, interactivity with servers was predominantly achieved via standard hyperlink navigation or form submissions, both of which typically necessitated a full-page refresh.

=== Genesis === The conceptual underpinnings of XMLHttpRequest emerged around the year 2000, primarily driven by developers working on Microsoft Outlook. This idea was first instantiated in Internet Explorer 5 (released in 1999). Notably, the initial implementations did not utilize the standardized XMLHttpRequest string; instead, proprietary object constructors such as ActiveXObject("Msxml2.XMLHTTP") or ActiveXObject("Microsoft.XMLHTTP") were employed. By the release of Internet Explorer 7 (2006), support for the standardized XMLHttpRequest identifier became universal across major browser engines, including Mozilla's Gecko (2002), Safari (2004), and Opera (2005).

==== Standardization Efforts ==== The World Wide Web Consortium (W3C) formally published a Working Draft specification for the XMLHttpRequest object on April 5, 2006. This was followed by the Level 2 specification draft on February 25, 2008, which introduced enhancements such as event progress monitoring, facilitation of cross-site requests, and mechanisms for handling raw byte streams. By the close of 2011, the Level 2 features were integrated back into the primary specification document. As of the end of 2012, the maintenance and evolution of the living document were transferred to the WHATWG, utilizing the Web Interface Definition Language (Web IDL).

== Operational Flow ==

Executing a data request using XMLHttpRequest generally involves a sequence of distinct programmatic actions:

  1. Instantiation: An XHR object instance is created by invoking its constructor function.
  2. Configuration: The open() method is invoked to define the request methodology (e.g., GET, POST), specify the target Uniform Resource Identifier (URI), and determine whether the operation will execute synchronously or asynchronously.
  3. Event Handling (Asynchronous Path): For non-blocking operations, a callback function (listener) must be assigned to handle state transitions upon the server's response.
  4. Transmission: The request is dispatched to the server by calling the send() method, optionally providing payload data.
  5. Response Processing: The assigned listener monitors the object's state. Upon reaching state 4 (the 'done' status), the complete response body is accessible, typically in the responseText property.

Beyond these fundamental steps, XHR offers extensive control over request parameters. Custom HTTP headers can be prepended to guide server processing, and data uploads can be managed within the send() call. Furthermore, the incoming response stream can be parsed directly into a structured JavaScript object (e.g., from JSON format) or processed incrementally as data segments arrive, avoiding latency associated with waiting for total transfer completion. The process can also be manually terminated prematurely or configured with a timeout threshold.

See Also

`