Token导航 LogoToken导航TokenDH.com
MCP Handson Examples logo
地图位置stdio官方级别未说明来源级核验

MCP Handson Examples

MCP Server

MCP天气工具服务器提供天气警报、预报及天气术语表查询功能,适用于天气信息查询和学习MCP服务器开发。

工具数

5

提示词数

0

GitHub Stars

0

资源数

0
位置天气Python本地部署

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

sajankp

提供方

sajankp

最后核验

2026/5/17 20:20

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -r requirements.txt

详细介绍

MCP Weather Tool Server

This project is a demonstration of the mcp library to create a tool server that provides weather-related information. It also includes other example tools and resources.

This is intended as a hands-on learning project for understanding how an MCP server works.

Quick Start

  1. Start the MCP server by running:
./run.sh
  1. Create a .vscode/mcp.json file with the following content:
{
	"servers": {
		"weather-http": {
			"url": "http://localhost:8000/mcp",
			"type": "http"
		}
	},
	"inputs": []
}

This will start the weather_streamable_http server that you can connect to via the MCP protocol.

Features

This server exposes several tools and resources:

Weather Tools

  • get_alerts(state: str): Get weather alerts for a US state.

* state: Two-letter US state code (e.g., CA, NY).

  • get_forecast(latitude: float, longitude: float): Get the weather forecast for a specific location.

* latitude: The latitude of the location. * longitude: The longitude of the location.

Other Tools

  • add_2_numbers(a: int, b: int): Adds two numbers together.
  • greet_user_formal_tool(name: str): Greets a user formally.
  • greet_user_street_style_tool(name: str): Greets a user in a "street" style.

Prompts

  • greet_user_prompt(name: str): A prompt that will greet the user '''Laurent''' formally, and all other users in a "street" style.

Resources

  • resource://weather_glossary/: Retrieves a full glossary of weather-related terms.
  • resource://weather_glossary_term/{word}: Retrieves the definition of a specific term from the weather glossary.

Setup and Installation

  1. Install the required Python packages:
    pip install -r requirements.txt

Running the Server

This project includes three different implementations for running the MCP server.

1. Standard I/O (stdio)

This runs the server over standard input/output.

python weather.py

2. Server-Sent Events (SSE)

This runs the server using Server-Sent Events.

python weather_sse.py

3. Streamable HTTP Server

This runs the server as a streamable HTTP application using uvicorn. This is the most feature-rich example, including the glossary resources and extra tools.

You can run it using the provided shell script:

./run.sh

This will start the server on http://localhost:8000.

目录标签

目录标签

位置天气Python本地部署天气服务MCP服务器学习项目工具开发

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

5

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP