Baostock
🐍 ☁️ - MCP server based on baostock, providing access and analysis capabilities for Chinese stock market data.
What is Baostock?
Baostock is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to 🐍 ☁️ - mcp server based on baostock, providing access and analysis capabilities for chinese stock market data.
🐍 ☁️ - MCP server based on baostock, providing access and analysis capabilities for Chinese stock market data.
This server falls under the Finance & Fintech category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- 🐍 ☁️ - MCP server based on baostock, providing access and an
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-baostockConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Baostock
The MCP Baostock server provides AI assistants with access to Chinese A-share stock market data via the open-source baostock library, which requires no API key. It exposes nine data interfaces covering K-line historical prices, industry classification, dividend history, quarterly financial metrics (profitability, operational efficiency, growth), major market index data, and valuation ratios — all queryable through natural language. Analysts and developers use it to build AI-powered research tools for Chinese equities without needing access to paid data terminals.
Prerequisites
- Python 3.10 or later
- uv package manager (recommended) or pip
- The baostock and pandas Python libraries
- No API key required — baostock data is free and open access
- An MCP-compatible client such as Claude Desktop
Install the mcp-baostock-server package
Clone the repository and install dependencies using uv. The server uses baostock for data access and pandas for data processing.
git clone https://github.com/HuggingAGI/mcp-baostock-server.git
cd mcp-baostock-server
uv pip install baostock pandas mcpRun the server to verify it starts
Start the server manually to confirm the dependencies are installed correctly. It should start without errors and wait for MCP client connections.
uv run mcp-baostock-serverAdd the server to Claude Desktop config
Register the MCP server in your claude_desktop_config.json. No API keys or environment variables are needed — baostock data is freely accessible.
{
"mcpServers": {
"baostock": {
"command": "uv",
"args": ["run", "--directory", "/path/to/mcp-baostock-server", "mcp-baostock-server"]
}
}
}Restart Claude Desktop
Restart your MCP client to load the new server. The baostock tools will be available for stock data queries on the next startup.
Test with a stock query
Ask Claude for historical price data on a Chinese stock using the ticker format sh.XXXXXX (Shanghai) or sz.XXXXXX (Shenzhen). A successful data return confirms the server is working.
Baostock Examples
Client configuration
Claude Desktop configuration for the baostock MCP server running via uv.
{
"mcpServers": {
"baostock": {
"command": "uv",
"args": [
"run",
"--directory",
"/path/to/mcp-baostock-server",
"mcp-baostock-server"
]
}
}
}Prompts to try
Chinese stock market queries enabled by the baostock MCP server.
- "Get the daily K-line data for Kweichow Moutai (sh.600519) for the past 30 days"
- "What industry sector does sz.000001 (Ping An Bank) belong to?"
- "Show me the quarterly profit growth rate for sh.600519 over the last 4 quarters"
- "Retrieve the CSI 300 index daily performance for this month"
- "What are the price-to-earnings and price-to-book ratios for BYD (sz.002594) over the past year?"Troubleshooting Baostock
baostock login fails or returns no data
Baostock auto-logs in on first use and requires an internet connection to reach the baostock.com servers. Verify connectivity: `python -c "import baostock as bs; lg = bs.login(); print(lg.error_msg)"`.
uv command not found
Install uv with `curl -LsSf https://astral.sh/uv/install.sh | sh` on macOS/Linux, or `pip install uv` as a fallback. Alternatively, use `python -m mcp_baostock_server` if you installed with pip directly.
Stock ticker returns empty results
Verify the ticker format: Shanghai stocks use the prefix sh. (e.g., sh.600519) and Shenzhen stocks use sz. (e.g., sz.000001). Ensure the date range you provide uses YYYY-MM-DD format and falls within a trading period.
Frequently Asked Questions about Baostock
What is Baostock?
Baostock is a Model Context Protocol (MCP) server that 🐍 ☁️ - mcp server based on baostock, providing access and analysis capabilities for chinese stock market data. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Baostock?
Follow the installation instructions on the Baostock GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Baostock?
Baostock works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Baostock free to use?
Yes, Baostock is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
Baostock Alternatives — Similar Finance & Fintech Servers
Looking for alternatives to Baostock? Here are other popular finance & fintech servers you can use with Claude, Cursor, and VS Code.
ValueCell
★ 10.7kValueCell is a community-driven, multi-agent platform for financial applications.
Vibe Trading
★ 8.1k'Vibe-Trading: Your Personal Trading Agent'
Quantdinger
★ 6.2kAI quantitative trading platform for crypto, stocks, and forex with backtesting, live trading, market data, and multi-agent research.vibe-trading ,trading-agents,ai-trader,ai-trading
TradingView
★ 2.8kReal-time crypto & stock screening, advanced technical indicators, Bollinger Bands intelligence, candlestick patterns + native Claude Desktop integration. Multi-exchange (Binance, KuCoin, Bybit+). Open-source AI trading infrastructure.
Financial Datasets
★ 2.1kProvides access to comprehensive financial data including income statements, balance sheets, cash flow statements, stock prices, company news, SEC filings, and cryptocurrency information with built-in financial ratio analysis.
Stripe
★ 1.6kThe Stripe Model Context Protocol server allows you to integrate with Stripe APIs through function calling. This protocol supports various tools to interact with different Stripe services.
Browse More Finance & Fintech MCP Servers
Explore all finance & fintech servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Baostock in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Baostock?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.