home / mcp / akshare mcp server
Provides historical stock data via MCP SSE interface using AkShare with configurable environment and logging.
Configuration
View docs{
"mcpServers": {
"guangxiangdebizi-akshare-mcp": {
"url": "https://<not-provided>/mcp",
"headers": {
"HOST": "127.0.0.1",
"PORT": "8005",
"TRANSPORT": "sse"
}
}
}
}You run an AkShare MCP Server that exposes financial data via SSE, providing ready-made, formatted outputs for stock, HK, and A-share histories. It integrates AkShare data interfaces, validates inputs, and logs activity for easy monitoring and reliable usage by your MCP clients.
To use this MCP server, start it on your machine and connect your MCP client to the local SSE endpoint. The server exposes financial data tools for U.S. stocks, Hong Kong stocks, and Chinese A-shares, returning outputs in readable Markdown table format. Start, connect, and request data using the client’s standard MCP workflow. Ensure the client is configured to talk to the server over SSE with the correct host and port. The server handles parameter validation and returns structured results with fields such as date, prices, volume, and related metrics.
Prerequisites: you need Python installed on your machine. You will also need network access for AkShare to fetch external data.
Step 1: Install dependencies.
pip install -r requirements.txtStep 2: Start the MCP server using one of the provided runtime commands.
Step 3: Verify the server is running by checking the logs and ensuring the chosen port is listening.
Environment variables control where the server runs and how it is exposed. You can set these before starting the server:
HOST The host address to bind the server to. Typical value is 127.0.0.1 or 0.0.0.0.
PORT The port on which the SSE endpoint will be exposed.
TRANSPORT The transport protocol, for example sse.
In your MCP client, configure a connection to the local server using the following details. The server exposes an SSE endpoint on the configured host/port.
Request U.S. stock historical data for a given symbol, period, date range, and adjust type. Do the same for 港股 and A股 as needed. Interpret the returned Markdown table: it includes date, open, close, high, low, volume, turnover, and metrics like amplitude and changes.
Fetch US stock historical data with selectable period, date range, and adjustment type. Returns date, open, close, high, low, volume, turnover, amplitude, change rate, and change amount.
Fetch Hong Kong stock historical data with selectable period, date range, and adjustment type. Returns date, open, close, high, low, volume, turnover, amplitude, change rate, and change amount.
Fetch A-share historical data for Shanghai and Shenzhen markets with selectable period, date range, and adjustment type. Returns date, stock code, open, close, high, low, volume, turnover, amplitude, change rate, and change amount.