Skip to main content
Glama

MoonGate MCP Server

npm version License: MIT

Model Context Protocol (MCP) server for MoonGate - the Solana wallet with zero-friction authentication.

This server enables AI assistants and tools like Claude (via API or Desktop), OpenClaw, and Cursor to interact with your MoonGate wallet:

  • πŸ”‘ Sign transactions and messages

  • πŸ’Έ Send tokens (SOL and SPL tokens)

  • πŸ“Š View portfolio and balances

  • πŸ”„ Swap tokens

  • πŸ” OAuth-based authentication (Google/Apple)

Quick Start

Installation

npm install -g moongate-mcp-server

Configuration

For Claude Desktop

Add to your ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "moongate": {
      "command": "npx",
      "args": ["-y", "moongate-mcp-server"],
      "env": {
        "MOONGATE_API_URL": "https://wallet.moongate.one"
      }
    }
  }
}

For Cursor

Add to your Cursor MCP settings:

{
  "mcpServers": {
    "moongate": {
      "command": "npx",
      "args": ["-y", "moongate-mcp-server"]
    }
  }
}

For OpenClaw or Custom Integrations

Use the MCP SDK to connect to the server programmatically. See the MCP documentation for details on client implementation.

Authentication

πŸ“– See AUTH-GUIDE.md for detailed instructions with screenshots.

TL;DR: Use a token from your browser session (recommended):

  1. Log into wallet.moongate.one

  2. Open DevTools β†’ Application β†’ Local Storage

  3. Copy the token value

  4. Add it to your MCP config as MOONGATE_TOKEN

For Claude Desktop:

{
  "mcpServers": {
    "moongate": {
      "command": "npx",
      "args": ["-y", "moongate-mcp-server"],
      "env": {
        "MOONGATE_TOKEN": "eyJhbGciOiJSUzI1NiIsInR5cCI6..."
      }
    }
  }
}

Tokens expire after 7 days - just grab a fresh one from your browser when needed.

Related MCP server: Solana MCP Server

Available Tools

get_wallet_address

Get your MoonGate wallet's public key (address).

// No parameters required

Returns:

{
  "publicKey": "5xGj3..."
}

sign_message

Sign a message with your wallet.

Parameters:

  • message (string | number[]): The message to sign

Returns:

{
  "signature": "4vJ5a..."
}

sign_transaction

Sign a Solana transaction (optionally broadcast it).

Parameters:

  • serializedTransaction (number[]): Serialized transaction bytes

  • type (string): Transaction type - "legacy" or "versioned" (default: "versioned")

  • broadcast (boolean): Whether to broadcast after signing (default: false)

  • includePayerSignature (boolean): Include payer signature (default: true)

Returns:

{
  "signatures": ["..."],
  "signedTransaction": [/* bytes */],
  "txSignature": "3nZ4..." // if broadcast=true
}

send_token

Send SOL or SPL tokens to another address. Fetches your portfolio to resolve the token, verify balance, and use correct decimals.

Parameters:

  • tokenMint (string): Token mint address (optional if tokenName/tokenSymbol provided)

  • tokenName (string): Token name to search in portfolio (e.g. "Wrapped SOL")

  • tokenSymbol (string): Token symbol to search in portfolio (e.g. "SOL", "USDC")

  • toAddress (string): Recipient wallet address

  • amount (number): Amount to send

  • decimals (number): Token decimals (optional; auto-fetched from portfolio)

  • userWallet (string): Optional - sender address (auto-detected if omitted)

Note: Provide at least one of tokenMint, tokenName, or tokenSymbol. The token must exist in your portfolio.

Returns:

{
  "success": true,
  "signature": "2wE3..."
}

get_portfolio

Get wallet portfolio (tokens, balances, NFTs).

Parameters:

  • walletAddress (string): Optional - wallet to query (defaults to your wallet)

Returns:

{
  "tokens": [...],
  "totalValue": 1234.56,
  "nfts": [...]
}

search_token

Search for Solana tokens by name, symbol, or mint address. Returns top results sorted by market cap.

Parameters:

  • query (string): Token name (e.g. "Solana"), symbol (e.g. "SOL"), or mint address

  • limit (number): Maximum results to return (default: 10, max: 100)

Returns:

{
  "success": true,
  "results": [
    {
      "mint": "So11111111111111111111111111111111111111112",
      "name": "Wrapped SOL",
      "symbol": "SOL",
      "decimals": 9,
      "price": "$86.46",
      "marketCap": "52474839784",
      "volume24h": "139815210",
      "holders": 2877594,
      "image": "https://..."
    }
  ],
  "count": 1
}

swap_token

Swap tokens via MoonGate DEX integration (Jupiter). Supports searching by name/symbol or mint address.

Parameters:

  • inputMint (string): Input token mint address (optional if inputToken provided)

  • inputToken (string): Input token name/symbol (e.g. "SOL", "USDC") - searches for mint

  • outputMint (string): Output token mint address (optional if outputToken provided)

  • outputToken (string): Output token name/symbol (e.g. "SOL", "USDC") - searches for mint

  • inputAmount (number): Amount of input token to swap

  • slippagePercentage (number): Slippage tolerance in basis points (default: 100 = 1%)

  • transactionSpeed (string): Priority - "slow", "normal", or "fast" (default: "normal")

Note: Provide either mint address OR name/symbol for each token. Name/symbol search returns the top result by market cap.

Returns:

{
  "success": true,
  "signature": "4xK2...",
  "transactionCount": 1,
  "inputToken": "USDC",
  "outputToken": "SOL",
  "inputAmount": 100
}

get_token_info

Get detailed token information including security analysis and rugpull risk indicators.

Parameters:

  • tokenMint (string): Token mint address (optional if tokenName provided)

  • tokenName (string): Token name or symbol to search for

Returns:

{
  "token": {
    "mint": "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
    "name": "Bonk",
    "symbol": "BONK",
    "decimals": 5,
    "supply": 87995151415980.58,
    "createdAt": 1670531612
  },
  "price": {
    "usd": 0.00000646,
    "marketCap": 568745265,
    "circulatingMarketCap": 531283669
  },
  "security": {
    "mintable": false,
    "freezable": false,
    "lockedLiquidityPercent": 75,
    "topHoldersPercent": 33.56,
    "devHoldersPercent": 0.000000166,
    "snipersPercent": 0
  },
  "market": {
    "liquidity": 178311,
    "holders": 987817,
    "buyCount24h": 5165,
    "sellCount24h": 5630,
    "buyerSentimentPercent": 47.85
  },
  "socialLinks": {
    "website": "https://www.bonkcoin.com",
    "twitter": "https://twitter.com/bonk_inu",
    "telegram": "https://t.me/Official_Bonk_Inu"
  },
  "riskAssessment": {
    "overallRisk": "LOW",
    "riskIndicators": ["No major red flags detected"],
    "safetyIndicators": [
      "Good liquidity ($178.3K)",
      "987,817 holders",
      "Good distribution (top holders: 33.6%)",
      "βœ“ Not mintable or freezable",
      "75% liquidity locked",
      "Has social media presence"
    ],
    "recommendation": "βœ“ Appears relatively safe, but always DYOR (Do Your Own Research)"
  }
}

Risk Indicators:

  • Liquidity: Low liquidity (<$10K) flags high rugpull risk

  • Holder Distribution: Top holders >50% indicates concentration risk

  • Security: Mintable/freezable tokens can be manipulated

  • Locked Liquidity: <50% locked is risky

  • Age: Very new tokens (<7 days) are higher risk

  • Social Presence: No social links is suspicious

  • Sentiment: Low buyer percentage (<30%) indicates bearish market

Risk Levels:

  • LOW: 0-1 risk indicators

  • MODERATE: 2-4 risk indicators

  • HIGH: 5+ risk indicators

Environment Variables

Variable

Description

Default

MOONGATE_API_URL

MoonGate API base URL

https://wallet.moongate.one

MOONGATE_CALLBACK_PORT

OAuth callback port

8787

MOONGATE_MCP_DEBUG

Debug logging (verbose)

true (set to false to disable)

MOONGATE_TOKEN

Manual token (for testing)

-

Development

Local Setup

git clone https://github.com/invictusdhahri/moongate-mcp-server.git
cd moongate-mcp-server
npm install
npm run build

Testing

For quick testing without OAuth flow, set a manual token:

export MOONGATE_TOKEN="your-jwt-token"
npm run dev

Building

npm run build

The built files will be in dist/.

Authentication Flow

sequenceDiagram
    participant User
    participant MCP as MCP Server
    participant Browser
    participant MG as MoonGate API

    MCP->>MCP: Check ~/.moongate-mcp/session.json
    
    alt Session exists & valid
        MCP->>MG: GET /api2/auth (refresh if needed)
        MG-->>MCP: Fresh token
    else No session or expired
        MCP->>Browser: Open localhost:8787
        Browser->>Browser: User clicks Google/Apple
        Browser->>MG: OAuth verification
        MG-->>Browser: JWT token
        Browser->>MCP: Redirect with token
        MCP->>MCP: Save session.json
    end
    
    MCP-->>User: Ready for tool calls

Security

  • Session Storage: Tokens stored in ~/.moongate-mcp/session.json with 0o600 permissions (user read/write only)

  • Auto-Refresh: Tokens automatically refresh when within 1 hour of expiry

  • Password-less Signing: All signing operations use empty password per MoonGate OAuth design

  • Local OAuth: Authentication happens via localhost callback, not exposing credentials

Roadmap

  • Phase 1: Core tools (get address, sign message/tx)

  • Phase 2: OAuth browser flow, send tokens

  • Phase 3: Portfolio & swap tools

  • Phase 4: Token search and rugpull analysis

  • Phase 5: npm publish as moongate-mcp-server

  • Phase 6: NFT operations (list, transfer, mint)

  • Phase 7: Token metadata updates

  • Phase 8: Multi-wallet support

Troubleshooting

"Not authenticated" or "Invalid token" error

Your token has expired (7-day lifetime). Get a fresh one:

  1. Go to wallet.moongate.one and log in

  2. Open DevTools β†’ Application β†’ Local Storage β†’ https://wallet.moongate.one

  3. Copy the token value

  4. Update MOONGATE_TOKEN in your MCP config

  5. Restart Claude Desktop / your MCP client

OAuth callback times out or "localhost:8787" won't load

Solution: Use the manual token method instead (see Authentication section above). The local OAuth server requires port 8787 to be available and may not work in sandboxed environments.

If you need OAuth: set MOONGATE_CALLBACK_PORT to another port and ensure it's accessible.

Debug logging

Debug logging is enabled by default. To disable it:

export MOONGATE_MCP_DEBUG=false

Testing with MCP Inspector

The MCP Inspector provides a web UI to test your server:

npx @modelcontextprotocol/inspector node dist/cli.js

This will open a browser where you can:

  • View all available tools

  • Test tool calls with a form UI

  • See request/response logs in real-time

  • Debug without needing Claude Desktop

Contributing

Contributions welcome! Please open an issue or PR.

License

MIT


Built with ❀️ for the Solana ecosystem

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers