Stock_datasource stock-mcp-query
Query 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. Requires a valid MCP query token purchased from the management platform.
install
source · Clone the upstream repo
git clone https://github.com/Yourdaylight/stock_datasource
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/Yourdaylight/stock_datasource "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/stock-mcp-query" ~/.claude/skills/yourdaylight-stock-datasource-stock-mcp-query && rm -rf "$T"
manifest:
skills/stock-mcp-query/SKILL.mdsource content
Stock MCP Query
Query historical stock market data including daily OHLCV, financial reports, index data, ETF data, and more through the MCP protocol.
Prerequisites
This skill requires:
- STOCK_MCP_TOKEN environment variable — a JWT token purchased from the management platform (nps_enhanced)
- STOCK_MCP_SERVER_URL environment variable (optional) — the MCP server URL, defaults to the URL provided at purchase time
Setup Check
Before using any data query tools, verify the environment is configured:
# Check if token exists echo ${STOCK_MCP_TOKEN:+Token is set}${STOCK_MCP_TOKEN:-ERROR: STOCK_MCP_TOKEN not set}
If
STOCK_MCP_TOKEN is not set:
- Visit the management platform (nps_enhanced web panel)
- Navigate to "MCP Data Query" subscription page
- Purchase a query quota pack (e.g., 10k records for 10 CNY)
- Copy the issued token
- Set the environment variable:
export STOCK_MCP_TOKEN="eyJ..." export STOCK_MCP_SERVER_URL="https://your-node:8001/messages"
MCP Server Configuration
Add to your MCP client configuration:
{ "mcpServers": { "stock-data": { "type": "streamable-http", "url": "${STOCK_MCP_SERVER_URL}", "headers": { "Authorization": "Bearer ${STOCK_MCP_TOKEN}" } } } }
Available Data Categories
| Category | Description | Example Tools |
|---|---|---|
| Daily K-line | OHLCV + volume + turnover | |
| Daily Basics | PE, PB, market cap, volume ratio | |
| Adj Factor | Forward/backward adjustment factors | |
| Financial | Balance sheet, income, cash flow | , etc. |
| Index | Index daily, weights, components | |
| ETF | ETF daily prices and holdings | |
| HK Stock | Hong Kong stock daily data | |
| Market | Market overview, trading calendar | |
Usage Notes
- Each tool call returns data and counts against your query quota
- The response includes
showing records returned_usage.record_count - The response includes
showing remaining quota_usage.quota_remaining - When quota is exhausted, purchase additional packs from the management platform
- Data is sourced from ClickHouse and covers the full available history
Billing
- Billed per record (data row) returned by each tool call
- Query packs are valid for 90 days from purchase
- Multiple packs stack additively (quota accumulates)
- Usage is reconciled asynchronously between the MCP server and management platform
Troubleshooting
- 401 "API key required":
is not set or not passed in Authorization headerSTOCK_MCP_TOKEN - 401 "Token expired": Your token has expired. Purchase a new quota pack to get a fresh token
- 401 "Invalid token": Token is malformed or the server's public key doesn't match
- No data returned: Check that the requested date is a trading day, or the stock code is valid
- Quota exhausted: The
will show 0. Purchase additional packs_usage.quota_remaining