ws-mcp

MCP.Pizza Chef: nick1udwig

ws-mcp is an MCP client that wraps MCP standard input/output servers with a WebSocket interface, enabling real-time, bidirectional communication. It facilitates integration with MCP servers over WebSocket connections, allowing dynamic configuration of which MCP servers to run. It supports easy setup and configuration, making it ideal for connecting MCP servers like wcgw and fetch to WebSocket-based environments.

Use This MCP client To

Connect MCP stdio servers to WebSocket clients for real-time interaction Configure and run multiple MCP servers via a single WebSocket client Enable web apps to communicate with MCP servers over WebSocket Facilitate remote control of MCP servers through WebSocket connections Integrate MCP servers into WebSocket-based AI workflows Simplify deployment of MCP servers with dynamic config files

README

ws-mcp

Wrap MCP stdio servers with a WebSocket. For use with kibitz.

Quickstart

Prerequisites

Install uv:

curl -LsSf https://astral.sh/uv/install.sh | sh

Configuration

The config file specifies which MCP servers to run. The default config (no --config or --command args provided) includes:

  • wcgw: For general system operations and file management
  • fetch: For making HTTP requests

To make a configuration file:

  1. Create your configuration file:
    cp sample.config.json config.json
  2. Modify config.json to add or remove servers based on your needs.
  3. Run with --config path/to/config.json to use the new config file.

Running ws-mcp

Basic usage with default config file (no --config or --command provided) and port:

uvx --refresh ws-mcp@latest

This will start all configured servers on the default port (10125).

To use a config file and port:

uvx --refresh ws-mcp@latest --config path/to/config --port 10125

Detailed Usage

# Example using fetch
uvx --refresh ws-mcp --command "uvx mcp-server-fetch" --port 3002

# Example using wcgw
## On macOS
uvx --refresh ws-mcp --command "uvx --from wcgw@latest --python 3.12 wcgw_mcp" --port 3001

## On Linux (or if you have issues on macOS with wcgw)
cd /tmp
git clone https://github.com/nick1udwig/wcgw.git
cd wcgw
git submodule update --init --recursive
git checkout hf/fix-wcgw-on-ubuntu
cd ..
uvx --refresh ws-mcp --command "uvx --from /tmp/wcgw --with /tmp/wcgw/src/mcp_wcgw --python 3.12 wcgw_mcp" --port 3001

# Example using Brave search
export BRAVE_API_KEY=YOUR_API_KEY_HERE
uvx --refresh ws-mcp --env BRAVE_API_KEY=$BRAVE_API_KEY --command "npx -y @modelcontextprotocol/server-brave-search" --port 3003

# Or, with a .env file:
uvx --refresh ws-mcp --env-file path/to/.env --command "npx -y @modelcontextprotocol/server-brave-search" --port 3003

# `--command` can be supplied multiple times!
#  Example serving multiple servers at once:
uvx --refresh ws-mcp --env-file path/to/.env --command "npx -y @modelcontextprotocol/server-brave-search" --command "uvx mcp-server-fetch" --port 3004

# Servers can also be specified in a `.json` file following [the standard MCP format](https://modelcontextprotocol.io/quickstart/user#2-add-the-filesystem-mcp-server)
uvx --refresh ws-mcp --env-file path/to/.env --config path/to/config.json --port 3005

ws-mcp FAQ

How do I configure which MCP servers ws-mcp runs?
You create or modify a JSON config file specifying the MCP servers to run, then launch ws-mcp with the --config option pointing to that file.
What prerequisites are needed to run ws-mcp?
You need to install the 'uv' runtime from https://github.com/astral-sh/uv to run ws-mcp.
Can ws-mcp run multiple MCP servers simultaneously?
Yes, ws-mcp supports running multiple MCP servers as specified in the configuration file.
How does ws-mcp communicate with MCP servers?
ws-mcp wraps MCP stdio servers with a WebSocket interface, enabling real-time bidirectional communication.
Is ws-mcp compatible with other MCP clients or servers?
ws-mcp is designed to work with MCP stdio servers and can integrate with other MCP components that support stdio or WebSocket protocols.
How do I start ws-mcp with the default configuration?
Run ws-mcp without --config or --command arguments to use the default config, which includes servers like wcgw and fetch.
What is the role of the 'uv' tool in ws-mcp?
'uv' is the runtime environment that executes ws-mcp, providing necessary system support for its operation.
Can I extend ws-mcp to support custom MCP servers?
Yes, by modifying the configuration file, you can add or remove MCP servers to tailor ws-mcp to your needs.