SelfHeal MCP

io.github.carsonroell-debug由 GitHub 账号 carsonroell-debug 发布v0.1.1更新于 Oct 24, 2026

Self-healing proxy for MCP servers with retry, circuit breaker, and observability

概览

AI 生成的概览

一个本地 MCP 代理,为 HTTP 调用和其他 MCP 服务器加上自动重试、熔断保护和调用指标。

可以做什么
  • 通过带重试与熔断保护的自愈封装发起 HTTP 请求
  • 查看某个目标的熔断状态,并在问题修复后重置熔断器
  • 读取成功率、延迟和主要错误,并查看近期失败的详细信息
  • 在代理模式下,把配置好的 MCP 服务器的全部工具重新暴露,并附带同样的重试、熔断与指标能力
适用场景
当助手依赖不稳定或受限流的 API、MCP 服务器,希望在不改动原有工具的情况下获得重试、退避和故障隔离时适用。也适合用来统计这些调用的按工具成功率和延迟。
运行要求
以 stdio 在本地运行,通常用 npx selfheal-mcp 启动,因此需要 Node.js。代理模式需要 selfheal.config.json 列出目标服务器,并通过 SELFHEAL_CONFIG 指定路径。可选调参变量包括 SELFHEAL_MAX_RETRIES 和 SELFHEAL_CIRCUIT_THRESHOLD。未声明任何身份验证。
安装前请注意
wrap_call 工具会按助手给出的地址发起外部 HTTP 请求,因此传入的 URL 和内容会发送给该第三方。代理模式会把调用转发到配置的目标服务器。重试可能重复执行非幂等请求,写操作可能被执行多次。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

SelfHeal MCP

[npm] [License: MIT] [MCPize]

Self-healing proxy for MCP servers. Wraps any MCP tool call with automatic retry, circuit breaker protection, and call observability.

Your AI agents stop breaking on flaky APIs.

One-click install: Install on MCPize | npx selfheal-mcp

Features

  • Retry with backoff — Exponential backoff + jitter on transient failures (5xx, timeouts, rate limits)
  • Circuit breaker — Per-target circuit breaker stops hammering dead services
  • Call metrics — Success rates, latency, error frequency, broken down by tool and target
  • Proxy mode — Wrap any existing MCP server transparently
  • Zero config — Works standalone out of the box, config file for proxy mode

Quick Start

Standalone Mode

Add to your Claude Desktop / Claude Code config:

json
{  "mcpServers": {    "selfheal": {      "command": "npx",      "args": ["-y", "selfheal-mcp"]    }  }}

Then use wrap_call to make any HTTP request with self-healing:

Use the wrap_call tool to GET https://api.example.com/data with target "example-api"

Proxy Mode

Create selfheal.config.json:

json
{  "mode": "proxy",  "targets": [    {      "name": "my-server",      "transport": "streamable-http",      "url": "https://my-mcp-server.com/mcp"    }  ]}
json
{  "mcpServers": {    "selfheal": {      "command": "npx",      "args": ["-y", "selfheal-mcp"],      "env": {        "SELFHEAL_CONFIG": "/path/to/selfheal.config.json"      }    }  }}

All tools from my-server are re-exposed with self-healing built in.

Tools

ToolDescription
wrap_callExecute HTTP call with retry + circuit breaker
circuit_statusCheck health of any target
circuit_resetReset circuit breaker after fixing issues
metricsSuccess rates, latency, top errors
recent_errorsRecent failures with full details

Proxy Mode Adds

ToolDescription
selfheal_metricsMetrics for all proxied calls
selfheal_circuitsCircuit status for all targets
selfheal_recent_errorsRecent errors across all targets

Configuration

Environment Variables

VariableDefaultDescription
SELFHEAL_CONFIG./selfheal.config.jsonConfig file path
SELFHEAL_MAX_RETRIES3Max retry attempts
SELFHEAL_BASE_DELAY_MS1000Base delay for backoff
SELFHEAL_MAX_DELAY_MS30000Max delay cap
SELFHEAL_CIRCUIT_THRESHOLD5Failures before circuit opens
SELFHEAL_CIRCUIT_COOLDOWN_MS120000Cooldown before half-open test

How It Works

Agent → SelfHeal MCP → [Retry + Circuit Breaker] → Target API/MCP Server                ↓          Metrics Collector
  1. Request arrives — Agent calls a tool
  2. Circuit check — If target has failed too many times, reject immediately
  3. Execute with retry — Try the call, retry on transient errors with exponential backoff
  4. Record metrics — Log success/failure, duration, attempts
  5. Update circuit — Track consecutive failures per target

Install

MCPize (Recommended)

One-click install with managed hosting: Install on MCPize

npm

bash
npx selfheal-mcp

PyPI

Not applicable — this is a TypeScript server. For Python alternatives, see LeadEnrich MCP.

License

MIT — Built by Freedom Engineers

Related

来源:README.md,提交 cb405ae

工具

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

版本历史

1
  1. v0.1.1最新Sep 16, 2026

评分

已满足适用检查项的 40%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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

    请在仓库或注册中心条目中声明许可证。