AgentStack
MCP unreviewed MIT Self-run

Mcpo Rs

mcp-xiaofeitm233-mcpo-rs · by xiaofeiTM233

A simple, secure MCP-to-OpenAPI proxy server written in Rust

No reviews yet
0 installs
0 views
view→install

Install

$ agentstack add mcp-xiaofeitm233-mcpo-rs

Open-source listing — not yet scanned by AgentStack. Follow the source repository for install instructions.

Security review

⚠ Flagged

1 finding(s); flagged for manual review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures
  • high Pipes remote content directly into a shell (remote code execution).

What it can access

  • Network access Used
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Mcpo Rs? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

⚡️ mcpo-rs

> MCP-to-OpenAPI proxy server, rewritten in Rust

将任意 MCP Server 暴露为 OpenAPI 兼容的 HTTP 服务,零配置、即时可用。

本项目参考 open-webui/mcpo 用 Rust 重写,代码由 AI 辅助生成。

与原版 mcpo 的区别

| | mcpo (Python) | mcpo-rs (Rust) | | --- | --- | --- | | 启动速度 | ~1s (含 Python 解释器初始化) | /openapi.json`

  • Swagger UI:http://localhost:8000//docs
  • 健康检查:http://localhost:8000/health

配置文件模式

支持 Claude Desktop 格式的多服务器配置:

mcpo --config /path/to/config.json --hot-reload

config.json

{
  "mcpServers": {
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    },
    "time": {
      "command": "uvx",
      "args": ["mcp-server-time", "--local-timezone=America/New_York"],
      "disabledTools": ["convert_time"]
    },
    "remote_server": {
      "type": "sse",
      "url": "http://127.0.0.1:8001/sse",
      "headers": {
        "Authorization": "Bearer token"
      }
    },
    "streamable_server": {
      "type": "streamable-http",
      "url": "http://127.0.0.1:8002/mcp"
    }
  }
}

每个服务器有独立的 API 路由:

  • http://localhost:8000/memory — memory 服务器
  • http://localhost:8000/time — time 服务器
  • http://localhost:8000/remote_server — 远程 SSE 服务器
  • http://localhost:8000/streamable_server — Streamable HTTP 服务器

热重载

启用 --hot-reload 后,修改配置文件会自动重载服务器列表:

mcpo --config config.json --hot-reload
  • 新增服务器 → 自动添加路由
  • 删除服务器 → 自动卸载路由
  • 修改服务器配置 → 自动重连

API Key 认证

mcpo --api-key "my-secret-key" -- your_mcp_command

客户端请求时需携带 Header:

Authorization: Bearer my-secret-key

CLI 参数

| 参数 | 简写 | 默认值 | 说明 | | --- | --- | --- | --- | | --host | -H | 0.0.0.0 | 监听地址 | | --port | -p | 8000 | 监听端口 | | --api-key | -k | — | API 认证密钥 | | --type | — | stdio | 服务器类型:stdio / sse / streamable-http | | --config | -c | — | 配置文件路径 | | --name | -n | MCP OpenAPI Proxy | 服务器名称 | | --description | -d | — | 服务器描述 | | --cors-allow-origins | — | * | CORS 允许的来源(逗号分隔) | | --path-prefix | — | / | URL 前缀 | | --root-path | — | — | 反向代理根路径 | | --header | — | — | SSE/HTTP 请求头(JSON 格式) | | --hot-reload | — | false | 启用配置文件热重载 | | --log-level | — | info | 日志级别 | | --strict-auth | — | false | API Key 保护所有端点 |

OpenAPI 3.0

每个 MCP 服务器自动生成 OpenAPI 3.0 JSON 规范:

GET /{server}/openapi.json

返回格式:

{
  "openapi": "3.0.3",
  "info": {
    "title": "time MCP Server",
    "version": "1.0.0"
  },
  "paths": {
    "/time/get_current_time": {
      "post": {
        "operationId": "time_get_current_time",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/get_current_time_params"
              }
            }
          }
        }
      }
    }
  }
}

每个工具的 JSON Schema 输入参数来自 MCP 协议中的 inputSchema

配置文件 JSON Schema

配置文件遵循 config.schema.json 中定义的 JSON Schema 规范,详见 [config.schema.json](config.schema.json)。

支持三种服务器类型:

  • stdio:子进程通信,需指定 command 和可选的 argsenv
  • sse:Server-Sent Events,需指定 type: "sse"url
  • streamable-http:Streamable HTTP,需指定 type: "streamable-http"url

项目结构

src/
├── main.rs               # CLI 入口 (clap)
├── server.rs             # actix-web HTTP 服务器 + 动态端点
├── config.rs             # 配置文件加载与校验
├── connection.rs         # 连接管理器
├── openapi.rs            # 动态生成 OpenAPI 3.0 JSON
├── auth.rs               # API Key 认证中间件
├── watcher.rs            # 配置文件热重载
└── mcp/
    ├── mod.rs
    ├── types.rs          # JSON-RPC 2.0 / MCP 协议类型
    ├── client.rs         # MCP 客户端封装
    ├── stdio.rs          # stdio 传输层
    ├── sse.rs            # SSE 传输层
    └── streamable_http.rs # Streamable HTTP 传输层

从源码构建

# 安装 Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# 克隆仓库
git clone https://github.com/xiaofeiTM233/mcpo-rs.git
cd mcpo-rs

# 构建
cargo build --release

# 二进制位置
./target/release/mcpo --help

交叉编译

# Linux x86_64 (静态链接)
cargo build --release --target x86_64-unknown-linux-musl

# Linux ARM64
cargo build --release --target aarch64-unknown-linux-gnu

# macOS (在 macOS 上)
cargo build --release --target aarch64-apple-darwin

# Windows (在 Windows 上或交叉编译)
cargo build --release --target x86_64-pc-windows-msvc

说明

本 README 文档由 AI 辅助生成。如有问题,请提交 Issue 或与我联系

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.