MCP SSE Server

by aihes
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Implements an MCP server using Express.js to provide SSE (Server-Sent Events) for real-time communication between clients and the AI system

  • Used for package management and running scripts for the MCP server and client examples

MCP SSE 服务器和客户端示例

该存储库包含基于 SSE(服务器发送事件)的 MCP(模型上下文协议)服务器和客户端的完整示例实现。

概述

模型上下文协议 (MCP) 是一种专为人工智能系统设计的通信协议。本实现演示了如何创建一个使用服务器发送事件 (SSE) 与客户端进行实时通信的 MCP 服务器。

特征

  • 基于 SSE 的 MCP 服务器:使用 Express.js 和 MCP SDK 的 SSEServerTransport 实现服务器
  • 交互式 MCP 客户端:提供连接到 SSE 服务器的客户端实现
  • 工具实现:包括示例工具(加法、乘法)和适当的描述
  • 动态资源:使用 URI 模式演示动态资源模板
  • 调试支持:包括详细的日志记录和调试配置

成分

  • server.js - 使用 StdioServerTransport 的基本 MCP 服务器
  • sse-server.js - 使用 SSEServerTransport 和 Express.js 的 MCP 服务器
  • client.js - 基本服务器的客户端
  • sse-client.js - SSE 服务器的客户端

入门

  1. 安装依赖项:
    npm install
  2. 启动 SSE 服务器:
    npm run sse-server
  3. 在另一个终端中,运行 SSE 客户端:
    npm run sse-client

服务器功能

SSE 服务器提供:

  • 加法和乘法的工具端点
  • 具有模板支持的动态问候资源
  • 为多个客户端提供适当的会话管理
  • 用于调试的详细日志记录

客户端功能

SSE 客户端演示:

  • 连接到 SSE 服务器
  • 列出可用的工具和资源
  • 调用带参数的工具
  • 读取具有动态参数的资源

URI 模板

服务器演示了如何向客户端公开 URI 模板,让客户端了解如何动态构建资源 URI:

greeting://{name} - Replace {name} with any name to get a personalized greeting

执照

麻省理工学院

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

Tools

使用服务器发送事件 (SSE) 进行实时通信的模型上下文协议 (MCP) 服务器的实现,提供计算工具和动态资源模板。

  1. Overview
    1. Features
      1. Components
        1. Getting Started
          1. Server Features
            1. Client Features
              1. URI Templates
                1. License
                  ID: ysdb8lhfed