Weather & Location MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Weather & Location MCP Serverget current weather in Paris"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Weather & Location MCP Server
A beginner-friendly MCP server built with TypeScript, Node.js, the MCP TypeScript SDK, OpenWeather API, dotenv, and zod.
Features
getCurrentWeather(city)getForecast(city)getAirQuality(city)Sunrise and sunset information
Environment variable support with
dotenvInput validation with
zodTypeScript response types for API data
Helpful error handling
Related MCP server: Weather MCP Server
Tech Stack
TypeScript
Node.js
@modelcontextprotocol/sdkOpenWeather API
dotenvzod
Project Structure
weather-location-mcp-server/
|- src/
| |- index.ts
| |- weatherApi.ts
| `- types.ts
|- .env.example
|- .gitignore
|- package.json
|- README.md
`- tsconfig.jsonSetup
1. Install dependencies
npm install2. Create your environment file
Create a .env file in the project root:
OPENWEATHER_API_KEY=your_api_key_hereYou can copy from .env.example and replace the placeholder value with your real OpenWeather API key.
3. Build the project
npm run buildRun the Server
Development mode
npm run devProduction build
npm run build
npm run startThe server runs over stdio, so it will wait quietly for an MCP client to connect.
Available Tools
getCurrentWeather
Input:
{
"city": "Delhi"
}Returns:
City name
Country
Weather condition and description
Temperature
Feels-like temperature
Humidity
Sunrise time
Sunset time
getForecast
Input:
{
"city": "Delhi"
}Returns:
City name
Country
First 5 forecast entries
Temperature
Weather condition and description
getAirQuality
Input:
{
"city": "Delhi"
}Returns:
AQI value
AQI label
CO
NO2
O3
PM2.5
PM10
Using with Codex
If you want Codex to use this server as an MCP tool provider, add a project config file at .codex/config.toml:
[mcp_servers.weather_location]
command = "node"
args = ["dist/index.js"]
cwd = "D:\\My PC\\Coding\\web development\\Weather & Location MCP Server"
enabled = true
startup_timeout_sec = 20
tool_timeout_sec = 60Then restart Codex or open a new thread in the project.
Notes
Keep
.envout of GitHub because it contains your API key.Keep
.codex/out of GitHub if it contains your personal local Codex setup.This project uses Node.js native
fetch.
License
ISC
Available Tools
3 toolsgetAirQualityGet Air QualityB
Get air quality information for a city
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes | The city name |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden for behavioral disclosure. It provides no information about side effects, constraints, rate limits, or what data is returned (e.g., AQI, pollutants). The tool is essentially a black box beyond its name.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, clear sentence with no extraneous words. It is appropriately sized for a simple tool and front-loads the key action.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with no output schema, the description should hint at what information is returned (e.g., air quality index, specific pollutants). It does not, leaving the agent uncertain about the tool's output beyond 'air quality information'.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% (one parameter 'city' with description 'The city name'). The description adds no additional meaning beyond what the schema provides, so it meets the baseline but does not enhance understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description 'Get air quality information for a city' clearly states the action (get) and resource (air quality information) with context (city). It distinguishes from sibling tools like getCurrentWeather and getForecast, which focus on weather rather than air quality.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
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 vs. siblings. The description does not mention alternatives like getCurrentWeather for weather data or specify any prerequisites or context for when air quality should be retrieved.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
getCurrentWeatherGet Current WeatherC
Get the current weather for a city
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes | The city name |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, and the description omits behavioral traits such as data freshness, rate limits, or whether the result is real-time vs cached. For a simple read tool, this is insufficiently transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, concise sentence that efficiently conveys the core purpose with no extraneous words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is simple with one parameter and no output schema, but the description does not specify what data is returned (e.g., temperature, conditions). This leaves the agent guessing about the output format.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema covers 100% of parameters, and the description does not add meaning beyond what the schema provides (city name). Baseline of 3 is appropriate since schema already defines the parameter.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Get') and resource ('current weather') with a city scope. It distinguishes from siblings (getAirQuality, getForecast) by focusing on current weather, though it does not explicitly contrast them.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
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 (e.g., getForecast for future data, getAirQuality for pollutants). The agent must infer usage from the name alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
getForecastGet ForecastC
Get a weather forecast for a city
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes | The city name |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, and the description provides no behavioral context such as read-only nature, required permissions, or output format. For a forecast tool, details like time range or data units would be helpful.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence with no extraneous words. It efficiently conveys the basic purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (1 parameter, no output schema), the description is too minimal. It lacks information about what the forecast includes (e.g., temperature, precipitation) and how it differs from getCurrentWeather.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% and the 'city' parameter description 'The city name' is adequate. The description adds no additional meaning beyond the schema, so a baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Get a weather forecast for a city', which matches the tool name and indicates a specific resource. However, it does not distinguish from sibling tools like getCurrentWeather, which could also involve weather data.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
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 its siblings (getAirQuality, getCurrentWeather). The agent is left to infer the difference from 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.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v1.0.0- First observed
getAirQuality - First observed
getCurrentWeather - First observed
getForecast
TDQS
Scored across 3 tools
Each tool returns a distinct type of weather information (air quality, current weather, forecast), so an agent can easily select the correct one without ambiguity.
All tool names follow a consistent 'get' + noun pattern in camelCase (getAirQuality, getCurrentWeather, getForecast), making them predictable and easy to remember.
Three tools is a well-scoped set for a weather service, covering the most common queries without being overly sparse or bloated.
The set covers the essential weather operations (current, forecast, air quality). One could argue for additional tools like weather alerts or historical data, but the core is complete.
Maintenance
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
Free, keyless real-time air quality (US AQI plus PM2.5, PM10, ozone, NO2, SO2, CO) for any city.
Global weather via Open-Meteo: forecast, ERA5 archive, marine, air quality, geocoding, elevation.
Global weather API: forecasts, historical data, marine, ski, astronomy and timezone.
Air Quality MCP — wraps air-quality-api.open-meteo.com (free, no auth)
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides access to real-time weather data, 5-day forecasts, and air quality information for any city using the OpenWeatherMap API.MIT
- AlicenseNot gradedqualityDmaintenanceProvides access to real-time weather data, 5-day forecasts, air quality information, and weather comparisons across multiple cities using the free OpenWeatherMap API.MIT
- AlicenseNot gradedqualityDmaintenanceEnables querying real-time weather and 5-day forecasts for any city using the OpenWeatherMap API.134MIT
- FlicenseNot gradedqualityDmaintenanceProvides weather data, forecasts, air quality, and location services via OpenWeatherMap API integration.13-