nasdaq-data-link-ai-gateway
Facilitate LLM interaction with Nasdaq Data Link's vast repositories of financial and economic metrics via natural language processing. Enables real-time analytical queries leveraging integrated artificial intelligence.
Author

stefanoamorelli
Quick Info
Actions
Tags
A community-maintained implementation of the Model Context Protocol (MCP) specification, connecting large language models to the comprehensive data services provided by Nasdaq Data Link. Designed for seamless integration with MCP-compliant client applications.
This software package is engineered to streamline the retrieval and exploration of Nasdaq Data Link's extensive, high-value financial and economic data resources through intuitive, natural language commands executed by LLMs.
🐍 This service leverages the official Python SDK from Nasdaq: Nasdaq/data-link-python.
[!IMPORTANT] This is an independent open-source initiative, officially neither affiliated with nor endorsed by Nasdaq, Inc. Nasdaq® is a registered trademark property of Nasdaq, Inc.
🌐 Operational Examples
| Retail Trading Activity Demonstration | World Bank Data Query Demo |
| Groq + DeepSeek R1 RTAT 10 Integration |
[!TIP] If this component is utilized in academic or professional work, kindly provide citation via the [CITATION.cff] file or utilize the APA citation format below:
Amorelli, S. (2025). Nasdaq Data Link MCP (Model Context Protocol) Server [Computer software]. GitHub. https://github.com/stefanoamorelli/nasdaq-data-link-mcp
Once configured and linked to an appropriate MCP-compliant interface (e.g., Claude Desktop, or Groq Desktop (beta)), this server exposes specialized functionalities for AI agents to access necessary data.
This implementation currently supports querying the following Nasdaq Data Link databases: - Equities 360 (Company financial summaries and fundamentals) - Nasdaq RTAT (Retail trading movement tracker) - Trade Summary (Aggregated trade records, including OHLCV metrics) - World Bank dataset on Nasdaq Data Link (Global economic indicators) - Nasdaq Fund Network (NFN) (Mutual fund and investment vehicle metadata)
🔍 Illustrative Query Scenarios
> **User:** Which securities saw the highest retail transaction volumes yesterday? > **AI Assistant:** *invokes `get_rtat(📦 Setup Procedure
1. Obtain Source Code
bash git clone https://github.com/stefanoamorelli/nasdaq-data-link-mcp.git cd nasdaq-data-link-mcp
2. Initialize Dependencies
Requires Python 3.13+ and the mcp command-line utility.
bash uv init mcp uv add "mcp[cli]"
MCP SDK Reference: https://github.com/modelcontextprotocol/python-sdk Nasdaq Data Link SDK Reference: https://github.com/Nasdaq/data-link-python
3. Secure API Credential
Register at https://data.nasdaq.com/ and securely store your generated API access token.
4. Configure Environment Variables
Duplicate the example configuration file:
bash cp .env.example .env
Modify .env to include your key:
NASDAQ_DATA_LINK_API_KEY=your_api_key_here
Ensure the PYTHONPATH points to the local repository root:
PYTHONPATH=/path/to/your/local/cloned/repo/nasdaq-data-link-mcp
5. Deploy the MCP Service Instance
Register the server component with your local MCP infrastructure:
bash uv run mcp install nasdaq_data_link_mcp_os/server.py --env-file .env --name "Nasdaq Data Link MCP Server" --with nasdaq-data-link --with pycountry
This command registers the service endpoint accessible by clients such as Claude Desktop.
🧪 Validation
Execute the integrated test suite:
bash python -m pytest tests/ -v
The testing regimen encompasses: - Verification of core functional integrity - Confirmation of module loadability - Input parameter validity checks - Comprehensive error path validation - End-to-end integration verification
Tests are structured to permit execution without an active API key for baseline component verification.
🛠️ Exposed Toolset
Upon successful deployment, the following functions are available for utilization by connected MCP clients:
📈 Retail Activity Tracking Utilities
### `get_rtat10` Retrieves data from the Retail Trading Activity Tracker 10 (RTAT10) set for specified trading dates and optional equity tickers. { "action": "tool", "name": "get_rtat10", "params": { "dates": "2025-03-31,2025-03-28,2025-03-27", "tickers": "TSLA,TQQQ,SQQQ" } } Returns RTAT10 records sourced from Nasdaq Data Link corresponding to the provided temporal and security identifiers. --- ### `get_rtat` Fetches the standard Retail Trading Activity (RTAT) data based on supplied dates and optional security identifiers. { "action": "tool", "name": "get_rtat", "params": { "dates": "2025-03-31,2025-03-28,2025-03-27", "tickers": "TSLA,TQQQ,SQQQ" } } Returns RTAT dataset contents for the specified dates and tickers from the Nasdaq Data Link repository.📊 Consolidated Trade Summary Access
### `get_trade_summary_data` Queries the consolidated Trade Summary records (dataset NDAQ/TS) hosted on Nasdaq Data Link. { "action": "tool", "name": "get_trade_summary_data" } Provides aggregated trading statistics including opening prices, maximum/minimum daily values, closing prices, and total volume figures.📊 World Bank Data Interfaces
### `get_indicator_value` Retrieves the recorded value for a precise economic indicator associated with a specified nation. { "action": "tool", "name": "get_indicator_value", "params": { "country": "Italy", "indicator": "NY.GDP.MKTP.CD" } } Yields the most current data point recorded for that indicator across the targeted geography. --- ### `country_code` Translates a full geographic entity name into its corresponding ISO 3-character identifier (e.g., "ITA" for Italy). { "action": "tool", "name": "country_code", "params": { "countryName": "Italy" } } --- ### `list_worldbank_indicators` Returns a complete catalog of all available World Bank indicators, exceeding 1500 entries. { "action": "tool", "name": "list_worldbank_indicators" } --- ### `search_worldbank_indicators` Performs a keyword-based filtering operation across the indicator index. { "action": "tool", "name": "search_worldbank_indicators", "params": { "keyword": "population" } }📈 Equities 360 Data Retrieval
### `get_stock_stats` Fetches a broad spectrum of statistical data for a security from the Nasdaq Equities 360 database. { "action": "tool", "name": "get_stock_stats", "params": { "symbol": "MSFT" } } Alternatively, identification can be done via FIGI: { "action": "tool", "name": "get_stock_stats", "params": { "figi": "BBG000BPH459" } } Returns metrics such as valuation ratios, 52-week trading extremes, dividend yield information, and market capitalization. --- ### `list_stock_stat_fields` Generates a manifest of all queryable fields within the stock statistics schema, including their definitions. { "action": "tool", "name": "list_stock_stat_fields" } Provides documentation for parameters accessible via `get_stock_stats`. --- ### `get_fundamental_data` Queries the Nasdaq Equities 360 Fundamental Summary repository for core financial data. { "action": "tool", "name": "get_fundamental_data", "params": { "symbol": "MSFT", "dimension": "MRY" } } Or with alternative identification and dates: { "action": "tool", "name": "get_fundamental_data", "params": { "figi": "BBG000BPH459", "calendardate": "2022-12-31", "dimension": "MRQ" } } Yields data spanning profitability assessments (ROE, ROA), valuation figures (P/E, Price-to-Sales), income statement line items (revenue, gross profit), and solvency metrics (current ratio). --- ### `list_fundamental_fields` Generates a manifest of all queryable fields within the fundamental summary schema, including their definitions. { "action": "tool", "name": "list_fundamental_fields" } Provides documentation for parameters accessible via `get_fundamental_data`. --- ### `get_detailed_financials` Retrieves granular financial statement components from the Nasdaq Equities 360 Fundamental Details source. { "action": "tool", "name": "get_detailed_financials", "params": { "symbol": "MSFT", "dimension": "MRQ" } } Or with alternative identification and dates: { "action": "tool", "name": "get_detailed_financials", "params": { "figi": "BBG000BPH459", "calendardate": "2022-12-31", "dimension": "MRY" } } Returns extensive data covering Balance Sheet entries (equity, liabilities), Income Statement sections (profit, operating costs), Cash Flow segments (financing, investing), and detailed financial ratios. --- ### `list_detailed_financial_fields` Generates a manifest of all queryable fields within the fundamental details schema, including their definitions. { "action": "tool", "name": "list_detailed_financial_fields" } Provides documentation for parameters accessible via `get_detailed_financials`. --- ### `get_balance_sheet_data` Queries the Nasdaq Equities 360 Balance Sheet specific database. { "action": "tool", "name": "get_balance_sheet_data", "params": { "symbol": "MSFT", "dimension": "MRQ" } } Or with alternative identification and dates: { "action": "tool", "name": "get_balance_sheet_data", "params": { "figi": "BBG000BPH459", "calendardate": "2022-12-31", "dimension": "MRY" } } Returns comprehensive Balance Sheet records including intangible assets, non-current liabilities, total equity, and associated core metrics. --- ### `list_balance_sheet_fields` Generates a manifest of all queryable fields within the balance sheet schema, including their definitions. { "action": "tool", "name": "list_balance_sheet_fields" } Provides documentation for parameters accessible via `get_balance_sheet_data`. --- ### `get_cash_flow_data` Retrieves statement of cash flows data from the Nasdaq Equities 360 Cash Flow repository. { "action": "tool", "name": "get_cash_flow_data", "params": { "symbol": "MSFT", "dimension": "MRQ" } } Or with alternative identification and dates: { "action": "tool", "name": "get_cash_flow_data", "params": { "figi": "BBG000BPH459", "calendardate": "2022-12-31", "dimension": "MRY" } } Returns figures for operating cash flow (NCFO), investing cash flow (NCFI), financing cash flow (NCFF), capital expenditures (CAPEX), and calculated free cash flow (FCF). --- ### `list_cash_flow_fields` Generates a manifest of all queryable fields within the cash flow statement schema, including their definitions. { "action": "tool", "name": "list_cash_flow_fields" } Provides documentation for parameters accessible via `get_cash_flow_data`. --- ### `get_corporate_action_data` Fetches records of significant corporate actions from the Nasdaq Equities 360 database. { "action": "tool", "name": "get_corporate_action_data", "params": { "symbol": "TSLA", "action": "split" } } Alternative filtering by date is also supported: { "action": "tool", "name": "get_corporate_action_data", "params": { "date": "2023-03-24" } } Returns details regarding events such as stock dividends, mergers, acquisitions, and stock restructuring activities impacting ownership. --- ### `list_corporate_action_fields` Generates a manifest of all queryable fields within the corporate actions schema, including their definitions. { "action": "tool", "name": "list_corporate_action_fields" } Provides documentation for parameters accessible via `get_corporate_action_data`. --- ### `get_company_reference_data` Retrieves static reference metadata for entities from the Nasdaq Equities 360 Reference Data source. { "action": "tool", "name": "get_company_reference_data", "params": { "symbol": "AMD" } } Alternatively, identification can be done via FIGI: { "action": "tool", "name": "get_company_reference_data", "params": { "figi": "BBG000BBQCY0" } } Returns foundational information including listing exchange, sector/industry classifications, official web links, SEC filing paths, and primary location details. --- ### `list_reference_data_fields` Generates a manifest of all queryable fields within the company reference data schema, including their definitions. { "action": "tool", "name": "list_reference_data_fields" } Provides documentation for parameters accessible via `get_company_reference_data`.📊 Nasdaq Fund Network (NFN) Utilities
### `get_fund_master_report` Fetches core descriptive data (NFN/MFRFM) for investment vehicles based on their unique identifier. { "action": "tool", "name": "get_fund_master_report", "params": { "fund_id": "12345" } } Returns basic registration details for the specified fund ID from the NFN. ### `get_fund_information` Retrieves detailed narrative and structural information (NFN/MFRFI) pertaining to investment funds. { "action": "tool", "name": "get_fund_information", "params": { "fund_id": "12345" } } ### `get_share_class_master` Fetches summarized registration attributes (NFN/MFRSM) for various share classes associated with a fund. { "action": "tool", "name": "get_share_class_master", "params": { "fund_id": "12345" } } ### `get_share_class_information` Retrieves specific, granular characteristics (NFN/MFRSI) tied to a fund's share classes, identified by ticker. { "action": "tool", "name": "get_share_class_information", "params": { "ticker": "ABCDX" } } ### `get_price_history` Queries historical pricing data, including Net Asset Value (NAV) (NFN/MFRPH), across a defined date range. { "action": "tool", "name": "get_price_history", "params": { "ticker": "ABCDX", "start_date": "2024-01-01", "end_date": "2024-04-30" } } ### `get_recent_price_history` Fetches the latest ten trading days of NAV and pricing data (NFN/MFRPH10). { "action": "tool", "name": "get_recent_price_history", "params": { "ticker": "ABCDX" } } ### `get_performance_statistics` Retrieves calculated performance returns (NFN/MFRPS) for a specified fund ticker. { "action": "tool", "name": "get_performance_statistics", "params": { "ticker": "ABCDX" } } ### `get_performance_benchmark` Fetches data detailing the performance relative to chosen benchmark indexes (NFN/MFRPRB). { "action": "tool", "name": "get_performance_benchmark", "params": { "ticker": "ABCDX" } } ### `get_performance_analytics` Retrieves advanced performance risk metrics such as Sharpe ratio, Alpha, and Beta (NFN/MFRPA). { "action": "tool", "name": "get_performance_analytics", "params": { "ticker": "ABCDX" } } ### `get_fees_and_expenses` Queries data related to operational costs, sales charges, and expense ratios (NFN/MFRPM). { "action": "tool", "name": "get_fees_and_expenses", "params": { "ticker": "ABCDX" } } ### `get_monthly_flows` Retrieves historical monthly net flow data indicating investor capital movement in/out of the fund (NFN/MFRMF). { "action": "tool", "name": "get_monthly_flows", "params": { "ticker": "ABCDX" } }🧪 MCP Development & Diagnostics
To conduct local validation of the server functionality using a graphical interface:
bash mcp dev nasdaq_data_link_mcp_os/server.py --env-file .env
This launches the interactive MCP Dev console, facilitating manual tool invocation and diagnostic analysis.
📊 System Topology
mermaid graph TD subgraph "Local Execution Environment" A[MCP Gateway: Nasdaq Data Link Adapter] --> C[MCP Client Application (e.g., Claude Desktop)] end
C -->|Natural Language Request| D[Large Language Model Core] D -->|Tool Invocation| A A -->|API Calls| B[Nasdaq Data Link External Service] B -.-> E[Retail Trading Activity Tracker Source] B -.-> F[World Bank Indicator Source] B -.-> N[Trade Summary Aggregator NDAQ/TS]
subgraph "Nasdaq Fund Network (NFN) Datasets" O1[MFRFM: Master Registry] O2[MFRFI: Detailed Fund Profile] O3[MFRSM: Share Class Summary] O4[MFRSI: Share Class Specifics] O5[MFRPH/MFRPH10: Pricing History] O6[MFRPS/MFRPRB/MFRPA: Performance Analytics] O7[MFRPM: Expense Structures] O8[MFRMF: Monthly Capital Flows] end
B -.-> O1 B -.-> O2 B -.-> O3 B -.-> O4 B -.-> O5 B -.-> O6 B -.-> O7 B -.-> O8
subgraph "Equities 360 Databases" G[STAT: Key Statistics] H[FS: Fundamental Summary] I[FD: Detailed Financial Statements] J[BS: Balance Sheet Records] K[CF: Cash Flow Statements] L[CA: Corporate Actions Log] M[RD: Entity Reference Data] end
B -.->|Mapping to E360| G B -.->|Mapping to E360| H B -.->|Mapping to E360| I B -.->|Mapping to E360| J B -.->|Mapping to E360| K B -.->|Mapping to E360| L B -.->|Mapping to E360| M
📚 Informational Links
📄 Legal Status
MIT License (C) 2025 Stefano Amorelli
WIKIPEDIA NOTE: XMLHttpRequest (XHR) is a standard browser API embodied as a JavaScript object, facilitating asynchronous HTTP requests between the client environment and a remote web server. The methods permit dynamic data retrieval post-page load. XHR is foundational to the Ajax programming paradigm. Before Ajax adoption, server interaction was predominantly managed via standard link navigation or form submissions, typically resulting in a full page refresh. Since the adoption of XHR, interaction is often seamless. Microsoft Outlook developers conceived the XHR mechanism around 2000, initially deploying it within Internet Explorer 5 (1999) using proprietary ActiveXObject identifiers. By IE7 (2006), the universal XMLHttpRequest identifier was supported across all major rendering engines, including Mozilla's Gecko (2002), Safari 1.2 (2004), and Opera 8.0 (2005).
=== Standardization === The W3C issued the first Working Draft for the XMLHttpRequest object specification on April 5, 2006. Level 2 work, introduced in February 2008, added capabilities for monitoring request progress, enabling cross-origin resource sharing (CORS), and handling binary data streams. This Level 2 specification was later merged back into the main standard by late 2011. Development responsibility transferred to WHATWG in late 2012, which now maintains the living document using Web IDL definitions.
== Operational Flow == Standard XHR request execution involves a predictable sequence of programming steps:
- Instantiate the XMLHttpRequest object using its constructor.
- Invoke the "open" method, specifying the HTTP verb, the target URI, and setting the operation mode (synchronous or asynchronous).
- For asynchronous operations, define an event handler callback function to process state transitions.
- Begin the transmission process by calling the "send" method, optionally passing request payload data.
- Monitor the
readyStateproperty within the listener; upon reaching state 4 (complete), the server response is accessible, typically via theresponseTextattribute.
Beyond this core sequence, XHR offers fine-grained control. Custom HTTP headers can be set to influence server processing. Data can be transmitted to the server via the send() argument. Responses can be automatically deserialized from JSON into native JavaScript objects, or processed incrementally as data chunks arrive. Requests can be terminated prematurely or subject to a defined timeout threshold.
== Cross-Origin Policy Enforcement == In the early Web environment, unrestricted communication between different domains presented significant security vulnerabilities. This led to the implementation of the Same-Origin Policy (SOP), which severely restricts requests originating from one domain attempting to access resources on another, unless explicitly permitted via CORS headers.
