- Home
- MCP servers
- Weather and Stock
Weather and Stock
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 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": {
"suraj2906-mcpserver": {
"command": "uv",
"args": [
"--directory",
"YOUR\\\\REPOSITORY\\\\PATH",
"run",
"mcp-server.py"
],
"env": {
"NEWS_API_KEY": "YOUR_NEWS_API_KEY",
"ALPHA_VANTAGE_API_KEY": "YOUR_ALPHA_VANTAGE_KEY"
}
}
}
}This MCP server provides real-time weather alerts, forecasts, stock market data, and news information through integrated APIs, enabling you to monitor weather conditions and financial headlines from a single endpoint.
How to use
You interact with the Weather and Stock MCP server through a compatible MCP client. Start the local MCP server using the provided command, then issue requests for weather alerts, forecasts, stock gainers/losers, and news about specific stocks or keywords. You can combine data sources to build dashboards, alerts, and automated workflows that react to weather events or market movements.
How to install
Prerequisites: Python 3.x, the uv package manager, and API keys for Alpha Vantage and News API.
# Step 1: Clone the project
git clone https://github.com/suraj2906/mcpServer
cd mcpServer
# Step 2: Create and activate a Python virtual environment using uv
uv venv
# Step 3: Install dependencies
uv pip install -r requirements.txt
# Step 4: Create environment keys file
# Add your API keys to a .env file at the project root
# Example:
# ALPHA_VANTAGE_API_KEY=your_alpha_vantage_key
# NEWS_API_KEY=your_news_api_key
Configuration and run
To run the MCP server locally, use the following configuration to start the server with uv. This tells the MCP framework how to locate and run the server script.
{
"mcpServers": {
"weather_stock": {
"command": "uv",
"args": [
"--directory",
"YOUR\\REPOSITORY\\PATH",
"run",
"mcp-server.py"
]
}
},
"envVars": {
"ALPHA_VANTAGE_API_KEY": {
"description": "API key for Alpha Vantage stock data",
"required": true,
"example": "YOUR_ALPHA_VANTAGE_KEY"
},
"NEWS_API_KEY": {
"description": "API key for News API data",
"required": true,
"example": "YOUR_NEWS_API_KEY"
}
}
}
Notes and security considerations
Place your API keys in the .env file at the project root so they are securely loaded by the server at runtime. Ensure the path in the configuration matches your actual project location. If you run into API errors, verify that your keys are valid and have the required permissions for the respective services.
Available tools
get_weather_alerts
Get active weather alerts for a US state, e.g., get_weather_alerts("CA").
get_forecast
Get weather forecast for a location using coordinates, e.g., get_forecast(37.7749, -122.4194).
get_top_gainers_losers
Retrieve top gainers and losers in the US stock market.
get_news_and_sentiments
Fetch news articles and sentiment analysis for a specific stock ticker, e.g., get_news_and_sentiments("AAPL").
get_news_today
Search for news articles by keyword and date, e.g., get_news_today("technology", "2024-03-20").