Skip to main content
Glama

MCP SSE Server

by aihes

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

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.

Tools

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

  1. 概述
    1. 特征
      1. 成分
        1. 入门
          1. 服务器功能
            1. 客户端功能
              1. URI 模板
                1. 执照

                  Related MCP Servers

                  • -
                    security
                    A
                    license
                    -
                    quality
                    MCP Server simplifies the implementation of the Model Context Protocol by providing a user-friendly API to create custom tools and manage server workflows efficiently.
                    Last updated -
                    4
                    3
                    TypeScript
                    MIT License
                  • -
                    security
                    A
                    license
                    -
                    quality
                    This server implements the Model Context Protocol (MCP) to handle asynchronous tasks with real-time status tracking, robust error handling, and automatic resource management.
                    Last updated -
                    2
                    1
                    JavaScript
                    MIT License
                  • -
                    security
                    -
                    license
                    -
                    quality
                    A specialized server that helps users create new Model Context Protocol (MCP) servers by providing tools and templates for scaffolding projects with various capabilities.
                    Last updated -
                    1
                    TypeScript
                  • A
                    security
                    F
                    license
                    A
                    quality
                    A Model Context Protocol (MCP) server that interacts with system APIs, allowing users to check connections, search employees, register breakfast, and update chemical information by shifts.
                    Last updated -
                    21
                    42
                    JavaScript

                  View all related MCP servers

                  MCP directory API

                  We provide all the information about MCP servers via our MCP API.

                  curl -X GET 'https://glama.ai/api/mcp/v1/servers/aihes/mcp-sse-server'

                  If you have feedback or need assistance with the MCP directory API, please join our Discord server