Skip to main content
Glama
monostate

Crossmint HR Airdrop MCP

by monostate

connect_wallet

Securely link your Solana wallet to the Crossmint HR Airdrop MCP server to enable token distribution. Provide your private key for wallet authentication.

Instructions

Connect a Solana wallet to the airdrop server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
privateKeyYesThe private key of the Solana wallet (base58 encoded)
rpcUrlNoThe Solana RPC URL to use (optional)

Implementation Reference

  • The main handler function for the 'connect_wallet' tool. It validates input using Zod, creates a Solana connection, derives the keypair from base64 private key, fetches the SOL balance, updates the server state, and returns the connection details.
    private async handleConnectWallet(args: any) {
      try {
        // Validate input
        const schema = z.object({
          privateKey: z.string(),
          rpcUrl: z.string().optional(),
        });
        
        const { privateKey, rpcUrl } = schema.parse(args);
        
        // Connect to Solana
        const connection = new Connection(
          rpcUrl || 'https://api.mainnet-beta.solana.com',
          'confirmed'
        );
        
        let keypair: Keypair;
        try {
          keypair = Keypair.fromSecretKey(Buffer.from(privateKey, 'base64'));
        } catch (e: any) {
          throw new McpError(ErrorCode.InvalidParams, 'Invalid private key format. Please provide a base64 encoded private key.');
        }
        
        const publicKey = keypair.publicKey.toString();
        
        // Get SOL balance
        const balance = await connection.getBalance(keypair.publicKey);
        const solBalance = balance / LAMPORTS_PER_SOL;
        
        // Update state
        this.state.connectedWallet = {
          publicKey,
          solBalance,
        };
        
        return {
          content: [
            {
              type: 'text',
              text: `Wallet connected successfully. Public Key: ${publicKey}\nSOL Balance: ${solBalance} SOL`,
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to connect wallet: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • The tool registration in ListToolsRequestHandler, including name, description, and input schema definition (JSON Schema). Note: description mentions base58 but code expects base64.
    {
      name: 'connect_wallet',
      description: 'Connect a Solana wallet to the airdrop server',
      inputSchema: {
        type: 'object',
        properties: {
          privateKey: {
            type: 'string',
            description: 'The private key of the Solana wallet (base58 encoded)',
          },
          rpcUrl: {
            type: 'string',
            description: 'The Solana RPC URL to use (optional)',
          },
        },
        required: ['privateKey'],
      },
  • src/server.ts:314-316 (registration)
    The dispatch/registration in the CallToolRequestHandler switch statement that routes 'connect_wallet' calls to the handler function.
    case 'connect_wallet':
      return await this.handleConnectWallet(args);
    case 'connect_crossmint_wallet':
  • Zod runtime validation schema inside the handler for input parameters.
    const schema = z.object({
      privateKey: z.string(),
      rpcUrl: z.string().optional(),
    });
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/monostate/Employees-Airdrop-Rewards-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server