
MCP - Model Context Protocol
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.
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?
- Building AI applications that require real-time weather data.
- Integrating weather alerts into existing applications.
- 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.
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.
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 implementationstools/
→ LLM-callable functionsprompts/
→ 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]
index.js
What Happens After Once your index.js
is ready, it flows like this:
Claude Desktop ↔ stdio ↔ Server Transport ↔ McpServer ↔ Tools (1)