本项目将 MCP 标准输入输出服务器包装到 WebSocket 中,适用于 kibitz,为相关应用提供更便捷的服务。
需安装 uv,可使用以下命令进行安装:
curl -LsSf https://astral.sh/uv/install.sh | sh
配置文件用于指定要运行的 MCP 服务器。若未提供 --config 或 --command 参数,默认配置包含:
创建配置文件的步骤如下:
cp sample.config.json config.json
config.json 以添加或删除服务器。--config path/to/config.json 运行新的配置文件。使用默认配置文件(未提供 --config 或 --command)和端口:
uvx --refresh ws-mcp@latest
此命令将在默认端口(10125)上启动所有配置的服务器。
uvx --refresh ws-mcp@latest --config path/to/config --port 10125
# 使用 fetch 的示例
uvx --refresh ws-mcp --command "uvx mcp-server-fetch" --port 3002
# 使用 wcgw 的示例
## 在 macOS 上
uvx --refresh ws-mcp --command "uvx --from wcgw@latest --python 3.12 wcgw_mcp" --port 3001
## 在 Linux(或在 macOS 上遇到问题时)
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
# 使用 Brave 搜索的示例
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
# 或者,使用 .env 文件:
uvx --refresh ws-mcp --env-file path/to/.env --command "npx -y @modelcontextprotocol/server-brave-search" --port 3003
# `--command` 可以多次提供!
# 示例同时服务多个服务器:
uvx --refresh ws-mcp --env-file path/to/.env --command "npx -y @modelcontextprotocol/server-brave-search" --command "uvx mcp-server-fetch" --port 3004
# 服务器也可以指定在遵循 [标准 MCP 格式](https://modelcontextprotocol.io/quickstart/user#2-add-the-filesystem-mcp-server) 的 `.json` 文件中
uvx --refresh ws-mcp --env-file path/to/.env --config path/to/config.json --port 3005