MCP - Model Context Protocol

MCP - Model Context Protocol

By AdiGo22 GitHub

MCP Server using TypeScript and JavaScript made with official MCP docs handling US Weather data having context for two tools - showing weather forecast and weather alerts for US based location. Used Zod for data validation and architectured two folders - src and build , development (ts) and production (js) respectively.

javascript weather
Overview

What is MCP?

MCP, or Model Context Protocol, is an open standard that allows developers to create secure, two-way connections between their data sources and AI-powered tools, specifically designed to handle US weather data.

How to use MCP?

To use MCP, developers can set up an MCP server using TypeScript and JavaScript, following the provided architecture. They can implement protocol handlers and connect their applications to the server for weather forecasts and alerts.

Key features of MCP?

  • Client-server architecture for flexible data handling
  • Support for TypeScript and JavaScript
  • Data validation using Zod
  • Handles weather forecasts and alerts for US locations

Use cases of MCP?

  1. Building AI applications that require real-time weather data.
  2. Integrating weather alerts into existing applications.
  3. Developing tools that utilize AI for weather predictions.

FAQ from MCP?

  • What programming languages does MCP support?

MCP supports TypeScript and JavaScript for server implementation.

  • Can MCP handle data from multiple sources?

Yes, MCP is designed to connect to multiple servers, allowing for diverse data integration.

  • Is there a specific setup required for using MCP?

Developers need to follow the architecture guidelines and set up the necessary directories for TypeScript and compiled JavaScript.

Content

MCP - Model Context Protocol

About MCP

The Model Context Protocol (MCP) is an open standard that enables developers to build secure, two-way connections between their data sources and AI-powered tools. The architecture is straightforward: developers can either expose their data through MCP servers or build AI applications (MCP clients) that connect to these servers.

👉 Learn more


MCP follows a client-server architecture where a host application can connect to multiple servers.


Architecture

src/ → TypeScript source
build/ → Compiled JavaScript


```bash
weather/
├── src/        # TypeScript source
│   └── index.ts
├── build/      # Compiled JavaScript
│   └── index.js
├── tsconfig.json
└── package.json

src/ Directory (TypeScript Source)

Purpose:

  • Contains development-time code written in TypeScript
  • You implement MCP protocol handlers here (Resources, Tools, Prompts)
  • Also contains logic, type definitions, SDKs, etc.

Key Files:

  • index.ts → Entry point for your MCP server
  • MCP concepts:
    • resources/ → MCP Resource implementations
    • tools/ → LLM-callable functions
    • prompts/ → Prompt templates / management

build/ Directory (Compiled JavaScript)

Purpose:

  • Holds runtime code after TS compilation
  • This is the folder Claude Desktop interacts with via:
    node build/index.js

Traits:

  • Compiled, production-ready JavaScript
  • No TS needed after this stage
  • Clean deployable output

⚙️ Data Flow Pipeline

graph LR
    A[Developer Writes TS Code] --> B[src/index.ts]
    B --> C[TypeScript Compiler tsc]
    C --> D[build/index.js]
    D --> E[Node.js Runtime]
    E --> F[Claude Desktop IPC]

What Happens After index.js

Once your index.js is ready, it flows like this:

Claude Desktop ↔ stdio ↔ Server Transport ↔ McpServer ↔ Tools (1)

No tools information available.

Model Context Protocol (MCP) server that provides weather information from Malaysia Government's Open API

agent weather
View Details

Adapters for integrating Model Context Protocol (MCP) tools with LangChain.js applications, supporting both stdio and SSE transports.

javascript typescript
View Details

MCP Server for Aviation LLM interactions

aviation weather
View Details

Adapters for integrating Model Context Protocol (MCP) tools with LangChain.js applications, supporting both stdio and SSE transports.

javascript typescript
View Details
MCP SERVER
MCP SERVER by Kostya-Zhdanovich

-

mcp-server weather
View Details

-

mcp-weather-server weather
View Details

-

mcp-weather-server weather
View Details