- Home
- MCP servers
- Tushare
Tushare
- python
1
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"sunyalou-tushare-mcp-server": {
"command": "python",
"args": [
"-m",
"tushare_mcp_server.main"
],
"env": {
"TUSHARE_TOKEN": "your_tushare_api_token_here"
}
}
}
}You can run a Python MCP server that exposes Tushare stock market data to MCP clients. It supports core market data APIs, historical price ranges, and full MCP protocol compatibility, letting you query stock basics and daily/weekly/monthly prices with robust validation and clear error handling.
How to use
You connect to the server from an MCP client and issue data queries through the available tools. Use the stock_basic tool to retrieve basic information about listed stocks, and use daily, weekly, or monthly tools to fetch OHLC prices and trading volume for specified stocks and date ranges. All requests rely on a Tushare API token that you provide as an environment variable. Run commands locally and then point your MCP client to the local server configuration.
How to install
Prerequisites: you need Python (3.8+), Git, and pip installed on your system.
Option 1: Install from source
How to install
Option 1: Install from source
git clone <repository-url>
cd tushare-mcp-server
pip install -r requirements.txt
pip install -e .
How to install
Option 2: Direct Python Execution
# Clone and run without installation
git clone <repository-url>
cd tushare-mcp-server
pip install -r requirements.txt
How to install
Configuration instructions below assume you have a Tushare Pro token ready.
How to install
Next steps enumerate how to run the server locally with your token.
How to use
Set your Tushare token in the environment and start the server.
How to install
Complete runtime commands are shown in the quick start examples.
Configuration and runtime
You must provide your Tushare API token as an environment variable when starting the server. You can pass it directly in the command line or store it in a .env file for convenience.
Configuration and runtime
# Start the MCP server with a token provided in the environment
TUSHARE_TOKEN=your_token python -m tushare_mcp_server.main
# Or enable debug mode while starting
DEBUG=true TUSHARE_TOKEN=your_token python -m tushare_mcp_server.main
Claude Desktop Integration
If you use Claude Desktop, add an MCP server configuration that runs the Python module locally and provides your token via environment variables.
Claude Desktop Integration
{
"mcpServers": {
"tushare": {
"command": "python",
"args": ["-m", "tushare_mcp_server.main"],
"env": {
"TUSHARE_TOKEN": "your_tushare_api_token_here"
}
}
}
}
Available tools
stock_basic
Retrieves basic stock information and company details such as name, area, industry, and listing date.
daily
Fetches daily OHLC prices, volume, and amount for a given ts_code within a date range.
weekly
Fetches weekly OHLC prices and volume data for a given ts_code (requires a sufficient number of Tushare data points).
monthly
Fetches monthly OHLC prices and volume data for a given ts_code (requires a sufficient number of Tushare data points).