Content
# Tushare MCP Server
<div align="center">
An intelligent stock data assistant based on Model Context Protocol (MCP)
[](https://opensource.org/licenses/MIT)
[](https://www.python.org/downloads/)
</div>
## 🚀 Core Features
### 1. Stock Basic Information Query
- Supports precise queries by stock code (e.g., 000001.SZ)
- Supports fuzzy queries by stock name (e.g., 平安银行)
- Returned information includes:
- Stock code and name
- Industry and region
- Listing date
- Market type
- Trading status
### 2. Intelligent Stock Search
- Supports fuzzy keyword search
- Matches both stock codes and names
- Supports industry keyword search (e.g., "新能源", "科技")
- Returns a list of stocks with the highest match degree
### 3. Financial Statement Analysis
- Supports querying listed company income statement data
- Flexible time range queries (annual reports, quarterly reports, semi-annual reports)
- Supports various report types (consolidated reports, parent company reports, etc.)
- Key indicators at a glance:
- Earnings per share
- Operating income and costs
- Period expenses
- Profit indicators
- Supports historical data comparative analysis
### 4. Secure Token Management
- Interactive token configuration process
- Local secure storage (encrypted)
- Automatic token validity verification
- Regular token status checks
## 🎯 Use Cases
1. **Investment Research**
```
"Help me find all stocks related to renewable energy"
"Query the basic information of BYD"
"Get the income statement of Ping An Bank for 2023"
```
2. **Financial Analysis**
```
"View the latest consolidated report of Tencent Holdings"
"Compare Alibaba's profit changes over the past three years"
"Analyze the quarterly profit trend of Xiaomi Group"
```
3. **Industry Analysis**
```
"List all stocks in the pharmaceutical industry"
"Find technology companies in Shenzhen"
```
4. **Report Query**
```
"Query the income statement of Ping An Bank for the first quarter of 2023"
"Get the parent company report of BYD"
"View the annual income statement of Moutai for the past 5 years"
```
## 🛠️ Technical Features
- Based on the MCP protocol, supports natural conversation with AI assistants like Claude
- Real-time connection to Tushare Pro data source
- Intelligent error handling and prompts
- Supports concurrent request processing
- Data caching optimization
## 📦 Installation Instructions
### Environment Requirements
- Python 3.8+
- Tushare Pro account and API Token
### Quick Start
1. Install the package
```bash
git clone https://github.com/zhewenzhang/tushare_MCP.git
cd tushare_MCP
pip install -r requirements.txt
```
2. Start the service
```bash
python server.py
```
3. Install in Claude
```bash
mcp install server.py
```
## 🔑 First-Time Configuration
1. **Get Token**
- Visit [Tushare Token Page](https://tushare.pro/user/token)
- Log in to obtain the API Token
2. **Configure Token**
```
Tell Claude: Please help me configure the Tushare token
```
3. **Verify Configuration**
```
Tell Claude: Please check the token status
```
## 📚 API Reference
### Utility Functions
1. **Stock Query**
```python
get_stock_basic_info(ts_code="", name="")
# Example: get_stock_basic_info(ts_code="000001.SZ")
```
2. **Stock Search**
```python
search_stocks(keyword="")
# Example: search_stocks(keyword="新能源")
```
3. **Income Statement Query**
```python
get_income_statement(ts_code="", start_date="", end_date="", report_type="1")
# Example: get_income_statement(ts_code="000001.SZ", start_date="20230101", end_date="20231231")
```
4. **Token Management**
```python
setup_tushare_token(token="")
check_token_status()
```
## 🔒 Data Security
- Token storage: `.tushare_mcp/.env` in the user's home directory
- Environment variables: Managed securely using python-dotenv
- Data transmission: Encrypted with HTTPS
## 🤝 Contribution Guidelines
Contributions are welcome! Please submit Issues and Pull Requests!
## 📄 Open Source License
MIT License - See the [LICENSE](LICENSE) file for details.
Connection Info
You Might Also Like
valuecell
ValueCell is a community-driven, multi-agent platform for financial applications.
hexstrike-ai
HexStrike AI MCP Agents is an advanced MCP server that lets AI agents...
YC-Killer
A library of enterprise-grade AI agents designed to democratize artificial...
AP2
Building a Secure and Interoperable Future for AI-Driven Payments.
solana-agent-kit
connect any ai agents to solana protocols
Stripe
The Stripe Agent Toolkit integrates agent frameworks with Stripe APIs via...