MCP Servers

模型上下文协议服务器、框架、SDK 和模板的综合目录。

MCP server by tareq199923

创建于 5/19/2026
更新于 about 20 hours ago
Repository documentation and setup instructions

my-mcp

A small demonstration repository showing how to build Model Context Protocol (MCP) servers in Node.js using the @modelcontextprotocol/sdk package.

This project includes two example server scripts:

  • mcp.js - a minimal MCP server exposing a simple addition tool.
  • weather.js - an MCP server exposing a weather lookup tool using the Open-Meteo API.

Features

  • mcp.js

    • Registers an add tool that accepts two numbers and returns their sum.
    • Demonstrates basic MCP server setup and tool registration.
  • weather.js

    • Registers a get_weather tool that fetches current weather for a latitude/longitude pair.
    • Uses openmeteo and zod for API calls and input validation.
    • Returns both human-readable text and structured output.

Prerequisites

  • Node.js 18+ installed
  • Internet access for the weather example

Install

npm install

Usage

Run the addition server:

node mcp.js

Run the weather server:

node weather.js

Each script starts an MCP server using StdioServerTransport, so it expects MCP-compatible client communication over standard input/output.

File Overview

  • mcp.js - MCP server example registering an add tool.
  • weather.js - MCP server example registering a get_weather tool.
  • package.json - project metadata and dependencies.

Dependencies

  • @modelcontextprotocol/sdk - MCP server SDK
  • openmeteo - helper for Open-Meteo weather API requests
  • zod - runtime schema validation

Notes

  • The weather.js example uses Open-Meteo query parameters to request current weather variables.
  • The example returns structured data for temperature, humidity, wind, precipitation, and day/night state.

Extending this project

  • Add more MCP tools to either server.
  • Add a client implementation to send MCP requests and receive tool results.
  • Replace the default StdioServerTransport with another transport for different integration patterns.
快速设置
此服务器的安装指南

安装包 (如果需要)

npx @modelcontextprotocol/server-my-mcp

Cursor 配置 (mcp.json)

{ "mcpServers": { "tareq199923-my-mcp": { "command": "npx", "args": [ "tareq199923-my-mcp" ] } } }