A MCP server implementation for LongPort OpenAPI, provides real-time stock market data, provides AI access analysis and trading capabilities through MCP. - LongPort OpenAPI: https://open.longportapp.com/en/ - SDK docs: https://longportapp.github.io/openapi - Trading - Create, amend, cancel orders, query today’s/past orders and transaction details, etc. - Quotes - Real-time quotes, acquisition of h
Add this skill
npx mdskills install longportapp/openapiWell-documented MCP server for stock market data and trading with clear setup instructions
1# LongPort MCP23A [MCP](https://modelcontextprotocol.io/introduction) server implementation for [LongPort OpenAPI](https://open.longportapp.com), provides real-time stock market data, provides AI access analysis and trading capabilities through MCP.45## Documentation67- LongPort OpenAPI: https://open.longportapp.com/en/8- SDK docs: https://longportapp.github.io/openapi910## Features1112- Trading - Create, amend, cancel orders, query today’s/past orders and transaction details, etc.13- Quotes - Real-time quotes, acquisition of historical quotes, etc.14- Portfolio - Real-time query of the account assets, positions, funds1516## Installation1718### macOS or Linux1920Run script to install:2122```bash23curl -sSL https://raw.githubusercontent.com/longportapp/openapi/refs/heads/main/mcp/install | bash24```2526### Windows2728Download the latest binary from the [Releases](https://github.com/longportapp/openapi/releases/tag/longport-mcp-0.1.0) page.2930## Example Prompts3132Once you done server setup, and connected, you can talk with AI:3334- What's the current price of AAPL and TSLA stock?35- How has Tesla performed over the past month?36- Show me the current values of major market indices.37- What's the stock price history for TSLA, AAPL over the last year?38- Compare the performance of TSLA, AAPL and NVDA over the past 3 months.39- Generate a portfolio performance chart for my holding stocks, and return me with data table and pie chart (Just return result no code).40- Check the price of the stocks I hold today, and if they fall/rise by more than 3%, sell(If fall, buy if rise) 1/3 at the market price.4142## Usage4344### Use in Cursor4546To configure LongPort MCP in Cursor:4748- Open Cursor Settings49- Go to Features > MCP Servers50- Click `+ Add New MCP Server`51- Enter the following:52 - Name: `longport-mcp` (or your preferred name)53 - Type: `command`54 - Command: `env LONGPORT_APP_KEY=your-app-key LONGPORT_APP_SECRET=your-app-secret LONGPORT_ACCESS_TOKEN=your-access-token longport-mcp`5556If you are using Windows, replace command with `cmd /c "set LONGPORT_APP_KEY=your-app-key && set LONGPORT_APP_SECRET=your-app-secret && set LONGPORT_ACCESS_TOKEN=your-access-token && longport-mcp"`5758Or use this config:5960```json61{62 "mcpServers": {63 "longport-mcp": {64 "command": "/usr/local/bin/longport-mcp",65 "env": {66 "LONGPORT_APP_KEY": "your-app-key",67 "LONGPORT_APP_SECRET": "your-app-secret",68 "LONGPORT_ACCESS_TOKEN": "your-access-token"69 }70 }71 }72}73```7475### Use in Cherry Studio7677To configure LongPort MCP in Cherry Studio:7879- Go to Settings > MCP Servers80- Click `+ Add Server`81- Enter the following:82 - Name: `longport-mcp` (or your preferred name)83 - Type: `STDIO`84 - Command: `env LONGPORT_APP_KEY=your-app-key LONGPORT_APP_SECRET=your-app-secret LONGPORT_ACCESS_TOKEN=your-access-token longport-mcp`8586If you are using Windows, replace command with `cmd /c "set LONGPORT_APP_KEY=your-app-key && set LONGPORT_APP_SECRET=your-app-secret && set LONGPORT_ACCESS_TOKEN=your-access-token && longport-mcp"`8788## Running as a SSE server8990```bash91env LONGPORT_APP_KEY=your-app-key LONGPORT_APP_SECRET=your-app-secret LONGPORT_ACCESS_TOKEN=your-access-token longport-mcp --sse92```9394Default bind address is `127.0.0.1:8000`, you can change it by using the `--bind` flag:9596```bash97longport-mcp --sse --bind 127.0.0.1:300098```99100## Configuration101102### Readonly mode103104To run the server in read-only mode, set the flag `--readonly`:105106```bash107longport-mcp --readonly108```109110This will prevent the server from submitting orders to the exchange.111112### Enable logging113114To enable logging, set the flag `--log-dir` to the directory where you want to store the logs:115116```bash117longport-mcp --log-dir /path/to/log/dir118```119
Full transparency — inspect the skill content before installing.