stock_mcp
Configuration
View docs{
"mcpServers": {
"jwangkun-stock_mcp": {
"command": "python",
"args": [
"stock_mcp_server.py"
]
}
}
}You can run this stock analysis MCP server locally to access real-time quotes, historical data, technical indicators, market sentiment, stock search, and news through the MCP protocol. It is built with the FastMCP framework and AKShare API, designed for high performance and easy integration with CherryStudio.
You interact with the server through an MCP client. You can request real-time data for a stock, retrieve historical data at different frequencies, compute common technical indicators, analyze market sentiment, search for stocks by name or code, and fetch relevant news. Each capability is exposed as an endpoint you can call via MCP, returning structured data you can display or analyze in your application.
Prerequisites: ensure you have Python installed on your system.
Step 1: Install dependencies.
pip install -r requirements.txtStep 2: Start the MCP server.
python stock_mcp_server.pyStep 3: Configure CherryStudio to use this MCP server. Create a server entry with the following settings:
{
"name": "股票分析工具",
"command": "python",
"args": ["stock_mcp_server.py"],
"cwd": "/path/to/your/project"
}Be aware that the server uses AKShare as its data source and includes a built‑in cache mechanism to improve response times. Ensure you comply with AKShare's terms of use.
If you need to customize how long data is cached, or extend the set of technical indicators, you can modify the implementation in your local project. The default cache timeout is 5 minutes.
- Do not expose the MCP server to untrusted networks without proper authentication and access controls.
- Keep dependencies up to date and monitor logs for any errors or unusual activity.
If the server fails to start, verify that Python is installed and the required packages are installed. Check that the file stock_mcp_server.py exists in your project directory and that there are no port conflicts or permission issues.
Fetches real-time price, percentage change, volume, turnover, and related fields for a given stock symbol.
Retrieves historical data for a stock in a specified period (daily, weekly, monthly) between two dates.
Calculates indicators such as MA, MACD, RSI for a stock and returns the results.
Provides market sentiment data for a single stock or for the overall market, including fund flows and directional statistics.
Searches for stock information by name or code using a keyword.
Retrieves news related to a specific stock or market-wide news with optional limits.