The Architecture of Economic Sovereignty: Building Corre

"Technology is at its most potent not when it dazzles with complexity, but when it dissolves the invisible borders that dictate a person's financial destiny."


Inspiration: The Weight of an Invisible Boundary

Growing up in an era defined by hyperconnected digital highways, I was struck by a jarring paradox: while information travels across continents in milliseconds, financial opportunity remains chained to geography. I watched friends and families in emerging markets watch their life savings erode under the quiet violence of local currency devaluation, barred from basic wealth preservation vehicles like dollar-denominated yields or fractional shares of the world’s most innovative enterprises.

To open a brokerage account or access an inflation-resistant yield vault often required arbitrary minimum balances, weeks of bureaucratic verification, and exorbitant cross-border wire fees. The traditional financial apparatus had decided that billions of people were simply too expensive to serve.

At the same time, we stood on the precipice of another revolution: autonomous AI agents capable of reasoning, analyzing market data, and orchestrating complex tasks. Yet, these agents were trapped in sandbox silos—intellectually capable, but economically paralyzed.

Corre was born at the intersection of these two convictions:

  1. Financial self-sovereignty must be a universal human right, not a geographical privilege.
  2. The future of global wealth creation belongs to autonomous, user-aligned AI agents interacting natively with decentralized rails.

What Was Already There vs. What We Built During This Period

Before this project, Corre already had a working foundation:

  • Existing Backend & Core App: A dashboard for savings vaults (~$8.5\%$ standard yield, ~$6.2\%$ shielded yield) and US stock trading via Jupiter.
  • Remote MCP Server (mcp.corre.bond): An SSE endpoint where external AI assistants like Claude Desktop or ChatGPT could read public vault rates and search stocks remotely.

What We Built & Updated During This Period:

  1. Created the Client-Side WebMCP Engine (frontend/src/webmcp): We built an in-browser runtime that taps into the emerging Chrome document.modelContext API, with a fallback bridge on window.__correWebMCP. Instead of relying on a backend server, the web app itself registers tools directly into the browser session.
  2. Built Client-Side WebMCP Tools: We created a dedicated suite of browser tools:
    • get_savings_yield: Pulls live vault APYs in real time.
    • get_savings_balance: Reads the user's active shielded and standard balances.
    • deposit_savings_vault: Generates and signs on-chain Solana deposit transactions right inside the browser.
    • get_stock_quote & list_available_stocks: Queries live tokenized stock prices and directs users to exact asset pages.
    • get_naira_exchange_rate & get_supported_banks: Provides real-time fiat on/off-ramp conversion rates.
  3. Integrated Native In-Browser Wallet Signing: We connected Privy’s Solana wallet provider directly into the WebMCP context so an AI agent can prepare a transaction, and the browser wallet can sign it without ever exposing private keys.
  4. Interactive WebMCP Inspector UI & Agent Toast System: We designed an in-app inspector badge and dialog where users can see every tool registered with their browser, test tools with live JSON output, and copy JavaScript snippets. We also built an agent notification system (WebMcpAgentToast) that shows live toasts whenever an AI agent calls a tool.

                  ┌─────────────────────────────────────────────────────────┐
                  │                 Autonomous AI Agents                    │
                  │   (Browser Agents, ChatGPT, Claude Desktop, Cursor)     │
                  └────────────┬───────────────────────────────┬─────────────┘
                               │                               │
                     [Browser ModelContext]            [Remote MCP / SSE]
                               │                               │
                               ▼                               ▼
                     ┌──────────────────┐            ┌──────────────────┐
                     │   Corre WebMCP   │            │  mcp.corre.bond  │
                     │  Client Runtime  │            │  Remote Gateway  │
                     └────────┬─────────┘            └────────┬─────────┘
                              │                               │
                              └───────────────┬───────────────┘
                                              │
                                              ▼
 ┌────────────────────────────────────────────────────────────────────────────────────────┐
 │                              Corre Core Settlement Engine                              │
 ├─────────────────────────┬────────────────────────────┬─────────────────────────────────┤
 │     Yield Engine        │      Equities Engine       │        Identity & Safety        │
 │  • Standard Vault       │  • Fractional US Stocks    │  • Privy Embedded Solana Wallet │
 │    (~8.5% APY via Lulo) │    (AAPL, TSLA, NVDA...)   │  • Gas-Sponsored Relayer        │
 │  • Shielded Vault       │  • Jupiter Liquidity V2    │  • Session Circuit Breakers     │
 │    (~6.2% APY pUSD)     │  • Zero-Commission Swaps   │  • Local Fiat Ramp (PAJ / NGN)  │
 └─────────────────────────┴────────────────────────────┴─────────────────────────────────┘

4. Democratized Tokenized US Equities

By routing through liquidity aggregators directly on-chain, Corre allows anyone with an internet connection to purchase fractional shares of US stocks (Tesla, Apple, Nvidia, S&P 500) starting from as little as $\$5.00$ USDC, with instant settlement and $0\%$ broker commissions.

5. The Native Browser WebMCP & Remote Agent Gateway

We pioneered a dual-rail agent interface:

  • In-Browser WebMCP (document.modelContext): Direct browser-level tool registration exposing real-time portfolio telemetry, stock quotes, and savings deposits directly into browser-native AI agents without exposing private keys.
  • Production MCP Gateway (https://mcp.corre.bond): A secure Server-Sent Events (SSE) protocol endpoint allowing ChatGPT, Claude Desktop, and Cursor to analyze vault positions, project multi-year compounding scenarios, and prepare in-chat transactions.

6. Frictionless Onboarding & Key Quorum Security

Web3's steepest hurdle has always been the friction of 12-word seed phrases and gas fees. We integrated:

  • Privy Embedded Solana Wallets: Instant email/social login with cryptographic key quorums.
  • Automated Gas Relayer: A backend fee-payer service that subsidizes Solana transaction fees, providing a pure, Web2-grade user experience with Web3 custody.

Challenges We Ran Into: The Forge of Complex Engineering

Building a production-ready application at the frontier of Web3 and AI forced us to confront problems that textbooks rarely cover:

1. Reconciling Asymmetric Cryptographic Signing Environments

Browser AI agents require fast, deterministic execution, but signing financial transactions requires strict user consent. When integrating Privy’s Solana signers into the WebMCP runtime, EVM wallet hooks initially collided with Solana keypairs. We refactored the entire context lifecycle to decouple wallet discovery, handle partially signed serialized versioned transactions ($V0$), and implement structured error propagation so that AI agents receive actionable diagnostic feedback instead of silent failure states.

2. Defense-in-Depth Against Agentic Exploits

Exposing financial actions to autonomous agents introduces novel threat vectors. We developed strict server-side validation layers:

  • Transaction size limits ($\le \$500$ per in-chat operation).
  • Transaction instruction inspection (stripping out malicious CloseAccount instructions or fee-payer drainage attempts).
  • Rate-limiting circuit breakers backed by persistent PostgreSQL state.

3. The Gas Relayer Payload Mismatch

Once the wallet was recognized, deposits failed with an HTTP 400 error. The frontend was posting { signedTransaction: serializedTransaction }, but our backend controller was strictly checking for req.body.transaction.

We fixed the payload key to { transaction: serializedTransaction } and updated the response parsing to correctly capture sponsorData.transactionHash || sponsorData.signature.

4. Opaque Chrome Model Context Errors

When a tool threw an error (like an invalid deposit amount), Chrome displayed a generic message:

"Tool was executed but the invocation failed. For example, the script function threw an error"

Because the engine was letting exceptions bubble up as unhandled promise rejections, Chrome hid the real cause. We wrapped tool invocations in structured try/catch blocks inside engine.ts. Now, if something goes wrong, the AI agent receives a clear, readable JSON error (e.g., {"status": "error", "error": "Minimum deposit is 1 USDC"}) and can tell the user what to fix.


What We Learned: Beyond Code and Syntax

Building Corre was a masterclass in systems thinking. I learned that:

  1. Simplicity is the highest form of security: The most resilient distributed systems are those that hide mathematical complexity behind intuitive, human-centered interfaces.
  2. AI Agents need native economic primitives: The next billion on-chain transactions will not be initiated by manual human clicks, but by autonomous agents executing financial strategies programmed to maximize their owners' long-term welfare.
  3. AI Agents need clear contracts, not just text prompts: If an API returns an unhandled rejection, an AI agent gets confused. Robust error boundaries are twice as important for AI tools as they are for human buttons.
  4. Client-side MCP changes how we think about privacy: You don't need to send private keys or sensitive user data to a third-party server. By running WebMCP directly in the browser tab, the AI can help prepare transactions while the user's browser wallet maintains complete custody.
  5. Persistence matters in software: When a bug appears like a cut-off dialog or a failing gas relayer, it rarely means the concept is broken. It usually means two different layers of the stack aren't speaking the same language yet.

What's Next for Corre

Corre is only just beginning. Our roadmap includes:

  • Autonomous Dollar-Cost Averaging (DCA) Swarms: Self-balancing agent portfolios that automatically re-weight between high-yield vaults and undervalued equities based on real-time macroeconomic indicators.
  • Decentralized Agent Credit Scores: Enabling autonomous AI agents to build verifiable on-chain credit reputations to access undercollateralized yield farming pools.

Built With

Share this project:

Updates

Submission history