Skip to main content
Glama
luiso2

Evolution API WhatsApp MCP Server

by luiso2

connect_instance

Connect a WhatsApp Business instance to enable messaging through Evolution API for sending notifications, managing contacts, and handling business communications.

Instructions

Connect a WhatsApp instance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instanceNameYesInstance name to connect

Implementation Reference

  • The main MCP tool handler function for 'connect_instance'. It extracts the instanceName from args, calls evolutionAPI.connectInstance, and returns the result as a formatted JSON text response.
    private async handleConnectInstance(args: any) {
      const result = await evolutionAPI.connectInstance(args.instanceName);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • Input schema definition for the 'connect_instance' tool, specifying instanceName as required string.
    inputSchema: {
      type: 'object',
      properties: {
        instanceName: { type: 'string', description: 'Instance name to connect' }
      },
      required: ['instanceName']
    }
  • src/index.ts:64-74 (registration)
    Tool registration in the tools array, including name, description, and input schema. Used by the MCP listTools handler.
    {
      name: 'connect_instance',
      description: 'Connect a WhatsApp instance',
      inputSchema: {
        type: 'object',
        properties: {
          instanceName: { type: 'string', description: 'Instance name to connect' }
        },
        required: ['instanceName']
      }
    },
  • src/index.ts:490-491 (registration)
    Dispatcher switch case that routes 'connect_instance' tool calls to the handleConnectInstance method.
    case 'connect_instance':
      return await this.handleConnectInstance(args);
  • Helper method in EvolutionAPI service that makes the HTTP GET request to connect the WhatsApp instance via the Evolution API backend.
    async connectInstance(instanceName: string): Promise<Instance> {
      const response = await this.client.get(`/instance/connect/${instanceName}`);
      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