This repository contains multiple Model Context Protocol (MCP) servers built with FastMCP, providing various functionalities including authentication, financial data, portfolio management, and data visualization.
Purpose: Provides Azure Entra ID authentication for secure user identification and access control.
Features:
- Azure Entra ID integration
- OAuth 2.0 authentication flow
- User information retrieval (name, email, job title, office location)
Tools:
get_user_info- Fetch authenticated user information from access token
Purpose: Fetch real-time stock quotes and historical price data from Yahoo Finance.
Features:
- Real-time stock quotes
- Historical OHLCV (Open, High, Low, Close, Volume) data
- Flexible date range and interval configurations
Tools:
ping- Test connectivityget_quote- Fetch latest quote for a ticker symbolget_history- Download historical price data with customizable periods/dates
Purpose: Comprehensive investment portfolio management with persistent storage using Azure Cosmos DB.
Features:
- Portfolio holdings management (CRUD operations)
- Transaction history tracking
- Watchlist management
- Cash balance tracking
- API key-based authentication
- Azure Cosmos DB integration
Tools:
add_to_portfolio- Purchase stocks and add to holdingsremove_from_portfolio- Sell stocks and remove holdingsupdate_position- Update existing holdingsget_holdings- View all portfolio holdingsget_transaction_history- View transaction historyadd_to_watchlist/remove_from_watchlist- Manage watchlistget_watchlist- View watchlist
Purpose: Create various data visualizations including charts, graphs, and plots.
Features:
- Multiple chart types (scatter, line, histogram, heatmap, pie)
- Relationship graphs with networkx
- Automatic plot saving and display
- Customizable styling and configurations
Tools:
create_relationship_graph- Directed relationship graphscreate_scatter_plot- Scatter plots with labelscreate_classification_plot- Category-colored scatter plotscreate_histogram- Distribution histogramscreate_line_plot- Time series and line chartscreate_heatmap- 2D matrix heatmapscreate_pie_chart- Pie charts for proportions
- Python 3.10 or higher
- pip or uv package manager
- Docker Desktop (for Portfolio MCP only)
- Azure Entra ID credentials (for Auth MCP only)
- Clone the repository:
git clone <repository-url>
cd ms-mcp- Install dependencies:
# Install all dependencies
pip install -r requirements.txt
# Or install per server using uv
cd auth_mcp && uv pip install -e .
cd localFinance && uv pip install -e .
cd PortfolioMcp && uv pip install -e .
cd vis_mcp && uv pip install -e .-
Configure Azure Entra ID credentials in auth_mcp/main.py:
tenant_idclient_idclient_secret
-
Start the server:
cd auth_mcp
python main.pyThe server runs on HTTP at http://localhost:8010
cd localFinance
python main.pyThe server runs using stdio transport (standard input/output for MCP communication).
- Start Azure Cosmos DB Emulator:
cd PortfolioMcp
docker-compose up -dWait for the Cosmos DB emulator to be healthy (takes ~60 seconds).
- Configure environment variables (create
.envfile inPortfolioMcp/):
# Database Configuration
COSMOS_ENDPOINT=https://localhost:8081
COSMOS_KEY=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==
COSMOS_DATABASE_NAME=portfolio_db
# Authentication
API_KEY=your-secure-api-key-here
# Logging
LOG_LEVEL=INFO- Start the server:
cd PortfolioMcp
python server.pyThe server initializes database containers and repositories on first run.
cd vis_mcp
python server.pyThe server runs using stdio transport. Generated plots are saved to the system temp directory and automatically opened.
Add to your .vscode/mcp.json or MCP client settings:
Windows:
{
"mcpServers": {
"mslab/auth": {
"command": "${workspaceFolder}/auth_mcp/.venv/Scripts/python.exe",
"args": ["main.py"],
"cwd": "${workspaceFolder}/auth_mcp",
"transport": "http",
},
"mslab/finance": {
"command": "${workspaceFolder}/localFinance/.venv/Scripts/python.exe",
"args": ["main.py"],
"cwd": "${workspaceFolder}/localFinance"
},
"mslab/portfolio": {
"command": "${workspaceFolder}/PortfolioMcp/.venv/Scripts/python.exe",
"args": ["server.py"],
"cwd": "${workspaceFolder}/PortfolioMcp",
"env": {
"API_KEY": "your-secure-api-key-here"
}
},
"mslab/visualization": {
"command": "${workspaceFolder}/vis_mcp/.venv/Scripts/python.exe",
"args": ["server.py"],
"cwd": "${workspaceFolder}/vis_mcp"
}
}
}Linux/macOS:
{
"mcpServers": {
"mslab/auth": {
"command": "${workspaceFolder}/auth_mcp/.venv/bin/python",
"args": ["main.py"],
"cwd": "${workspaceFolder}/auth_mcp",
"transport": "http",
},
"mslab/finance": {
"command": "${workspaceFolder}/localFinance/.venv/bin/python",
"args": ["main.py"],
"cwd": "${workspaceFolder}/localFinance"
},
"mslab/portfolio": {
"command": "${workspaceFolder}/PortfolioMcp/.venv/bin/python",
"args": ["server.py"],
"cwd": "${workspaceFolder}/PortfolioMcp",
"env": {
"API_KEY": "your-secure-api-key-here"
}
},
"mslab/visualization": {
"command": "${workspaceFolder}/vis_mcp/.venv/bin/python",
"args": ["server.py"],
"cwd": "${workspaceFolder}/vis_mcp"
}
}
}Note: The
${workspaceFolder}variable automatically resolves to your workspace root directory. Make sure each server has its own.venvdirectory with dependencies installed.
Create and configure virtual environments for each server:
Windows:
# Navigate to each server directory and set up venv
cd auth_mcp
python -m venv .venv
.venv\Scripts\activate
pip install -e .
deactivate
cd ../localFinance
python -m venv .venv
.venv\Scripts\activate
pip install -e .
deactivate
cd ../PortfolioMcp
python -m venv .venv
.venv\Scripts\activate
pip install -e .
deactivate
cd ../vis_mcp
python -m venv .venv
.venv\Scripts\activate
pip install -e .
deactivateLinux/macOS:
# Navigate to each server directory and set up venv
cd auth_mcp
python -m venv .venv
source .venv/bin/activate
pip install -e .
deactivate
cd ../localFinance
python -m venv .venv
source .venv/bin/activate
pip install -e .
deactivate
cd ../PortfolioMcp
python -m venv .venv
source .venv/bin/activate
pip install -e .
deactivate
cd ../vis_mcp
python -m venv .venv
source .venv/bin/activate
pip install -e .
deactivatems-mcp/
βββ README.md # This file
βββ requirements.txt # All dependencies
βββ auth_mcp/ # Authentication MCP
β βββ main.py # Server entry point
β βββ pyproject.toml # Project metadata
βββ localFinance/ # Finance data MCP
β βββ main.py # Server entry point
β βββ finance_tools.py # Yahoo Finance integration
β βββ pyproject.toml # Project metadata
β βββ requirements.txt # Dependencies
βββ PortfolioMcp/ # Portfolio management MCP
β βββ server.py # Server entry point
β βββ docker-compose.yml # Cosmos DB emulator
β βββ pyproject.toml # Project metadata
β βββ config/ # Configuration modules
β βββ database/ # Database layer
β βββ models/ # Domain models
β βββ services/ # Business logic
β βββ tools/ # MCP tools
βββ vis_mcp/ # Visualization MCP
βββ server.py # Server entry point
βββ config.py # Plot styling
βββ plot_utils.py # Utilities
βββ pyproject.toml # Project metadata
βββ README.md # Detailed docs
βββ tools/ # Visualization tools
- Auth MCP: Never commit Azure credentials to version control. Use environment variables or secure secret management.
- Portfolio MCP: Change the default API key before production use. The Cosmos DB emulator key is for development only.
- All MCPs: Run in trusted environments when exposing sensitive financial or user data.
Test each server's connectivity:
# Finance MCP
curl -X POST http://localhost:<port> -d '{"tool": "ping"}'
# Portfolio MCP (with API key)
curl -H "Authorization: Bearer your-api-key" http://localhost:<port>- fastmcp - MCP server framework
- yfinance - Yahoo Finance data
- azure-cosmos - Azure Cosmos DB client
- matplotlib, networkx, plotly - Visualization libraries
- uvicorn - ASGI server
- pydantic - Data validation
Each MCP server is designed to be modular and independent. Feel free to:
- Add new tools to existing servers
- Create additional MCP servers
- Enhance authentication and security
- Improve data persistence and caching
[Specify your license here]