m

mcp-sse天气服务

@sidharthrajaram/mcp-sse
0 Stars 1.2k 次浏览 sidharthrajaram 更新于 2026-08-23

这个基于SSE的MCP服务器允许用户连接并交互以获取国家气象局API的天气警报和预报。

该服务暂未提供标准配置,请参考 README 手动接入

服务介绍

基于 SSE 的 MCP 服务器和客户端

smithery 徽章

这展示了基于 SSE 的 MCP 服务器和独立的 MCP 客户端使用工具的工作模式。基于原始讨论这里

使用方法

注意:确保在 .env 文件中或作为环境变量提供 ANTHROPIC_API_KEY

uv run weather.py

uv run client.py http://0.0.0.0:8080/sse
Initialized SSE client...
Listing tools...

Connected to server with tools: ['get_alerts', 'get_forecast']

MCP Client Started!
Type your queries or 'quit' to exit.

Query: whats the weather like in Spokane?

I can help you check the weather forecast for Spokane, Washington. I'll use the get_forecast function, but I'll need to use Spokane's latitude and longitude coordinates.

Spokane, WA is located at approximately 47.6587° N, 117.4260° W.
[Calling tool get_forecast with args {'latitude': 47.6587, 'longitude': -117.426}]
Based on the current forecast for Spokane:

Right now it's sunny and cold with a temperature of 37°F and ...

为什么?

这意味着 MCP 服务器现在可以是运行中的进程,代理(客户端)可以在任何时间、任何地点连接到它、使用它并断开与它的连接。换句话说,基于 SSE 的服务器和客户端可以是解耦的过程(甚至可能是,在解耦的节点上)。相比 STDIO 模式下客户端自己启动服务器作为子进程的情况,这种方式更适合“云原生”用例,并且有所不同。

通过 Smithery 安装

要通过 Smithery 自动安装 Claude Desktop 的基于 SSE 的服务器和客户端:

npx -y @smithery/cli install @sidharthrajaram/mcp-sse --client claude

服务器

weather.py 是一个基于 SSE 的 MCP 服务器,它基于国家气象服务 API 提供了一些工具。改编自 MCP 文档中的示例 STDIO 服务器实现。

默认情况下,服务器运行在 0.0.0.0:8080,但可以通过命令行参数进行配置,例如:

uv run weather.py --host <your host> --port <your port>

客户端

client.py 是一个 MCP 客户端,它连接到基于 SSE 的 MCP 服务器并使用其提供的工具。改编自 MCP 文档中的示例 STDIO 客户端实现。

默认情况下,客户端通过命令行参数提供的 SSE 端点连接,例如:

uv run client.py http://0.0.0.0:8080/sse

相关 MCP 服务