Model Context Protocol (MCP) Integration
The Model Context Protocol (MCP) integration allows your Vapi assistant to dynamically access tools from MCP servers during calls. This enables your assistant to:
- Connect to any MCP-compatible server
- Access tools dynamically at runtime
- Execute actions through the MCP server
This powerful integration allows your assistant to leverage a wide range of tools without requiring individual integrations for each service.
Vapi also provides its own MCP server that exposes Vapi APIs as callable tools. See the Vapi MCP Server documentation to learn how to use it with Claude Desktop or custom applications.
Prerequisites
Before you can use the MCP integration, you need to:
- Have access to the Vapi Dashboard
- Have an assistant created in Vapi
- Have access to an MCP server URL (e.g., from Zapier, Composio, or other MCP providers)
Setup Steps
1. Obtain MCP Server URL
First, you need to obtain an MCP server URL from your chosen provider:
- Sign up for an MCP-compatible service (e.g., Zapier, Composio)
- Navigate to the MCP configuration section of your provider
- Generate or copy your MCP server URL
For Zapier MCP, visit https://actions.zapier.com/settings/mcp/ to generate your MCP server URL. This URL should be treated as a credential and kept secure.
2. Create and Configure MCP Tool
After obtaining your MCP server URL, create and configure the tool:
- Go to Dashboard > Tools page
- Click the Create Tool button
- Select MCP from the available options
- Provide a name and description explaining when it should be invoked
- Configure the tool with the following required field:
serverUrl
: The URL of your MCP server
The MCP server URL should be treated as a credential and kept secure. It will be used to authenticate requests to the MCP server.
3. Add Tool to Assistant
Now, add the MCP tool to your assistant:
- Navigate to Dashboard > Assistants page
- Select your assistant
- Go to the Tools tab
- In the tools dropdown, select your MCP tool
- Click Publish to save your changes
How MCP Works
The MCP integration follows these steps during a call:
- When a call starts, Vapi connects to your configured MCP server
- The MCP server returns a list of available tools and their capabilities
- These tools are dynamically added to your assistant’s available tools
- The assistant can then use these tools during the call
- When a tool is invoked, Vapi sends the request to the MCP server
- The MCP server executes the action and returns the result
The MCP tool itself is not meant to be invoked by the model. It serves as a configuration mechanism for Vapi to fetch and inject the specific tool definitions from the MCP server into the model’s context.
The tools available through MCP are determined by your MCP server provider. Different providers may offer different sets of tools.
Tool Configuration
MCP Tool
This tool uses the following field to connect to your MCP server:
serverUrl
: The URL of your MCP server (e.g., https://actions.zapier.com/mcp/actions/)
The server URL should be treated as a credential and kept secure. It will be used to authenticate requests to the MCP server.
Example Usage
Here’s how the MCP tool can be used in your assistant’s configuration:
Best Practices
- Dynamic Tool Awareness: Be aware that the available tools may change between calls
- Clear Instructions: Provide clear instructions in your assistant’s system message about how to handle dynamic tools
- Error Handling: Include fallback responses for cases where tools fail or are unavailable
- User Communication: Explain to users what tools you’re using and what actions you’re taking
- Security: Treat the MCP server URL as a credential and keep it secure
Example MCP Providers
Zapier MCP
Zapier offers an MCP server that provides access to thousands of app integrations:
- Go to https://actions.zapier.com/settings/mcp/
- Generate your MCP server URL
- Add the URL to your MCP tool configuration
- Your assistant will now have access to Zapier’s extensive integration network
Zapier MCP provides access to over 7,000+ apps and 30,000+ actions without requiring complex API integrations.
Composio MCP
Composio also offers an MCP server for integration:
- Log in to the Composio dashboard at https://mcp.composio.dev/dashboard
- Select the tool you want to integrate (e.g., Gmail)
- Enable the MCP server for the selected tool by connecting your account using authentication flow
- Create a server and copy the generated URL
- Add this URL to your MCP tool configuration as the
serverUrl
- Your assistant will now have access to the specific Composio tool integration
Context Overflow Warning: Some MCP server tool calls (eg: GitHub API queries) may return large amounts of data. This can exceed model context limits, affecting assistant performance and potentially causing failures, especially with models like GPT-4o.
Best Practices:
- Configure your MCP tools to return focused, relevant data
- Use filtering parameters when available to limit response size
- Test your integration with realistic queries before deploying
- Monitor token usage and context size during development