MCP WebSocket Server

by virajsharma2000

31 398 downloads Not rated yet MIT
GitHub

About

This server implements an MCP (Model Context Protocol) server with WebSocket enhancements for real-time data updates.

Details

License
MIT

Explore

- 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 asyncio for efficient non-blocking operations.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP WebSocket Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

1. Clone this repository:

   git clone https://github.com/your-repo/mcp-websocket-server.git
cd mcp-websocket-server

2. Install dependencies:
   pip install websockets mcp-sdk  # Replace with actual MCP SDK package name

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp websocket server": {
            "mcp-websocket": {
                "command": "python",
                "args": [
                    "server.py"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-websocket": {
        "command": "python",
        "args": [
            "server.py"
        ]
    }
}

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 asyncio for efficient non-blocking operations.

Installation

1. Clone this repository:
   git clone https://github.com/your-repo/mcp-websocket-server.git
   cd mcp-websocket-server
   
2. 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]].
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.

Videos about MCP WebSocket Server

Relevant YouTube tutorials, setups, and demos