模型上下文协议代理服务器

SuperMCP 是一个安全、高性能的模型上下文协议(MCP)代理服务器,具有高级沙箱功能,支持多种传输方式和统一的提供者架构。

  • by hongkongkiwi
  • Rust
  • 本地部署
  • 更新于
在 GitHub 查看 hongkongkiwi/super-mcp

使用说明

SuperMCP

一个安全、高性能的模型上下文协议(MCP)服务器代理,具有高级沙盒,用Rust编写。

特性

  • 安全第一:每个MCP服务器都在具有平台本机隔离的沙盒环境中运行
  • 热重新加载:无需重新启动即可应用配置更改
  • 多个传输:支持stdio、SSE、HTTP和流式HTTP
  • 基于标签的访问控制:控制客户端可以访问哪些服务器
  • 速率限制:内置防滥用保护
  • 审计日志:全面的安全事件记录
  • 轻量级客户端:无需运行服务器即可直接调用MCP工具
  • 统一提供商架构:通过一个界面支持MCP、技能和自定义提供者

快速开始

安装

cargo install supermcp

配置

在以下位置创建配置文件 ~/.config/supermcp/config.toml:

[server]
host = "127.0.0.1"
port = 3000

[[servers]]
name = "filesystem"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/docs"]
tags = ["filesystem"]

[servers.sandbox]
network = false
filesystem = "readonly"

作为服务器运行

supermcp serve

使用轻量级客户端

无需运行服务器即可直接调用MCP工具:

# List tools from a configured server
supermcp tools filesystem

# Call a tool using shell-friendly syntax
supermcp call filesystem.list_directory path:/home/user/docs

# Use function-style syntax
supermcp call "filesystem.read_file(path: /home/user/docs/readme.md)"

# Ad-hoc connections without configuration
supermcp call --stdio "npx -y @modelcontextprotocol/server-filesystem /tmp" list_directory path:/tmp

# List tools from ad-hoc server
supermcp tools --stdio "npx -y @modelcontextprotocol/server-filesystem /tmp" --schema

统一提供商架构

SuperMCP通过统一的接口支持多种类型的工具提供商:

提供者类型 描述 示例
MCP 体育 通过stdio连接本地MCP服务器 @modelcontextprotocol/server-filesystem
MCP SSE MCP服务器通过服务器发送事件 https://mcp.example.com/sse
MCP HTTP MCP服务器通过流式HTTP https://mcp.example.com/mcp
技能 Kimi CLI技能 自定义技能目录

从AI编辑器导入

SuperMCP可以从流行的AI编辑器和工具导入MCP服务器配置:

# Import from all supported sources
supermcp import all

# Import from specific editor
supermcp import cursor
supermcp import claude
supermcp import vscode
supermcp import codex
supermcp import kimi-cli
supermcp import windsurf
supermcp import opencode
supermcp import gemini
supermcp import qwen
supermcp import github-copilot

# Dry run - see what would be imported
supermcp import all --dry-run

# JSON output for scripting
supermcp import all --json

支持的来源:

源 配置位置
光标 ~/.cursor/mcp.json
克劳德桌面版 ~/Library/Application Support/Claude/claude_desktop_config.json
VS Code (Cline、Kilo、Roo、Continue) VS代码设置.json
法典 (OpenAI) ~/.codex/config.json
化学CLI ~/.kimi/config.json
帆板运动 (可待因) ~/.windsurf/mcp.json
OpenCode ~/.opencode/config.json
双子座 谷歌 ~/.gemini/config.json
通义 (阿里巴巴) ~/.qwen/config.json
GitHub Copilot ~/.github/copilot/mcp.json (未来)

列出所有提供商

# List all available providers (MCPs and skills)
supermcp providers

# JSON output for scripting
supermcp providers --json

工具发现(所有提供商)

# List tools from all providers
supermcp tools --all

# List tools from a specific provider
supermcp tools filesystem
supermcp tools my-skill

# Show with schema details
supermcp tools filesystem --schema

# JSON output
supermcp tools --all --json

轻量级客户端(MCPorter风格)

SuperMCP包括一个轻量级客户端,用于在不运行代理服务器的情况下直接调用工具。其灵感来源于 MCPorter 但直接集成到SuperMCP中。

直接工具调用

# Using configured providers
supermcp call server.tool_name param1:value1 param2:value2
supermcp call filesystem.list_directory path:/tmp
supermcp call my-skill.do_something input:hello

# Auto-discovery - tool name only (searches all providers)
supermcp call list_directory path:/tmp

# Function-style syntax (useful for complex arguments)
supermcp call "filesystem.read_file(path: /tmp/test.txt)"

# With JSON output
supermcp call filesystem.list_directory path:/tmp --json

临时连接

无需预先配置即可连接到任何MCP服务器:

# Stdio transport
supermcp call --stdio "npx -y @modelcontextprotocol/server-filesystem /tmp" list_directory path:/tmp

# With environment variables
supermcp call --stdio "npx -y some-mcp-server" --env API_KEY=secret get_data id:123

# HTTP/SSE transport
supermcp call --http-url https://mcp.example.com/sse get_status

使用技能

# Call a skill directly
supermcp call --skill my-skill do_something input:hello

# List tools from a skill
supermcp tools --skill my-skill

参数语法

这 call 命令支持灵活的参数格式:

  • 冒号格式: key:value (shell友好,无需引号)
  • 等于格式: key=value (传统风格)
  • JSON值: config:{"nested":"value"}
  • 数字和布尔值: count:42 enabled:true

建筑

SuperMCP使用分层架构:

  • 安全层:平台原生沙盒(Linux上的seccomp/Landlock,macOS上的安全带)
  • 核心层:服务器生命周期管理、能力处理
  • 传输层:stdio、SSE、HTTP、流式HTTP支持
  • 应用层:CLI、配置管理、审核日志记录

发展

建筑

cargo build --release

测试

cargo test

许可证

麻省理工学院或阿帕奇-2.0