MCP Server for Shioaji
A Model Context Protocol (MCP) server that provides AI assistants with access to Shioaji trading API for the Taiwanese financial market.
Overview
This server implements the MCP protocol to expose Shioaji API functionality as tools that can be used by AI assistants. It allows AI models to:
- Retrieve current stock prices
- Fetch historical data
- List available stocks
- And more...
Installation
Prerequisites
- Python 3.10 or higher
- uv (fast Python package manager)
Using uv
Configuration
Before running the server, you need to configure your Shioaji API credentials. There are two ways to do this:
Environment Variables
Set the following environment variables:
Using .env File
Create a .env
file in the root directory with the following content:
Running the Server
Start the server with:
The server will start on http://0.0.0.0:8000
by default.
Available Tools
The server exposes the following tools via MCP:
get_stock_price
Get the current price of a stock by its symbol.
Response will include price information for the requested stocks, including open, high, low, close prices, volume, and other trading data.
get_kbars
Fetch K-Bar (candlestick) data for a stock within a date range.
If start_date
is not provided, it defaults to today. If end_date
is not provided, it defaults to the same as start_date
.
scan_stocks
Scan stocks based on various ranking criteria.
Supported scanner types:
VolumeRank
- Ranking by trading volumeAmountRank
- Ranking by trading amountTickCountRank
- Ranking by number of transactionsChangePercentRank
- Ranking by percentage changeChangePriceRank
- Ranking by price changeDayRangeRank
- Ranking by daily range
Default limit is 20, and results are sorted in descending order by default (set ascending
to true
for ascending order).
Development
Project Structure
Adding New Tools
To add new Shioaji functionality, modify server.py
and add new tool definitions using the @mcp.tool
decorator.
License
MIT
Acknowledgements
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
模型上下文协议 (MCP) 服务器,为 AI 助手提供访问台湾金融市场的 Shioaji 交易 API 的权限。
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 -11462PythonMIT License
- AsecurityFlicenseAqualityAn 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 -15TypeScript
- -securityAlicense-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 -54TypeScriptMIT 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 -TypeScript