
该服务器实现了一个MCP(模型上下文协议)服务器,并通过WebSocket增强功能实现实时数据更新。
概览
该项目实现了带有WebSocket增强功能的MCP(模型上下文协议)服务器,实现实时数据更新。它允许客户端发出标准MCP请求,同时使基于WebSocket的订阅在新数据可用时接收推送通知。 - 处理来自客户端的标准MCP请求。- 允许客户端订阅实时更新。- 当有新数据可用时,向所有订阅客户端发送更新。- 使用asyncio实现高效的非阻塞操作。 1. 克隆该仓库:2. 安装依赖: 执行以下命令启动MCP和WebSocket服务器: 客户端可以通过发送以下方式连接到WebSocket服务器(ws://localhost:8765)并订阅更新: MCP客户端可以向位于http://localhost:8080的MCP服务器发送请求,有效载荷如下: 该项目采用MIT许可证授权。 欢迎拉取请求!对于重大变更,请先开启议题讨论你想更改的内容。
概述(AI 翻译)
该项目实现了带有WebSocket增强功能的MCP(模型上下文协议)服务器,实现实时数据更新。它允许客户端发出标准MCP请求,同时使基于WebSocket的订阅在新数据可用时接收推送通知。
特色
- MCP 服务器(端口 8080): 处理客户端的标准 MCP 请求。
- WebSocket 服务器(端口8765): 允许客户端订阅实时更新。
- 推送通知: 当有新数据可用时,向所有订阅客户端发送更新。
- 异步架构: 使用
asyncio进行高效的非阻塞操作。
安装
-
克隆此仓库:
-
安装依赖:
用途
启动服务器
执行以下命令启动MCP和WebSocket服务器:
通过WebSockets连接
客户端可以通过发送以下方式连接到WebSocket服务器(ws://localhost:8765)并订阅更新:
发送MCP请求
MCP客户端可以向位于http://localhost:8080的MCP服务器发送请求,有效载荷如下:
服务器会回复:
许可证
该项目采用MIT许可证授权。
贡献
本页由 AI 翻译,技术细节请以原文为准。
README
MCP WebSocket Server
This project implements an MCP (Model Context Protocol) server with WebSocket enhancements for real-time data updates. It allows clients to make standard MCP requests while also enabling WebSocket-based subscriptions to receive push notifications when new data becomes available.
Features
- MCP Server (Port 8080): Handles standard MCP requests from clients.
- WebSocket Server (Port 8765): Allows clients to subscribe for real-time updates.
- Push Notifications: Sends updates to all subscribed clients when new data is available.
- Async Architecture: Uses
asynciofor efficient non-blocking operations.
Installation
- Clone this repository:
git clone https://github.com/your-repo/mcp-websocket-server.git cd mcp-websocket-server - Install dependencies:
pip install websockets mcp-sdk # Replace with actual MCP SDK package name
Usage
Start the Server
Run the following command to start both the MCP and WebSocket servers:
python server.py
Connecting via WebSockets
Clients can connect to the WebSocket server (ws://localhost:8765) and subscribe to updates by sending:
{"action": "subscribe"}
Sending MCP Requests
MCP clients can send requests to the MCP server at http://localhost:8080 with a payload like:
{"method": "get_data"}
The server will respond with:
{"result": "Here is your data!"}
License
This project is licensed under the MIT License.
Contributing
Pull requests are welcome! For major changes, please open an issue first to discuss what you’d like to change.
Contact
For questions or suggestions, reach out via [[email protected]].
mcp-websocket
This server implements an MCP (Model Context Protocol) server with WebSocket enhancements for real-time data updates.
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →