Skip to main content
@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 the swig-ts monorepo. Build the full workspace:
Or build only the MCP server:
The compiled output is a single file at 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.
Agent configuration examples: Claude Code:
Cursor, VS Code, or another MCP client:

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.
Endpoints: Agent configuration examples: Claude Code:
Cursor:
Any MCP-compatible client can connect by sending an InitializeRequest to /mcp.

CLI Options

Environment Variables

Tools

The server exposes 13 tools across configuration, wallet management, and transaction execution. In a fresh session, call configure_rpc first.

Configuration

Wallet Management

For add_authority, the newAuthorityPubkey format depends on authorityType:
  • ed25519 and ed25519Session: base58 public key
  • secp256k1: hex-encoded SEC1 public key
  • secp256r1: compressed hex-encoded P-256 public key

Transactions

Gas and Fee Handling

Configure one fee strategy before sending transactions.

1. Swig Paymaster

The Swig Paymaster covers transaction fees. Call configure_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. Call configure_gas_sponsor with the service URL. The server sends a base64-encoded transaction to:
The sponsor service is expected to return JSON in this shape:

3. Self-Funded

The agent can pay fees from its own SOL balance. Call generate_agent_keypair or configure_agent_keypair, then fund that address with SOL.

Permissions Reference

When calling create_swig_wallet, add_authority, or update_authority, pass a permissions array where each object has a type field. Example:
For more detail on how these actions map to the SDK, see Swig Actions Documentation.

Deployment

Docker

Railway, Render, and Fly.io

Use this start command:
Set PORT and SWIG_MCP_API_KEY in your deployment environment.

Production Checklist

  • Require authentication with --api-key or SWIG_MCP_API_KEY
  • Put the server behind a reverse proxy with TLS termination
  • Set --cors-origin to your specific domain instead of *
  • Use a dedicated RPC endpoint such as Helius, Triton, or QuickNode instead of the public Solana RPC

Architecture

The server uses @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