Baostock

v1.0.0Finance & Fintechstable

🐍 ☁️ - MCP server based on baostock, providing access and analysis capabilities for Chinese stock market data.

mcp-baostockmcpai-integration
Share:
107
Stars
0
Downloads
0
Weekly
0/5

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

Access and analyze Chinese stock market data with real-time quotes and historical pricing. Query financial metrics and trading information for Chinese stocks.
HuggingAGI

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedMay 13, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mcp-baostock

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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 mcp
2

Run 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-server
3

Add 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"]
    }
  }
}
4

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.

5

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.

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.

Quick Config Preview

{ "mcpServers": { "mcp-baostock": { "command": "npx", "args": ["-y", "mcp-baostock"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides