@swig-wallet/mcp-server is an MCP (Model Context Protocol) server that gives AI agents the ability to create and manage Swig smart wallets on Solana. It can run locally over stdio or remotely over Streamable HTTP.
If you are setting this up for the first time, start with
Getting Started with Swig MCP.
Quick Start
Local (stdio)
Remote (HTTP)
Installation
The server is part of theswig-ts monorepo.
Build the full workspace:
dist/index.js.
Transport Modes
stdio (default)
In stdio mode, the server reads JSON-RPC messages from stdin and writes responses to stdout. This is the standard local MCP pattern, where the AI client launches the server as a subprocess.
Streamable HTTP (--http)
In HTTP mode, the server exposes the MCP Streamable HTTP transport. Each connecting client gets its own stateful session, which makes this mode appropriate for shared or hosted deployments.
| Path | Methods | Description |
|---|---|---|
/mcp | POST, GET, DELETE | MCP Streamable HTTP endpoint |
/health | GET | Health check that returns JSON status and session count |
InitializeRequest to /mcp.
CLI Options
| Flag | Default | Description |
|---|---|---|
--http | off | Enable HTTP mode instead of stdio |
--port <n> | 3001 | HTTP listen port |
--host <addr> | 0.0.0.0 | HTTP bind address |
--api-key <key> | none | Require Authorization: Bearer <key> on every request |
--cors-origin <origin> | * | Value for the Access-Control-Allow-Origin header |
--help, -h | Print help and exit |
Environment Variables
| Variable | Description |
|---|---|
PORT | HTTP port, overridden by --port |
SWIG_MCP_API_KEY | Bearer token for auth, overridden by --api-key |
Tools
The server exposes 13 tools across configuration, wallet management, and transaction execution. In a fresh session, callconfigure_rpc first.
Configuration
| Tool | Description |
|---|---|
configure_rpc | Set the Solana RPC endpoint and commitment level |
configure_paymaster | Provide Swig Paymaster API credentials from dashboard.onswig.com for gasless transactions |
configure_gas_sponsor | Provide a custom gas sponsorship server URL |
generate_agent_keypair | Generate a new Ed25519 keypair for the agent and optionally save it to a file |
configure_agent_keypair | Load an existing keypair from a JSON file or base58 secret key |
get_balance | Check the SOL balance of any address |
Wallet Management
| Tool | Description |
|---|---|
create_swig_wallet | Create a new Swig smart wallet on-chain with a root authority and permissions |
fetch_swig_wallet | Fetch wallet details, including account version, wallet address, and authorities |
add_authority | Add a new authority with specific permissions |
remove_authority | Remove an authority by role ID |
update_authority | Update an authority’s permissions or configuration |
add_authority, the newAuthorityPubkey format depends on authorityType:
ed25519anded25519Session: base58 public keysecp256k1: hex-encoded SEC1 public keysecp256r1: compressed hex-encoded P-256 public key
Transactions
| Tool | Description |
|---|---|
transact_sol_transfer | Transfer SOL from the Swig wallet to a recipient |
transact_custom | Execute arbitrary instructions through the Swig wallet, with the wallet as signer |
Gas and Fee Handling
Configure one fee strategy before sending transactions.1. Swig Paymaster
The Swig Paymaster covers transaction fees. Callconfigure_paymaster with your API key and paymaster public key.
For broader Paymaster setup details, see Using Paymaster SDK.
2. Custom Gas Sponsor
Your own sponsor service signs and sponsors transactions. Callconfigure_gas_sponsor with the service URL.
The server sends a base64-encoded transaction to:
3. Self-Funded
The agent can pay fees from its own SOL balance. Callgenerate_agent_keypair or configure_agent_keypair, then fund that address with SOL.
Permissions Reference
When callingcreate_swig_wallet, add_authority, or update_authority, pass a permissions array where each object has a type field.
| Type | Additional fields | Description |
|---|---|---|
all | none | Full root permissions |
manageAuthority | none | Can add, remove, and update authorities |
allButManageAuthority | none | Everything except authority management |
closeSwigAuthority | none | Can close the Swig account |
solLimit | amount | One-time SOL spend limit in lamports, passed as a string |
solRecurringLimit | recurringAmount, window | Recurring SOL limit |
solDestinationLimit | amount, destination | SOL limit to a specific recipient |
tokenLimit | mint, amount | One-time token spend limit |
tokenRecurringLimit | mint, recurringAmount, window | Recurring token limit |
programLimit | programId | Access to a specific program |
programAll | none | Access to any program |
programCurated | none | Access to curated programs |
subAccount | none | Sub-account management |
stakeAll | none | Full staking permissions |
stakeLimit | amount | Staking with an amount limit |
Deployment
Docker
Railway, Render, and Fly.io
Use this start command:PORT and SWIG_MCP_API_KEY in your deployment environment.
Production Checklist
- Require authentication with
--api-keyorSWIG_MCP_API_KEY - Put the server behind a reverse proxy with TLS termination
- Set
--cors-originto your specific domain instead of* - Use a dedicated RPC endpoint such as Helius, Triton, or QuickNode instead of the public Solana RPC
Architecture
@swig-wallet/classic internally. Wallet creation, authority management, and transaction signing are handled through @swig-wallet/classic and @swig-wallet/paymaster-classic.
License
AGPL-3.0-only
