MCPixy 是一个零配置的 MCP(模型上下文协议)服务器构建器,适用于开发或本地工作,允许您仅通过 YAML 配置创建 MCP 服务器。几分钟内连接任何工具到您的大语言模型,无需编写代码。
# 克隆仓库
git clone https://github.com/jondot/mcpixy.git
cd mcpgw
# 构建项目
cargo build --release
# 使用默认配置引导
mcpixy bootstrap
引导过程会创建默认配置、一个示例工具文件以及用于签署工具的密钥对,在 ~/.mcpixy 目录下。
下次运行 mcpixy 时,它会自动加载这些配置。
编辑在 ~/.mcpixy/tools/sample_tools.yaml 中引导的工具,并添加如下内容:
tools:
- id: http_get_example
type: http
name: "HTTP GET 示例"
description: "向任意 URL 发送简单 GET 请求"
method: GET
url: "{{input.url}}"
headers:
User-Agent: "MCPixy/1.0"
input_schema:
type: object
properties:
url:
type: string
description: "要发送 GET 请求的 URL"
required: [url]
签署此工具:
mcpixy sign-tool --file ~/.mcpixy/tools/sample_tools.yaml --tool-id http_get_example
或者签署所有工具:
mcpixy sign-tool --file ~/.mcpixy/tools/sample_tools.yaml
在您的 mcp.json 文件中添加以下条目:
{
"mcpServers": {
"mcpixy": {
"url": "http://localhost:3033/mcp"
}
}
}
如果您正常运行了 mcpixy,这将只提供 已签名的工具,要允许未签名的工具运行,请使用 mcpixy --allow-unsigned。
要使用 JWT 身份验证,请配置 gateway.toml:
[auth]
mode = "jwt"
algorithm = "HS256" # 或 "RS256"
secret = "your-super-secret-key-here" # 对于 HS256
使用密钥签署 JWT,并通过您的 mcp.json 配置提供它:
{
"mcpServers": {
"mcpixy": {
"url": "http://localhost:3033/mcp",
"headers": {
"Authorization": "Bearer eyJ...<TOKEN剩余部分>"
}
}
}
}
# 使用默认配置引导
mcpixy bootstrap
# 为安全目的签署工具
mcpixy sign-tool --file tools.yaml --tool-id my_tool
# 验证工具签名
mcpixy verify-tool --file tools.yaml --tool-id my_tool
# 使用自定义配置启动
mcpixy --config my_config.toml
# 覆盖端口
mcpixy --port 8080
# 设置日志级别
mcpixy --log-level debug
# 检查配置
mcpixy --check-config
在启动网关后,通过 http://<您的 mcpixy 地址>/ui 访问 Web UI:
我们欢迎贡献!请参阅我们的贡献指南:
本项目根据 MIT 许可证发布 - 详情见 LICENSE 文件。