We provide several components for LLMs (Large Language Models) that allow you to easily access and analyze financial data, real-time market data, and even enable AI to place orders.
Yes, you can use our LLM components through the LongPort OpenAPI. Start today!
The OpenAPI documentation follows the LLMs Text standard, providing llms.txt and Markdown files for each document. Based on this LLMs Text, you can provide AI with a complete dictionary of LongPort OpenAPI documentation as a reference for AI-assisted development, enabling AI to generate more accurate code.
Each of our documents is also available in Markdown format. When accessing them, simply add the .md suffix to the URL.
.md
For example:
Open Cursor, open the command palette (Command + Shift + P), search for and select Add New Custom Docs and enter the LongPort OpenAPI LLMs Text address in the dialog box:
Command + Shift + P
https://open.longportapp.com/llms.txt
Once added successfully, the Cursor Settings will look like this:
Next, in an AI conversation, you can select the Docs you just added under the docs menu of @Add Context. This allows the AI to use these documents as context in subsequent conversations.
docs
We are building an MCP implementation for LongPort OpenAPI (based on our SDK), which you can use on any platform that supports MCP.
It is also open-sourced in our GitHub organization.
https://github.com/longportapp/openapi
Before starting, read the Getting Started guide and obtain your LONGPORT_APP_KEY, LONGPORT_APP_SECRET, and LONGPORT_ACCESS_TOKEN.
LONGPORT_APP_KEY
LONGPORT_APP_SECRET
LONGPORT_ACCESS_TOKEN
You can run the following script in the terminal to install directly:
curl -sSL https://raw.githubusercontent.com/longportapp/openapi/refs/heads/main/mcp/install | bash
After the script finishes, longport-mcp will be installed in the /usr/local/bin/ directory. Run the following command to verify the installation:
longport-mcp
/usr/local/bin/
longport-mcp -h
Visit https://github.com/longportapp/openapi/releases to download longport-mcp-x86_64-pc-windows-msvc.zip and extract longport-mcp.exe.
longport-mcp-x86_64-pc-windows-msvc.zip
longport-mcp.exe
Once you done server setup, and connected, you can talk with AI:
Open the command palette (Command + Shift + P), select Cursor Settings to enter the Cursor Settings interface, and select MCP Servers. Click the Add new global MCP server button.
In the opened mcp.json file, add the following content, replacing your-app-key, your-app-secret, and your-access-token with your actual values:
mcp.json
your-app-key
your-app-secret
your-access-token
{ "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" } } } }
Demo:
In this section, we will show you how to configure LongPort MCP in your AI chat (screenshots use Cherry Studio).
Using STDIO Mode:
Ensure you have configured the environment variables and installed the longport-mcp command-line tool on your system.
Using SSE Mode:
You must first start the SSE server. You can use the following command:
longport-mcp --sse
Then configure your AI chat to use http://localhost:8000.
http://localhost:8000