> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wassist.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrations

> Connect external services like ElevenLabs and MCP servers

The Integrations resource lets you connect external services to extend your agents' capabilities.

## Available Integrations

<CardGroup cols={2}>
  <Card title="ElevenLabs" icon="microphone">
    Voice synthesis for audio responses.
  </Card>

  <Card title="MCP Connectors" icon="server">
    Model Context Protocol servers for advanced integrations.
  </Card>
</CardGroup>

## ElevenLabs Integration

Connect your ElevenLabs account to enable voice responses.

### List Integrations

```typescript theme={null}
const integrations = await client.integrations.elevenlabs.list();

integrations.forEach(int => {
  console.log(`${int.name} (${int.id})`);
});
```

### Create Integration

```typescript theme={null}
const integration = await client.integrations.elevenlabs.create({
  name: 'My ElevenLabs Account',
  apiKey: 'your-elevenlabs-api-key',
});

console.log(`Created integration: ${integration.id}`);
```

### Get Integration

```typescript theme={null}
const integration = await client.integrations.elevenlabs.get(integrationId);
```

### Update Integration

```typescript theme={null}
await client.integrations.elevenlabs.update(integrationId, {
  name: 'Updated Name',
});
```

### Delete Integration

```typescript theme={null}
await client.integrations.elevenlabs.delete(integrationId);
```

### List ElevenLabs Agents

Retrieve agents from your ElevenLabs account:

```typescript theme={null}
const { agents, nextCursor, hasMore } = await client.integrations.elevenlabs.getAgents(
  integrationId,
  {
    search: 'support',
    pageSize: 20,
  }
);

agents.forEach(agent => {
  console.log(`${agent.name} (${agent.agentId})`);
  console.log(`  Tags: ${agent.tags.join(', ')}`);
});

// Paginate if needed
if (hasMore) {
  const nextPage = await client.integrations.elevenlabs.getAgents(integrationId, {
    cursor: nextCursor,
  });
}
```

### Response Types

```typescript theme={null}
interface ElevenLabsIntegration {
  id: UUID;
  name: string | null;
}

interface ElevenLabsAgent {
  agentId: string;
  name: string;
  tags: string[];
  createdAtUnixSecs: number;
  lastCallTimeUnixSecs: number | null;
}
```

## MCP Connectors

Connect Model Context Protocol servers for advanced tool integrations.

### List Connectors

```typescript theme={null}
// Your connectors
const myConnectors = await client.integrations.connectors.list();

// Public connectors
const publicConnectors = await client.integrations.connectors.listPublic();
```

### Create Connector

```typescript theme={null}
const connector = await client.integrations.connectors.create({
  url: 'https://your-mcp-server.com',
  name: 'My MCP Server',
});

console.log(`Connector status: ${connector.status}`);
```

### Get Connector

```typescript theme={null}
const connector = await client.integrations.connectors.get(connectorId);

console.log(`Status: ${connector.status}`);
console.log(`Tools available:`);
connector.knownTools.forEach(tool => {
  console.log(`  - ${tool.name}: ${tool.description}`);
});
```

### Update Connector

```typescript theme={null}
await client.integrations.connectors.update(connectorId, {
  name: 'Updated Name',
  url: 'https://new-url.com',
});
```

### Delete Connector

```typescript theme={null}
await client.integrations.connectors.delete(connectorId);
```

### Response Types

```typescript theme={null}
type ConnectorStatus = 'SUCCESS' | 'AUTH_REQUIRED' | 'UNKNOWN' | 'UNKNOWN_ERROR';

interface Connector {
  id: UUID;
  name: string | null;
  description: string | null;
  url: string;
  status: ConnectorStatus;
  slug: string | null;
  logo: ImageInfo | null;
  knownTools: ConnectorTool[];
}

interface ConnectorTool {
  id: UUID;
  name: string;
  description: string | null;
  inputSchema: Record<string, unknown>;
}
```

## Using Integrations with Agents

### Adding ElevenLabs Voice

After creating an ElevenLabs integration, link it to an agent:

```typescript theme={null}
await client.agents.update(agentId, {
  voiceCallConfig: {
    agentId: 'elevenlabs-agent-id',
    integrationId: integrationId,
  },
});
```

### Adding MCP Tools

Connect MCP tools to an agent:

```typescript theme={null}
await client.agents.update(agentId, {
  mcpConfigs: [
    {
      connectorId: connectorId,
      toolWhitelist: ['search', 'lookup'],  // Only enable specific tools
    },
  ],
});
```

## Complete Example

```typescript theme={null}
import { createWassistClient } from '@wassist/sdk';

const client = createWassistClient({
  baseUrl: 'https://backend.wassist.app/api/v1/',
  authToken: process.env.WASSIST_TOKEN,
});

async function setupVoiceAgent() {
  // 1. Connect ElevenLabs
  const elevenLabs = await client.integrations.elevenlabs.create({
    name: 'Production Voice',
    apiKey: process.env.ELEVENLABS_API_KEY!,
  });
  
  // 2. List available ElevenLabs agents
  const { agents } = await client.integrations.elevenlabs.getAgents(elevenLabs.id);
  
  if (agents.length === 0) {
    throw new Error('No ElevenLabs agents found');
  }
  
  // 3. Create an agent with voice
  const agent = await client.onboarding.createFromElevenLabs({
    integrationId: elevenLabs.id,
    agentId: agents[0].agentId,
  });
  
  console.log(`Created voice agent: ${agent.name}`);
}

async function setupMCPIntegration() {
  // 1. Connect an MCP server
  const connector = await client.integrations.connectors.create({
    name: 'Database Access',
    url: 'https://my-mcp-server.com',
  });
  
  // 2. Wait for tools to be discovered
  if (connector.status !== 'SUCCESS') {
    console.log(`Connector status: ${connector.status}`);
    // May need authentication or retry
    return;
  }
  
  // 3. Add to an existing agent
  const agent = await client.agents.get('my-agent-id');
  
  await client.agents.update(agent.id, {
    mcpConfigs: [
      {
        connectorId: connector.id,
        toolWhitelist: connector.knownTools.map(t => t.name),
      },
    ],
  });
  
  console.log(`Added ${connector.knownTools.length} MCP tools to agent`);
}
```

## Connector Status

| Status          | Description          | Action              |
| --------------- | -------------------- | ------------------- |
| `SUCCESS`       | Connected and ready  | Tools available     |
| `AUTH_REQUIRED` | Needs authentication | Complete OAuth flow |
| `UNKNOWN`       | Initial state        | Wait for connection |
| `UNKNOWN_ERROR` | Connection failed    | Check URL, retry    |

## Related

<CardGroup cols={2}>
  <Card title="ElevenLabs Guide" icon="microphone" href="/guides/create-agent-elevenlabs">
    Create voice-enabled agents.
  </Card>

  <Card title="Configure Tools" icon="wrench" href="/guides/configure-tools">
    Learn about all tool types.
  </Card>
</CardGroup>
