$npx -y skills add Yourdaylight/stock_datasource --skill stock-mcp-queryQuery historical stock market data (A-shares, HK stocks, ETFs, indices) via MCP protocol. Use this skill when the user wants to retrieve historical daily K-line data, financial statements, market indicators, stock screening results, or any other batch data from the stock database
| 1 | # Stock MCP Query |
| 2 | |
| 3 | Query historical stock market data including daily OHLCV, financial reports, index data, ETF data, and more through the MCP protocol. |
| 4 | |
| 5 | ## Prerequisites |
| 6 | |
| 7 | This skill requires: |
| 8 | |
| 9 | 1. **STOCK_MCP_TOKEN** environment variable — a JWT token purchased from the management platform (nps_enhanced) |
| 10 | 2. **STOCK_MCP_SERVER_URL** environment variable (optional) — the MCP server URL, defaults to the URL provided at purchase time |
| 11 | |
| 12 | ## Setup Check |
| 13 | |
| 14 | Before using any data query tools, verify the environment is configured: |
| 15 | |
| 16 | ```bash |
| 17 | # Check if token exists |
| 18 | echo ${STOCK_MCP_TOKEN:+Token is set}${STOCK_MCP_TOKEN:-ERROR: STOCK_MCP_TOKEN not set} |
| 19 | ``` |
| 20 | |
| 21 | If `STOCK_MCP_TOKEN` is not set: |
| 22 | |
| 23 | 1. Visit the management platform (nps_enhanced web panel) |
| 24 | 2. Navigate to "MCP Data Query" subscription page |
| 25 | 3. Purchase a query quota pack (e.g., 10k records for 10 CNY) |
| 26 | 4. Copy the issued token |
| 27 | 5. Set the environment variable: |
| 28 | ```bash |
| 29 | export STOCK_MCP_TOKEN="eyJ..." |
| 30 | export STOCK_MCP_SERVER_URL="https://your-node:8001/messages" |
| 31 | ``` |
| 32 | |
| 33 | ## MCP Server Configuration |
| 34 | |
| 35 | Add to your MCP client configuration: |
| 36 | |
| 37 | ```json |
| 38 | { |
| 39 | "mcpServers": { |
| 40 | "stock-data": { |
| 41 | "type": "streamable-http", |
| 42 | "url": "${STOCK_MCP_SERVER_URL}", |
| 43 | "headers": { |
| 44 | "Authorization": "Bearer ${STOCK_MCP_TOKEN}" |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | ``` |
| 50 | |
| 51 | ## Available Data Categories |
| 52 | |
| 53 | | Category | Description | Example Tools | |
| 54 | |----------|-------------|---------------| |
| 55 | | Daily K-line | OHLCV + volume + turnover | `tushare_daily_*` | |
| 56 | | Daily Basics | PE, PB, market cap, volume ratio | `tushare_daily_basic_*` | |
| 57 | | Adj Factor | Forward/backward adjustment factors | `tushare_adj_factor_*` | |
| 58 | | Financial | Balance sheet, income, cash flow | `tushare_balancesheet_*`, etc. | |
| 59 | | Index | Index daily, weights, components | `tushare_index_*` | |
| 60 | | ETF | ETF daily prices and holdings | `tushare_fund_*` | |
| 61 | | HK Stock | Hong Kong stock daily data | `akshare_hk_*` | |
| 62 | | Market | Market overview, trading calendar | `tushare_trade_cal_*` | |
| 63 | |
| 64 | ## Usage Notes |
| 65 | |
| 66 | - Each tool call returns data and counts against your query quota |
| 67 | - The response includes `_usage.record_count` showing records returned |
| 68 | - The response includes `_usage.quota_remaining` showing remaining quota |
| 69 | - When quota is exhausted, purchase additional packs from the management platform |
| 70 | - Data is sourced from ClickHouse and covers the full available history |
| 71 | |
| 72 | ## Billing |
| 73 | |
| 74 | - Billed per record (data row) returned by each tool call |
| 75 | - Query packs are valid for 90 days from purchase |
| 76 | - Multiple packs stack additively (quota accumulates) |
| 77 | - Usage is reconciled asynchronously between the MCP server and management platform |
| 78 | |
| 79 | ## Troubleshooting |
| 80 | |
| 81 | - **401 "API key required"**: `STOCK_MCP_TOKEN` is not set or not passed in Authorization header |
| 82 | - **401 "Token expired"**: Your token has expired. Purchase a new quota pack to get a fresh token |
| 83 | - **401 "Invalid token"**: Token is malformed or the server's public key doesn't match |
| 84 | - **No data returned**: Check that the requested date is a trading day, or the stock code is valid |
| 85 | - **Quota exhausted**: The `_usage.quota_remaining` will show 0. Purchase additional packs |