MCP Weather Server
Planned future integration that will provide GitHub Copilot with access to weather data services when MCP support is added to Copilot
Click on "Deploy 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., "@MCP Weather Serverwhat's the weather in Tokyo right now?"
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.
MCP Data Server ๏ฟฝ
A comprehensive Model Context Protocol (MCP) server that provides various data services, starting with real-time weather data and designed for easy extension to other data sources.
๐ Features
Modular Architecture: Easy to extend with new data services
Real-time Weather Data: Get current weather conditions for any city
MCP Protocol Compliance: Fully compatible with the Model Context Protocol
TypeScript Support: Written in TypeScript for better type safety
Stdio Transport: Uses standard input/output for communication
Extensible Design: Ready for news, finance, sports, and other data services
Related MCP server: Weather MCP Server
๐ Prerequisites
Node.js (v18 or higher)
npm or yarn package manager
TypeScript support
๐ ๏ธ Installation
Clone the repository:
git clone https://github.com/ParthibanRajasekaran/mcp-weather.git
cd mcp-weatherInstall dependencies:
npm installBuild the project (optional):
npm run build๐ฏ Usage
Running the Server
Development Mode
npm run devProduction Mode
npm run build
npm startMCP Configuration
Add the following configuration to your MCP client's configuration file (.vscode/mcp.json):
{
"servers": {
"mcp-data-server": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"tsx",
"src/main.ts"
]
}
}
}๐ง Available Services
Weather Service
getWeather
Get current weather data for a specified city.
Parameters:
city(string): The name of the city to get weather for
Example Usage:
// MCP client call
const weather = await mcpClient.callTool("getWeather", { city: "London" });Response Format:
{
"latitude": 51.51147,
"longitude": -0.13078308,
"current": {
"time": "2025-07-08T06:15",
"temperature_2m": 13.9,
"apparent_temperature": 11,
"is_day": 1,
"rain": 0
},
"hourly": {
"time": [...],
"temperature_2m": [...]
}
}๐ฎ Future Services (Planned)
News Service: Get latest news from various sources
Finance Service: Stock prices, market data, cryptocurrency
Sports Service: Live scores, team statistics, schedules
Social Media Service: Trending topics, social metrics
Maps Service: Location data, directions, places
๐๏ธ Architecture
Project Structure
mcp-weather/
โโโ src/
โ โโโ main.ts # Main server entry point
โ โโโ services/ # Data service implementations
โ โ โโโ weather.ts # Weather service
โ โโโ types/ # TypeScript type definitions
โ โ โโโ weather.ts # Weather-related types
โ โ โโโ service.ts # Base service interfaces
โ โโโ utils/ # Utility functions
โ โโโ registry.ts # Service registry
โโโ .vscode/
โ โโโ mcp.json # MCP client configuration
โโโ package.json # Project dependencies and scripts
โโโ tsconfig.json # TypeScript configuration
โโโ README.md # This fileTransport Layer
The server uses StdioServerTransport for communication:
Input: Standard input (stdin)
Output: Standard output (stdout)
Protocol: JSON-RPC over stdio
Benefits: Simple, reliable, and widely supported
Service Architecture
Each service follows this pattern:
// 1. Define types
interface ServiceInput { /* ... */ }
interface ServiceOutput { /* ... */ }
// 2. Create service class
class MyService {
async getData(input: ServiceInput): Promise<string> {
// Implementation
}
}
// 3. Register with MCP server
server.tool("myTool", "Description", schema, handler);๐ค AI Assistant Integration
Claude Desktop (Available Now)
Your MCP server works with Claude Desktop out of the box! See docs/AI_INTEGRATION.md for setup instructions.
GitHub Copilot (Coming Soon)
GitHub Copilot doesn't support MCP yet, but your server is ready! See docs/GITHUB_COPILOT_INTEGRATION.md for:
Current workarounds using VS Code extensions
What to expect when MCP support is added
Example integration patterns
VS Code Extension Example
Check out examples/vscode-extension/ for a working example that integrates your MCP server with VS Code today!
๐ MCP Inspector Integration
For debugging and development, you can use the MCP Inspector:
Install the MCP Inspector:
npm install -g @modelcontextprotocol/inspectorRun the inspector:
npx @modelcontextprotocol/inspector npx tsx src/main.tsOpen the inspector in your browser at
http://localhost:5173
๐งช Development
Adding New Services
Create Type Definitions (
src/types/myservice.ts):
export interface MyServiceInput {
query: string;
}
export const MyServiceSchema = z.object({
query: z.string().describe("Your query parameter")
});Implement Service (
src/services/myservice.ts):
export class MyService {
async getData(input: MyServiceInput): Promise<string> {
// Your implementation
return "Service response";
}
}Register Tool (in
src/main.ts):
server.tool(
"myTool",
"Description of my tool",
MyServiceSchema,
async ({ query }: { query: string }) => {
const result = await myService.getData({ query });
return {
content: [{ type: "text", text: result }]
};
}
);Development Scripts
npm run dev- Run in development mode with hot reloadnpm run build- Build the TypeScript projectnpm start- Run the built projectnpm test- Run all testsnpm run test:watch- Run tests in watch modenpm run test:coverage- Run tests with coverage report
๐ API Details
Weather Service API
Geocoding:
https://geocoding-api.open-meteo.com/v1/searchWeather:
https://api.open-meteo.com/v1/forecastRate Limit: Free tier, no authentication required
Model: UKMO Seamless (UK Met Office)
๐ค Contributing
We welcome contributions for new data services! Here's how:
Fork the repository
Create a feature branch:
git checkout -b feature/new-serviceAdd your service following the architecture above
Add tests and documentation
Commit your changes:
git commit -m 'Add new service'Push to the branch:
git push origin feature/new-serviceOpen a Pull Request
Service Guidelines
Each service should be self-contained in its own file
Use TypeScript for type safety
Include proper error handling
Add JSDoc comments for public methods
Follow the existing code style
๐ License
This project is licensed under the ISC License - see the LICENSE file for details.
๐ Acknowledgments
Model Context Protocol for the protocol specification
Open-Meteo for the free weather API
TypeScript for type safety
๐ Support
If you encounter any issues or have questions:
Check the Issues page
Create a new issue with detailed information
Contact: rajasekaran.parthiban7@gmail.com
๐ Changelog
v1.0.0
Initial release with weather service
Modular architecture for easy extension
MCP protocol compliance
TypeScript implementation
Stdio transport support
Made with โค๏ธ by ParthibanRajasekaran | Ready for extension to any data service! const server = new McpServer({ name: "MCP Weather Server", version: "1.0.0", description: "A server that provides weather data" });
## ๐ง Tools Available
### `getWeather`
Retrieves current weather conditions and forecasts for a specified city.
**Parameters:**
- `city` (string): The name of the city to get weather data for
**Returns:**
- Current temperature, apparent temperature, and conditions
- Hourly temperature forecast for the next 7 days
- Location coordinates and timezone information
**Example Usage:**
```typescript
// Through MCP client
const weatherData = await mcpClient.callTool("getWeather", { city: "London" });๐ Project Structure
mcp-weather/
โโโ .vscode/
โ โโโ mcp.json # MCP server configuration
โโโ weather/
โ โโโ main.ts # Main server implementation
โโโ package.json # Dependencies and scripts
โโโ tsconfig.json # TypeScript configuration
โโโ README.md # This file๐ MCP Inspector Integration
To use with the MCP Inspector for debugging and development:
Configure MCP Client: Add the server to your MCP configuration file (
.vscode/mcp.json):
{
"servers": {
"my-weather-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "tsx", "weather/main.ts"]
}
}
}Launch Inspector: The server can be inspected using MCP-compatible tools and inspectors.
Debug Mode: Use the development server for real-time debugging:
npm run dev๐ API Integration
The server integrates with two Open-Meteo APIs:
Geocoding API
Endpoint:
https://geocoding-api.open-meteo.com/v1/searchPurpose: Convert city names to coordinates
Features: Multi-language support, fuzzy matching
Weather API
Endpoint:
https://api.open-meteo.com/v1/forecastPurpose: Retrieve weather data using coordinates
Model: UK Met Office Seamless model (
ukmo_seamless)Data: Current conditions + hourly forecasts
๐ ๏ธ Development
Available Scripts
# Development server with hot reload
npm run dev
# Build TypeScript to JavaScript
npm run build
# Start production server
npm start
# Run tests
npm testAdding New Features
New Tools: Add tools to the server using the
server.tool()methodEnhanced Data: Extend the weather API calls to include more parameters
Error Handling: Improve error handling for edge cases
๐ Usage Examples
Basic Weather Query
// Get weather for London
const result = await getWeather({ city: "London" });
// Current conditions
console.log(`Temperature: ${result.current.temperature_2m}ยฐC`);
console.log(`Feels like: ${result.current.apparent_temperature}ยฐC`);
console.log(`Rain: ${result.current.rain}mm`);Multi-City Comparison
const cities = ["London", "Paris", "New York", "Tokyo"];
const weatherData = await Promise.all(
cities.map(city => getWeather({ city }))
);๐ Error Handling
The server includes comprehensive error handling:
Invalid Cities: Returns helpful error messages for non-existent cities
API Failures: Graceful handling of network issues
Data Validation: Input validation using Zod schemas
๐ Data Schema
Current Weather Response
interface WeatherResponse {
latitude: number;
longitude: number;
timezone: string;
current: {
time: string;
temperature_2m: number;
apparent_temperature: number;
is_day: number;
rain: number;
};
hourly: {
time: string[];
temperature_2m: number[];
};
}๐ค Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
๐ License
This project is licensed under the ISC License - see the LICENSE file for details.
๐ Acknowledgments
Open-Meteo for providing free weather data
Model Context Protocol for the MCP specification
UK Met Office for the weather model data
๐ Support
For questions or issues:
Create an issue on GitHub
Check the MCP Documentation
Built with โค๏ธ using the Model Context Protocol
Available Tools
1 toolgetWeatherC
Get the current weather for a given location
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes | The city to get the weather for |
TDQS
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 mentions 'current weather' but doesn't specify data freshness, rate limits, error handling, or authentication needs. For a tool with zero annotation coverage, this leaves significant gaps in understanding its operational behavior.
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, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and wastes no space, making it easy to parse quickly.
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 no annotations, no output schema, and a simple parameter, the description is too minimal. It doesn't explain what 'current weather' returns (e.g., temperature, humidity), potential errors, or usage constraints, leaving the agent with incomplete context for effective tool invocation.
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 description coverage is 100%, with the parameter 'city' clearly documented in the schema. The description adds no additional parameter details beyond what the schema provides, such as format examples or constraints, so it meets the baseline for adequate but not enhanced coverage.
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 for a given location'), making the purpose immediately understandable. It doesn't need to distinguish from siblings since none exist, but it could be slightly more specific about what 'current weather' includes (e.g., temperature, conditions).
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?
The description provides no guidance on when to use this tool versus alternatives, prerequisites, or limitations. It simply states what it does without context about appropriate scenarios or constraints, leaving the agent to infer usage entirely.
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.
1 tool update
- First observed
getWeather
TDQS
Scored across 1 tool
With only one tool, there is no possibility of confusion or overlap between tools. The tool's purpose is clearly defined and distinct by default.
A single tool inherently has perfect naming consistency, as there are no other tools to compare it against. The name 'getWeather' follows a clear verb_noun pattern.
A single tool for a weather server is too minimal for the apparent scope. It lacks essential operations like forecasts, historical data, or location search, making it feel incomplete and limiting for agent workflows.
The tool surface is severely incomplete for a weather domain. It only provides current weather, missing forecasts, alerts, multi-location queries, and other standard weather API features, which will cause agent failures in broader tasks.
Maintenance
Related MCP Connectors
MCP server for weather with reasoning โ umbrella advice, outdoor checks, city comparisons.
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
An MCP server for weather information by @kulybaba
An MCP server for weather information by @kulybaba
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides current weather information and 3-day forecasts for specified cities using the Open-Meteo API.1-
- FlicenseBqualityDmaintenanceA Model Context Protocol server that provides current weather forecasts for specific locations and active weather alerts for US states.2-
- AlicenseBqualityCmaintenanceA Model Context Protocol server that provides weather information and forecasts based on user location or address input.65 npm8MIT
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables natural language weather queries for global cities, integrating with OpenWeather API to provide real-time weather information in an easy-to-read format.1-