Content
# Financial Data MCP
## Project Overview
[Tsanghi Data](https://tsanghi.com) is a professional financial data API service that provides comprehensive market data for stocks, indices, bonds, and more. It primarily offers a pay-as-you-go model, which is quite convenient.
This project is based on that API and includes a complete server-side implementation.
## Core Features
- **Stock Data Query**: Real-time quotes, historical K-lines, financial statements, dividends, and stock splits, etc.
- **Index Data Query**: Constituent stocks, real-time indices, historical trends, etc.
- **Market Data**: Exchange information, stock lists, company information, etc.
- **Financial Data**: Balance sheets, cash flow statements, income statements, etc.
- **Corporate Information**: Company profiles, shareholder structures, management information, etc.
## Quick Start
### Startup
```bash
uv run server.py --transport fastapi --host 0.0.0.0 --port 8000
```
### Server Startup Options
- `--transport`: Transport mode, supports `stdio`, `sse`, or `fastapi`
- `--host`: Host address to bind the server
- `--port`: Port for the server to listen on
## API Examples
### Get Stock Real-time Quotes
```python
async def get_stock_realtime_daily(exchange_code: str, ticker: str):
"""Get real-time daily stock data"""
url = f"https://tsanghi.com/api/fin/stock/{exchange_code}/daily/realtime"
params = {
"token": FIN_API_TOKEN,
"ticker": ticker,
"fmt": "json"
}
async with httpx.AsyncClient() as client:
response = await client.get(url, params=params)
return response.json()
```
### Get Company Information
```python
async def get_stock_company_info(exchange_code: str, ticker: str):
"""Get stock company information"""
url = f"https://tsanghi.com/api/fin/stock/{exchange_code}/company/info"
params = {
"token": FIN_API_TOKEN,
"exchange_code": exchange_code,
"ticker": ticker
}
async with httpx.AsyncClient() as client:
response = await client.get(url, params=params)
return response.json()
```
## Documentation Crawler System
The project includes a dedicated documentation crawler system for automating the retrieval of API documentation and generating corresponding utility function code:
- `crawl_tsanghi_docs.py`: Crawls Tsanghi API documentation
- `code_creater.py`: Automatically generates utility function code based on the documentation
## Project Structure
```
├── server.py # Main server implementation
├── tools.py # Collection of utility functions
├── crawl_tsanghi_docs.py # API documentation crawler
├── code_creater.py # Code generator
├── tsanghi_docs/ # Directory for storing crawled documentation
└── tools_code/ # Generated utility function code
```
## Health Check and Debugging
- `/health`: Health check endpoint
- `/tools/list`: List all available utility functions
Connection Info
You Might Also Like
Vibe-Trading
Vibe-Trading: Your Personal Trading Agent
ai-berkshire
Berkshire in the AI Era: A Value Investment Research Framework Based on...
valuecell
Valuecell is a Python project for efficient data management.
hexstrike-ai
HexStrike AI is an AI-powered MCP cybersecurity automation platform with 150+ tools.
tradingview-mcp
AI-assisted TradingView chart analysis — connect Claude Code to your...
tradingview-mcp
TradingView MCP Server offers real-time market analysis for crypto and stocks.