Skip to main content
Glama
luiso2

Evolution API WhatsApp MCP Server

by luiso2

create_instance

Create a new WhatsApp Business instance for sending messages, managing contacts, and handling events through webhooks with QR code authentication.

Instructions

Create a new WhatsApp instance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instanceNameYesName for the instance
qrcodeNoGenerate QR code for connection
webhookUrlNoWebhook URL for events

Implementation Reference

  • src/index.ts:43-55 (registration)
    Registration of the 'create_instance' tool in the MCP tools array, including description and input schema definition.
    {
      name: 'create_instance',
      description: 'Create a new WhatsApp instance',
      inputSchema: {
        type: 'object',
        properties: {
          instanceName: { type: 'string', description: 'Name for the instance' },
          qrcode: { type: 'boolean', description: 'Generate QR code for connection' },
          webhookUrl: { type: 'string', description: 'Webhook URL for events' }
        },
        required: ['instanceName']
      }
    },
  • Input schema validation for the create_instance tool parameters.
    inputSchema: {
      type: 'object',
      properties: {
        instanceName: { type: 'string', description: 'Name for the instance' },
        qrcode: { type: 'boolean', description: 'Generate QR code for connection' },
        webhookUrl: { type: 'string', description: 'Webhook URL for events' }
      },
      required: ['instanceName']
    }
  • Main MCP handler function for 'create_instance' tool. Delegates to EvolutionAPI service and formats response as MCP content.
    private async handleCreateInstance(args: any) {
      const result = await evolutionAPI.createInstance(args);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • Supporting utility in EvolutionAPI service that performs the actual HTTP POST request to the backend /instance/create endpoint to create the WhatsApp instance.
    async createInstance(data: {
      instanceName: string;
      qrcode?: boolean;
      integration?: string;
      webhookUrl?: string;
      webhookByEvents?: boolean;
      webhookBase64?: boolean;
      webhookHeaders?: Record<string, string>;
    }): Promise<Instance> {
      const response = await this.client.post('/instance/create', data);
      return response.data;
    }

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/luiso2/mcp-evolution-api'

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