Ws Mcp

Ws Mcp

🚀 项目说明

本项目将 MCP 标准输入输出服务器包装到 WebSocket 中,适用于 kibitz,为相关应用提供更便捷的服务。

🚀 快速开始

🔍 先决条件

需安装 uv,可使用以下命令进行安装:

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

⚙️ 配置

配置文件用于指定要运行的 MCP 服务器。若未提供 --config--command 参数,默认配置包含:

  • wcgw:用于通用系统操作和文件管理。
  • fetch:用于发出 HTTP 请求。

创建配置文件的步骤如下:

  1. 复制示例配置文件:
    cp sample.config.json config.json
    
  2. 根据需求修改 config.json 以添加或删除服务器。
  3. 使用 --config path/to/config.json 运行新的配置文件。

🚀 运行 ws - mcp

基础用法

使用默认配置文件(未提供 --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
  • 0 关注
  • 0 收藏,37 浏览
  • system 提出于 2025-09-21 04:27

相似服务问题

相关AI产品