mcp-resilient
Drop-in reliability layer for MCP tool calls. Adaptive retry, cost-aware circuit breaking, ordered fallback chains, and pluggable observability - as a decorator around any existing MCP client. No protocol changes, no rebuild.
from mcp_resilient import ReliabilityConfig, mcp_reliable
config = ReliabilityConfig(tool_name="threat_intel_lookup")
@mcp_reliable(config)
async def call_threat_intel(ioc: str):
return await mcp_client.call_tool("threat_intel_lookup", {"ioc": ioc})
Why this exists
How agents discover and call tools is defined by MCP. Does not indicate what Occurs when a tool is slow or flaky or rate-limited that's left to each. developer to reinvent. A number of projects interface abutting troubles security None of them provide retry+circuit breaking+output-size reduction + fallback
- cost tracking in a Python native drop in wrapper.
See docs/comparison.md for the full landscape check.
Install
pip install mcp-resilient # core
pip install mcp-resilient[redis] # + distributed state for multi-instance agents
pip install mcp-resilient[otel] # + OpenTelemetry metrics export
pip install mcp-resilient[prometheus] # + Prometheus metrics export
pip install mcp-resilient[cli] # + `mcp-resilient simulate` command
Features
- Adaptive retry: fixed, exponential, or decorrelated-jitter backoff (AWS-style, avoids thundering herd on shared upstreams).
- Cost-aware circuit breaker: trips on failure count or cumulative $ spend in a window, whichever fires first.
- Fallback chains: ordered list of fallback tools, tried in sequence.
- Observability: Prometheus / OpenTelemetry exporters.
- Pluggable state: in-memory by default, Redis for multi-instance agents.
mcp-resilient simulate: dry-run a policy against synthetic failures before it ever touches production.
Real-world Example (SecOps/SIEM)
For a practical example, see examples/siem_threat_intel_example.py. It demonstrates a real SecOps pattern:
- A primary threat intelligence enrichment API call (which might be flaky or rate-limited).
- A free backup API fallback.
- A cost-aware circuit breaker to prevent retries from exceeding your primary API budget.
Quickstart
See docs/quickstart.md and the runnable scripts in examples/.
Architecture
See docs/architecture.md for the HLD/LLD.
Development
git clone https://github.com/ck-rajput/mcp-resilient
cd mcp-resilient
pip install -e ".[dev,cli]"
pytest -q
Scope & Compliance Warning
[!WARNING]
mcp-resilientis a resilience and access-control routing layer, NOT a data encryption or cryptographic compliance vault. For highly regulated environments (like finance PCI-DSS, SOC2 or healthcare), data encryption (at rest and in transit), credential storage security, and compliance auditing need to be performed in your main hosting infrastructure.
License
MIT - see LICENSE.
Metadata
Release files for mcp-resilient 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mcp_resilient-0.0.1.tar.gz | 46.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_resilient-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.3 kB
Release files / mcp_resilient-0.0.1.tar.gz
| Download URL | mcp_resilient-0.0.1.tar.gz |
|---|---|
| Size | 46.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72478f22c498d8e7cb8303efaf4eb33792d0359f6482a732175f63e589e9b45e
|
|
BLAKE2b-256 checksum How to use checksums |
4ffe8e444fc4dc9ebbb991e24ae241272537aa6032900ec047d056adc99fcf8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.8
|
Release files / mcp_resilient-0.0.1-py3-none-any.whl
| Download URL | mcp_resilient-0.0.1-py3-none-any.whl |
|---|---|
| Size | 25.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
153b6106b7ce0da4affcf9223a05ae61684093b666b0f3beaf2c0cd13732808a
|
|
BLAKE2b-256 checksum How to use checksums |
16c7f33b4f3d0b89e22cbfce75a9b7a35b37408280beab217d04dacf0dcd3e1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.8
|
Security for mcp-resilient 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.