# Project 0 Documentation > Project 0 is a DeFi-native prime broker on Solana (marginfi program): unified margin accounts across Project 0, Kamino, Drift and Jupiter Lend. These docs cover the protocol, guides, the CLI and the TypeScript SDK (@0dotxyz/p0-ts-sdk). - Full content in one file: https://docs.0.xyz/llms-full.txt - Per-page markdown: https://docs.0.xyz/llms.mdx/ - MCP server (Streamable HTTP): https://docs.0.xyz/api/mcp ## project 0 pay - [Project 0 Pay](https://docs.0.xyz/llms.mdx/project-0-pay): Spend crypto against your DeFi portfolio. ## guides - [Agent Skill](https://docs.0.xyz/llms.mdx/guides/agent-skill): How to install and use the P0 agent skill to interact with Project 0 via AI coding tools. - [Borrowing](https://docs.0.xyz/llms.mdx/guides/borrowing): How to borrow against your cross-venue collateral with unified margin on Project 0. - [CLI](https://docs.0.xyz/llms.mdx/guides/cli): How to install, configure, and use the marginfi CLI for advanced Project 0 and operator workflows. - [Emode](https://docs.0.xyz/llms.mdx/guides/emode): How Efficiency Mode affects your borrowing power and how to use it effectively on Project 0. - [Flashloans](https://docs.0.xyz/llms.mdx/guides/flashloans): How to use flashloans on Project 0 for atomic, uncollateralized borrowing within a single transaction. - [Lending & Earning Yield](https://docs.0.xyz/llms.mdx/guides/lending-and-earning-yield): How to deposit assets on Project 0 and earn yield across P0's native market and integrated venues. - [Liquidating Accounts](https://docs.0.xyz/llms.mdx/guides/liquidating-accounts): A guide for third-party liquidators on Project 0, covering account discovery, evaluation, and execution. - [Looping & Strategies](https://docs.0.xyz/llms.mdx/guides/looping-and-strategies): How to use leverage loops and cross-venue strategies on Project 0 to maximize yield. - [Managing Your Account](https://docs.0.xyz/llms.mdx/guides/managing-your-account): How to monitor your health score, use multiple accounts, and swap collateral or debt on Project 0. - [MCP Server](https://docs.0.xyz/llms.mdx/guides/mcp-server): Connect any AI agent to Project 0 through the hosted MCP server at ai.0.xyz. Live rates, strategies, health, and unsigned transaction builders. Your wallet signs. - [Pay](https://docs.0.xyz/llms.mdx/guides/pay): Spend crypto against your DeFi portfolio without selling your positions. - [Staking](https://docs.0.xyz/llms.mdx/guides/staking): Earn yield by minting LST or staking SOL directly to a Project 0 validator. ## introduction - [Getting Started](https://docs.0.xyz/llms.mdx/introduction/getting-started): Learn about the first DeFi native prime broker on Solana. - [What is Project 0](https://docs.0.xyz/llms.mdx/introduction/what-is-project-0): An on-chain prime broker that unifies collateral, risk, and margin across Solana DeFi. ## protocol overview - [Architecture](https://docs.0.xyz/llms.mdx/protocol-overview/architecture): Core data model of Project 0, including Groups, Banks, Accounts, Balances, and Oracles. - [Audits](https://docs.0.xyz/llms.mdx/protocol-overview/audits): Security audit reports for the Project 0 (mrgnLendv2) protocol. - [Bank States](https://docs.0.xyz/llms.mdx/protocol-overview/bank-states): Notable operational states that Banks can be placed into by the Group administrator. - [Cross-Venue Integrations](https://docs.0.xyz/llms.mdx/protocol-overview/cross-venue-integrations): How Project 0 integrates with Kamino, Drift, and other Solana DeFi venues as cross-venue collateral. - [Emissions](https://docs.0.xyz/llms.mdx/protocol-overview/emissions): How emissions campaigns distribute token rewards to lenders and borrowers on Project 0. - [Emode](https://docs.0.xyz/llms.mdx/protocol-overview/emode): How Efficiency Mode (Emode) enhances borrowing power for correlated asset pairs on Project 0. - [Fees](https://docs.0.xyz/llms.mdx/protocol-overview/fees): Overview of all fees on Project 0, both at the program level and the front end. - [Interest Rates](https://docs.0.xyz/llms.mdx/protocol-overview/interest-rates): How interest rate curves, compounding, and APR vs APY work on Project 0. - [Lending & Borrowing](https://docs.0.xyz/llms.mdx/protocol-overview/lending-and-borrowing): How deposits, borrows, interest accumulation, LTV, and the share system work on Project 0. - [Liquidation](https://docs.0.xyz/llms.mdx/protocol-overview/liquidation): How liquidation works on Project 0, including classic and receivership approaches, and the bankruptcy flow. - [Oracles](https://docs.0.xyz/llms.mdx/protocol-overview/oracles): How Project 0 prices assets with Pyth, Switchboard, Scope and exchange-rate oracles, and how confidence intervals, EMA and staleness apply. - [Program Addresses](https://docs.0.xyz/llms.mdx/protocol-overview/program-addresses): On-chain Solana mainnet addresses for all Project 0 programs. - [Risk Engine](https://docs.0.xyz/llms.mdx/protocol-overview/risk-engine): How Project 0's on-chain risk engine evaluates account health and protects protocol solvency. ## typescript sdk - [Accounts](https://docs.0.xyz/llms.mdx/typescript-sdk/accounts): Create, derive, load and read marginfi accounts, and move or close them when you are done. - [Architecture & API Layers](https://docs.0.xyz/llms.mdx/typescript-sdk/architecture): How the SDK is layered, what each layer does for you, and how to pick the right one. - [Banks & Prices](https://docs.0.xyz/llms.mdx/typescript-sdk/banks-and-prices): Find banks, understand asset tags, read bank metrics and rate limiters, and work with oracle prices. - [Error Handling](https://docs.0.xyz/llms.mdx/typescript-sdk/errors): Recognise and recover from SDK build errors, bundle simulation failures and the program errors you will actually meet. - [Flash Loans](https://docs.0.xyz/llms.mdx/typescript-sdk/flash-loans): How marginfi flash loans work, how the SDK uses them under the hood, and how to wrap your own instruction sequence with makeFlashLoanTx. - [Getting Started](https://docs.0.xyz/llms.mdx/typescript-sdk/getting-started): Install the Project 0 TypeScript SDK, pick an environment, and run your first deposit and borrow. - [Health, Max Amounts & E-mode](https://docs.0.xyz/llms.mdx/typescript-sdk/health-and-max-amounts): Read account health from the simulated health cache, size actions with computeMax*ForBank, and inspect e-mode state. - [Integration Banks & Native Stake](https://docs.0.xyz/llms.mdx/typescript-sdk/integrations): Deposit into and withdraw from Kamino, Drift and Jupiter Lend banks, and turn native stake accounts into LSTs you can deposit. - [Deposit, Withdraw, Borrow & Repay](https://docs.0.xyz/llms.mdx/typescript-sdk/lending-and-borrowing): Build and send the four core account operations with the MarginfiAccountWrapper. - [Looping](https://docs.0.xyz/llms.mdx/typescript-sdk/looping): Build a leveraged position in one flash-loan transaction with makeLoopTx and makeBridgedLoopTx, configure the swap engine, and handle routing failures. - [Migration Guide](https://docs.0.xyz/llms.mdx/typescript-sdk/migration): Migrate from marginfi-client-v2 to p0-ts-sdk - [Overview](https://docs.0.xyz/llms.mdx/typescript-sdk/overview): What the Project 0 TypeScript SDK is, how it is organised, and where to start. - [Collateral Swaps, Debt Swaps & Repay with Collateral](https://docs.0.xyz/llms.mdx/typescript-sdk/position-swaps): Rebalance an open position atomically — swap one collateral for another, move debt between tokens, repay debt from collateral, or roll a matured Exponent PT — without touching account health mid-way. - [Program Upgrade 0.1.11](https://docs.0.xyz/llms.mdx/typescript-sdk/program-upgrade-0-1-11): Upgrade to SDK 2.8.0 before September 4, 2026 — banks moving to the new oracle setups will not decode on older SDKs - [Program Upgrade 0.1.10](https://docs.0.xyz/llms.mdx/typescript-sdk/program-upgrade): What the marginfi 0.1.9 → 0.1.10 program upgrade means for SDK integrators - [Transactions](https://docs.0.xyz/llms.mdx/typescript-sdk/transactions): Result types, ordering and atomicity, simulation, priority fees, oracle cranking, integration refreshes, lookup tables and size limits.