# Systemic Risk Contagion MCP (`ryanclinton/systemic-risk-contagion-mcp`) Actor

Financial system cascade failure simulation using DebtRank, Eisenberg-Noe clearing, multivariate Hawkes processes, and supra-adjacency tensor decomposition.

- **URL**: https://apify.com/ryanclinton/systemic-risk-contagion-mcp.md
- **Developed by:** [ryan clinton](https://apify.com/ryanclinton) (community)
- **Categories:** AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event + usage

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Systemic Risk Contagion MCP Server

**Financial system cascade failure simulation using DebtRank, Eisenberg-Noe clearing, multivariate Hawkes processes, and supra-adjacency tensor decomposition.** This MCP server orchestrates **16 data sources** spanning corporate registries, SEC filings, FDIC bank data, stock markets, cryptocurrency, macroeconomic indicators, and sanctions lists to construct **4-layer multiplex financial networks** and run rigorous systemic risk analysis. Identifies G-SIBs, simulates cascade failures, detects stress clustering, and generates financial stability reports.

### What data can you access?

| Data Point | Source |
|---|---|
| Global corporate registrations and ownership | OpenCorporates |
| Legal Entity Identifiers and parent-child chains | GLEIF LEI |
| SEC annual/quarterly filings (10-K, 10-Q) | EDGAR Filings |
| SEC regulatory analysis and enforcement | SEC EDGAR |
| Executive insider stock transactions (Form 4) | SEC Insider Trading |
| US bank financial statements and condition data | FDIC Banks |
| Stock prices, quotes, and market data | Finnhub |
| US and global economic indicators | FRED |
| Employment and inflation statistics | BLS |
| IMF world economic data | IMF |
| Development and governance indicators | World Bank |
| Cryptocurrency prices and market capitalization | CoinGecko |
| Foreign exchange rates | Exchange Rates |
| Congressional stock trading disclosures | Congress Stock Trading |
| OFAC sanctions and blocked persons | OFAC |
| Consumer financial complaints | CFPB |

### MCP Tools

| Tool | Price | Description |
|------|-------|-------------|
| `build_systemic_network` | $0.04 | Construct a 4-layer multiplex financial network from 16 data sources |
| `compute_debtrank` | $0.04 | DebtRank (Battiston 2012): fraction of economic value affected by each node's distress |
| `simulate_cascade_failure` | $0.04 | Eisenberg-Noe (2001) clearing payment cascade with fixed-point default propagation |
| `identify_critical_nodes` | $0.04 | Supra-Laplacian spectral analysis for systemically critical entity identification |
| `detect_stress_clustering` | $0.04 | Multivariate Hawkes process for stress event clustering and criticality detection |
| `model_sanctions_shock` | $0.04 | Sanctions-induced shock propagation through counterparty exposure network |
| `compute_contagion_channels` | $0.04 | Supra-adjacency tensor decomposition of cross-layer contagion pathways |
| `generate_stability_report` | $0.04 | Comprehensive financial stability report with all analyses and recommendations |

### Data Sources

- **OpenCorporates** -- Corporate registrations and ownership structures for network construction
- **GLEIF LEI** -- Legal Entity Identifiers with parent-child ownership relationships
- **EDGAR Filings** -- SEC 10-K, 10-Q, and 8-K filings for financial exposure data
- **SEC EDGAR** -- Regulatory filings, enforcement actions, and analysis
- **SEC Insider Trading** -- Form 4 executive stock transactions for insider behavior signals
- **FDIC Banks** -- Bank financial statements, condition reports, and interbank exposure indicators
- **Finnhub** -- Stock market data for return correlation analysis
- **FRED** -- Federal Reserve economic data for macroeconomic context
- **BLS** -- Bureau of Labor Statistics employment and inflation data
- **IMF** -- World Economic Outlook data for global macro conditions
- **World Bank** -- Development and governance indicators
- **CoinGecko** -- Cryptocurrency prices and market data for crypto exposure layer
- **Exchange Rates** -- Foreign exchange rates for cross-border exposure analysis
- **Congress Stock Trading** -- Congressional stock trading disclosures for political risk layer
- **OFAC** -- Sanctions data for sanctions shock modeling
- **CFPB** -- Consumer complaints for retail financial stress signals

### How the scoring works

The MCP constructs a **4-layer multiplex financial network** and applies five analysis algorithms:

**DebtRank (Battiston et al. 2012)** measures the fraction of total economic value affected by each node's distress. Each entity is shocked individually, and stress propagates through weighted liability connections with no double-counting. Identifies G-SIBs (globally systemically important banks) and D-SIBs (domestically systemically important banks).

**Eisenberg-Noe Clearing (2001)** computes the fixed-point clearing vector via the Fictitious Default Algorithm. Each node pays min(obligations, available assets). An initial shock propagates through the network tracking defaults, cumulative losses, and cascade depth per round.

**Supra-Laplacian Spectral Analysis** builds the NL x NL supra-adjacency matrix (intra-layer blocks plus inter-layer coupling) and computes its largest eigenvalue via power iteration. If the eigenvalue exceeds the criticality threshold, the system is in supercritical regime where cross-layer cascades amplify.

**Multivariate Hawkes Process** estimates stress event intensity as self-exciting: past events increase future event probability. The branching ratio (spectral radius of alpha/beta) approaching 1 signals critical instability.

**Supra-Adjacency Tensor Decomposition** identifies dominant cross-layer contagion pathways. CP tensor rank estimation reveals which layer combinations (e.g., ownership to financial_exposure) are most dangerous for cascade amplification.

The four network layers are:
- **Ownership** -- Corporate registry and GLEIF parent-child relationships
- **Financial Exposure** -- SEC filings, FDIC interbank lending, derivative exposure
- **Market Correlation** -- Stock return correlations, crypto, and FX co-movement
- **Supply Chain** -- Sector co-occurrence and trade relationship data

### How to connect this MCP server

#### Claude Desktop

Add to your `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "systemic-risk-contagion": {
      "url": "https://systemic-risk-contagion-mcp.apify.actor/mcp"
    }
  }
}
````

#### Programmatic (HTTP)

```bash
curl -X POST https://systemic-risk-contagion-mcp.apify.actor/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN" \
  -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"compute_debtrank","arguments":{"query":"US banking sector"}},"id":1}'
```

This MCP also works with **Cursor**, **Windsurf**, **Cline**, and any other MCP-compatible client.

### Use cases for systemic risk intelligence

#### G-SIB/D-SIB Identification

Run DebtRank analysis to identify which financial entities would cause the largest fraction of total economic value loss if they entered distress. Rank systemic importance quantitatively.

#### Stress Testing and Resolution Planning

Simulate cascade failures using Eisenberg-Noe clearing to estimate how an initial shock amplifies through counterparty networks. Evaluate resolution plan effectiveness by comparing cascade depth with and without intervention.

#### Criticality Regime Detection

Use supra-Laplacian spectral analysis to determine whether the financial system is in subcritical, critical, or supercritical regime. Supercritical regime means cross-layer cascades amplify rather than dampen.

#### Stress Event Clustering Analysis

Apply Hawkes process analysis to detect whether financial stress events are clustering and accelerating. A branching ratio approaching 1 provides early warning of systemic instability.

#### Sanctions Impact Stress Testing

Model how new sanctions would propagate through the financial network. Estimate direct exposure loss, indirect cascading impact, and propagation depth for each sanctioned entity.

#### Cross-Layer Contagion Channel Mapping

Identify which types of financial connections (ownership, exposure, correlation, supply chain) carry the most contagion risk. Tensor decomposition reveals the most dangerous cross-layer amplification pathways.

### How much does it cost?

This MCP uses **pay-per-event** pricing. Each tool call costs $0.04.

The **Apify Free plan** includes $5 of monthly platform credits, which covers 125 tool calls.

| Example Use | Approximate Cost |
|---|---|
| DebtRank analysis for a sector | $0.04 |
| Cascade failure simulation | $0.04 |
| Full stability report (all algorithms) | $0.04 |
| Complete 8-tool analysis suite | $0.32 |

Note: Each tool runs all 16 actors in parallel, making the per-tool cost extremely efficient for the data volume and computational complexity involved.

### How it works

1. **You provide a financial entity, sector, or systemic risk topic**
2. **16 Apify actors run in parallel** fetching corporate registries, SEC filings, bank data, market data, macro indicators, crypto, FX, sanctions, and more
3. **A 4-layer multiplex network is constructed** with ownership, financial exposure, market correlation, and supply chain layers
4. **The selected algorithm runs** on the network -- DebtRank, Eisenberg-Noe, spectral analysis, Hawkes process, tensor decomposition, or comprehensive stability report
5. **Structured results are returned** with network statistics, algorithmic outputs, criticality assessments, and actionable signals

### FAQ

**Q: What is a multiplex network?**
A: A multiplex network has multiple layers of connections between the same set of nodes. In this case, financial entities are connected through ownership, financial exposure, market correlation, and supply chain channels simultaneously.

**Q: How accurate are the cascade simulations?**
A: The models implement published mathematical frameworks (Battiston DebtRank, Eisenberg-Noe clearing). Results depend on the quality and completeness of publicly available exposure data. They should be interpreted as scenario analysis, not predictions.

**Q: What is the branching ratio?**
A: In the Hawkes process, the branching ratio measures self-excitation intensity. Values near 0 indicate independent stress events; values approaching 1 indicate critical instability where each stress event triggers additional events.

**Q: Does this include private exposure data?**
A: No. The network is constructed from publicly available data (SEC filings, FDIC reports, market data). Private bilateral exposure data is not available.

**Q: Is it legal to use this data?**
A: All 16 data sources are publicly available government databases and open market data. See [Apify's guide on web scraping legality](https://blog.apify.com/is-web-scraping-legal/).

**Q: Can I combine this with other MCPs?**
A: Yes. Use alongside the Sovereign Debt Contagion MCP for sovereign-level stress analysis or the Sanctions Evasion Network MCP for sanctions compliance.

### Related MCP servers

| MCP Server | Description |
|---|---|
| [ryanclinton/sovereign-debt-contagion-mcp](https://apify.com/ryanclinton/sovereign-debt-contagion-mcp) | Sovereign fiscal stress and contagion modeling |
| [ryanclinton/sanctions-evasion-network-mcp](https://apify.com/ryanclinton/sanctions-evasion-network-mcp) | Structural sanctions evasion detection |
| [ryanclinton/investment-alternative-data-mcp](https://apify.com/ryanclinton/investment-alternative-data-mcp) | Alternative data for investment intelligence |

### Integrations

This MCP server is built on the **Apify platform** and supports:

- **Apify API** for programmatic systemic risk analysis pipelines
- **Scheduled runs** via Apify Scheduler for recurring stability monitoring
- **Webhooks** for triggering alerts when branching ratios or spectral radii exceed thresholds
- **Integration with 200+ Apify actors** for extending financial data coverage

# Actor input Schema

## Actor input object example

```json
{}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("ryanclinton/systemic-risk-contagion-mcp").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("ryanclinton/systemic-risk-contagion-mcp").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call ryanclinton/systemic-risk-contagion-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=ryanclinton/systemic-risk-contagion-mcp",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Systemic Risk Contagion MCP",
        "description": "Financial system cascade failure simulation using DebtRank, Eisenberg-Noe clearing, multivariate Hawkes processes, and supra-adjacency tensor decomposition.",
        "version": "1.0",
        "x-build-id": "sNHjDHxaTxeYDrMdJ"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/ryanclinton~systemic-risk-contagion-mcp/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-ryanclinton-systemic-risk-contagion-mcp",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/ryanclinton~systemic-risk-contagion-mcp/runs": {
            "post": {
                "operationId": "runs-sync-ryanclinton-systemic-risk-contagion-mcp",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/ryanclinton~systemic-risk-contagion-mcp/run-sync": {
            "post": {
                "operationId": "run-sync-ryanclinton-systemic-risk-contagion-mcp",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {}
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
