Token导航 LogoToken导航TokenDH.com
MCP Streamable Servers logo
地图位置未说明官方级别未说明来源级核验

MCP Streamable Servers

MCP Server

MCP Streamable Servers 是一个支持HTTP和SSE协议的实时数据服务器,提供天气和产品数据的实时更新。

工具数

6

提示词数

0

GitHub Stars

0

资源数

0
位置天气TypeScriptHTTP服务器

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

pong-pk007

提供方

pong-pk007

最后核验

2026/5/17 20:22

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

🚀 MCP Streamable Servers

MCP (Model Context Protocol) Servers ที่รองรับทั้ง HTTP และ SSE (Server-Sent Events) สำหรับข้อมูลสภาพอากาศและข้อมูลสินค้า

📋 เซิร์ฟเวอร์ที่มีให้

🌤️ Weather Server

  • HTTP Version: src/weather-server.ts (Port 3003)
  • SSE Version: src/weather-server-sse.ts (Port 3004)
  • Features: ข้อมูลสภาพอากาศ, พยากรณ์อากาศ, Real-time updates

📱 Product Server

  • HTTP Version: src/product-server.ts (Port 3002)
  • SSE Version: src/product-server-sse.ts (Port 3005)
  • Features: ข้อมูลสินค้า, ค้นหาสินค้า, ตรวจสอบสต็อค, Real-time stock/price updates

🛠️ การติดตั้งและเรียกใช้

1. ติดตั้ง Dependencies

npm install

2. เรียกใช้เซิร์ฟเวอร์

HTTP Servers:

# Weather Server (Port 3003)
npm run dev:weather

# Product Server (Port 3002)
npm run dev:product

# รันทั้งสองเซิร์ฟเวอร์พร้อมกัน
npm run dev:all

SSE Servers:

# Weather Server SSE (Port 3004)
npm run dev:weather-sse

# Product Server SSE (Port 3005)
npm run dev:product-sse

# รันทั้งสองเซิร์ฟเวอร์ SSE พร้อมกัน
npm run dev:all-sse

3. ทดสอบการทำงาน

Health Check:

# HTTP Servers
npm run test:health

# SSE Servers
npm run test:health-sse

MCP Tools:

# HTTP Servers
npm run test:mcp

# SSE Servers
npm run test:mcp-sse

🌐 Demo Web Interface

Weather Server SSE Demo

เปิดไฟล์ demo/weather-sse-demo.html ในเบราว์เซอร์

  • URL: file:///path/to/demo/weather-sse-demo.html
  • เชื่อมต่อกับ: http://localhost:3004

Product Server SSE Demo

เปิดไฟล์ demo/product-sse-demo.html ในเบราว์เซอร์

  • URL: file:///path/to/demo/product-sse-demo.html
  • เชื่อมต่อกับ: http://localhost:3005

🔌 API Endpoints

HTTP Servers

Weather Server (Port 3003)

  • GET /health - Health check
  • POST /mcp - MCP requests
  • OPTIONS /mcp - CORS preflight

Product Server (Port 3002)

  • GET /health - Health check
  • POST /mcp - MCP requests
  • OPTIONS /mcp - CORS preflight

SSE Servers

Weather Server SSE (Port 3004)

  • GET /health - Health check
  • GET /mcp - SSE connection
  • POST /mcp - MCP requests
  • OPTIONS /mcp - CORS preflight

Product Server SSE (Port 3005)

  • GET /health - Health check
  • GET /mcp - SSE connection
  • POST /mcp - MCP requests
  • OPTIONS /mcp - CORS preflight

🛠️ MCP Tools

Weather Server Tools

  1. get-weather - ดูสภาพอากาศปัจจุบัน
   {
     "name": "get-weather",
     "arguments": { "city": "Bangkok" }
   }
  1. get-weather-forecast - ดูพยากรณ์อากาศ
   {
     "name": "get-weather-forecast",
     "arguments": { "city": "Bangkok", "days": 3 }
   }

Product Server Tools

  1. get-product - ดูข้อมูลสินค้า
   {
     "name": "get-product",
     "arguments": { "productId": "P001" }
   }
  1. search-products - ค้นหาสินค้า
   {
     "name": "search-products",
     "arguments": { "query": "iPhone" }
   }
  1. check-stock - ตรวจสอบสต็อค
   {
     "name": "check-stock",
     "arguments": { "productId": "P001" }
   }
  1. get-product-specs - ดูสเปคสินค้า
   {
     "name": "get-product-specs",
     "arguments": { "productId": "P001" }
   }

📡 SSE Events

Weather Server SSE Events

  • connection - การเชื่อมต่อสำเร็จ
  • server_info - ข้อมูลเซิร์ฟเวอร์
  • weather_update - อัปเดตสภาพอากาศแบบ real-time (ทุก 30 วินาที)
  • mcp_response - ผลลัพธ์ MCP requests
  • mcp_error - ข้อผิดพลาด MCP
  • server_shutdown - เซิร์ฟเวอร์ปิดตัว

Product Server SSE Events

  • connection - การเชื่อมต่อสำเร็จ
  • server_info - ข้อมูลเซิร์ฟเวอร์
  • stock_update - อัปเดตสต็อคแบบ real-time (ทุก 45 วินาที)
  • price_update - อัปเดตราคาแบบ real-time (ทุก 60 วินาที)
  • mcp_response - ผลลัพธ์ MCP requests
  • mcp_error - ข้อผิดพลาด MCP
  • server_shutdown - เซิร์ฟเวอร์ปิดตัว

🧪 การทดสอบด้วย Tools

cURL Examples

List Tools:

curl -X POST http://localhost:3002/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

Search Products:

curl -X POST http://localhost:3002/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search-products","arguments":{"query":"iPhone"}}}'

Get Weather:

curl -X POST http://localhost:3003/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get-weather","arguments":{"city":"Bangkok"}}}'

Postman Testing

  1. Method: POST
  2. URL: http://localhost:3002/mcp (Product) หรือ http://localhost:3003/mcp (Weather)
  3. Headers:
   Content-Type: application/json
   Accept: application/json
  1. Body (JSON):
   {
     "jsonrpc": "2.0",
     "id": 1,
     "method": "tools/list"
   }

SSE Testing

เชื่อมต่อ SSE:

const eventSource = new EventSource('http://localhost:3004/mcp');
eventSource.onmessage = function(event) {
    const data = JSON.parse(event.data);
    console.log('SSE Event:', data);
};

ส่ง MCP Request:

fetch('http://localhost:3004/mcp', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'tools/call',
        params: {
            name: 'get-weather',
            arguments: { city: 'Bangkok' }
        }
    })
});

📊 Port Summary

ServiceTypePortURL
Product ServerHTTP3002http://localhost:3002
Weather ServerHTTP3003http://localhost:3003
Weather ServerSSE3004http://localhost:3004
Product ServerSSE3005http://localhost:3005

🔧 Development

Build:

npm run build

Clean:

npm run clean

Production:

npm run build
npm run start:weather
npm run start:product

📝 License

MIT License

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

📞 Support

หากพบปัญหาหรือต้องการความช่วยเหลือ กรุณาสร้าง issue ใน GitHub repository

目录标签

目录标签

位置天气TypeScriptHTTP服务器实时数据本地部署SSE服务器天气数据产品数据

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

6

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP