WebSocket MCP服务

通过WebSocket包装MCP标准输入输出服务器,用于与kibitz等工具集成,支持HTTP请求和系统操作等功能。

  • by nick1udwig
  • Python
  • 本地部署
  • 21 星标
  • 更新于
在 GitHub 查看 nick1udwig/ws-mcp

使用说明

ws-mcp

用WebSocket封装MCP stdio服务器。 用于 多管闲事.

快速启动

先决条件

安装 紫外线:

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

详细用法

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

# Example using wcgw
uvx --refresh ws-mcp --command "uvx --from wcgw@latest --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