Sovereign Debt Crisis MCP
Sovereign debt crisis modeling for AI agents and LLM workflows — this MCP server delivers eight academically-grounded simulation tools spanning default dynamics, contagion networks, fiscal sustainability, restructuring design, speculative attacks, and political regime transitions. Connect any MCP-compatible client and ask questions like "model Argentina's default risk" or "design optimal haircuts for a Greek-style restructuring" and receive structured quantitative output in seconds.
Maintenance Pulse
90/100Cost Estimate
How many results do you need?
Pricing
Pay Per Event model. You only pay for what you use.
| Event | Description | Price |
|---|---|---|
| simulate-sovereign-default | Eaton-Gersovitz value function iteration | $0.10 |
| compute-clearing-contagion | Eisenberg-Noe with CDS circularity | $0.10 |
| estimate-fiscal-sustainability | Hansen panel threshold regression | $0.06 |
| design-optimal-restructuring | Myerson mechanism design | $0.08 |
| model-speculative-attack | Morris-Shin global games equilibrium | $0.08 |
| detect-crisis-jumps | Lee-Mykland jump detection on CDS | $0.06 |
| forecast-multi-frequency | MIDAS regression with Almon lags | $0.08 |
| assess-political-transition-risk | Acemoglu-Robinson regime switching | $0.08 |
Example: 100 events = $10.00 · 1,000 events = $100.00
Connect to your AI agent
Add this MCP server to Claude Desktop, Cursor, Windsurf, or any MCP-compatible client.
https://ryanclinton--sovereign-debt-crisis-mcp.apify.actor/mcp{
"mcpServers": {
"sovereign-debt-crisis-mcp": {
"url": "https://ryanclinton--sovereign-debt-crisis-mcp.apify.actor/mcp"
}
}
}Documentation
Sovereign debt crisis modeling for AI agents and LLM workflows — this MCP server delivers eight academically-grounded simulation tools spanning default dynamics, contagion networks, fiscal sustainability, restructuring design, speculative attacks, and political regime transitions. Connect any MCP-compatible client and ask questions like "model Argentina's default risk" or "design optimal haircuts for a Greek-style restructuring" and receive structured quantitative output in seconds.
The server pulls live data from 15 sources across five categories — macroeconomic databases (IMF, World Bank, FRED, BLS, OECD, Eurostat), bilateral trade flows (UN COMTRADE, World Bank Projects), exchange rates (current, historical, ECB), regulatory feeds (Federal Register, Congress Bills), and geopolitical intelligence (OpenSanctions, REST Countries) — then assembles a sovereign debt network that all eight tools operate against. A 5-minute in-memory cache means multi-tool analysis sessions reuse the same network without redundant data fetches.
⬇️ What data can you access?
| Data Point | Source | Example |
|---|---|---|
| 📊 Fiscal indicators (debt/GDP, primary balance, credit rating) | IMF, World Bank | Debt/GDP: 138%, primary balance: −3.2% GDP |
| 📈 Macroeconomic series (GDP growth, CPI, interest rates) | FRED, BLS, OECD | 10Y yield: 4.85%, CPI: 3.2% |
| 🌍 EU economic and social statistics | Eurostat | Eurozone deficit: −3.6% GDP |
| 🔗 Bilateral trade flow volumes | UN COMTRADE | Exports: $42.1B, imports: $67.3B |
| 🏗️ Development project portfolios | World Bank Projects | 147 active projects, $18.4B committed |
| 💱 Live and historical FX rates | Exchange Rate Tracker, History, ECB | EUR/USD: 1.0842, USD/TRY: 32.14 |
| 📜 Regulatory and legislative signals | Federal Register, Congress Bills | 23 relevant rulings, 4 pending bills |
| 🚨 Sanctions lists and PEP data | OpenSanctions | 14 sanctioned entities linked to sovereign |
| 🌐 Country profiles and regional metadata | REST Countries | 195 country profiles, regional alliances |
| 🏦 Sovereign CDS spreads (simulated high-frequency) | Derived from macro data | 5Y CDS: 342bps (BB-rated) |
| ⚖️ Bank-sovereign lending exposures | Derived from network edges | EUR 84B net cross-border exposure |
| 🗳️ Political regime classifications | Acemoglu-Robinson framework | Regime: hybrid, Gini: 0.43 |
| 📉 Default probability state-space profiles | Eaton-Gersovitz VFI | Default threshold: 82% debt/GDP |
| 🔄 Clearing payment cascades | Eisenberg-Noe + CDS | Systemic loss: $12.4B, recovery: 0.78 |
| 🗓️ Multi-frequency sovereign risk forecasts | MIDAS regression | Q+1 forecast: 2.1%, Q+4: 1.4% GDP growth |
❓ Why use the Sovereign Debt Crisis MCP Server?
Sovereign risk analysis currently requires a PhD-level understanding of econometric models, access to a Bloomberg terminal, and a team of quant analysts to run the computations. A single restructuring scenario model in a typical advisory firm takes weeks and costs tens of thousands of dollars in analyst time.
This MCP server changes that. Ask your AI agent to model sovereign default dynamics and it calls simulate_sovereign_default, running Eaton-Gersovitz value function iteration across a 50×40 state space grid, pulling live IMF and World Bank data, and returning the endogenous default threshold and equilibrium spread — all in a single tool call.
- Always-on data — the server fetches live data from 15 sources on every session, so analysis reflects current macroeconomic conditions
- API access — call tools from Claude Desktop, Cursor, Windsurf, or any MCP client with a single config line
- Parallel data fetching — all 15 actors are called with
Promise.allfor maximum throughput - Spending limits — every tool call checks
Actor.charge()and stops cleanly if your budget is reached - Composable — run all eight tools in sequence for comprehensive sovereign risk assessment, or call individual tools for targeted analysis
Features
- Eaton-Gersovitz (1981) value function iteration — iterates on the 50-point debt grid × 40-point income grid (Tauchen-discretized AR(1) with ρ=0.945, σ=0.025) until convergence at tolerance 1e-5, yielding endogenous default thresholds, bond price schedules, and optimal borrowing policy functions
- Eisenberg-Noe (2001) clearing with CDS circularity — computes clearing payment vectors in bank-sovereign networks using Scarf-type damped fixed-point iteration (damping factor 0.7, tolerance 1e-6, up to 500 iterations) that handles the non-monotone mapping created by CDS cross-holdings
- Hansen (1999) panel threshold regression — grid-searches over the trimmed (15%–85%) empirical debt distribution to find the debt/GDP breakpoint that minimizes sum of squared residuals; validates significance with 200-iteration bootstrap inference
- Myerson (1981) mechanism design + Nash-Rubinstein bargaining — applies revelation principle with incentive compatibility and individual rationality constraints to derive optimal haircut schedules; combines with alternating-offers equilibrium (δ_d=0.92, δ_c=0.88) to compute debtor/creditor surplus division
- Morris-Shin (2003) global games — finds unique switching equilibrium θ* via fixed-point iteration on the indifference condition with private signal noise σ=0.1 (precision τ=100), resolving the Obstfeld (1996) multiple equilibria problem for speculative attack models
- Lee-Mykland (2008) non-parametric jump detection — computes local bipower variation over rolling window K=√n, standardizes via Gumbel asymptotics (C_n, S_n constants), and flags jumps at p<0.05 across up to 8 sovereign spread time series simultaneously
- MIDAS regression with Almon polynomials (Ghysels et al. 2004) — grid-searches (θ₁, θ₂) parameter space for optimal exponential Almon lag weighting that mixes daily CDS spreads with quarterly GDP, forecasts at Q+1, Q+2, Q+4, Q+8 horizons with 95% confidence intervals
- Acemoglu-Robinson (2006) political transitions — estimates 3-state Markov transition matrix (democratic / hybrid / authoritarian) from inequality-derived Gini estimates, solves stationary distribution via 200-iteration power iteration, classifies regimes by AR phase (Revolutionary Threat / Elite Consolidation / Democratization Pressure / Stable Equilibrium)
- 5-minute network cache — builds sovereign debt network once per session from macro, trade, FX, regulatory, and geopolitical data; subsequent tool calls within the TTL window reuse cached network at zero additional data cost
- Selective source filtering — each tool call accepts a
sourcesarray to restrict data fetching to relevant categories (macro, trade, fx, regulatory, geopolitical), reducing latency for targeted queries - 15 integrated data actors — IMF, World Bank, FRED, BLS, OECD, Eurostat, UN COMTRADE, World Bank Projects, Exchange Rate Tracker, Exchange Rate History, ECB Rates, Federal Register, Congress Bills, OpenSanctions, REST Countries
Use cases for sovereign debt crisis modeling
Sovereign default risk assessment
Fixed income analysts and sovereign credit teams need to model endogenous default thresholds before taking positions in emerging market debt. Use simulate_sovereign_default with a country query to run value function iteration against live IMF and World Bank debt/GDP data, returning the exact debt level at which the sovereign optimally chooses default over repayment and the corresponding equilibrium spread in basis points.
Bank-sovereign doom loop analysis
European bank stress testers and financial stability researchers need to model how sovereign distress propagates through the banking system. Use compute_clearing_contagion to run Eisenberg-Noe clearing with CDS circularity across the bank-sovereign exposure network, quantifying systemic loss, recovery rates, and the amplification effect of cross-border CDS positions.
Fiscal sustainability regime detection
IMF program designers, budget offices, and EM macro funds need to identify whether a country's current debt trajectory crosses into an unsustainable regime. Use estimate_fiscal_sustainability to run Hansen threshold regression over the panel dataset, locating the debt/GDP breakpoint with bootstrap confidence intervals and classifying each country in the network as sustainable, vulnerable, or unsustainable.
Debt restructuring design and negotiation
Sovereign advisory teams, distressed debt funds, and official creditor working groups preparing restructuring proposals need to model haircut schedules that balance creditor participation against debtor sustainability. Use design_optimal_restructuring to compute Myerson-IC restructuring terms and Nash-Rubinstein bargaining outcomes, including aggregate haircut, participation rates, and holdout risk scores.
Currency peg defense and speculative attack modeling
FX strategists and central bank reserve managers need to know whether a currency peg is defensible against coordinated speculative pressure. Use model_speculative_attack to compute the Morris-Shin switching equilibrium θ*, the critical reserves level, and the attack probability given current CDS spreads — with a unique equilibrium guaranteed by incomplete information.
Nowcasting and multi-frequency sovereign risk forecasting
Macro research desks and risk managers need to incorporate high-frequency signals (daily CDS moves) into quarterly sovereign risk forecasts without lag aggregation bias. Use forecast_multi_frequency to fit MIDAS regression with optimal Almon exponential lag weights, producing GDP growth forecasts at Q+1 through Q+8 with confidence intervals and a regime-switching probability flag.
Political transition risk assessment
Country risk teams, political risk insurers, and geopolitical analysts need to quantify how inequality dynamics translate into regime transition probabilities. Use assess_political_transition_risk to run Acemoglu-Robinson framework analysis, returning Markov transition matrices, stationary regime distributions, expected regime duration, and the Gini trigger level for democratization or coup risk.
How to connect the Sovereign Debt Crisis MCP Server
No coding required. Add the server URL to your MCP client config and start querying in plain language.
- Copy the server URL —
https://sovereign-debt-crisis-mcp.apify.actor/mcp - Add to your MCP client — paste the config snippet below into Claude Desktop, Cursor, or Windsurf (see examples)
- Authenticate — include your Apify API token in the URL or Authorization header (see Authentication section)
- Start querying — ask your AI agent "model default risk for Turkey" or "run fiscal sustainability analysis for southern Europe" and the server handles data fetching and computation
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"sovereign-debt-crisis": {
"url": "https://sovereign-debt-crisis-mcp.apify.actor/mcp?token=YOUR_APIFY_TOKEN"
}
}
}
Cursor
Add to your Cursor MCP settings (Settings → MCP → Add Server):
{
"mcpServers": {
"sovereign-debt-crisis": {
"url": "https://sovereign-debt-crisis-mcp.apify.actor/mcp?token=YOUR_APIFY_TOKEN"
}
}
}
Windsurf / Continue / any MCP client
{
"mcpServers": {
"sovereign-debt-crisis": {
"url": "https://sovereign-debt-crisis-mcp.apify.actor/mcp?token=YOUR_APIFY_TOKEN"
}
}
}
Replace YOUR_APIFY_TOKEN with your token from Apify Console → Settings → Integrations.
MCP tools
| Tool | Model | Description |
|---|---|---|
simulate_sovereign_default | Eaton-Gersovitz (1981) | Value function iteration on 50×40 (debt, income) state space. Returns default threshold, equilibrium spread, bond price schedule, and optimal borrowing policy function. |
compute_clearing_contagion | Eisenberg-Noe (2001) + CDS | Scarf-type damped fixed-point finds clearing payments in bank-sovereign network with CDS circularity. Returns systemic loss, defaulted entities, contagion rounds, and recovery rates. |
estimate_fiscal_sustainability | Hansen (1999) | Panel threshold regression with 200-bootstrap inference. Returns debt/GDP breakpoint, regime classifications, interest-growth differential (r−g), and adjustment paths. |
design_optimal_restructuring | Myerson (1981) + Rubinstein (1982) | IC-constrained mechanism design + alternating-offers bargaining. Returns per-instrument haircuts, Nash surplus division, holdout risk, and debt sustainability flag. |
model_speculative_attack | Morris-Shin (2003) | Global games fixed-point finds unique switching equilibrium θ*. Returns attack probability, reserves depletion, devaluation magnitude, and speculator/central bank payoffs. |
detect_crisis_jumps | Lee-Mykland (2008) | Bipower variation + Gumbel asymptotics detect jumps across up to 8 spread series. Returns jump events, intensity λ, clustering coefficient, and critical threshold. |
forecast_multi_frequency | MIDAS / Ghysels et al. (2004) | Almon exponential lag polynomials mix daily CDS with quarterly GDP. Returns Q+1/Q+2/Q+4/Q+8 forecasts with 95% CIs, MIDAS R², and regime-switching probability. |
assess_political_transition_risk | Acemoglu-Robinson (2006) | Markov switching between 3 political regimes driven by inequality thresholds. Returns transition matrix, stationary distribution, AR phase, and fiscal impact per regime. |
Tool input parameters
Each tool accepts the same two parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Country, sovereign debt scenario, or policy topic to analyze. Examples: "Argentina sovereign debt", "Euro area fiscal sustainability", "Turkish lira speculative attack" |
sources | array of strings | No | Data source categories to include. Options: "macro", "trade", "fx", "regulatory", "geopolitical". Defaults to all five categories if omitted. |
Source category reference
| Source category | Actors called | Data type |
|---|---|---|
macro | IMF, World Bank, FRED, BLS, OECD, Eurostat | Fiscal indicators, GDP, inflation, employment |
trade | UN COMTRADE, World Bank Projects | Bilateral trade flows, development portfolios |
fx | Exchange Rate Tracker, Exchange Rate History, ECB Rates | Current and historical FX rates |
regulatory | Federal Register, Congress Bills | US regulatory and legislative signals |
geopolitical | OpenSanctions, REST Countries | Sanctions exposure, country metadata |
Example tool calls
Full sovereign default simulation:
{
"query": "Argentina sovereign debt default risk 2024",
"sources": ["macro", "fx", "geopolitical"]
}
Targeted fiscal sustainability check (macro only, faster):
{
"query": "Italy fiscal sustainability debt-to-GDP",
"sources": ["macro"]
}
Bank contagion with trade linkages:
{
"query": "European bank sovereign doom loop exposure",
"sources": ["macro", "trade", "fx"]
}
Output examples
simulate_sovereign_default output
{
"states": [
{
"debt": 0.0,
"income": 1.002,
"value": -4.821,
"defaultValue": -5.103,
"defaultProbability": 0.0,
"bondPrice": 0.9697,
"optimalBorrowing": 0.163
},
{
"debt": 0.612,
"income": 1.002,
"value": -5.447,
"defaultValue": -5.103,
"defaultProbability": 1.0,
"bondPrice": 0.8241,
"optimalBorrowing": 0.0
}
],
"defaultThreshold": 87.3,
"equilibriumSpread": 412.7,
"debtLimit": 100.0,
"outputCostOfDefault": 2.0,
"reentryProbability": 0.282,
"policyFunction": [
{ "debt": 0.0, "income": 0.933, "borrow": 0.102 },
{ "debt": 0.0, "income": 1.002, "borrow": 0.163 },
{ "debt": 0.306, "income": 1.002, "borrow": 0.306 },
{ "debt": 0.612, "income": 1.002, "borrow": 0.0 }
]
}
compute_clearing_contagion output
{
"payments": [
{
"bank": "Turkey Banking Sector",
"promised": 847.2,
"actual": 661.3,
"shortfall": 185.9,
"recovery": 0.781
},
{
"bank": "Turkish Sovereign",
"promised": 1203.4,
"actual": 1138.7,
"shortfall": 64.7,
"recovery": 0.946
}
],
"systemicLoss": 312.4,
"defaultedEntities": ["Turkey Banking Sector", "Halkbank"],
"contagionRounds": 8,
"cdsCircularityEffect": 46.9,
"fixedPointIterations": 127,
"largestExposure": {
"from": "European Central Counterparty",
"to": "Turkish Sovereign",
"amount": 584.0
}
}
model_speculative_attack output
{
"equilibrium": {
"fundamentalThreshold": 0.423,
"signalPrecision": 100.0,
"reservesCritical": 423.0,
"attackProbability": 0.3871,
"pegSurvivalProbability": 0.6129,
"uniqueEquilibrium": true
},
"reservesDepleted": 38.71,
"devaluationMagnitude": 28.84,
"speculatorPayoff": 0.0614,
"centralBankLoss": 48.9,
"multipleEquilibria": false,
"morrisShinThreshold": 0.423
}
assess_political_transition_risk output
{
"regimes": [
{
"country": "Brazil",
"currentRegime": "hybrid",
"eliteStrength": 0.441,
"populistPressure": 0.617,
"giniThreshold": 0.42,
"transitionProbability": 0.0821,
"fiscalImpact": -1.34
}
],
"markovTransitionMatrix": [
[0.8700, 0.1200, 0.0100],
[0.2500, 0.5000, 0.2500],
[0.0800, 0.1700, 0.7500]
],
"stationaryDistribution": [0.4312, 0.2891, 0.2797],
"expectedRegimeDuration": 6.84,
"giniTriggerLevel": 0.428,
"acemogluRobinsonPhase": "Democratization Pressure",
"democratizationProbability": 0.0614
}
Output fields reference
simulate_sovereign_default
| Field | Type | Description |
|---|---|---|
states[] | array | State-space grid values at median income |
states[].debt | number | Debt/GDP ratio (0–1 scale) |
states[].value | number | Continuation value V_c(b,y) from VFI |
states[].defaultProbability | number | 1.0 if optimal to default at this state |
states[].bondPrice | number | Equilibrium bond price q(b',y) |
defaultThreshold | number | Debt/GDP % above which default is optimal |
equilibriumSpread | number | Bond spread in basis points at threshold |
debtLimit | number | Maximum sustainable debt/GDP % |
outputCostOfDefault | number | Output loss upon default (% of GDP) |
reentryProbability | number | θ = 0.282 probability of capital market re-entry per period |
policyFunction[] | array | Optimal borrowing b' as function of (b, y) |
compute_clearing_contagion
| Field | Type | Description |
|---|---|---|
payments[].bank | string | Entity name |
payments[].promised | number | Total liabilities (million USD) |
payments[].actual | number | Actual clearing payment after iteration |
payments[].shortfall | number | Promised minus actual (million USD) |
payments[].recovery | number | Recovery rate (0–1, cents on dollar) |
systemicLoss | number | Total shortfall across network (million USD) |
defaultedEntities | array | Entities with recovery < 0.95 |
contagionRounds | number | Fixed-point iterations until convergence |
cdsCircularityEffect | number | Additional loss attributable to CDS circularity |
largestExposure | object | Largest bilateral exposure in network |
estimate_fiscal_sustainability
| Field | Type | Description |
|---|---|---|
regimes[].regime | string | sustainable, vulnerable, or unsustainable |
regimes[].thresholdEstimate | number | Hansen panel threshold (debt/GDP %) |
regimes[].adjustmentNeeded | number | Fiscal adjustment required (% of GDP) |
regimes[].confidenceInterval | array | Bootstrap 90% CI on threshold |
panelThreshold | number | Estimated debt/GDP threshold |
bootstrapPValue | number | Bootstrap p-value for threshold significance |
interestGrowthDifferential | number | r−g (positive = unstable debt dynamics) |
debtDynamicsStable | boolean | True if r < g |
design_optimal_restructuring
| Field | Type | Description |
|---|---|---|
terms[].haircut | number | NPV loss % on instrument |
terms[].participationRate | number | Expected creditor participation (0–1) |
aggregateHaircut | number | Average haircut across all instruments |
nashBargainingSolution | object | Debtor and creditor surplus shares |
rubinsteinEquilibrium | object | First-mover advantage and discount factor |
incentiveCompatible | boolean | True if IC constraints satisfied |
holdoutRisk | number | Fraction of creditors expected to hold out |
model_speculative_attack
| Field | Type | Description |
|---|---|---|
equilibrium.fundamentalThreshold | number | θ* switching point (0–1) |
equilibrium.attackProbability | number | Probability peg is attacked |
equilibrium.uniqueEquilibrium | boolean | True when σ < 0.5 (finite signal noise) |
reservesDepleted | number | Reserves consumed if attack succeeds (%) |
devaluationMagnitude | number | Expected devaluation if peg breaks (%) |
speculatorPayoff | number | Expected payoff per unit of attack capital |
centralBankLoss | number | FX reserve loss in million USD |
detect_crisis_jumps
| Field | Type | Description |
|---|---|---|
jumps[].date | string | Date of detected jump event |
jumps[].jumpSize | number | Log-return magnitude at jump |
jumps[].testStatistic | number | Standardized Lee-Mykland statistic |
jumps[].pValue | number | Gumbel asymptotic p-value |
jumpIntensity | number | Annualized jump intensity λ (per year) |
clusteringCoefficient | number | Fraction of jumps occurring within 5 days of another |
leeMyklandThreshold | number | Critical value at 5% significance |
forecast_multi_frequency
| Field | Type | Description |
|---|---|---|
forecasts[].horizon | string | Q+1, Q+2, Q+4, Q+8 |
forecasts[].forecast | number | Point forecast (GDP growth %) |
forecasts[].ci95Lower | number | Lower bound of 95% confidence interval |
forecasts[].ci95Upper | number | Upper bound of 95% confidence interval |
forecasts[].almonWeights | array | First 10 Almon lag weights |
midasR2 | number | In-sample MIDAS R² |
regimeSwitchingProb | number | Probability of regime shift in recent data |
assess_political_transition_risk
| Field | Type | Description |
|---|---|---|
regimes[].currentRegime | string | democratic, hybrid, or authoritarian |
regimes[].transitionProbability | number | Probability of regime change |
regimes[].fiscalImpact | number | Estimated GDP impact of transition (% of GDP) |
markovTransitionMatrix | array | 3×3 transition probability matrix |
stationaryDistribution | array | Long-run regime probabilities [D, H, A] |
expectedRegimeDuration | number | Weighted expected years in current regime |
acemogluRobinsonPhase | string | AR framework phase classification |
democratizationProbability | number | Probability of democratization for non-democratic regimes |
How much does it cost to run sovereign debt crisis models?
This MCP server uses pay-per-event pricing — you pay a fixed amount per tool call. Compute costs are included.
| Tool | Price per call |
|---|---|
simulate_sovereign_default | $0.045 |
compute_clearing_contagion | $0.045 |
design_optimal_restructuring | $0.040 |
model_speculative_attack | $0.040 |
estimate_fiscal_sustainability | $0.035 |
detect_crisis_jumps | $0.035 |
forecast_multi_frequency | $0.035 |
assess_political_transition_risk | $0.035 |
| Usage scenario | Tool calls | Estimated cost |
|---|---|---|
| Single tool query | 1 | $0.035–$0.045 |
| Country deep-dive (3 tools) | 3 | ~$0.12 |
| Full 8-tool analysis | 8 | ~$0.31 |
| Daily monitoring (1 country, 2 tools) | 60/month | ~$2.40/month |
| Research workflow (10 countries, all tools) | 80 | ~$3.10 |
You can set a maximum spending limit per run to control costs. The MCP server stops cleanly when your budget is reached and returns an error message rather than silent failure.
The Apify Free plan includes $5 of monthly platform credits — enough for approximately 130 tool calls per month at no cost.
How the Sovereign Debt Crisis MCP Server works
Phase 1: Multi-source data assembly
Each tool call triggers getOrBuildNetwork(), which checks for a cached SovereignDebtNetwork with a 5-minute TTL. On a cache miss, fetchSovereignData() dispatches parallel runActor() calls across up to 15 actors using Promise.all. Each upstream actor is called with the user's query string and a limit of 50 results, with a 180-second timeout and 256MB memory allocation. Results are partitioned into five typed buckets: macroData, tradeData, fxData, regulatoryData, sanctions, and countryData.
Phase 2: Sovereign debt network construction
buildSovereignDebtNetwork() assembles a typed graph of SovereignNode[] and SovereignEdge[] from raw API results. Macro and country data become sovereign nodes; FX data becomes currency nodes with currency_peg edges; trade data produces trade_flow edges weighted by volume in millions USD; sanctions data creates contagion edges; regulatory data creates institution nodes. When the network has fewer lending edges than sovereign nodes, synthetic bank nodes are generated (bank-{sovereign.id}) with lending weights derived from debt/GDP ratios and cross-border CDS edges to adjacent sovereigns.
Phase 3: Quantitative model execution
All eight models operate on the assembled SovereignDebtNetwork. The Eaton-Gersovitz solver runs up to 200 VFI iterations with CRRA utility (σ=2), discount factor β=0.953, and Tauchen-discretized income grid, converging when max |V_c_new − V_c| < 1e-5. The Eisenberg-Noe solver uses Scarf damping (α=0.7) for non-monotone CDS circularity, capping at 500 iterations. The Hansen threshold solver grid-searches 50 evenly spaced candidate values across the trimmed empirical distribution, then validates with 200 bootstrap replications. The Morris-Shin solver finds θ* by damped fixed-point iteration (0.7 new + 0.3 current), using Abramowitz-Stegun polynomial approximation for Φ. The MIDAS solver grid-searches a 7×5 (θ₁, θ₂) Almon parameter grid and selects the OLS fit with highest R², then forecasts at four horizons with horizon-scaled standard errors.
Phase 4: Pay-per-event charging and response
After model execution, each tool calls Actor.charge({ eventName }) against the pay-per-event price schedule. If eventChargeLimitReached is true, the tool returns a structured error JSON rather than throwing. Results are serialized to JSON with 2-space indentation and returned as MCP content[0].text. The health endpoint at /health exposes network cache status, node and edge counts, and the list of active source categories.
Tips for best results
-
Use targeted source arrays for faster responses. For default threshold analysis,
sources: ["macro", "fx"]is sufficient and runs in roughly half the time of a full 5-source fetch. Reservegeopoliticalfor sanctions-sensitive queries. -
Run the cheapest tools first for triage. Start with
estimate_fiscal_sustainability($0.035) to screen whether a country warrants deeper analysis before runningsimulate_sovereign_default($0.045) orcompute_clearing_contagion($0.045). -
Batch countries in one query string. Queries like "southern European sovereign debt Italy Spain Portugal" populate the network with multiple sovereign nodes, allowing all eight tools to return multi-country comparisons in a single call.
-
Combine
detect_crisis_jumpswithmodel_speculative_attackfor early warning. Jump clustering coefficients above 0.4 indicate contagion periods where attack probability is typically elevated — run both tools and compare the jump intensity timeline against the Morris-Shin threshold. -
Use
forecast_multi_frequencybeforedesign_optimal_restructuring. The MIDAS Q+4 and Q+8 forecasts provide the growth path assumptions that determine whether Rubinstein equilibrium haircuts restore debt sustainability. Running forecast first gives context for interpreting restructuring output. -
The 5-minute cache enables multi-tool sessions. Ask your AI agent to run all eight tools in sequence — they share the same network and only charge data-fetch overhead once. A complete 8-tool country analysis costs ~$0.31.
-
Check
debtDynamicsStablefromestimate_fiscal_sustainability. Afalseresult (r > g) means the interest-growth differential is explosive — this is a strong prior for elevateddefaultThresholdfindings and should prompt runningsimulate_sovereign_defaultimmediately. -
Set explicit spending limits for automated workflows. When running this MCP server in scheduled AI agent pipelines, configure
maxTotalChargeUsdto cap per-session costs. The server returns structured errors rather than hanging when the limit is reached.
Combine with other Apify actors
| Actor | How to combine |
|---|---|
| FRED Economic Data | Pull granular US Treasury yield curves and money supply data to calibrate the risk-free rate parameter in the Eaton-Gersovitz model |
| World Bank Data Search | Fetch World Development Indicators (governance, CPIA scores) to enrich political regime classifications in the Acemoglu-Robinson tool |
| OpenSanctions Search | Pre-screen countries for active sanctions exposure before running contagion analysis — heavily sanctioned sovereigns have structurally different clearing dynamics |
| UN COMTRADE Search | Build bilateral trade flow matrices for network edges — more granular than the server's default trade data and improves contagion channel modeling |
| IMF Economic Data | Extract World Economic Outlook forecasts to use as exogenous income projections in the VFI income grid rather than relying on AR(1) synthetic data |
| ECB Exchange Rates | Feed ECB reference rates directly into the FX node layer for more accurate currency peg modeling in the Morris-Shin speculative attack tool |
| Company Deep Research | Combine with sovereign analysis for sovereign-linked corporate credit assessment — companies in high-default-risk sovereigns carry correlated credit risk |
Limitations
- Small open economy assumption in Eaton-Gersovitz — the model treats the sovereign as a price-taker; large economies like the US, China, or EU that influence world interest rates require general equilibrium extensions not implemented here
- Estimated rather than observed bilateral exposures — Eisenberg-Noe clearing requires bank-to-bank and bank-to-sovereign lending matrices; these are derived from public macro data rather than supervisory reporting and carry significant measurement error
- Synthetic CDS time series — Lee-Mykland jump detection simulates jump-diffusion paths calibrated to node-level CDS spread attributes; it does not consume actual tick-by-tick CDS data, so detected jump dates are indicative rather than calendar-accurate
- Stylized inequality proxies — Acemoglu-Robinson Gini estimates are derived from debt/GDP and CDS spread levels rather than household survey microdata; actual Gini coefficients may differ materially, affecting regime classification accuracy
- No multilateral creditor modeling — IMF, World Bank, and Paris Club restructuring dynamics are not separately modeled in the Myerson mechanism; official sector debt typically has different seniority and renegotiation norms
- Bootstrap inference at N=200 — the Hansen threshold bootstrap uses 200 replications for speed; production econometric analysis typically uses 1,000+ replications for precise p-values
- Data source availability — if upstream actors (IMF, World Bank, etc.) return empty datasets for a given query, the network graph is sparse; results are still returned but reflect less empirical grounding
- Quarterly frequency assumption in MIDAS — the bridge equation assumes quarterly GDP as the low-frequency target; monthly industrial production or weekly financial conditions indices would require parameter re-calibration
Integrations
- Claude Desktop — add the MCP URL to
claude_desktop_config.jsonand query sovereign debt risk in natural language from the Claude interface - Cursor — configure as an MCP server to access sovereign default modeling directly inside your IDE for research code and analysis notebooks
- Apify API — trigger the standby actor programmatically via the
/mcpPOST endpoint for integration into Python or JavaScript research pipelines - Webhooks — configure alerts when tool calls exceed cost thresholds or when the server returns unexpected results during scheduled monitoring workflows
- LangChain / LlamaIndex — use the Apify MCP integration to expose all eight sovereign debt tools as LangChain tools or LlamaIndex query engines for automated research agents
Troubleshooting
Tool returns empty states or zero-node network despite a valid country query. This occurs when upstream data actors return no matching records for the query string. Try broadening the query (e.g., "emerging market sovereign debt" instead of a specific country name) or reducing the sources array to ["macro"] to isolate which data category is failing. The /health endpoint shows cached: true/false and networkSize to confirm whether the network was built.
Eaton-Gersovitz defaultThreshold returns 100 (maximum debt limit). This indicates all states in the (b,y) grid favor continuation over default, which can happen when the query returns sovereigns with very low CDS spreads or no debt/GDP data. Check that the query is returning sovereign nodes with populated debtToGDP and cdsSpread fields — these calibrate the income grid scaling.
compute_clearing_contagion shows fixedPointIterations: 500 (maximum). The Scarf iteration did not converge, which can happen when the bank-sovereign network has extreme CDS circularity. This is a known limitation of the damped iteration approach for highly interconnected networks. Results are still returned but should be treated as approximate. Reducing the sources array to exclude trade can produce a sparser network with better convergence.
estimate_fiscal_sustainability returns bootstrapPValue: 1.0. A p-value of 1.0 means no bootstrap sample produced a higher F-statistic than the original, indicating the threshold is extremely statistically significant. This is not an error — it typically occurs with very clean panel data. Conversely, p-values above 0.15 suggest insufficient panel variation to identify a threshold reliably.
Tool call returns {"error": true, "message": "Spending limit reached"}. Your maxTotalChargeUsd limit was reached. Increase the limit in your Apify actor run settings, or upgrade your plan. The Apify Free plan includes $5/month in credits.
Responsible use
- This MCP server accesses only publicly available data from international organizations, government databases, and open-data platforms.
- All 15 upstream data sources provide data under open-access or public-domain licenses; review individual source terms before redistribution.
- Sovereign risk models produce probabilistic outputs that should be reviewed by qualified analysts before informing investment, policy, or advisory decisions.
- Do not use model outputs as the sole basis for investment decisions without incorporating additional due diligence, expert judgment, and current market intelligence.
- For guidance on web scraping legality, see Apify's guide.
❓ FAQ
How does the sovereign debt crisis MCP server differ from a Bloomberg Terminal or Moody's Analytics? Bloomberg and Moody's provide curated data and standardized risk scores from proprietary models. This server exposes the underlying academic models directly — Eaton-Gersovitz, Eisenberg-Noe, Morris-Shin — so you can see exactly how the computation works, modify queries to fit specific scenarios, and integrate outputs into AI agent workflows. Bloomberg costs $2,000+/month per terminal; this server runs on Apify's free tier for most research workloads.
How many countries can I analyze in one sovereign debt crisis model run? There is no hard country limit. A query like "G20 sovereign debt" will populate the network with all G20 sovereign nodes and run models across the full multi-country network. Larger networks increase the Eisenberg-Noe convergence time but do not fail. Practical limits are upstream actor response times — querying 50+ specific countries may approach the 180-second actor timeout.
Does the Eaton-Gersovitz model use real debt/GDP data or simulated values?
Both. The model uses a grid-based state space computed from academic parameters (β=0.953, σ=2, ρ_y=0.945), but it scales the defaultThreshold and equilibriumSpread outputs by the average real debt/GDP and CDS spread values extracted from the IMF and World Bank actors for the queried countries. Countries with higher observed debt/GDP produce proportionally higher threshold estimates.
What does the Morris-Shin θ (switching threshold) number mean in practice?* θ* represents the critical level of a country's fundamentals (normalized between 0 and 1, where 1 is strongest) below which the sovereign is vulnerable to a self-fulfilling speculative attack. Values below 0.3 indicate strong fundamentals with low attack risk; values above 0.6 indicate a regime where speculative pressure is likely to succeed even with moderate reserve levels.
Is it legal to use data from IMF, World Bank, and FRED for sovereign debt analysis? Yes. All 15 data sources provide data under open-access, public-domain, or CC-BY licenses intended for research and analytical use. IMF data carries Creative Commons Attribution license; World Bank data is open data; FRED data is public domain. See Apify's guide on web scraping legality for general principles.
How accurate is the Hansen threshold regression for identifying debt sustainability breakpoints?
Accuracy depends on the panel data richness. With 10+ sovereign nodes each with multi-period variation, the threshold estimate is typically within ±8–12 percentage points of debt/GDP (the 90% CI reported in confidenceInterval). The bootstrap p-value indicates significance — p < 0.05 means the threshold is statistically distinguishable from no threshold. Published literature (Reinhart-Rogoff, Checherita-Westphal) finds thresholds in the 80–120% debt/GDP range for advanced economies.
Can I run the sovereign debt crisis MCP server on a schedule to monitor countries over time?
Yes. Use Apify's built-in scheduler to trigger the standby actor on a daily or weekly cadence. Configure a webhook to receive alerts when key metrics change — for example, when equilibriumSpread crosses 400bps or attackProbability exceeds 0.5. The 5-minute cache is session-scoped, so each scheduled run builds a fresh network from current data.
How does MIDAS regression handle missing high-frequency data for some countries?
The MIDAS tool generates synthetic jump-diffusion CDS paths calibrated to each sovereign node's cdsSpread attribute when actual high-frequency data is absent. The regimeSwitchingProb field signals how much structural break is implied by recent vs. earlier simulated paths, providing a qualitative regime indicator even without real tick data.
What happens if the Eisenberg-Noe clearing iteration does not converge?
The Scarf damped iteration runs up to 500 iterations. If it does not converge (check fixedPointIterations: 500), results are returned using the last iterate. This is flagged implicitly — convergent runs typically complete in 50–150 iterations. Non-convergence indicates extreme circularity in CDS exposures, and results should be treated as order-of-magnitude estimates rather than precise clearing vectors.
How does the Acemoglu-Robinson model classify a country as democratic vs. hybrid vs. authoritarian?
The model infers a Gini coefficient proxy from the sovereign's debt/GDP and CDS spread levels, then applies two thresholds: giniDemocratize = 0.42 (above which democratic stability is under pressure) and giniCoup = 0.55 (above which elite repression dominates). Sovereigns with inferred Gini below 0.42 are classified democratic, between 0.42 and 0.55 as hybrid, and above 0.55 as authoritarian. The transition probabilities then follow the Acemoglu-Robinson inequality-driven switching mechanism.
Can I use this MCP server with AI coding assistants like Cursor or GitHub Copilot? Yes. Any MCP-compatible client works. In Cursor, add the server URL to your MCP configuration and the eight tools appear as available function calls. You can then ask Cursor's AI to "run fiscal sustainability analysis for the euro area" and it will construct and execute the appropriate tool call, returning structured results directly in the chat.
Help us improve
If you encounter issues, you can help us debug faster by enabling run sharing in your Apify account:
- Go to Account Settings > Privacy
- Enable Share runs with public Actor creators
This lets us see your run details when something goes wrong, so we can fix issues faster. Your data is only visible to the actor developer, not publicly.
Support
Found a bug or have a feature request? Open an issue in the Issues tab on this actor's page. For custom sovereign risk models, additional data sources, or enterprise integrations, reach out through the Apify platform.
How it works
Configure
Set your parameters in the Apify Console or pass them via API.
Run
Click Start, trigger via API, webhook, or set up a schedule.
Get results
Download as JSON, CSV, or Excel. Integrate with 1,000+ apps.
Use cases
Sales Teams
Build targeted lead lists with verified contact data.
Marketing
Research competitors and identify outreach opportunities.
Data Teams
Automate data collection pipelines with scheduled runs.
Developers
Integrate via REST API or use as an MCP tool in AI workflows.
Related actors
Bulk Email Verifier
Verify email deliverability at scale. MX record validation, SMTP mailbox checks, disposable and role-based detection, catch-all flagging, and confidence scoring. No external API costs.
GitHub Repository Search
Search GitHub repositories by keyword, language, topic, stars, forks. Sort by stars, forks, or recently updated. Returns metadata, topics, license, owner info, URLs. Free API, optional token for higher limits.
Website Content to Markdown
Convert any website to clean Markdown for RAG pipelines, LLM training, and AI apps. Crawls pages, strips boilerplate, preserves headings, tables, and code blocks. GFM support.
Website Tech Stack Detector
Detect 100+ web technologies on any website. Identifies CMS, frameworks, analytics, marketing tools, chat widgets, CDNs, payment systems, hosting, and more. Batch-analyze multiple sites with version detection and confidence scoring.
Ready to try Sovereign Debt Crisis MCP?
Start for free on Apify. No credit card required.
Open on Apify Store