MCP.so
ログイン

开发 SSE 类型的 MCP 服务

@cnych

开发 SSE 类型的 MCP 服务 について

claude mcp sse demo with server and client(cli、web)

基本情報

カテゴリ

その他

ランタイム

node

トランスポート

stdio

公開者

cnych

設定

以下の設定を使って、このサーバーを MCP 対応クライアントに追加してください。

{
  "mcpServers": {
    "mcp-sse-demo": {
      "command": "npx",
      "args": [
        "@modelcontextprotocol/inspector"
      ]
    }
  }
}

ツール

ツールは検出されませんでした

ツールは README から自動的に抽出されます。メンテナーは ## Tools という見出しの下に記載することで、このタブに反映できます。

概要

What is 开发 SSE 类型的 MCP 服务?

This project demonstrates how to build an MCP (Model Context Protocol) server using SSE (Server-Sent Events) for communication. It implements an intelligent mall service assistant that exposes product, inventory, and order management tools via SSE transport, allowing clients (e.g., web or CLI) to interact with LLMs through JSON-RPC 2.0 messages.

How to use 开发 SSE 类型的 MCP 服务?

Set up an Express server with endpoints /sse (SSE connection) and /messages (client message handling). Use SSEServerTransport from the MCP SDK to manage SSE connections. Start the server on port 8083 (configurable via PORT environment variable). For clients, use SSEClientTransport to connect to the SSE endpoint, then list tools and integrate with an LLM (e.g., Anthropic Claude) to handle user queries.

Key features of 开发 SSE 类型的 MCP 服务?

  • Implements MCP tools: getProducts, getInventory, getOrders, purchase
  • Uses SSE transport for web-based communication
  • Integrates with simulated product and order microservices
  • Supports real-time inventory checks and order placement
  • Works with LLMs like Anthropic Claude 3.5 Sonnet
  • Provides health check endpoint (/health) and graceful shutdown

Use cases of 开发 SSE 类型的 MCP 服务?

  • Building a web-based AI shopping assistant that accesses product catalogs
  • Enabling natural language queries to check inventory and place orders
  • Creating an MCP-powered customer support tool for retail
  • Demonstrating SSE-based MCP server development for tutorials or prototypes

FAQ from 开发 SSE 类型的 MCP 服务?

What is the difference between STDIO and SSE transports in MCP?

STDIO is used for local/command-line integration, while SSE is designed for web-based or network communication. Both use JSON-RPC 2.0 for message formatting.

What dependencies are required to run this server?

Node.js, Express, @modelcontextprotocol/sdk (for MCP and SSE transports), zod (for schema validation), and cors. The project uses TypeScript and ES modules.

Where is the data stored? Is it persistent?

Data (products, inventory, orders) is stored in-memory using simulated arrays. It is not persisted to a database; for production use, a database-backed microservice should replace the in-memory store.

What are the known limits of this implementation?

The implementation uses mock data and is intended for demonstration or educational purposes. It does not handle authentication, authorization, or large-scale concurrent connections beyond simple in-memory state.

Does this server support authentication or CORS?

The Express server includes CORS support (configurable via the ALLOWED_ORIGINS environment variable). The README does not mention authentication mechanisms; the provided code accepts requests without authentication.

コメント

「その他」の他のコンテンツ