Cover image
Try Now
2025-03-07

基于SSE的MCP客户和服务器的工作模式

3 years

Works with Finder

3

Github Watches

26

Github Forks

180

Github Stars

SSE-based Server and Client for MCP

smithery badge

This demonstrates a working pattern for SSE-based MCP servers and standalone MCP clients that use tools from them. Based on an original discussion here.

Usage

Note: Make sure to supply ANTHROPIC_API_KEY in .env or as an environment variable.

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 ...

Why?

This means the MCP server can now be some running process that agents (clients) connect to, use, and disconnect from whenever and wherever they want. In other words, an SSE-based server and clients can be decoupled processes (potentially even, on decoupled nodes). This is different and better fits "cloud-native" use-cases compared to the STDIO-based pattern where the client itself spawns the server as a subprocess.

Installing via Smithery

To install SSE-based Server and Client for Claude Desktop automatically via Smithery:

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

Server

weather.py is a SSE-based MCP server that presents some tools based on the National Weather Service APIs. Adapted from the MCP docs' example STDIO server implementation.

By default, server runs on 0.0.0.0:8080, but is configurable with command line arguments like:

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

Client

client.py is a MCP Client that connects to and uses tools from the SSE-based MCP server. Adapted from the MCP docs' example STDIO client implementation.

By default, client connects to SSE endpoint provided in the command line argument like:

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

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • https://reddgr.com
  • Delivers concise Python code and interprets non-English comments

  • 林乔安妮
  • A fashion stylist GPT offering outfit suggestions for various scenarios.

  • 田中 楓太
  • A virtual science instructor for engaging and informative lessons.

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • GeyserMC
  • 与Minecraft客户端/服务器通信的库。

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • awslabs
  • AWS MCP服务器 - 将AWS最佳实践直接带入您的开发工作流程的专门MCP服务器

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • 1Panel-dev
  • 💬MAXKB是一种现成的AI聊天机器人,它集成了检索功能增强的生成(RAG)管道,支持强大的工作流程并提供高级的MCP工具使用功能。

  • appcypher
  • 很棒的MCP服务器 - 模型上下文协议服务器的策划列表

  • chongdashu
  • 使用模型上下文协议(MCP),启用Cursor,Windsurf和Claude Desktop等AI助手客户,以通过自然语言控制虚幻引擎。

    Reviews

    1 (1)
    Avatar
    user_CER7gZKV
    2025-04-17

    As a dedicated user of mcp-sse, I must say it’s a fantastic tool for simplifying server-sent event (SSE) setups! Created by sidharthrajaram, this GitHub-hosted project provides a seamless experience with clear instructions and efficient implementation. It's a time-saver for developers working with real-time applications. Highly recommended!