# Build with Phantom
Source: https://docs.phantom.com/introduction
Integrate wallet functionality into your apps with Phantom's powerful SDKs.
**Phantom** is a leading crypto wallet enabling users to manage digital assets and access decentralized applications across Solana, Ethereum, Bitcoin, Base, Polygon, Sui, and Monad. Available as a browser extension, iOS app, and Android app, Phantom provides developers with enterprise-grade wallet infrastructure through our comprehensive SDK suite.
This documentation is for developers building with Phantom. For integration support, submit a request using this form. For general support, visit our Help Center.
## Key Features
### Phantom Connect
Enable smooth and fast authentication with Phantom Connect, offering users the choice between social login providers (Google, Apple) or their existing Phantom browser extension.
### Phantom Connect SDKs
Build with our comprehensive SDK suite for web and mobile platforms. Choose from React, React Native, or Browser SDKs to integrate wallet functionality into your app with native multi-chain support.
### Phantom Portal
Publish and maintain your app with Phantom Portal, a self-service dashboard for managing branding, supported networks, and contract verification.
# Phantom MCP server
Source: https://docs.phantom.com/phantom-mcp-server
The Phantom MCP server (`@phantom/mcp-server`) gives AI agents a Phantom wallet. Agents can sign transactions, transfer tokens, swap, and interact onchain across Solana, Ethereum, Bitcoin, and Sui. It's a Phantom wallet product for users who interact through AI agents — the same way the mobile wallet and browser extension serve users who interact directly.
## Quick install
Add to your AI client config (requires App ID from phantom.com/portal):
```json
{
"mcpServers": {
"phantom": {
"command": "npx",
"args": ["-y", "@phantom/mcp-server@latest"],
"env": { "PHANTOM_APP_ID": "your_app_id_from_portal" }
}
}
}
```
Supported clients: Claude Desktop, Cursor, Claude Code.
## Available tools
| Tool | Description |
|------|-------------|
| `get_connection_status` | Check if the wallet session is active |
| `get_wallet_addresses` | Get addresses for Solana, Ethereum, Bitcoin, and Sui |
| `get_token_balances` | View token holdings with live USD pricing |
| `transfer_tokens` | Transfer SOL, ETH, and SPL/ERC-20 tokens |
| `buy_token` | Swap tokens via Phantom routing (Solana, EVM, cross-chain) |
| `send_solana_transaction` | Sign and broadcast Solana transactions |
| `send_evm_transaction` | Sign and broadcast EVM transactions |
| `sign_solana_message` | Sign UTF-8 messages on Solana |
| `sign_evm_personal_message` | EIP-191 personal message signing |
| `sign_evm_typed_data` | EIP-712 structured data signing |
| `phantom_login` | Re-authenticate, switch accounts, or refresh a session |
| `pay_api_access` | Pay for daily API access when quota is consumed |
| `portfolio_rebalance` | Analyze and rebalance portfolio allocation via token swaps |
# Phantom MCP server setup
Source: https://docs.phantom.com/phantom-mcp-server/setup
Full installation and reference guide for the Phantom MCP server (`@phantom/mcp-server`).
## Prerequisites
Requires an App ID from Phantom Portal (phantom.com/portal):
1. Visit phantom.com/portal and sign in
2. Create an app and fill in required details
3. Navigate to Dashboard > View App > Redirect URLs and add `http://localhost:8080/callback`
4. Get your App ID from the Phantom Connect tab
## Installation
```bash
npx -y @phantom/mcp-server@latest
```
Or install globally: `npm install -g @phantom/mcp-server@latest` then run `phantom-mcp`.
## Setup by client
**Claude Desktop** — add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
```json
{
"mcpServers": {
"phantom": {
"command": "npx",
"args": ["-y", "@phantom/mcp-server@latest"],
"env": { "PHANTOM_APP_ID": "your_app_id_from_portal" }
}
}
}
```
**Cursor** — add to `~/.cursor/mcp.json` (same config as above).
**Claude Code**:
```bash
claude mcp add phantom -- npx -y @phantom/mcp-server@latest
export PHANTOM_APP_ID=your_app_id_from_portal
```
## Environment variables
Required: `PHANTOM_APP_ID` — App ID from Phantom Portal.
Optional: `PHANTOM_CLIENT_SECRET`, `PHANTOM_CALLBACK_PORT` (default 8080), `PHANTOM_CALLBACK_PATH` (default /callback), `PHANTOM_MCP_DEBUG` (set to 1), `PHANTOM_AUTH_BASE_URL`, `PHANTOM_CONNECT_BASE_URL`, `PHANTOM_API_BASE_URL`, `PHANTOM_QUOTES_API_URL`.
## Authentication flow
On first run: opens browser to connect.phantom.app for Google/Apple login, starts local server on port 8080 for OAuth callback, saves session to `~/.phantom-mcp/session.json`. Sessions persist indefinitely via stamper keys.
## Tools reference
### get_connection_status
Checks whether the authenticated wallet session is active.
### get_wallet_addresses
Gets all blockchain addresses for the authenticated wallet.
- `derivationIndex` (number, optional): default 0
### get_token_balances
Returns token holdings with live USD pricing.
- `networks` (string[], optional): filter by network names e.g. `["solana", "ethereum", "base", "polygon", "arbitrum", "bitcoin", "sui", "monad"]`. Omit to return all.
- `derivationIndex` (number, optional): default 0
### send_solana_transaction
Signs and broadcasts a Solana transaction.
- `transaction` (string, required): Base64-encoded transaction (standard base64 with `A-Za-z0-9+/=`)
- `networkId` (string, optional): e.g. `solana:mainnet`. Defaults to `solana:mainnet`.
- `walletId` (string, optional): wallet ID to use for signing
- `derivationIndex` (number, optional): default 0
### send_evm_transaction
Signs and broadcasts an EVM transaction with automatic gas estimation.
- `chainId` (number, required): EVM chain ID e.g. `1` (Ethereum), `8453` (Base), `137` (Polygon)
- `to` (string, required): destination address (`0x`-prefixed)
- `value` (string, optional): value in wei as hex e.g. `"0x0"`
- `data` (string, optional): calldata as hex
- `gasLimit` (string, optional): gas limit as hex. Auto-estimated if omitted.
- `derivationIndex` (number, optional): default 0
### transfer_tokens
Transfers native tokens or SPL/ERC-20 tokens across Solana and EVM.
- `networkId` (string, required), `to` (string, required), `amount` (string, required)
- `tokenMint` (string, optional): SPL token mint (Solana only, omit for native SOL)
- `tokenAddress` (string, optional): ERC-20 contract address (EVM only, omit for native ETH)
### buy_token
Fetches a swap quote from Phantom routing. Optionally executes when `execute: true`.
- `amount` (string, required), `sellChainId`, `buyChainId`, `buyTokenMint`, `sellTokenMint`, `execute` (boolean)
### sign_solana_message
Signs a UTF-8 message on Solana.
- `message` (string, required), `networkId` (string, required)
### sign_evm_personal_message
Signs a message using EIP-191 for EVM chains.
- `message` (string, required), `chainId` (number, required): e.g. `1`, `8453`
### sign_evm_typed_data
Signs EIP-712 structured data.
- `typedData` (object, required), `chainId` (number, required): e.g. `1`, `8453`
## Supported networks
Solana: `solana:mainnet`, `solana:devnet`, `solana:testnet`
EVM: `eip155:1` (Ethereum), `eip155:8453` (Base), `eip155:137` (Polygon), `eip155:42161` (Arbitrum), `eip155:143` (Monad), plus testnets
Bitcoin: `bip122:000000000019d6689c085ae165831e93`
Sui: `sui:mainnet`, `sui:testnet`
## Session management
Sessions stored in `~/.phantom-mcp/session.json`. To reset: `rm ~/.phantom-mcp/session.json` then restart your AI client.
# Phantom Connect
Source: https://docs.phantom.com/phantom-connect
Onboard users with embedded wallets and authenticate them using Google or Apple.
## Overview
Phantom Connect is a suite of tools that lets developers onboard users instantly with embedded wallets powered by Phantom. Users sign in with Google or Apple (with more identity providers coming in the future), and your app receives a secure, ready-to-use wallet without requiring extensions, mobile apps, or private-key management.
When users authenticate with social login, Phantom creates an embedded wallet inside a secure environment on the user's device. This wallet is authorized to transact with your app and is protected by spending-limit controls, domain binding, and real-time risk evaluation. Your app never handles private keys and never becomes a custodian.
Phantom Connect also supports users connecting through the Phantom extension or other injected wallets. In this case, Phantom doesn't create an embedded wallet. Users approve transactions directly in their existing wallet, and your app interacts with it through the same Phantom Connect SDK interface.
## Embedded Wallets
Embedded wallets are wallets built directly into your application. No browser extensions, mobile apps, or external wallet software required. Users authenticate with familiar methods like Google or Apple, and your app instantly has access to a fully functional wallet.
## Authentication Methods
### Social Login
When a user selects **Sign in with Google** or **Sign in with Apple**, Phantom Connect creates or retrieves an embedded wallet tied to that identity.
Flow summary:
1. Users authenticate with Google or Apple.
2. Users enter their 4-digit PIN.
3. Users approve any required permissions or spending limits.
4. Your app receives the connected embedded wallet.
### Extension and Injected Wallets
When users connect with the Phantom extension or any other injected wallet:
- Phantom Connect doesn't create an embedded wallet.
- Users transact and approve actions directly inside their extension.
- The extension signs using whatever key-management system that wallet uses.
- Your app receives the connected account through the same Phantom Connect SDK interface.
## Session Duration
A Phantom Connect session remains active for seven days from the last login. After it expires, users must sign in again with Google or Apple.
# Phantom Portal Overview
Source: https://docs.phantom.com/phantom-portal/portal
Dashboard for managing app configuration, branding, and integration with Phantom.
Phantom Portal is a self-service dashboard where developers manage their app's configuration, branding, and presence within Phantom. To sign up, go to phantom.app/portal and sign up with a Google account or Apple ID.
## Key Features
- Configure your app: Set up allowed URLs, network support, and authentication settings.
- Manage branding: Upload your app icon, cover image, and description.
- View access mode: See your app's current access mode (DISABLED, PRIVATE, or PUBLIC).
- Verify your domain: Confirm that you own the domain in order to have your app displayed in Phantom.
## Apps That Need Phantom Portal Access
You need to use Phantom Portal if you're building one of the following:
- Apps with embedded wallet: Using React SDK, Browser SDK, or React Native SDK
- Apps with Phantom Connect: Implementing social login or extension-based authentication
- Apps that need public listing: Appearing in Phantom's Explore tab, search results, or recommended apps
## Domain Verification
Domain verification confirms that you control the domain where your app runs. While domain verification is not required to use Phantom Connect, it is required for your app to appear in Phantom's public discovery surfaces.
# Phantom Connect SDK Overview
Source: https://docs.phantom.com/wallet-sdks-overview
Compare React, React Native, and Browser SDKs to choose the right one for your application.
| SDK | Platform | Best For |
|-----|----------|----------|
| React SDK | Web (React) | React apps with built-in UI components and hooks |
| React Native SDK | Mobile (iOS/Android) | React Native and Expo mobile apps |
| Browser SDK | Web (Any) | Vanilla JS or non-React frameworks |
All SDKs support:
- Social login (Google, Apple)
- Browser extension connection
- Multi-chain support (Solana, Ethereum, Bitcoin, Base, Polygon, Sui, Monad)
- Message signing
- Transaction signing and sending
# React SDK
Source: https://docs.phantom.com/sdks/react-sdk
React hooks for wallet integration with built-in UI components and native transaction support.
## Installation
```bash
npm install @phantom/react-sdk
```
## Quick Start
```tsx
import { PhantomProvider, AddressType } from "@phantom/react-sdk";
function App() {
return (
);
}
```
## Hooks
### useConnect
Manages wallet connection functionality.
```tsx
const { connect, isConnecting, error } = useConnect();
// Connect with Google
await connect({ provider: "google" });
// Connect with Apple
await connect({ provider: "apple" });
// Connect with the Phantom browser extension
await connect({ provider: "injected" });
```
### useAccounts
Provides access to connected wallet information.
```tsx
const {
addresses, // Array of wallet addresses
isConnected, // Connection status
walletId, // Phantom wallet ID
} = useAccounts();
```
### useSolana
Provides access to Solana-specific operations.
```tsx
const { solana, isAvailable } = useSolana();
// Sign a message
const signature = await solana.signMessage("Hello Solana!");
// Sign and send a transaction
const result = await solana.signAndSendTransaction(transaction);
```
### useEthereum
Provides access to Ethereum-specific operations.
```tsx
const { ethereum, isAvailable } = useEthereum();
// Get accounts
const accounts = await ethereum.getAccounts();
// Sign a message
const signature = await ethereum.signPersonalMessage("Hello!", accounts[0]);
// Send a transaction
const result = await ethereum.sendTransaction(transactionData);
```
### useDisconnect
Manages wallet disconnection.
```tsx
const { disconnect, isDisconnecting } = useDisconnect();
await disconnect();
```
# React Native SDK
Source: https://docs.phantom.com/sdks/react-native-sdk
Mobile wallet integration for React Native apps with OAuth authentication.
## Installation
```bash
npm install @phantom/react-native-sdk
# For Expo projects
npx expo install expo-secure-store expo-web-browser expo-auth-session expo-router react-native-svg
# Required polyfill
npm install react-native-get-random-values
```
## Required Polyfill
You must polyfill random byte generation. Add this import at the very top of your app's entry point (before any other imports):
```tsx
// index.js, App.tsx, or _layout.tsx - MUST be the first import
import "react-native-get-random-values";
```
## Configure App Scheme
Add your custom scheme to `app.json`:
```json
{
"expo": {
"scheme": "mywalletapp",
"plugins": ["expo-router", "expo-secure-store", "expo-web-browser", "expo-auth-session"]
}
}
```
## Quick Start
```tsx
import "react-native-get-random-values";
import { PhantomProvider, AddressType, darkTheme } from "@phantom/react-native-sdk";
export default function App() {
return (
);
}
```
## Using the Connection Modal
```tsx
import { useModal, useAccounts } from "@phantom/react-native-sdk";
export function WalletScreen() {
const modal = useModal();
const { isConnected, addresses } = useAccounts();
if (!isConnected) {
return