Shioaji 的 MCP 服务器
模型上下文协议 (MCP) 服务器,为 AI 助手提供访问台湾金融市场的 Shioaji 交易 API 的权限。
概述
该服务器实现了 MCP 协议,将 Shioaji API 功能公开为可供 AI 助手使用的工具。它允许 AI 模型执行以下操作:
检索当前股票价格
获取历史数据
列出可用股票
还有更多...
安装
先决条件
Python 3.10 或更高版本
uv(快速 Python 包管理器)
使用 uv
配置
在运行服务器之前,您需要配置Shioaji API凭据。有两种方法可以做到这一点:
环境变量
设置以下环境变量:
使用 .env 文件
在根目录中创建一个.env文件,其内容如下:
运行服务器
使用以下命令启动服务器:
服务器默认从http://0.0.0.0:8000启动。
可用工具
服务器通过 MCP 公开以下工具:
获取股票价格
通过股票代码获取股票的当前价格。
响应将包括所请求股票的价格信息,包括开盘价、最高价、最低价、收盘价、交易量和其他交易数据。
获取kbars
获取某个日期范围内股票的 K-Bar(烛台)数据。
如果未提供start_date ,则默认为今天。如果未提供end_date ,则默认与start_date相同。
扫描股票
根据各种排名标准扫描股票。
支持的扫描仪类型:
VolumeRank- 按交易量排名AmountRank- 按交易金额排名TickCountRank- 按交易数量排名ChangePercentRank- 按百分比变化排名ChangePriceRank- 按价格变化排名DayRangeRank- 按每日范围排名
默认限制为 20,结果默认按降序排列( ascending为true可实现升序排列)。
发展
项目结构
添加新工具
要添加新的 Shioaji 功能,请修改server.py并使用@mcp.tool装饰器添加新的工具定义。
执照
麻省理工学院
致谢
This server cannot be installed
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityMCP server that provides AI assistants access to stock market data including financial statements, stock prices, and market news through a Model Context Protocol interface.Last updated -2211688MIT License
- Asecurity-licenseAqualityAn MCP server that enables AI models like Claude to interact with the Trading Simulator API for checking balances, viewing prices, and executing trades with automatic chain detection.Last updated -15
- -security-license-qualityAn implementation of the Model Context Protocol (MCP) server that exposes Twilio APIs to AI assistants and tools, allowing them to interact with Twilio services through the MCP protocol.Last updated -67MIT License
- -securityFlicense-qualityA Model Context Protocol server that enables AI assistants to interact with a complete e-commerce application, providing authentication, product browsing, and shopping cart management through standardized MCP tools.Last updated -