MCP Weather Client & Server Example with Typescript
LocalAbout MCP Weather Client & Server Example with Typescript
This TypeScript tutorial project demonstrates MCP with a CLI client and a weather tools server. The client uses Anthropic Claude to call weather alert and forecast tools over stdio.
Key features
- 01TypeScript CLI client and server
- 02Weather alert and forecast tools
- 03MCP communication over stdio
- 04Anthropic Claude tool calls
- 05API key configuration through .env
Use cases
- 01Learn MCP client-server communication
- 02Try weather alerts through an AI client
- 03Request weather forecasts with Claude
MCP support
Includes an MCP server that exposes weather alert and forecast tools, plus a CLI client that calls them over stdio.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEMCP Weather Client & Server Example with Typescript
This is a tutorial project demonstrating the use of the Model Context Protocol (MCP) with Anthropic's Claude models. The app includes a simple CLI-based client and a weather tools server, which communicates via MCP over stdio.
Features
- 🔌 MCP-compliant server exposing tools like
get-alertsandget-forecast - 🤖 CLI client using Anthropic Claude (via the
@anthropic-ai/sdk) to call tools - 🛠️ Written in TypeScript for the client and server
- 🌦️ Example tools provide weather alert and forecast info
- 🔐 Supports
.envconfiguration withANTHROPIC_API_KEY
Getting Started
Prerequisites
- Node.js v20+
- An Anthropic API key
- NOTE: You will need credits added
Running
- In
client:npm install && npm run build - In
server:npm install && npm run build - In
client:node build/index.js ../server/build/index.js
Comments
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.