FinSight
FinSight is a serverless, institutional-grade multi-asset portfolio analytics API that operates via pay-per-call USDC micropayments on the Tempo network — no account, subscription, or API key required.
Core Analytics Capabilities:
Risk Analysis (
$0.01): Calculate Sharpe, Sortino, and Calmar ratios, market beta, per-asset risk scores, and portfolio-level risk tier (low / moderate / high / very high).Rebalancing Recommendations (
$0.02): Get target allocations via four methods — profile-based, risk parity, minimum variance, or equal weight — with per-asset actions (increase / reduce / hold) and deltas.Diversification Scoring (
$0.01): Evaluate portfolio concentration via the Herfindahl-Hirschman Index (HHI), with grades (excellent → critical) and breakdowns by asset class, region, and sector.Macro Stress Testing (
$0.03): Simulate performance across 10 macro scenarios (market crash, crypto winter, rate hike shock, recession, stagflation, geopolitical shock, dollar rally, etc.) with per-scenario worst/best asset identification.Value-at-Risk & CVaR (
$0.02): Compute parametric VaR and Conditional VaR (Expected Shortfall) at 95% and 99% confidence, including daily/annualized figures and worst-case dollar loss on $1M AUM.Factor Exposure Analysis (
$0.02): Analyze market beta, region/sector breakdowns, portfolio duration, weighted dividend yield, and currency exposure.Correlation Matrix (
$0.02): Generate a full cross-asset correlation matrix, average pairwise correlation, and diversification ratio.Market Regime Detection (
$0.02): Detect the current regime (risk_on / stable_growth / recovery / high_volatility / risk_off / crisis) from macro indicators and portfolio signals, with confidence levels and suggested adjustments.Full Institutional Report (
$0.10): Run all 8 modules in a single call, producing an executive summary with an overall score (0–100), grade (A–F), key strengths, risks, and top recommendations.Portfolio Comparison (
$0.05): Compare two portfolios side-by-side across 9 key metrics (Sharpe, Sortino, Calmar, VaR, CVaR, etc.) with a winner determination and recommendation.
Additional Features:
Dry-run mode: Append
?dry_run=trueto any endpoint for free request validation without payment.MCP compatibility: Works as an MCP stdio server for AI assistants like Claude and Cursor.
Global edge deployment: Built on Cloudflare Workers for low-latency serverless infrastructure.
FinSight — Pay-per-use Portfolio Analytics API
What Are We Building?
FinSight is a pay-per-use financial portfolio analytics API designed to be consumed autonomously by AI agents (Claude, Cursor, Cline, and others) — no registration, no API key per user, just a USDC balance.
It combines two core technologies:
MCP (Model Context Protocol) — the standard for integrating AI agents with external tools and APIs
MPP (Machine Payment Protocol) + Tempo Blockchain — infrastructure for automated machine-to-machine micropayments
The result: an AI agent can analyze investment portfolios in real-time, pay per request on its own, and return quantitative results to the user — all without human intervention.
Live API: https://finsight-mpp.finsight-mpp.workers.dev
The Role of MPP + Tempo Blockchain
MPP (Machine Payment Protocol)
MPP is an HTTP standard for automated micropayments between machines. It works like HTTP auth but for payment challenge-response:
Server returns HTTP 402 Payment Required with a payment challenge
Client (AI agent) reads the challenge, pays on-chain, and attaches the payment proof
Server verifies the proof and serves the request
MPP enables a registrationless paid API — anyone with a wallet and USDC can use it immediately.
Tempo Blockchain
Tempo is an L2 blockchain (chainId: 4217) used as the USDC payment rails. Chosen for:
~500ms transaction confirmation — fast enough for per-request payments
~$0.001 gas fee — cheap enough for micropayments
Native TIP-20 token support (USDC) for stablecoin settlement
Payment Flow
AI Agent / Client FinSight Worker Tempo Blockchain
│ │ │
├─── POST /analyze/risk ──────────►│ │
│ │ │
│◄── HTTP 402 + challenge ─────────┤ │
│ (amount, recipient, chainId) │ │
│ │ │
├─── Send USDC ───────────────────────────────────────────────────►│
│◄── TX Hash / Receipt ───────────────────────────────────────────┤
│ │ │
├─── POST /analyze/risk ──────────►│ │
│ Authorization: Bearer <hash> ├─── Verify TX ────────────────►│
│ │◄── Valid ─────────────────────┤
│◄── HTTP 200 + Analysis Result ───┤ │Key Components
Component | Location | Purpose |
| Server (Cloudflare Worker) | Validates payment tokens from clients |
| Client (MCP Server) | Signs and generates payment tokens |
| Server | USDC recipient wallet address |
MPP_SECRET_KEY(server) andMPPX_SECRET_KEY(client) must share the same value.
Dry-Run Mode (Development)
Test without any on-chain transaction:
curl -X POST https://finsight-mpp.finsight-mpp.workers.dev/analyze/risk?dry_run=true \
-H "Authorization: Bearer <DRY_RUN_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"holdings":[{"asset":"BTC","ticker":"BTC","weight":0.6},{"asset":"ETH","ticker":"ETH","weight":0.4}]}'Quantitative multi-asset portfolio analytics delivered as a Cloudflare Worker with micropayment gating via Tempo chain (USDC). Supports 70+ crypto tickers, 60+ US equity/ETF tickers, 30+ IDX Indonesia stocks, and macro indicators from FRED.
Data Sources
Source | Coverage | Cache TTL |
CoinGecko | 70+ crypto tickers, 365-day daily history | 5 min |
Twelve Data | 60+ US equity/ETF, 252-day daily history | 1 hr |
Yahoo Finance | 30+ IDX Indonesia stocks (.JK suffix) | 1 hr |
FRED | VIX, yield curve, CPI, GDP, unemployment, M2 | 1 hr |
Alternative.me | Fear & Greed Index (0-100) | 1 hr |
Analytics Methodology
Correlation Matrix
Computes real Pearson correlation rho(X,Y) = Cov(X,Y) / (sigma_X * sigma_Y) from daily log returns when price history is available for both assets. Falls back to asset-class heuristic estimates when no price data exists.
Portfolio Volatility
Uses the full covariance matrix formula sigma_p = sqrt(w^T * Sigma * w) where Sigma_ij = rho_ij * sigma_i * sigma_j. This correctly accounts for cross-asset correlations rather than assuming a single average correlation for all pairs.
Beta (Market Sensitivity)
Computed via OLS regression against SPY benchmark: beta = Cov(r_asset, r_SPY) / Var(r_SPY) from aligned daily log returns. SPY is always fetched as benchmark even when not in the portfolio. Falls back to asset-class defaults when insufficient data.
Stress Testing
10 scenario simulations with beta-adjusted impacts. Market-wide scenarios (crash, recovery, recession) scale each asset's impact by its effective beta rather than using hardcoded constants. Sector-specific adjustments apply where relevant.
Executive Summary
Scores portfolios on a 0-100 scale across 4 components (Sharpe, diversification, drawdown, profile alignment). Produces 5+ items per category (strengths, risks, recommendations) with quantitative backing — e.g., specific ratios, percentages, and thresholds.
Additional Modules
VaR/CVaR — Parametric Value-at-Risk at 95% and 99% confidence
Monte Carlo — 10,000-path Geometric Brownian Motion simulation (Box-Muller RNG)
Diversification — HHI, effective asset count, asset-class/region/sector breakdown
Factor Exposure — Market beta, duration, dividend yield, currency exposure
Market Regime — Detection from macro indicators (VIX, yield curve, credit spreads)
Rebalancing — Risk parity, minimum variance, equal weight, profile-based
Portfolio Comparison — Side-by-side delta across 9 metrics
Endpoints
Endpoint | Method | Price | Description |
| GET | Free | API info and supported assets |
| GET | Free (2/day/IP) | Live demo with BTC+ETH+SPY+GLD |
| GET | Free | Full pricing table |
| GET | Free | Health check |
| GET | Free | MCP integration docs |
| POST | $0.005 | Sharpe, Sortino, Calmar, beta, risk tier |
| POST | $0.01 | Target weights by method |
| POST | $0.005 | HHI, breakdown, warnings |
| POST | $0.01 | 10 beta-adjusted scenarios |
| POST | $0.01 | VaR/CVaR at 95% and 99% |
| POST | $0.01 | Factor exposure analysis |
| POST | $0.01 | Pearson correlation matrix |
| POST | $0.01 | Market regime detection |
| POST | $0.02 | 10,000-path Monte Carlo |
| POST | $0.05 | Full report: all modules + executive summary |
| POST | $0.03 | Compare two portfolios |
Payment
All paid endpoints require USDC payment on Tempo chain (chainId: 4217) via the Machine Payment Protocol (MPP). Settlement is ~500ms with ~$0.001 gas.
Dry-run mode is available for development only when DRY_RUN_TOKEN is configured as a Wrangler secret. Requires Authorization: Bearer <token> header. Not publicly accessible.
Request Format
{
"holdings": [
{ "asset": "BTC", "weight": 0.4, "assetClass": "crypto" },
{ "asset": "ETH", "weight": 0.3, "assetClass": "crypto" },
{ "asset": "SPY", "weight": 0.2, "assetClass": "equity" },
{ "asset": "GLD", "weight": 0.1, "assetClass": "commodity" }
],
"profile": "balanced",
"benchmarkReturn": 0.08,
"riskFreeRate": 0.05,
"rebalanceMethod": "risk_parity"
}Fields like avgReturn, volatility, and maxDrawdown are auto-populated from live data when the ticker is recognized. User-provided non-default values always take precedence.
Supported Tickers
Crypto (CoinGecko — 70+)
BTC, ETH, SOL, BNB, XRP, ADA, AVAX, DOGE, DOT, TRX, TON, HBAR, ALGO, FTM, ICP, VET, XMR, BCH, KAS, FIL, FLOW, STX, ROSE, MATIC/POL, ARB, OP, STRK, IMX, MANTA, LINK, UNI, AAVE, MKR, CRV, LDO, SNX, COMP, GMX, DYDX, 1INCH, CAKE, ATOM, NEAR, APT, SUI, SEI, TIA, LTC, ETC, XLM, INJ, JUP, PYTH, RNDR, GRT, OCEAN, ENS, WLD, HYPE, ZRO, LIT, EIGEN, VIRTUAL, PEPE, WIF, BONK, TRUMP, SHIB, FLOKI, POPCAT, USDC, USDT, DAI, FRAX, USDS
US Equity/ETF (Twelve Data — 60+)
SPY, QQQ, IWM, DIA, VTI, VOO, VEA, VWO, ARKK, GLD, SLV, TLT, IEF, BND, AGG, HYG, XLK, XLF, XLE, XLV, SOXX, SMH, AAPL, MSFT, GOOGL, AMZN, NVDA, TSLA, META, AMD, CRM, PLTR, COIN, MSTR, JPM, BAC, GS, V, MA, XOM, CVX, JNJ, UNH, LLY, WMT, COST, VNQ, O, AMT, BIL, SGOV, and more
IDX Indonesia (Yahoo Finance — 30+)
BBCA, BBRI, BMRI, BBNI, TLKM, ASII, ADRO, PTBA, ANTM, GOTO, BUKA, KLBF, SIDO, BSDE, SMGR, and more
MCP Integration
FinSight works as an MCP (Model Context Protocol) server for AI agents like Claude, Cursor, and Cline. See /llms.txt for setup instructions.
Development
# Install dependencies
npm install
# Local development
npx wrangler dev
# Set secrets
wrangler secret put MPP_SECRET_KEY
wrangler secret put COINGECKO_API_KEY
wrangler secret put TWELVE_DATA_API_KEY
wrangler secret put FRED_API_KEY
wrangler secret put DRY_RUN_TOKEN
# Deploy
npx wrangler deployKV Namespaces
RATE_LIMITS— IP-based rate limiting (60 req/min)CACHE— Report result cache (30s TTL)MARKET_DATA— Price data and macro indicator cache
Architecture
Runtime: Cloudflare Workers (edge deployment)
Framework: Hono (TypeScript)
Payment: MPP via Tempo chain (USDC)
Validation: Zod schemas with weight-sum verification
Caching: Cloudflare KV with versioned keys
Version
v3.1.0 — Twelve Data equity provider, lower pricing, demo rate limiting (2/day/IP), real Pearson correlation, OLS beta, beta-adjusted stress tests.
Available Tools
10 toolsanalyze_compareA
Side-by-side comparison of two portfolios across 9 key metrics: Sharpe ratio, Sortino ratio, VaR, CVaR, max drawdown, diversification score, stress test loss, market beta, and overall risk tier. Returns winner per metric and delta values. Useful for A/B testing portfolio strategies or comparing current vs. rebalanced allocation. Costs $0.05 USDC.
Inputs: portfolio_a (required), portfolio_b (required).
analyze_correlationB
Cross-asset correlation matrix and diversification ratio. Returns the full N×N correlation matrix, average pairwise correlation, diversification ratio (DR>1 = benefit), and asset-class pair correlations. Payment: $0.02 USDC on Tempo chain.
Inputs: holdings (required), profile, benchmarkReturn, riskFreeRate, +2 more.
analyze_diversificationA
Portfolio diversification analysis using Herfindahl-Hirschman Index (HHI). Returns concentration grade (excellent/good/moderate/poor/critical), effective number of assets, breakdown by asset class / region / sector, and concentration warnings. Payment: $0.01 USDC on Tempo chain.
Inputs: holdings (required), profile, benchmarkReturn, riskFreeRate, +2 more.
analyze_factorsA
Factor exposure analysis: portfolio market beta, asset-class contributions, region/sector breakdown, interest-rate sensitivity (duration), dividend yield, currency exposure. Payment: $0.02 USDC on Tempo chain.
Inputs: holdings (required), profile, benchmarkReturn, riskFreeRate, +2 more.
analyze_rebalanceA
Portfolio rebalancing recommendations with live market data. Four methods: profile (conservative/balanced/aggressive), risk_parity (inverse-vol weighting), min_variance (inverse-variance), equal_weight (1/N). Returns target weight, current weight, action (increase/reduce/hold), and delta per asset. Known crypto tickers auto-enriched with real volatility data. Payment: $0.02 USDC on Tempo.
Inputs: holdings (required), profile, benchmarkReturn, riskFreeRate, +2 more.
analyze_regimeA
Market regime detection from macro indicators + portfolio signals. Regimes: risk_on | stable_growth | recovery | high_volatility | risk_off | crisis. Returns regime, confidence (low/medium/high), individual signals, portfolio-fit score (0-100), and suggested adjustments. Provide marketIndicators for higher confidence. Costs $0.02 USDC.
Inputs: holdings (required), profile, benchmarkReturn, riskFreeRate, +2 more.
analyze_reportA
Full report — all 8 modules in one call: risk + rebalance + diversification + stress_test (10 scenarios) + var_cvar + factor_exposure + correlation + market_regime. Includes ExecutiveSummary: overall score (0-100), grade (A-F), key strengths, key risks, top recommendations. Most cost-effective option for comprehensive analysis. Costs $0.10 USDC.
Inputs: holdings (required), profile, benchmarkReturn, riskFreeRate, +2 more.
analyze_riskA
Crypto portfolio risk profiling using live CoinGecko market data. For known tickers (BTC, ETH, SOL, AVAX, ARB, etc.) you only need { asset, weight } — volatility, returns, and drawdown are auto-fetched from 365-day real price history. Returns Sharpe ratio, Sortino ratio, Calmar ratio, market beta, risk tier (low/moderate/high/very high), and per-asset risk scores. Payment: $0.01 USDC on Tempo chain (~500ms).
Inputs: holdings (required), profile, benchmarkReturn, riskFreeRate, +2 more.
analyze_stressA
Stress test across 10 macro scenarios using real portfolio volatility data: market_crash (-40%), crypto_winter (-70%), stablecoin_depeg, high_volatility, recovery_bull (+50%), rate_hike_shock, recession, stagflation, geopolitical_shock, dollar_rally. All shocks are asset-class and sector-aware. Returns P&L per scenario with worst/best asset. Payment: $0.03 USDC on Tempo chain.
Inputs: holdings (required), profile, benchmarkReturn, riskFreeRate, +2 more.
analyze_varA
Value-at-Risk (VaR) and CVaR (Expected Shortfall) at 95% and 99% confidence. Uses real volatility auto-fetched from CoinGecko for known crypto tickers. Returns daily and annualised VaR/CVaR, worst-case dollar loss on $1M AUM, and interpretation. Payment: $0.02 USDC on Tempo chain.
Inputs: holdings (required), profile, riskFreeRate, benchmarkReturn, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Tools are mostly distinct: each focuses on a different analysis type (diversification, regime, risk, rebalance, stress, factors, correlation, report, compare, VaR). However, analyze_diversification and analyze_factors both include sector/region breakdowns, and analyze_compare overlaps with analyze_risk and analyze_stress in metrics, but descriptions are detailed enough to avoid major confusion.
All tools follow a consistent pattern: the prefix 'analyze_' followed by a descriptive noun (diversification, regime, risk, rebalance, stress, factors, correlation, report, compare, var). This makes it predictable and easy to navigate.
With 10 tools, the count is well-scoped for a portfolio analysis server. Each tool covers a distinct aspect of analysis, and the aggregate report tool (analyze_report) provides a comprehensive option without overwhelming the user. The count is at the higher end of ideal but stays within a reasonable range.
The server covers a wide range of portfolio analysis needs: risk, correlation, diversification, stress testing, VaR/CVaR, factor exposure, rebalancing, regime detection, and comparison. Minor gaps include lack of tools for data input management (e.g., updating portfolio allocations) and performance attribution, but these are not critical for the stated purpose of analysis.
Maintenance
Related MCP Connectors
Portfolio and strategy stress diagnostics with hedge-break detection and regime outlook. Free tier.
Portfolio-aware finance tools: drift, risk, earnings, benchmarks, news, tax harvesting
Portfolio risk analytics — VaR, Monte Carlo, optimization, options Greeks, stress testing.
Measures a portfolio from price history: independent bets, what funds own, past crises. No advice.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables financial research and analysis through AI agents that combine web search, content crawling, entity extraction, and deep research workflows. Supports extracting stock/fund entities with security codes and conducting structured financial investigations.926Apache 2.0