Skip to main content
Glama
fakepixels

Base Network MCP Server

by fakepixels

create_wallet

Generate a new wallet on the Base Network MCP Server to manage blockchain assets, execute transactions, and check balances. Optional wallet naming available for organization.

Instructions

Create a new wallet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoOptional name for the wallet

Implementation Reference

  • Main handler function for the 'create_wallet' tool. Validates args, calls createWallet helper, formats and returns the response.
    async function handleCreateWallet(args: CreateWalletArgs): Promise<any> {
      try {
        const wallet = createWallet(args.name);
        
        return {
          success: true,
          message: `Created new wallet "${wallet.name}" with address ${wallet.address}`,
          wallet: {
            name: wallet.name,
            address: wallet.address
          }
        };
      } catch (error) {
        console.error('Error creating wallet:', error);
        throw error;
      }
    }
  • MCP CallToolRequestSchema handler case that dispatches 'create_wallet' tool calls to handleCreateWallet and returns MCP-formatted response.
    case 'create_wallet': {
      const result = await toolHandlers.handleCreateWallet({
        name: typeof args.name === 'string' ? args.name : undefined,
      });
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Tool registration in ListToolsRequestSchema response, defining name, description, and input schema for 'create_wallet'.
      name: 'create_wallet',
      description: 'Create a new wallet',
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description: 'Optional name for the wallet',
          },
        },
      },
    },
  • TypeScript interface defining the input arguments for create_wallet tool.
    export interface CreateWalletArgs {
      name?: string; // Optional wallet name
    }
  • Core helper function that generates a new wallet using viem, stores it in memory, and returns wallet details.
    export function createWallet(name?: string): Wallet {
      // Generate a random private key
      const privateKey = generatePrivateKey();
      const account = privateKeyToAccount(privateKey);
      
      // Use provided name or generate a random one
      const walletName = name || `wallet_${Object.keys(walletStore).length + 1}`;
      
      // Store the wallet
      const wallet: Wallet = {
        address: account.address,
        privateKey: privateKey,
        name: walletName
      };
      
      walletStore[walletName] = wallet;
      console.log(`Created new wallet: ${wallet.address} with name: ${walletName}`);
      
      return wallet;
    }
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/fakepixels/base-mcp-server'

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