MCP integration

Overview

The Model Context Protocol (MCP) integration transforms your IDE’s AI assistant into a Vapi expert. Once configured, your IDE gains complete, accurate knowledge of Vapi’s APIs, features, and best practices - eliminating AI hallucinations and outdated information.

In this guide, you’ll learn to:

  • Set up MCP in supported IDEs
  • Understand what knowledge is provided
  • Use your enhanced IDE effectively
  • Troubleshoot common issues

Quick start

Run the setup command to auto-configure all supported IDEs:

$vapi mcp setup

Or configure a specific IDE:

$vapi mcp setup cursor # For Cursor
>vapi mcp setup windsurf # For Windsurf
>vapi mcp setup vscode # For VSCode with Copilot

What is MCP?

Model Context Protocol is a standard that allows AI assistants to access structured knowledge and tools. When you set up MCP for Vapi:

  • Your IDE’s AI gains access to complete Vapi documentation
  • Code suggestions become accurate and up-to-date
  • Examples use real, working Vapi patterns
  • API hallucinations are eliminated

Supported IDEs

How it works

What gets configured

The MCP setup creates configuration files that connect your IDE to the Vapi MCP server:

File: .cursor/mcp.json

1{
2 "servers": {
3 "vapi-docs": {
4 "command": "npx",
5 "args": ["@vapi-ai/mcp-server"]
6 }
7 }
8}

What knowledge is provided

Your IDE gains access to:

  • Complete API Reference - Every endpoint, parameter, and response
  • Code Examples - Working samples for all features
  • Integration Guides - Step-by-step implementation patterns
  • Best Practices - Recommended approaches and patterns
  • Latest Features - Always up-to-date with new releases
  • Troubleshooting - Common issues and solutions

Using your enhanced IDE

Example prompts

Once MCP is configured, try these prompts in your IDE:

Prompt: “How do I create a voice assistant with Vapi?”

Your IDE will provide accurate code like:

1import { VapiClient } from "@vapi-ai/server-sdk";
2
3const client = new VapiClient({ token: process.env.VAPI_API_KEY });
4
5const assistant = await client.assistants.create({
6 name: "Customer Support",
7 model: {
8 provider: "openai",
9 model: "gpt-4",
10 systemPrompt: "You are a helpful customer support agent..."
11 },
12 voice: {
13 provider: "11labs",
14 voiceId: "rachel"
15 }
16});

Prompt: “Show me how to handle Vapi webhooks”

Get complete webhook examples:

1app.post('/webhook', async (req, res) => {
2 const { type, call, assistant } = req.body;
3
4 switch (type) {
5 case 'call-started':
6 console.log(`Call ${call.id} started`);
7 break;
8 case 'speech-update':
9 console.log(`User said: ${req.body.transcript}`);
10 break;
11 case 'function-call':
12 // Handle tool calls
13 const { functionName, parameters } = req.body.functionCall;
14 const result = await handleFunction(functionName, parameters);
15 res.json({ result });
16 return;
17 }
18
19 res.status(200).send();
20});

Prompt: “How do I set up call recording with custom storage?”

Get detailed implementation:

1const assistant = await client.assistants.create({
2 name: "Recorded Assistant",
3 recordingEnabled: true,
4 artifactPlan: {
5 recordingEnabled: true,
6 videoRecordingEnabled: false,
7 recordingPath: "s3://my-bucket/recordings/{call_id}"
8 },
9 credentialIds: ["aws-s3-credential-id"]
10});

Best practices

1

Be specific

Ask detailed questions about Vapi features:

  • ✅ “How do I transfer calls to a human agent in Vapi?”
  • ❌ “How do I transfer calls?”
2

Request examples

Ask for working code samples:

  • “Show me a complete example of…”
  • “Generate a working implementation of…”
3

Check versions

Specify SDK versions when needed:

  • “Using @vapi-ai/web v2.0, how do I…”
  • “What’s the latest way to…”

Configuration options

Check status

View current MCP configuration:

$vapi mcp status

Output:

MCP Configuration Status:
✓ Cursor: Configured (.cursor/mcp.json)
✗ Windsurf: Not configured
✓ VSCode: Configured (workspace settings)
Vapi MCP Server: v1.2.3 (latest)

Update server

Keep the MCP server updated:

$# Update to latest version
>npm update -g @vapi-ai/mcp-server
>
># Or reinstall
>npm install -g @vapi-ai/mcp-server@latest

Remove configuration

Remove MCP configuration:

$# Remove from all IDEs
>vapi mcp remove
>
># Remove from specific IDE
>vapi mcp remove cursor

How MCP tools work

The Vapi MCP server provides these tools to your IDE:

Search Documentation

Semantic search across all Vapi docs

Example: “How to handle voicemail detection”

Get Examples

Retrieve code samples for any feature

Example: “WebSocket connection example”

API Reference

Get detailed API endpoint information

Example: “POST /assistant parameters”

Implementation Guides

Step-by-step guides for complex features

Example: “Workflow implementation guide”

Troubleshooting

If your IDE isn’t using the MCP knowledge:

  1. Restart your IDE after configuration
  2. Check the logs in your IDE’s output panel
  3. Verify npm is accessible from your IDE
  4. Ensure MCP server is installed globally
$# Verify installation
>npm list -g @vapi-ai/mcp-server

For permission issues:

$# Install with proper permissions
>sudo npm install -g @vapi-ai/mcp-server
>
># Or use a Node version manager
>nvm use 18
>npm install -g @vapi-ai/mcp-server

If you’re getting old API information:

  1. Update the MCP server:
$npm update -g @vapi-ai/mcp-server
  1. Clear your IDE’s cache
  2. Restart the IDE

For different projects needing different configs:

  • MCP configuration is per-workspace
  • Run vapi mcp setup in each project
  • Configuration won’t conflict between projects

Advanced usage

Custom MCP configuration

Modify the generated MCP configuration for advanced needs:

1{
2 "servers": {
3 "vapi-docs": {
4 "command": "npx",
5 "args": ["@vapi-ai/mcp-server"],
6 "env": {
7 "VAPI_MCP_LOG_LEVEL": "debug"
8 }
9 }
10 }
11}

Using with teams

Share MCP configuration with your team:

  1. Commit the config files (.cursor/mcp.json, etc.)
  2. Document the setup in your README
  3. Include in onboarding for new developers

Example README section:

1## Development Setup
2
3This project uses Vapi MCP for enhanced IDE support:
4
51. Install Vapi CLI: `curl -sSL https://vapi.ai/install.sh | bash`
62. Set up MCP: `vapi mcp setup`
73. Restart your IDE

Next steps

Now that MCP is configured:


Pro tip: After setting up MCP, try asking your IDE to “Create a complete Vapi voice assistant with error handling and logging” - watch it generate production-ready code with all the right patterns!