US Stock Data MCP Server logo

US Stock Data MCP Server

by mingyaw

This is a Model Context Protocol (MCP) server designed for accessing and updating US stock historical price data. It leverages local data storage and automatic updates from Yahoo Finance.

View on GitHub

Last updated: N/A

What is US Stock Data MCP Server?

The US Stock Data MCP Server is a server application that provides access to historical US stock price data via the Model Context Protocol (MCP). It stores data locally in CSV format and can automatically update this data from Yahoo Finance.

How to use US Stock Data MCP Server?

  1. Install Python 3.x and clone the repository. 2. Install dependencies using pip install -r requirements.txt. 3. Start the server using python server.py. 4. Access stock data using the provided MCP tools (get_local_stock_data, update_stock_data) or the resource URI (usstock://{symbol}/historical).

Key features of US Stock Data MCP Server

  • Local Data Storage

  • Automatic Updates from Yahoo Finance

  • Safe Data Writing

  • Flexible Time Range for Updates

Use cases of US Stock Data MCP Server

  • Backtesting trading strategies

  • Analyzing stock market trends

  • Building financial models

  • Integrating stock data into other applications

FAQ from US Stock Data MCP Server

Where is the data stored by default?

The default data storage path is ~/Library/Application Support/us-market-data/data.

Can I customize the data storage path?

Yes, you can customize the data storage path using the US_STOCK_DATA_DIR environment variable.

How does the server handle duplicate data during updates?

Duplicate data is automatically handled during updates, keeping the latest records.

Is there a delay between update operations?

Yes, a 5-second delay is implemented between update operations to avoid frequent API requests.

What data fields are included in the stored stock data?

The stored stock data includes the following fields: Date, Open, High, Low, Close, and Volume.