Endara接力
所有MCP服务器的一个端点。 endara.ai
在单个端点后聚合本地和云MCP服务器。
添加服务器、管理OAuth、连接任何AI客户端——所有这些都可以在一个地方完成。
> 适用于Claude Desktop、ChatGPT、Cursor、Windsurf、VS Code、Zed、Continue和任何兼容MCP的客户端。
为什么?
- 一个端点,而不是N --将每个AI客户端指向
localhost:9400而不是将相同的MCP服务器配置粘贴到每个应用程序中。 - OAuth为您管理 --Relay为需要它的服务器处理令牌存储和刷新,因此您的客户端不必这样做。
- 热重载配置 --编辑您的TOML,保存,Relay无需重新启动即可获取更改。
- 崩溃时自动重启 --脆弱的STDIO服务器会以指数级的回退自行恢复。
- 完全本地化 --没有云,没有账户,没有遥测。一切都在你的机器上运行。
这是什么?
Endara Relay是一个单一的Rust二进制文件,位于您的AI助手(Claude Desktop、Cursor或任何MCP客户端)和您使用的所有MCP服务器之间。您可以将客户端指向一个本地端点,而不是在客户端中单独配置每个服务器-- localhost:9400 --其余的由Relay处理。
它使用适当的传输(STDIO、SSE或HTTP)连接到每个MCP服务器,将它们的工具目录合并到一个统一的列表中,并为工具名称添加前缀以避免冲突。如果服务器崩溃,Relay会自动重新启动它。如果编辑配置文件,Relay会在不重新启动的情况下获取更改。
没有云。没有账户。一切都在你的机器上运行。```
┌──────────────────────────────────────────────────────┐
│ Endara Relay (single Rust process) │
│ │
│ ┌────────────────────┐ ┌──────────────────────────┐│
│ │ TCP loopback :9400 │ │ Unix socket / Named pipe ││
│ │ /mcp /healthz │ │ /api/* (per-user, 0600)││
│ │ /oauth/callback │ │ ││
│ └────────────────────┘ └──────────────────────────┘│
└──────────────────────────────────────────────────────┘
TCP环回侦听器为MCP流量、健康探测和OAuth回调提供服务。API管理层(`/api/*`)仅绑定到具有0600权限的每个用户操作系统本地Unix域套接字(Linux/macOS)或命名管道(Windows);它无法通过TCP访问。看 管理API 用于查看完整端点列表和特定于平台的套接字路径。
## 快速开始
### 1.安装```bash
# Homebrew — recommended (macOS / Linux)
brew install endara-ai/tap/endara-relay
# Or, with cargo:
cargo install endara-relay
# Or download a pre-built binary from GitHub Releases:
# https://github.com/endara-ai/endara-relay/releases
2.创建配置文件```bash
mkdir -p ~/.endara
cat > ~/.endara/config.toml << 'EOF'
[relay]
machine_name = "my-laptop"
[[endpoints]]
name = "filesystem"
transport = "stdio"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/projects"]
[[endpoints]]
name = "github"
transport = "stdio"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-github"]
env = { GITHUB_TOKEN = "$GITHUB_TOKEN" }
EOF
### 3.跑步```bash
endara-relay --config ~/.endara/config.toml
4.连接您的MCP客户端
将Claude Desktop(或任何MCP客户端)指向 http://localhost:9400/mcp。您将在一个列表中看到所有已配置端点的工具,前缀为端点名称:
filesystem__read_filefilesystem__write_filegithub__list_reposgithub__create_issue
配置
配置文件是TOML。这里有一个完整的参考:```toml
[relay]
machine_name = "my-laptop" # Required — identifies this machine
local_js_execution = true # Optional — enable JS execution mode (default: false)
STDIO endpoint — spawns a child process
[[endpoints]]
name = "github" # Required — unique name, used as tool prefix
transport = "stdio" # Required — "stdio", "sse", or "http"
command = "npx" # Required for stdio — command to run
args = ["-y", "@modelcontextprotocol/server-github"] # Optional — command arguments
env = { GITHUB_TOKEN = "$GITHUB_TOKEN" } # Optional — environment variables
SSE endpoint — connects to a Server-Sent Events MCP server
[[endpoints]]
name = "remote-server"
transport = "sse"
url = "http://localhost:3001/sse" # Required for sse/http — server URL
HTTP endpoint — connects via JSON-RPC over HTTP
[[endpoints]]
name = "http-server"
transport = "http"
url = "http://localhost:4000/mcp" # Required for sse/http — server URL
Optional — override the advertised server_type
By default the relay derives the server_type from the upstream
serverInfo.name, then strips one of the suffixes
-mcp-server, _mcp_server, -mcp, _mcp (so linear-mcp-server
becomes linear). When that produces an awkward name, set
server_type_override to take control of what is advertised to the
model. The override is sanitized to a valid identifier but is never
auto-stripped — what you write is what gets used.
[[endpoints]]
name = "drive"
transport = "oauth"
url = "https://drivemcp.googleapis.com/mcp/v1"
oauth_server_url = "https://accounts.google.com"
client_id = "$GOOGLE_CLIENT_ID"
server_type_override = "google-drive" # Optional — overrides upstream-derived server_type
### 环境变量分辨率
环境变量 `env` 启动时解析映射:
|语法|行为|
|--------|----------|
| `$VAR` |替换为以下值 `VAR` 从过程环境|
| `$$VAR` |文字字符串 `$VAR` (双重逃脱 `$`) |
| `plain` |保持原样|
### 验证规则
- 必须至少配置一个端点
- 终结点名称必须唯一且非空
- `stdio` 运输需要 `command` 领域
- `sse` 和 `http` 运输需要 `url` 领域
______________________________________________________________________
## 特性
### 多传输适配器
连接到任何MCP服务器,无论其通信方式如何:
- **工作室** --生成一个子进程,并通过stdin/stdout进行通信。非常适合基于CLI的本地MCP服务器,如官方 `@modelcontextprotocol/server-*` 包装。
- **上海证券交易所** --使用HTTP+服务器发送事件连接到远程服务器。适用于推送更新的服务器。
- **超文本传输协议** --基于HTTP POST的标准JSON-RPC 2.0。最简单的远程运输。
### 工具前缀
每个工具都会自动以其端点名称作为前缀,以防止冲突。如果终点 `github` 公开一个名为 `list_repos`,它变成 `github__list_repos` 在合并的目录中。这意味着您可以连接多个服务器,这些服务器公开名称相同的工具,而不会发生冲突。
### 配置热重载
Relay使用 通知 机箱。保存文件时,Relay会自动执行以下操作:
- 为新添加的端点启动适配器
- 停止已删除端点的适配器
- 为更改的端点重新启动适配器
- 保持不变的端点运行
无需重新启动。
### 崩溃恢复
如果STDIO服务器进程崩溃,Relay会自动以指数回退方式重新启动它。在多次失败后,端点被标记为不健康。这使您的工具目录即使在单个服务器出现故障时也保持可用。
### JS执行模式
当 `local_js_execution = true`,Relay用三个元工具替换了完整的工具目录:
|元工具|描述|
|-----------|-------------|
| `list_tools` |列出所有端点上的所有可用工具|
| `search_tools` |按名称或描述搜索工具|
| `execute_tools` |运行一个可以调用任何工具的JavaScript脚本|
这大大减少了上下文窗口污染。它只看到了三个工具,而不是将数百个工具暴露给人工智能。AI编写简短的JS脚本来发现和调用它需要的工具。
**示例:AI调用 `execute_tools` 与:**```javascript
const repos = await call("github__list_repos", { org: "endara-ai" });
const issues = await call("github__list_issues", { repo: repos[0].name });
return { repos: repos.length, firstRepoIssues: issues };
JS沙盒由 boa_engine 并且完全在进程内运行,不需要外部运行时。
管理API
中继公开了用于监视和控制的管理REST API。API只能通过具有0600权限的用户创建的操作系统本地Unix-domain套接字(Linux/macOS)或命名管道(Windows)访问;它不绑定到TCP。
| 平台 | 路径 |
|---|---|
| Linux | $XDG_RUNTIME_DIR/endara-relay/api.sock (回退: /api.sock) |
| macOS | $TMPDIR/endara-relay-/api.sock |
| 窗户 | \\.\pipe\endara-relay- |
| 方法 | 端点 | 描述 |
|---|---|---|
GET |
/api/status |
中继状态、正常运行时间、端点/健康计数 |
GET |
/api/endpoints |
列出所有包含健康和传输信息的端点 |
GET |
/api/endpoints/:name/tools |
列出特定端点的工具 |
GET |
/api/endpoints/:name/logs |
查看STDIO端点的stderr日志 |
POST |
/api/endpoints/:name/restart |
重新启动特定终结点 |
POST |
/api/endpoints/:name/refresh |
重新获取端点的工具目录 |
GET |
/api/config |
查看当前配置(环境值已编辑) |
POST |
/api/config/reload |
触发配置重新加载 |
示例(Linux/macOS):```bash
curl --unix-socket "$XDG_RUNTIME_DIR/endara-relay/api.sock" http://localhost/api/status
______________________________________________________________________
## 从源代码构建
### 先决条件
- 锈 (稳定版,2021年版)
- macOS、Linux或Windows
### 构建```bash
git clone https://github.com/endara-ai/endara-relay.git
cd endara-relay
cargo build --release
二进制文件将位于 target/release/endara-relay.
运行测试```bash
Unit tests
cargo test
All tests (including integration tests)
cargo test --all-targets
______________________________________________________________________
## 释放
发布是通过GitHub Actions自动完成的。要创建新版本,请执行以下操作:
1. 标记提交: `git tag v0.1.0 && git push origin v0.1.0`
1. 这 发布工作流程 自动:
- 为所有平台(Linux x86_64/aarch64、macOS x86_64/aarch64、Windows x86_64)构建发布二进制文件
- 创建带有标签的GitHub版本
- 上传平台二进制文件作为发布资产
二进制命名约定: `endara-relay-{target_triple}` (例如。 `endara-relay-aarch64-apple-darwin`, `endara-relay-x86_64-pc-windows-msvc.exe`)
这 Endara桌面 发布工作流下载这些二进制文件,将其打包为Tauri sidecar。
### CI
在每次推送和PR时,CI工作流都会运行:
- `cargo fmt --check` --格式化
- `cargo clippy -- -D warnings` --林惇
- `cargo test` --单元测试
- `cargo test --test '*'` --集成测试
- 跨平台构建矩阵(Linux、macOS、Windows)
______________________________________________________________________
## 桌面应用
更喜欢UI而不是从终端运行二进制文件? Endara桌面 将Relay捆绑为sidecar,并添加了端点仪表板、日志查看器和一键OAuth流。它从同一个Homebrew水龙头安装(`brew install --cask endara-ai/tap/endara`)并且建立在这个repo之上。更多 endara.ai.
______________________________________________________________________
## 安全
继电器的威胁模型——包括其信任边界、管理API的UDS/Named-Pipe隔离以及OAuth回调的本地主机上的CSRF保护——记录在 `THREAT_MODEL.md`.通过在GitHub上打开私人安全咨询来报告安全问题。
______________________________________________________________________
## 贡献
欢迎投稿!以下是如何开始:
1. **分叉** 存储库
1. **创建分支** 针对您的功能或修复(`git checkout -b my-feature`)
1. **进行更改** 并确保测试通过(`cargo test`)
1. **运行格式化和lints** (`cargo fmt && cargo clippy`)
1. **提交拉取请求** 清楚地描述您的更改
请先打开一个问题,了解重大更改或新功能,以便我们讨论该方法。
______________________________________________________________________
## 链接
- 网站: endara.ai
- 桌面应用程序: endara ai/endara桌面
- 发布: github/endara-ai/endara-relay/releases
______________________________________________________________________
## 许可证
根据 Apache许可证,版本2.0.```
Copyright 2025–2026 Endara AI
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
