CAPI Gateway

io.github.surisoft-io由 GitHub 账号 surisoft-io 发布v1.0.0更新于 Oct 25, 2026

Apache Camel API Gateway with REST-to-MCP bridging for LLM agents.

发布方自己的服务:core.blue

概览

AI 生成的概览

CAPI Gateway 是一个轻量级 API 网关,其试验性 MCP 模式可将 REST 与 MCP 后端暴露为 LLM 智能体可用的 MCP 工具。

可以做什么
发现并列出在 Consul 中注册的 REST 服务,将其元数据转换为 MCP 工具目录。调用这些工具,由 CAPI 把参数转换为 REST 请求并将响应包装为 MCP 格式。把真正的 MCP Server 后端与 REST 后端聚合到同一个 MCP 端点下。以负载均衡、故障转移和反向代理头代理 REST、WebSocket 与 SSE 流量。应用 OAuth2/OIDC、API Key 与 OPA 授权、限流、链路追踪和 Prometheus 指标。
适用场景
适用于已在 Consul 后运行 REST 服务、希望助手无需改动后端即可将其作为 MCP 工具调用的情况,或希望把多个 REST 与 MCP 后端统一到一个 MCP 端点的情况。
运行要求
以 Docker 镜像(surisoft/capi-core)通过 stdio 本地运行,也可用 JAR 或 Helm chart 运行。需要由 CAPI_CONFIG_FILE 环境变量指定的配置文件、带 MCP 元数据的 HashiCorp Consul 注册中心,以及访问网关端口(MCP 默认 8383)的网络。
安装前请注意
MCP 网关标注为试验性。它会代理请求到你的后端,并可能按配置执行或绕过安全策略,暴露服务前应检查 OAuth2/OIDC、API Key 与 OPA 设置。Helm 示例以参数形式传入 SSL keystore 和密码,应作为机密处理。工具调用会访问第三方 REST 服务。

安装

在 SourceWeft 中

  1. 打开 控制台中的 CAPI Gateway,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[CAPI]

[CAPI] [License] [Docker Image Version (latest by date)]


[Share your use case with us]

CAPI Gateway

Lightweight API Gateway

CAPI is a lightweight API Gateway and load balancer built on Undertow's async proxy architecture. Services register themselves in HashiCorp Consul, and CAPI automatically discovers them, creates proxy handlers, and applies security, throttling, and observability policies — no database required.

Features

  • REST, WebSocket, and SSE gateway with fully async proxying (zero threads blocked during backend calls)
  • Service discovery via HashiCorp Consul (automatic route creation and removal)
  • OAuth2 / OIDC token validation (multi-provider, cookie-based auth supported)
  • API Key authentication with per-key throttling (via Consul KV)
  • Fine-grained authorization via OPA (Open Policy Agent, async policy evaluation)
  • Distributed throttling (Hazelcast, with Kubernetes discovery)
  • Load balancing (Round Robin) and Failover
  • Distributed tracing (OpenTelemetry / OTLP)
  • Prometheus metrics
  • OpenAPI spec aggregation from upstream services
  • TLS termination and dynamic truststore management (via Consul KV hot-reload)
  • CORS management
  • Admin API with health, metrics, and route inspection
  • Multi-instance support (route targeting per CAPI instance)
  • Reverse proxy headers (X-Forwarded-*)
  • [Experimental] MCP Gateway — expose services as MCP tools for LLM agents (JSON-RPC 2.0 over Streamable HTTP)
  • [Experimental] gRPC Gateway — transparent HTTP/2 reverse proxy for gRPC services with header-based routing

REST-to-MCP Bridging

CAPI's MCP Gateway turns any existing REST API into an MCP tool — no code changes on your backends.

Register a service in Consul with MCP metadata, and LLM agents (Claude Desktop, Cursor, custom agents) can discover and invoke it immediately. Your REST services don't need to know anything about MCP, JSON-RPC, or tool schemas. CAPI handles the translation:

LLM Agent                          CAPI                          Your REST API                                                                 (unchanged)  tools/list  ──────────────►  reads Consul metadata              ◄──────────────  returns tool catalog
  tools/call  ──────────────►  extracts arguments              {"name":"..."}   POST /endpoint  ──────────────►  handles request                               wraps response  ◄──────────────  returns JSON              ◄──────────────  MCP-formatted result

CAPI also supports real MCP Server backends — services that already speak JSON-RPC 2.0. Register them with mcp-type: server and CAPI discovers their tools automatically via tools/list, then proxies tools/call requests transparently. Both REST and MCP Server backends are aggregated under one unified MCP endpoint.

Unlike dedicated MCP gateways that require all backends to be MCP Servers, CAPI bridges the gap between existing REST infrastructure and LLM-native protocols. See the MCP Gateway docs and the demo for a working example with both backend types.

Quickstart

CAPI requires the CAPI_CONFIG_FILE environment variable pointing to a valid configuration file.

Running from JAR

bash
CAPI_CONFIG_FILE=config/config.yaml java -jar capi-core.jar

Running with Docker

bash
docker run -p 8380:8380 -p 8381:8381 \  -v $(pwd)/config/config.yaml:/capi/config/config.yaml \  -e CAPI_CONFIG_FILE=/capi/config/config.yaml \  surisoft/capi-core

Running with Helm (Kubernetes)

A Helm chart is available in helm/capi-core/.

bash
helm install capi-core helm/capi-core
# With custom valueshelm install capi-core helm/capi-core -f my-values.yaml
# Enable SSL and truststorehelm install capi-core helm/capi-core \  --set capi.ssl.enabled=true \  --set capi.ssl.keystoreBase64=<base64-encoded-keystore> \  --set capi.ssl.password=changeit

See helm/capi-core/values.yaml for all available configuration options.

Ports

PortDescriptionConfig key
8380REST API gatewaycapi.rest.port
8381Admin / metricscapi.adminPort
8382WebSocket gatewaycapi.websocket.port
8383MCP Gateway (experimental)capi.mcp.port
8384gRPC Gateway (experimental)capi.grpc.port

Running Modes

The runningMode field controls which types of services CAPI will proxy:

ModeDescription
fullProxies REST, WebSocket, and SSE services (default)
websocketOnly proxies WebSocket services
sseOnly proxies SSE services

Documentation

DocumentDescription
Service RegistrationHow to register services in Consul and configure routing, security, and throttling via metadata
SecurityOAuth2/OIDC and OPA authorization configuration
Admin APIAdmin endpoints reference (health, metrics, routes, OpenAPI)
Configuration ReferenceComplete YAML configuration reference with all fields
MCP Gateway (Experimental)MCP Gateway for LLM tool integration via JSON-RPC 2.0
gRPC Gateway (Experimental)Transparent gRPC reverse proxy with header-based routing

来源:README.md,提交 ff325b9

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Core 集成