股票数据 MCP 服务
Project description
stock-mcp
股票数据 MCP (Model Context Protocol) 服务,提供股票代码和日 K 线数据的查询功能。
功能特性
- 股票基本信息查询
- 按行业搜索股票
- 股票日 K 线数据查询
- 股票代码列表获取
- 基于 HTTP 的 MCP 服务接口
- 简单易用的 Python 客户端
快速开始
安装
pip install stock-mcp
启动服务器
# 使用默认配置启动
stock-mcp-server
# 自定义配置启动
stock-mcp-server --port 30815 --host 42.51.40.70 --user xx --password xxx --db xx --db-port 3306
使用客户端
from stock_mcp import StockMCPClient
# 创建客户端
client = StockMCPClient("http://42.51.40.70:30815")
# 获取股票信息
result = client.get_stock_info("SZ300750")
print(result)
# 获取日 K 线数据
kline = client.get_day_kline("SZ300750", limit=10)
print(kline)
命令行客户端
# 获取股票信息
stock-mcp-client info --code SZ300750
# 获取日 K 线数据
stock-mcp-client kline --code SZ300750 --limit 10
# 健康检查
stock-mcp-client health
API 接口
健康检查
- 端点: GET /health
- 功能: 检查服务和数据库连接状态
工具列表
- 端点: GET /tools
- 功能: 获取所有可用工具的定义
工具调用
- 端点: POST /invoke
- 功能: 调用具体的工具执行操作
- 请求格式:
{ "tool": "工具名称", "args": { "参数1": "值1", "参数2": "值2" } }
依赖项
- Python 3.8+
- PyMySQL 1.1.2+
许可证
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stock_mcp-1.0.5.tar.gz
(2.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stock_mcp-1.0.5.tar.gz.
File metadata
- Download URL: stock_mcp-1.0.5.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a0e58068b1e29e94accfe21ed5ae2da53c11a7109b7329d9c02ce6bfbb2002b
|
|
| MD5 |
ea13599e7ab3e5fa896defb120b4fda3
|
|
| BLAKE2b-256 |
6c134a23fb2e2c337c5b1dc9d9db6c76e42ba1e6cf97a7f7f537ffe6095e7a92
|
File details
Details for the file stock_mcp-1.0.5-py3-none-any.whl.
File metadata
- Download URL: stock_mcp-1.0.5-py3-none-any.whl
- Upload date:
- Size: 2.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5aa6fca260df898fa88d48cead493691cf6d5db4aab51093531892b78846f71
|
|
| MD5 |
db188ac6d4d613442d5b979c50292e61
|
|
| BLAKE2b-256 |
aee56427235787e8deac5cef48f0ef62a8aca7410c31c8feea76a645e4d82f2b
|