Stock-MCP
by Madhan-2096
README.md
# š Stock-MCP
### AI-Powered Stock Market MCP Server for GitHub Copilot
> A production-ready **Model Context Protocol (MCP) Server** built with **Python** and **FastMCP** that enables **GitHub Copilot Agent Mode** to access live stock market data, company information, technical analysis, news, and portfolio analytics through intelligent AI tool calling.
---
## š Overview
Stock-MCP transforms GitHub Copilot into an intelligent financial assistant by exposing stock market capabilities as MCP tools.
Instead of relying on static knowledge, Copilot can invoke this server to fetch live financial information and perform real-time analysis.
Example:
> **User:** *What is the current stock price of Apple?*
ā
GitHub Copilot
ā
MCP Server
ā
Yahoo Finance
ā
Live Price Returned
ā
Copilot explains the result.
---
# ⨠Features
- š Live Stock Price Lookup
- š¢ Company Information
- š° Latest Financial News
- š Technical Analysis
- š¼ Portfolio Valuation
- š Portfolio Performance Analysis
- ā” FastMCP-based Tool Registration
- š¤ GitHub Copilot Agent Mode Integration
- š Pure Python Implementation
- š§ Easily Extendable Architecture
---
# š Architecture
```text
User
ā
ā¼
GitHub Copilot Agent
ā
Model Context Protocol
ā
ā¼
Stock-MCP Server
ā
āāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāā
ā ā ā
ā¼ ā¼ ā¼
Stock Tool Company Tool News Tool
ā ā ā
āāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāā
ā
Yahoo Finance API
```
---
# š Project Structure
```text
Stock-MCP/
āāā server.py
āāā mcp_app.py
āāā mcp.json
āāā requirements.txt
āāā README.md
ā
āāā tools/
ā āāā ping.py
ā āāā stock.py
ā āāā company.py
ā āāā news.py
ā āāā technical.py
ā āāā portfolio.py
ā āāā prediction.py
ā
āāā services/
āāā utils/
āāā models/
āāā config/
āāā tests/
```
---
# š Tech Stack
| Technology | Purpose |
|------------|---------|
| Python 3.12+ | Backend |
| FastMCP | MCP Framework |
| MCP SDK | Protocol Support |
| yfinance | Stock Data |
| Pandas | Data Processing |
| NumPy | Numerical Computing |
| TA | Technical Indicators |
| Pydantic | Validation |
| GitHub Copilot | MCP Client |
---
# š¦ Installation
Clone the repository
```bash
git clone https://github.com/Madhan-2096/Stock-MCP.git
cd Stock-MCP
```
Create a virtual environment
```bash
python -m venv .venv
```
Activate it
### Windows
```bash
.venv\Scripts\activate
```
### Linux / macOS
```bash
source .venv/bin/activate
```
Install dependencies
```bash
pip install -r requirements.txt
```
---
# ā¶ Running the MCP Server
```bash
python server.py
```
Expected Output
```text
Starting MCP Server...
Transport: stdio
Waiting for requests...
```
---
# š Connecting with GitHub Copilot
Create an `mcp.json` configuration.
Example:
```json
{
"servers": {
"stock-market-assistant": {
"command": "python",
"args": [
"server.py"
]
}
}
}
```
Reload GitHub Copilot Agent Mode.
Your tools will automatically become available.
---
# š§° Available MCP Tools
| Tool | Description |
|------|-------------|
| ping | Health check |
| get_stock_price | Get latest stock price |
| get_company_info | Company fundamentals |
| get_stock_news | Latest market news |
| technical_analysis | RSI, SMA, EMA, MACD |
| calculate_portfolio_value | Portfolio valuation |
| get_portfolio_performance | Portfolio return analysis |
---
# š¬ Example Prompts
### Get Stock Price
```
What is the current price of AAPL?
```
---
### Company Information
```
Tell me about Microsoft.
```
---
### Technical Analysis
```
Perform technical analysis for TSLA.
```
---
### News
```
Show today's news about NVIDIA.
```
---
### Portfolio
```
Calculate my portfolio.
AAPL - 10
MSFT - 5
GOOGL - 8
```
---
# š Current Capabilities
ā
Live Stock Prices
ā
Company Information
ā
Technical Indicators
ā
Financial News
ā
Portfolio Valuation
ā
Portfolio Performance
ā
GitHub Copilot Integration
---
# š§ Roadmap
- [ ] Real-Time WebSocket Stock Streaming
- [ ] AI Investment Recommendations
- [ ] Sentiment Analysis
- [ ] Candlestick Pattern Detection
- [ ] Portfolio Optimization
- [ ] Stock Comparison Tool
- [ ] PDF Report Generator
- [ ] Alpha Vantage Integration
- [ ] Finnhub Integration
- [ ] Docker Support
- [ ] GitHub Actions CI/CD
---
# š¤ Contributing
Contributions are welcome.
1. Fork the repository
2. Create a new feature branch
```bash
git checkout -b feature/new-feature
```
3. Commit your changes
```bash
git commit -m "Added new feature"
```
4. Push
```bash
git push origin feature/new-feature
```
5. Open a Pull Request
---
# š License
This project is licensed under the MIT License.
---
# šØāš» Author
**Madhan J R**
B.Tech Artificial Intelligence & Data Science
Meenakshi Sundararajan Engineering College
GitHub: https://github.com/Madhan-2096
---
## ā Support
If you found this project useful,
please consider giving it a ā on GitHub.
It helps others discover the project and motivates future development.
---
This server cannot be deployed
Maintenance
ActivityStale
ResponsivenessNo issues