Skip to main content
Glama
suraj2906

Weather and Stock Information MCP Server

by suraj2906

MCP Server - Weather and Stock Information Service

This MCP (Model Control Protocol) server provides real-time weather alerts, forecasts, stock market data, and news information through various API integrations.

Features

  • Weather Alerts: Get active weather alerts for US states

  • Weather Forecast: Get detailed weather forecasts for specific locations

  • Stock Market Data: Access top gainers and losers in the US stock market

  • Stock News and Sentiments: Get news and sentiment analysis for specific stocks

  • General News: Search for news articles by keyword and date

Related MCP server: Node.js MCP Weather Server

Prerequisites

  • Python 3.x

  • uv package manager

  • API Keys for:

    • Alpha Vantage (for stock data)

    • News API (for news data)

Setup

  1. Clone the repository:

git clone https://github.com/suraj2906/mcpServer
cd mcpServer
  1. Create a virtual environment and install dependencies:

uv venv
uv pip install -r requirements.txt
  1. Create a .env file in the project root with your API keys:

ALPHA_VANTAGE_API_KEY=your_alpha_vantage_key
NEWS_API_KEY=your_news_api_key

Configuration

To use this MCP server with Claude, you need to add the following configuration to Claude's config file:

  1. Open Claude's settings

  2. Go to File > Settings > Developer > Edit Config

  3. Add the following configuration:

{
    "mcpServers": {
        "weatherAndStock": {
            "command": "uv",
            "args": [
                "--directory",
                "YOUR\\REPOSITORY\\PATH",
                "run",
                "mcp-server.py"
            ]
        }
    }
}

Note: Make sure to adjust the path (C:\\Users\\asus\\code\\mcpServer) to match your actual project location.

Available Tools

Weather Tools

  • get_weather_alerts(state): Get active weather alerts for a US state

    • Example: get_weather_alerts("CA")

  • get_forecast(latitude, longitude): Get weather forecast for a location

    • Example: get_forecast(37.7749, -122.4194)

Stock Market Tools

  • get_top_gainers_losers(): Get top gainers and losers in the US stock market

  • get_news_and_sentiments(ticker): Get news and sentiment analysis for a stock

    • Example: get_news_and_sentiments("AAPL")

News Tools

  • get_news_today(keyword, date): Get news articles for a keyword and date

    • Example: get_news_today("technology", "2024-03-20")

Error Handling

The server includes robust error handling for API requests and will return appropriate error messages if:

  • API keys are missing

  • API requests fail

  • Invalid parameters are provided

  • No data is found for the given criteria

Contributing

Feel free to submit issues and enhancement requests!

Available Tools

5 tools
get_forecastC

Get the weather forecast for a specific location.

Args:
    latitude: Latitude of the location
    longitude: Longitude of the location
ParametersJSON Schema
NameRequiredDescriptionDefault
latitudeYes
longitudeYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves weather forecasts but lacks details on rate limits, authentication needs, data freshness, or response format. This is a significant gap for a tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with the core purpose stated first followed by parameter details. It avoids redundancy, though the parameter section could be more integrated for better flow.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of weather forecasting, lack of annotations, and no output schema, the description is incomplete. It doesn't cover return values, error handling, or behavioral traits like data sources or update frequency, making it inadequate for full agent understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds minimal semantics beyond the input schema, listing latitude and longitude as required parameters. With 0% schema description coverage, it partially compensates by naming the parameters, but doesn't explain their formats, ranges, or units, leaving gaps in understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('weather forecast for a specific location'). It distinguishes itself from sibling tools like get_weather_alerts by focusing on forecasts rather than alerts, though it doesn't explicitly mention this distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. While the description implies usage for weather forecasts, it doesn't specify scenarios, prerequisites, or comparisons with sibling tools like get_weather_alerts, leaving the agent without explicit usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_news_and_sentimentsB

Get the news and sentiments of a particular stock Args: ticker: Stock ticker/symbol (eg. AAPL)

ParametersJSON Schema
NameRequiredDescriptionDefault
tickerYes

TDQS

B3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves news and sentiments but lacks details on behavioral traits such as data freshness, rate limits, authentication needs, or what 'sentiments' entails (e.g., sentiment scores, analysis). This leaves significant gaps in understanding how the tool operates beyond its basic purpose.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with the main purpose stated first followed by parameter details. It uses two sentences efficiently, avoiding unnecessary elaboration. However, the structure could be slightly improved by integrating the parameter explanation more seamlessly, but it remains clear and concise overall.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of retrieving news and sentiments (which implies data processing and potential nuances), the description is incomplete. No annotations exist to cover behavioral aspects, and there's no output schema to explain return values. The description only covers the basic purpose and parameter, leaving gaps in understanding the tool's behavior, output format, and operational context, which is inadequate for effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context for the single parameter: it explains that 'ticker' is the 'Stock ticker/symbol' and provides an example ('eg. AAPL'). Since schema description coverage is 0% (the schema only lists the parameter name and type without description), the description compensates well by clarifying the parameter's purpose and format, though it could add more detail on valid ticker formats or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get the news and sentiments of a particular stock.' It specifies the verb ('Get') and resource ('news and sentiments'), and while it doesn't explicitly differentiate from siblings, the focus on stock-related news and sentiments is distinct from tools like get_weather_alerts or get_forecast. However, it doesn't fully distinguish from get_news_today, which might overlap in scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions the ticker parameter but doesn't specify contexts, prerequisites, or exclusions. For example, it doesn't clarify if this is for real-time news, historical data, or how it differs from get_news_today, leaving the agent to infer usage based on the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_news_todayB

Get the news headlines for a specific keyword and date Args: keyword: Keyword to search for in the news date: Date in YYYY-MM-DD format

ParametersJSON Schema
NameRequiredDescriptionDefault
keywordYes
dateYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Get[s] the news headlines,' implying a read-only operation, but doesn't clarify aspects like rate limits, authentication needs, error handling, or what the return format looks like (e.g., list of headlines, pagination). This leaves significant gaps in understanding how the tool behaves beyond basic functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with the main purpose stated clearly in the first sentence. The additional parameter details are concise and relevant, avoiding unnecessary verbosity. However, the structure could be slightly improved by integrating parameter info more seamlessly rather than as a separate 'Args:' section.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 parameters, no annotations, no output schema), the description is minimally adequate. It covers the basic purpose and parameters but lacks details on behavioral traits, usage guidelines, and output format. Without annotations or output schema, the agent has incomplete context for reliable invocation, though the parameter semantics help.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful semantics beyond the input schema, which has 0% description coverage. It explains that 'keyword' is for 'searching in the news' and 'date' should be in 'YYYY-MM-DD format,' providing context that the schema lacks. This compensates well for the low schema coverage, though it doesn't detail constraints like date ranges or keyword length.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get the news headlines for a specific keyword and date.' It specifies the verb ('Get'), resource ('news headlines'), and scope ('for a specific keyword and date'), making it easy to understand what the tool does. However, it doesn't differentiate from sibling tools like 'get_news_and_sentiments,' which might offer similar functionality with additional features.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, exclusions, or comparisons to sibling tools such as 'get_news_and_sentiments,' leaving the agent without context for tool selection. Usage is implied only through the parameters, but no explicit guidelines are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_top_gainers_losersB

Get the top gainers and losers in the US stock market Args: None

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but lacks details on traits such as data freshness, rate limits, authentication needs, or output format. For a tool fetching dynamic market data, this omission is significant, though it doesn't contradict any annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise and well-structured: one sentence for the purpose and a brief note on arguments. There is no wasted text, and the information is front-loaded, making it easy to scan and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (simple data fetch with no parameters) and lack of annotations/output schema, the description is minimally adequate. It covers the basic purpose but misses key contextual details like return format or data constraints. Without an output schema, the description should ideally hint at what to expect, but it doesn't, leaving gaps in completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description correctly notes 'Args: None,' which adds clarity beyond the schema by explicitly confirming no inputs are required. This is helpful, though not essential, earning a 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get the top gainers and losers in the US stock market.' It specifies the verb ('Get') and resource ('top gainers and losers'), and the geographic scope ('US stock market') helps distinguish it from siblings like get_forecast or get_weather_alerts. However, it doesn't explicitly differentiate from get_news_and_sentiments or get_news_today, which might also relate to market data, so it's not a perfect 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, timing considerations (e.g., market hours), or comparisons to sibling tools like get_news_and_sentiments. Without such context, users might struggle to choose between this and other tools for market-related queries.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_weather_alertsB

Get weather alerts for a US state.

Args:
    state: Two-letter US state code (e.g., CA, NY)
ParametersJSON Schema
NameRequiredDescriptionDefault
stateYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves weather alerts but doesn't describe what the alerts include (e.g., severity, types, timestamps), how they are formatted, whether there are rate limits, or if authentication is required. This leaves significant gaps in understanding the tool's behavior and constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured: a clear purpose statement followed by parameter details in a labeled 'Args' section. Both sentences are necessary and add value. It could be slightly improved by integrating the parameter info more seamlessly, but it's efficiently presented without wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (single parameter, no output schema, no annotations), the description is minimally adequate. It covers the purpose and parameter semantics but lacks details on output format, error handling, or behavioral traits. Without annotations or an output schema, users won't know what the alerts look like or how to interpret results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context for the single parameter 'state', specifying it as a 'Two-letter US state code (e.g., CA, NY)'. This clarifies the expected format beyond the schema's basic 'string' type, which has 0% description coverage. However, it doesn't address edge cases (e.g., invalid codes) or provide examples beyond CA and NY.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get weather alerts for a US state.' It specifies the verb ('Get'), resource ('weather alerts'), and geographic scope ('US state'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_forecast' (which might provide general weather data rather than alerts).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools (e.g., 'get_forecast' for non-alert weather data) or specify contexts where weather alerts are preferred over other weather-related information. The user must infer usage based on the tool name and description alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

B3.2/5.0
Disambiguation4/5

Most tools have distinct purposes: weather forecasting vs. stock information vs. weather alerts. However, get_news_and_sentiments and get_news_today could cause confusion as both handle news retrieval, though one focuses on stock sentiment and the other on general keyword-based news. The descriptions help differentiate them, but overlap exists.

Naming Consistency4/5

Tool names follow a consistent verb_noun pattern (e.g., get_forecast, get_news_and_sentiments), all using snake_case. There is a minor deviation with get_top_gainers_losers, which uses a compound noun without 'and' in the name, but overall the naming is predictable and readable.

Tool Count4/5

With 5 tools, the count is reasonable for a server covering weather and stock information. It's slightly lean but manageable, as it includes core functions like forecasting, alerts, stock news, and market data. A few more tools might enhance coverage, but this is well-scoped for basic operations.

Completeness3/5

The tool surface has notable gaps. For weather, it covers forecasting and alerts but lacks current conditions or historical data. For stocks, it includes news, sentiment, and market movers but omits stock price quotes, historical data, or portfolio management. Agents can work around this, but the coverage is incomplete for a full weather and stock domain.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    B
    quality
    D
    maintenance
    An MCP server that provides weather information and alerts for US locations using the National Weather Service API, enabling retrieval of weather forecasts and active weather alerts.
    2
  • F
    license
    C
    quality
    C
    maintenance
    An MCP server that provides weather alerts and forecasts using the National Weather Service API, with additional system tools for shell commands and process information.
    3

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/suraj2906/mcpServer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server