{
  "markdown": "# China A-Share Stock Quotes MCP\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n[![MCP](https://img.shields.io/badge/MCP-Server-blue)](https://modelcontextprotocol.io)\n[![Remote](https://img.shields.io/badge/Streamable%20HTTP-hosted%20free-success)](https://mcp.pianam.cn/stock-mcp/mcp)\n\nReal-time **China A-share stock & market-index quotes** for AI agents. Query by stock code (`sh600519`, `600519`) or by Chinese name (`贵州茅台`), with automatic name resolution and dual data sources.\n\n- **Try it in 30 seconds**: a free public MCP endpoint is already running — just paste the URL into your MCP client (no install, no API key).\n- **Or self-host**: a small FastMCP server using only free public quote endpoints (Tencent Finance primary, Sina Finance fallback). No paid API, no key.\n\n## ⚡ Use the hosted endpoint (no setup)\n\n```\nhttps://mcp.pianam.cn/stock-mcp/mcp\n```\n\nTransport: **Streamable HTTP** (MCP 2025-03-26 compatible). No authentication required.\n\n## 🔌 Client configuration\n\nAdd this to your MCP client's `mcpServers` configuration (Claude Desktop, Cursor, Cline, Cherry Studio, etc.):\n\n```json\n{\n  \"mcpServers\": {\n    \"stock\": {\n      \"type\": \"http\",\n      \"url\": \"https://mcp.pianam.cn/stock-mcp/mcp\"\n    }\n  }\n}\n```\n\n> Clients that do not accept `\"type\": \"http\"` accept the same entry with just `\"url\"`.\n\n## 🧰 Tools\n\n| Tool | Parameters | Returns |\n|\n\n[![stock-mcp MCP server](https://glama.ai/mcp/servers/boy-373/stock-mcp/badges/score.svg)](https://glama.ai/mcp/servers/boy-373/stock-mcp)\n\n---|---|---|\n| `query_stock_quote(stock)` | `stock`: stock code (`sh600519`, `SH600519`, `600519`, `000858`) or Chinese name (`贵州茅台`, `宁德时代`). | Name, code, current price, prev close, open, high/low, change amount & percent, direction (涨/跌/平), volume (shares & lots), turnover, update time, data source. |\n| `query_index()` | (none) | The three major A-share indices — 上证指数 / 深证成指 / 创业板指: points, change, open/prev-close/high/low, plus an overall market-trend summary (全面上涨 / 多数下跌 etc.). |\n\n### Examples\n\n- \"贵州茅台现在多少钱？\" → live quote for Kweichow Moutai.\n- \"查一下 300750\" → quote for CATL (宁德时代).\n- \"今天大盘怎么样？\" → the three indices and market trend.\n\n## 📡 Data sources\n\n- **Primary**: Tencent Finance real-time quote endpoint (`qt.gtimg.cn`) — free public interface, GBK encoded, no key.\n- **Fallback**: Sina Finance (`hq.sinajs.cn`, sent with a `Referer` header) — automatically used if the primary source fails.\n- Name → code resolution uses Tencent's suggest API, with a bundled map of ~50 common stocks for instant lookup.\n- All requests have timeouts and graceful degradation; **no API key or registration required**.\n\n> Data is for informational purposes only and is delayed / indicative per the data providers; it is not investment advice.\n\n## 🐢 Self-hosting\n\n```bash\ngit clone https://github.com/boy-373/stock-mcp.git\ncd stock-mcp\npip install -r requirements.txt\npython server.py\n# listens on 127.0.0.1:8000 by default; override with:\n#   MCP_HOST=0.0.0.0 MCP_PORT=9000 python server.py\n# behind a reverse proxy, allow your public hostname:\n#   MCP_ALLOWED_HOSTS=\"your-domain.com,your-domain.com:*\" python server.py\n```\n\nThen point your MCP client at `http://127.0.0.1:8000/mcp`.\n\nWith [uv](https://docs.astral.sh/uv/):\n\n```bash\nuv venv && uv pip install -r requirements.txt\nuv run python server.py\n```\n\n## 🗂️ Files\n\n- `stock_server.py` — the MCP server: code/name resolution, Tencent + Sina quote parsing, FastMCP tool definitions.\n- `server.py` — standalone Streamable HTTP entry point (serves the MCP app at `/mcp`).\n- `requirements.txt` — Python dependencies.\n- `LICENSE` — MIT.\n\n---\n\n## 🇨🇳 中文说明\n\nA 股实时行情 MCP：**个股行情查询**（支持代码 `sh600519`/`600519` 或中文名「贵州茅台」，内置约 50 只常用股映射 + 腾讯搜索补全）与**三大指数查询**（上证 / 深成 / 创业板，含市场整体涨跌趋势）。\n\n**在线直连（免费、无需 Key）**：`https://mcp.pianam.cn/stock-mcp/mcp`\n\n主数据源腾讯财经（`qt.gtimg.cn`，免费公开接口），失败自动降级新浪财经（`hq.sinajs.cn`）；所有请求带超时与友好错误，无需任何 API Key。数据仅供参考，不构成投资建议。\n\n## 📄 License\n\n[MIT](LICENSE) © 2026 boy-373 (刘扶阳)\n",
  "bytes": 3981,
  "sha": "7a82c8f62108fb696bc6b590e7029a66a056d00e34134a9f78624f4d158fae62",
  "repo_slug": "boy-373/stock-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_cn_pianam_mcp_stock_mcp_3fd48100/readme"
}