Markdown Content: openapi/mcp at main · longportapp/openapi · GitHub
===============
Skip to content Navigation Menu
Toggle navigation
Appearance settings
- Product
* [GitHub Copilot Write better code with AI](https://github.com/features/copilot)
* [GitHub Spark New Build and deploy intelligent apps](https://github.com/features/spark)
* [GitHub Models New Manage and compare prompts](https://github.com/features/models)
* [GitHub Advanced Security Find and fix vulnerabilities](https://github.com/security/advanced-security)
* [Actions Automate any workflow](https://github.com/features/actions)
* [Codespaces Instant dev environments](https://github.com/features/codespaces)
* [Issues Plan and track work](https://github.com/features/issues)
* [Code Review Manage code changes](https://github.com/features/code-review)
* [Discussions Collaborate outside of code](https://github.com/features/discussions)
* [Code Search Find more, search less](https://github.com/features/code-search)
Explore * Why GitHub * All features * Documentation * GitHub Skills * Blog
- Solutions
By company size * Enterprises * Small and medium teams * Startups * Nonprofits
By use case * DevSecOps * DevOps * CI/CD * View all use cases
By industry * Healthcare * Financial services * Manufacturing * Government * View all industries
- Resources
Topics * AI * DevOps * Security * Software Development * View all
Explore * Learning Pathways * Events & Webinars * Ebooks & Whitepapers * Customer Stories * Partners * Executive Insights
- Open Source
* [GitHub Sponsors Fund open source developers](https://github.com/sponsors)
* [The ReadME Project GitHub community articles](https://github.com/readme)
Repositories * Topics * Trending * Collections
- Enterprise
* [Enterprise platform AI-powered developer platform](https://github.com/enterprise)
Available add-ons * GitHub Advanced Security Enterprise-grade security features * Copilot for business Enterprise-grade AI features * Premium Support Enterprise-grade 24/7 support
Search or jump to...
Search code, repositories, users, issues, pull requests...
Search
Clear
Provide feedback
We read every piece of feedback, and take your input very seriously.
- [x] Include my email address so I can be contacted
Cancel Submit feedback
Saved searches
Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our documentation.
Cancel Create saved search
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
longportapp/**openapi**Public
-
NotificationsYou must be signed in to change notification settings
-
Security### Uh oh! There was an error while loading.Please reload this page.
Additional navigation options
Collapse file tree
Files
main
Search this repository
-
.github -
c -
cmake.build -
cpp -
examples -
java -
mcp-
src -
CHANGELOG.md -
Cargo.toml -
README.md -
install
-
-
nodejs -
python -
rust -
.clang-format -
.gitignore -
.gitmodules -
.rustfmt.toml -
CHANGELOG.md -
CMakeLists.txt -
Cargo.toml -
Cross.toml -
LICENSE-APACHE -
LICENSE-MIT -
Makefile.toml -
README.md -
SECURITY.md
Breadcrumbs
/ mcp
/
Copy path
Directory actions
More options
Directory actions
More options
Latest commit
success
Aug 9, 2025
275f1d6·Aug 9, 2025
History
Open commit details
Breadcrumbs
/ mcp
/
Top
Folders and files
| Name | Name | Last commit message | Last commit date |
|---|---|---|---|
| ### parent directory .. | |||
| src | src | Add option_quote mcp tool (#269) | Jul 23, 2025 |
| CHANGELOG.md | CHANGELOG.md | v3.0.9 | Jul 24, 2025 |
| Cargo.toml | Cargo.toml | v3.0.12 | Aug 9, 2025 |
| README.md | README.md | Update README.md | Jun 4, 2025 |
| install | install | Update MCP install script. | Apr 22, 2025 |
| View all files |
README.md
Outline
LongPort MCP
A MCP server implementation for LongPort OpenAPI, provides real-time stock market data, provides AI access analysis and trading capabilities through MCP.
Features
- Trading - Create, amend, cancel orders, query today’s/past orders and transaction details, etc.
- Quotes - Real-time quotes, acquisition of historical quotes, etc.
- Portfolio - Real-time query of the account assets, positions, funds
Installation
macOS or Linux
Run script to install:
undefinedshell curl -sSL https://raw.githubusercontent.com/longportapp/openapi/refs/heads/main/mcp/install | bash undefined
Windows
Download the latest binary from the Releases page.
Example Prompts
Once you done server setup, and connected, you can talk with AI:
- What's the current price of AAPL and TSLA stock?
- How has Tesla performed over the past month?
- Show me the current values of major market indices.
- What's the stock price history for TSLA, AAPL over the last year?
- Compare the performance of TSLA, AAPL and NVDA over the past 3 months.
- Generate a portfolio performance chart for my holding stocks, and return me with data table and pie chart (Just return result no code).
- 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.
Usage
Use in Cursor
To configure LongPort MCP in Cursor:
- Open Cursor Settings
- Go to Features > MCP Servers
- Click
+ Add New MCP Server - Enter the following:
- Name:
longport-mcp(or your preferred name) - Type:
command - Command:
env LONGPORT_APP_KEY=your-app-key LONGPORT_APP_SECRET=your-app-secret LONGPORT_ACCESS_TOKEN=your-access-token longport-mcp
- Name:
If 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"
Or use this config:
undefinedjson { "mcpServers": { "longport-mcp": { "command": "/usr/local/bin/longport-mcp", "env": { "LONGPORT_APP_KEY": "your-app-key", "LONGPORT_APP_SECRET": "your-app-secret", "LONGPORT_ACCESS_TOKEN": "your-access-token" } } } } undefined
Use in Cherry Studio
To configure LongPort MCP in Cherry Studio:
- Go to Settings > MCP Servers
- Click
+ Add Server - Enter the following:
- Name:
longport-mcp(or your preferred name) - Type:
STDIO - Command:
env LONGPORT_APP_KEY=your-app-key LONGPORT_APP_SECRET=your-app-secret LONGPORT_ACCESS_TOKEN=your-access-token longport-mcp
- Name:
If 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"
Running as a SSE server
undefinedshell env LONGPORT_APP_KEY=your-app-key LONGPORT_APP_SECRET=your-app-secret LONGPORT_ACCESS_TOKEN=your-access-token longport-mcp --sse undefined
Default bind address is 127.0.0.1:8000, you can change it by using the --bind flag:
undefinedshell longport-mcp --sse --bind 127.0.0.1:3000 undefined
Configuration
Readonly mode
To run the server in read-only mode, set the flag --readonly:
undefinedshell longport-mcp --readonly undefined
This will prevent the server from submitting orders to the exchange.
Enable logging
To enable logging, set the flag --log-dir to the directory where you want to store the logs:
undefinedshell longport-mcp --log-dir /path/to/log/dir undefined
Footer
Footer navigation
You can’t perform that action at this time.
Recommend MCP Servers 💡
Chargebee AgentKit
Seamlessly integrate AI agents with Chargebee using AgentKit for smarter billing and subscription workflows.
binance-mcp-server
An MCP server integrating AI assistants with Binance APIs for automated trading, market data, and account management.
plaid-dashboard-mcp-server
Plaid's MCP server for AI tools to monitor Plaid integration health, analyze Link analytics, and track usage via SSE.
tradingview-chart-mcp
An MCP server that fetches TradingView chart images based on ticker and interval, featuring advanced browser pooling for optimized concurrent performance.
mcp-yahoo-finance
An MCP server for Yahoo Finance that provides financial data retrieval and visualization tools
@shinzolabs/coinmarketcap-mcp
An MCP server implementation for CoinMarketCap API, providing standardized access to cryptocurrency market data, exchange information, and blockchain-related metrics.