Skip to content

Commit c0a5fcc

Browse files
committed
VAP-5569 Add MCP Server docs
1 parent bc47c21 commit c0a5fcc

File tree

2 files changed

+296
-0
lines changed

2 files changed

+296
-0
lines changed

fern/docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ navigation:
219219
path: tools/google-sheets.mdx
220220
- page: Slack
221221
path: tools/slack.mdx
222+
- page: MCP Server
223+
path: tools/mcp-server.mdx
222224

223225
- section: Knowledge Base
224226
path: knowledge-base/knowledge-base.mdx

fern/tools/mcp-server.mdx

Lines changed: 294 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,294 @@
1+
---
2+
title: Vapi MCP Server
3+
subtitle: 'Integrate Vapi APIs with AI assistants through the Model Context Protocol (MCP)'
4+
slug: tools/mcp-server
5+
---
6+
7+
The Vapi Model Context Protocol (MCP) server allows you to integrate with Vapi APIs through function calling. This enables AI assistants like Claude to directly communicate with Vapi's services, making it possible to manage assistants, phone numbers, and create calls directly through conversational interfaces.
8+
9+
## What is Vapi MCP Server?
10+
11+
Vapi MCP Server is an implementation of the Model Context Protocol that exposes Vapi's APIs as callable functions. This allows any MCP-compatible client (like Claude Desktop or custom applications using the MCP SDK) to access Vapi functionality, including:
12+
13+
- Listing, creating, and managing Vapi assistants
14+
- Managing phone numbers
15+
- Creating and scheduling outbound calls
16+
- Retrieving call details and status
17+
18+
## Supported Actions
19+
20+
The Vapi MCP Server provides the following tools for integration:
21+
22+
### Assistant Tools
23+
- `list_assistants`: Lists all Vapi assistants
24+
- `create_assistant`: Creates a new Vapi assistant
25+
- `get_assistant`: Gets a Vapi assistant by ID
26+
27+
### Call Tools
28+
- `list_calls`: Lists all Vapi calls
29+
- `create_call`: Creates an outbound call
30+
- `get_call`: Gets details of a specific call
31+
32+
> **Note:** The `create_call` action supports scheduling calls for immediate execution or for a future time using the optional `scheduledAt` parameter.
33+
34+
### Phone Number Tools
35+
- `list_phone_numbers`: Lists all Vapi phone numbers
36+
- `get_phone_number`: Gets details of a specific phone number
37+
38+
## Setup Options
39+
40+
There are two primary ways to connect to the Vapi MCP Server:
41+
42+
1. **Local Setup**: Run the MCP server locally for development or testing
43+
2. **Remote SSE Connection**: Connect to Vapi's hosted MCP server via Server-Sent Events (SSE)
44+
45+
## Claude Desktop Setup
46+
47+
The easiest way to get started with Vapi MCP Server is through Claude Desktop. This allows you to interact with Vapi services directly through conversations with Claude.
48+
49+
### Prerequisites
50+
- Claude Desktop application installed
51+
- Vapi API key (get it from the [Vapi dashboard](https://dashboard.vapi.ai/org/api-keys))
52+
53+
### Configuration Steps
54+
55+
1. Open Claude Desktop and press `CMD + ,` (Mac) to go to `Settings`
56+
2. Click on the `Developer` tab
57+
3. Click on the `Edit Config` button
58+
4. This will open the `claude_desktop_config.json` file in your file explorer
59+
5. Add the following configuration to the file:
60+
61+
```json
62+
{
63+
"mcpServers": {
64+
"vapi-mcp-server": {
65+
"command": "npx",
66+
"args": [
67+
"-y",
68+
"@vapi-ai/mcp-server"
69+
],
70+
"env": {
71+
"VAPI_TOKEN": "<your_vapi_token>"
72+
}
73+
}
74+
}
75+
}
76+
```
77+
78+
6. Replace `<your_vapi_token>` with your actual Vapi API key
79+
7. Save the file and restart Claude Desktop
80+
81+
### Example Usage with Claude Desktop
82+
83+
After configuring Claude Desktop with the Vapi MCP server, you can ask Claude to help with Vapi-related tasks.
84+
85+
#### Example 1: Request an immediate call
86+
87+
```
88+
I'd like to speak with my appointment scheduling assistant. Can you have it call me at +1234567890?
89+
```
90+
91+
#### Example 2: Schedule a future call
92+
93+
```
94+
I need to schedule a call with my customer service assistant for next Tuesday at 3:00 PM. My phone number is +1555123456.
95+
```
96+
97+
#### Example 3: Manage assistants
98+
99+
```
100+
Can you list all my Vapi assistants and help me create a new one for appointment scheduling?
101+
```
102+
103+
## Remote SSE Connection
104+
105+
For production use or if you prefer not to run a local server, you can connect to Vapi's hosted MCP server via Server-Sent Events (SSE) Transport.
106+
107+
### Connection Details
108+
109+
- SSE Endpoint: `https://mcp.vapi.ai/sse`
110+
- Authentication: Include your Vapi API key as a bearer token in the request headers
111+
- Example header: `Authorization: Bearer your_vapi_api_key_here`
112+
113+
This connection allows you to access Vapi's functionality remotely without running a local server.
114+
115+
## Custom MCP Client Integration
116+
117+
If you're building a custom application that needs to communicate with Vapi, you can use any MCP-compatible client SDK.
118+
119+
### Available SDKs
120+
121+
The Model Context Protocol supports clients in multiple languages:
122+
123+
- [TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)
124+
- [Python SDK](https://github.com/modelcontextprotocol/python-sdk)
125+
- [Java SDK](https://github.com/modelcontextprotocol/java-sdk)
126+
- [Kotlin SDK](https://github.com/modelcontextprotocol/kotlin-sdk)
127+
- [C# SDK](https://github.com/modelcontextprotocol/csharp-sdk)
128+
129+
### Integration Steps
130+
131+
1. Install the MCP client SDK for your language of choice
132+
2. Configure the client to connect to the Vapi MCP Server (either locally or via SSE)
133+
3. Query the server for available tools
134+
4. Use the tools in your application logic
135+
136+
Here's an example using the Node.js SDK with SSE transport:
137+
138+
```javascript
139+
#!/usr/bin/env node
140+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
141+
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
142+
import dotenv from 'dotenv';
143+
144+
// Load environment variables from .env file
145+
dotenv.config();
146+
147+
// Ensure API key is available
148+
if (!process.env.VAPI_TOKEN) {
149+
console.error('Error: VAPI_TOKEN environment variable is required');
150+
process.exit(1);
151+
}
152+
153+
async function main() {
154+
try {
155+
// Initialize MCP client
156+
const mcpClient = new Client({
157+
name: 'vapi-client-example',
158+
version: '1.0.0',
159+
});
160+
161+
// Create SSE transport for connection to remote Vapi MCP server
162+
const transport = new SSEClientTransport({
163+
url: 'https://mcp.vapi.ai/sse',
164+
headers: {
165+
'Authorization': `Bearer ${process.env.VAPI_TOKEN}`
166+
}
167+
});
168+
169+
console.log('Connecting to Vapi MCP server via SSE...');
170+
await mcpClient.connect(transport);
171+
console.log('Connected successfully');
172+
173+
try {
174+
// List available tools
175+
const toolsResult = await mcpClient.listTools();
176+
console.log('Available tools:');
177+
toolsResult.tools.forEach((tool) => {
178+
console.log(`- ${tool.name}: ${tool.description}`);
179+
});
180+
181+
// List assistants
182+
console.log('\nListing assistants...');
183+
const assistantsResponse = await mcpClient.callTool({
184+
name: 'list_assistants',
185+
arguments: {},
186+
});
187+
188+
const assistants = assistantsResponse.content;
189+
if (!(Array.isArray(assistants) && assistants.length > 0)) {
190+
console.log('No assistants found. Please create an assistant in the Vapi dashboard first.');
191+
return;
192+
}
193+
194+
console.log('Your assistants:');
195+
assistants.forEach((assistant) => {
196+
console.log(`- ${assistant.name} (${assistant.id})`);
197+
});
198+
199+
// List phone numbers
200+
console.log('\nListing phone numbers...');
201+
const phoneNumbersResponse = await mcpClient.callTool({
202+
name: 'list_phone_numbers',
203+
arguments: {},
204+
});
205+
206+
const phoneNumbers = phoneNumbersResponse.content;
207+
if (!(Array.isArray(phoneNumbers) && phoneNumbers.length > 0)) {
208+
console.log('No phone numbers found. Please add a phone number in the Vapi dashboard first.');
209+
return;
210+
}
211+
212+
console.log('Your phone numbers:');
213+
phoneNumbers.forEach((phoneNumber) => {
214+
console.log(`- ${phoneNumber.phoneNumber} (${phoneNumber.id})`);
215+
});
216+
217+
// Create a call using the first assistant and first phone number
218+
const phoneNumberId = phoneNumbers[0].id;
219+
const assistantId = assistants[0].id;
220+
221+
console.log(`\nCreating a call using assistant (${assistantId}) and phone number (${phoneNumberId})...`);
222+
const createCallResponse = await mcpClient.callTool({
223+
name: 'create_call',
224+
arguments: {
225+
assistantId: assistantId,
226+
phoneNumberId: phoneNumberId,
227+
customer: {
228+
phoneNumber: "+1234567890" // Replace with actual customer phone number
229+
}
230+
// Optional: schedule a call for the future
231+
// scheduledAt: "2025-04-15T15:30:00Z"
232+
},
233+
});
234+
235+
console.log('Call created:', JSON.stringify(createCallResponse.content, null, 2));
236+
} finally {
237+
console.log('\nDisconnecting from server...');
238+
await mcpClient.close();
239+
console.log('Disconnected');
240+
}
241+
} catch (error) {
242+
console.error('Error:', error);
243+
process.exit(1);
244+
}
245+
}
246+
247+
main();
248+
```
249+
250+
This code shows how to:
251+
- Connect to the Vapi MCP Server using SSE transport
252+
- List available tools
253+
- List your existing assistants
254+
- List your phone numbers
255+
- Create an outbound call using your first assistant and phone number
256+
257+
You can run this code by saving it as a script and executing it with Node.js:
258+
259+
```bash
260+
# Install required packages
261+
npm install @modelcontextprotocol/sdk dotenv
262+
263+
# Create a .env file with your Vapi API token
264+
echo "VAPI_TOKEN=your_vapi_api_token_here" > .env
265+
266+
# Run the script
267+
node vapi-client.js
268+
```
269+
270+
For more detailed examples and complete client implementations, refer to the [MCP Client Quickstart](https://modelcontextprotocol.io/quickstart/client).
271+
272+
## References
273+
274+
- [Vapi MCP Server Repository](https://github.com/VapiAI/mcp-server)
275+
- [Model Context Protocol Documentation](https://modelcontextprotocol.io)
276+
- [Vapi Dashboard](https://dashboard.vapi.ai)
277+
- [Model Context Protocol Client Quickstart](https://modelcontextprotocol.io/quickstart/client)
278+
279+
<CardGroup cols={2}>
280+
<Card
281+
title="Need Help?"
282+
icon="question-circle"
283+
href="https://discord.gg/pUFNcf2WmH"
284+
>
285+
Join our Discord community for support with MCP integration
286+
</Card>
287+
<Card
288+
title="API Reference"
289+
icon="book"
290+
href="/api-reference/tools/create"
291+
>
292+
View the complete API documentation for tools
293+
</Card>
294+
</CardGroup>

0 commit comments

Comments
 (0)