- Home
- MCP servers
- Stock
Stock
- python
4
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
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.
How to use
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.
How to install
Prerequisites: ensure you have Python installed on your system.
Step 1: Install dependencies.
pip install -r requirements.txt
Step 2: Start the MCP server.
python stock_mcp_server.py
Step 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"
}
Additional configuration and notes
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.
Security and performance considerations
-
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.
Troubleshooting
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.
Available tools
get_stock_realtime_data
Fetches real-time price, percentage change, volume, turnover, and related fields for a given stock symbol.
get_stock_history_data
Retrieves historical data for a stock in a specified period (daily, weekly, monthly) between two dates.
calculate_technical_indicators
Calculates indicators such as MA, MACD, RSI for a stock and returns the results.
get_market_sentiment
Provides market sentiment data for a single stock or for the overall market, including fund flows and directional statistics.
search_stock_info
Searches for stock information by name or code using a keyword.
get_stock_news
Retrieves news related to a specific stock or market-wide news with optional limits.