Cover image
Try Now
2025-03-31

3 years

Works with Finder

3

Github Watches

0

Github Forks

5

Github Stars

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

uv sync

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:

export SHIOAJI_API_KEY="your_api_key"
export SHIOAJI_SECRET_KEY="your_secret_key"

Using .env File

Create a .env file in the root directory with the following content:

SHIOAJI_API_KEY=your_api_key
SHIOAJI_SECRET_KEY=your_secret_key

Running the Server

Start the server with:

uv run mcp-server-shioaji

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.

{
  "tool": "get_stock_price",
  "params": {
    "symbols": "TW.2330,TW.2317"
  }
}

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.

{
  "tool": "get_kbars",
  "params": {
    "symbol": "TW.2330",
    "start_date": "2023-12-01",
    "end_date": "2023-12-15"
  }
}

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.

{
  "tool": "scan_stocks",
  "params": {
    "scanner_type": "VolumeRank",
    "ascending": false,
    "limit": 10
  }
}

Supported scanner types:

  • VolumeRank - Ranking by trading volume
  • AmountRank - Ranking by trading amount
  • TickCountRank - Ranking by number of transactions
  • ChangePercentRank - Ranking by percentage change
  • ChangePriceRank - Ranking by price change
  • DayRangeRank - 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

mcp-server-shioaji/
├── src/
│   └── mcp_server_shioaji/
│       ├── __init__.py      # Package entry point
│       └── server.py        # MCP server implementation
├── pyproject.toml           # Project metadata and dependencies
└── README.md                # This file

Adding New Tools

To add new Shioaji functionality, modify server.py and add new tool definitions using the @mcp.tool decorator.

License

MIT

Acknowledgements

  • Shioaji - The Python wrapper for SinoPac's trading API
  • MCP - Model Context Protocol

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Yasir Eryilmaz
  • AI scriptwriting assistant for short, engaging video content.

  • J. DE HARO OLLE
  • Especialista en juegos de palabras en varios idiomas.

  • Daren White
  • A supportive coach for mastering all Spanish tenses.

  • albert tan
  • Japanese education, creating tailored learning experiences.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • ShrimpingIt
  • Micropython I2C-based manipulation of the MCP series GPIO expander, derived from Adafruit_MCP230xx

  • huahuayu
  • A unified API gateway for integrating multiple etherscan-like blockchain explorer APIs with Model Context Protocol (MCP) support for AI assistants.

  • deemkeen
  • control your mbot2 with a power combo: mqtt+mcp+llm

  • zhaoyunxing92
  • 本项目是一个钉钉MCP(Message Connector Protocol)服务,提供了与钉钉企业应用交互的API接口。项目基于Go语言开发,支持员工信息查询和消息发送等功能。

  • apappascs
  • Discover the most comprehensive and up-to-date collection of MCP servers in the market. This repository serves as a centralized hub, offering an extensive catalog of open-source and proprietary MCP servers, complete with features, documentation links, and contributors.

  • justmywyw
  • Short and sweet example MCP server / client implementation for Tools, Resources and Prompts.

    Reviews

    2 (1)
    Avatar
    user_GTKb2Nas
    2025-04-16

    I've been using the Popmelt MCP Server by avantjohn, and I am thoroughly impressed. The server's performance is top-notch, offering seamless integration and excellent reliability. It has greatly improved my workflow, making it more efficient and productive. Highly recommend it for anyone looking for a robust server solution! Check it out here: https://mcp.so/server/mcp-server-test-04/avantjohn