mcpField
M
My MCP Weather Server

My MCP Weather Server

Local
github.com/EnigmaticHarvestMedia & Design0Updated 73w ago

About My MCP Weather Server

A TypeScript example MCP server for developers testing MCP clients or agents. It returns structured dummy weather data for a few predefined cities over Streamable HTTP.

Key features

  1. 01get_city_weather tool
  2. 02Dummy weather for predefined cities
  3. 03Metric or imperial units
  4. 04Structured output schema
  5. 05In-memory session handling

Use cases

  1. 01Testing an MCP client’s tool calls
  2. 02Prototyping an agent that uses weather tools

MCP support

Implements MCP with Streamable HTTP transport and exposes the get_city_weather tool to MCP clients.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

My MCP Weather Server

This project is an example of an MCP (Model Context Protocol) server built with the @modelcontextprotocol/sdk for TypeScript. It demonstrates how to expose a simple tool that provides dummy weather information for a few predefined cities.

This server is intended to be used as a backend for an MCP-compliant client, such as an LLM-powered agent that can leverage the tools exposed by this server.

Features

  • MCP Compliant: Implements the Model Context Protocol.
  • Streamable HTTP Transport: Uses the recommended StreamableHTTPServerTransport for communication.
  • Tool Exposure: Exposes a get_city_weather tool.
    • Input: city (string, e.g., "paris", "london", "tokyo") and optional unit (enum: "metric" or "imperial", defaults to "metric").
    • Output: Returns dummy weather information including temperature, description, and humidity.
    • Structured Output: Provides structuredContent matching a defined outputSchema for reliable parsing by clients.
  • Basic Session Management: Demonstrates simple in-memory session handling for StreamableHTTPServerTransport.

Prerequisites

  • Node.js (v18 or higher recommended, as per MCP SDK)
  • npm (or yarn/pnpm)

Setup

  1. Clone the repository (or create the project files):

    # If you have it in a git repo:
    # git clone <your-repo-url>
    # cd my-mcp-weather-server
    
    # Otherwise, ensure you have the project directory with src/server.ts, package.json, tsconfig.json
    
  2. Install dependencies:

    npm install
    

Running the Server

For Development

This command uses ts-node to run the TypeScript source directly and nodemon to automatically restart the server on file changes.

npm run build
npm start

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.