@@ -66,7 +66,7 @@ Now, add the MCP tool to your assistant:
6666
6767The MCP integration follows these steps during a call:
6868
69- 1 . When a call starts, Vapi connects to your configured MCP server
69+ 1 . When a call starts, Vapi connects to your configured MCP server using ** Streamable HTTP ** protocol by default
70702 . The MCP server returns a list of available tools and their capabilities
71713 . These tools are dynamically added to your assistant's available tools
72724 . The assistant can then use these tools during the call
@@ -81,13 +81,29 @@ The MCP integration follows these steps during a call:
8181 The tools available through MCP are determined by your MCP server provider. Different providers may offer different sets of tools.
8282</Note >
8383
84+ ### Request Headers
85+
86+ MCP requests from Vapi include identifying headers to help with context and debugging:
87+
88+ - ** ` X-Call-Id ` ** : Included in requests during voice calls to identify the specific call
89+ - ** ` X-Chat-Id ` ** : Included in requests during chat interactions to identify the specific chat
90+ - ** ` X-Session-Id ` ** : Included in requests during chat interaction if the chat is part of a session
91+
8492## Tool Configuration
8593
8694### MCP Tool
8795
88- This tool uses the following field to connect to your MCP server:
96+ This tool uses the following configuration options:
97+
98+ ** Required:**
99+ - ` server.url ` : The URL of your MCP server (e.g., https://actions.zapier.com/mcp/actions/ )
89100
90- - ` serverUrl ` : The URL of your MCP server (e.g., https://actions.zapier.com/mcp/actions/ )
101+ ** Optional:**
102+ - ` server.headers ` : Custom headers to include in requests to the MCP server
103+ - ` metadata ` : Additional configuration options for the MCP connection
104+ - ` protocol ` : Communication protocol to use. Options are:
105+ - ` "shttp" ` (default): Uses Streamable HTTP protocol
106+ - ` "sse" ` : (deprecated) Uses Server-Sent Events protocol
91107
92108<Note >
93109 The server URL should be treated as a credential and kept secure. It will be used to authenticate requests to the MCP server.
@@ -97,6 +113,8 @@ This tool uses the following field to connect to your MCP server:
97113
98114Here's how the MCP tool can be used in your assistant's configuration:
99115
116+ ### Default Configuration (Streamable HTTP)
117+
100118``` json
101119{
102120 "model" : {
@@ -111,7 +129,9 @@ Here's how the MCP tool can be used in your assistant's configuration:
111129 "tools" : [
112130 {
113131 "type" : " mcp" ,
114- "name" : " mcpTools" ,
132+ "function" : {
133+ "name" : " mcpTools"
134+ },
115135 "server" : {
116136 "url" : " https://actions.zapier.com/mcp/actions/"
117137 }
@@ -121,13 +141,51 @@ Here's how the MCP tool can be used in your assistant's configuration:
121141}
122142```
123143
144+ ### Custom Configuration (SSE Protocol)
145+
146+ If you need to use Server-Sent Events protocol instead:
147+
148+ ``` json
149+ {
150+ "model" : {
151+ "provider" : " openai" ,
152+ "model" : " gpt-4" ,
153+ "messages" : [
154+ {
155+ "role" : " system" ,
156+ "content" : " You are a helpful personal assistant named Alex..."
157+ }
158+ ],
159+ "tools" : [
160+ {
161+ "type" : " mcp" ,
162+ "function" : {
163+ "name" : " mcpTools"
164+ },
165+ "server" : {
166+ "url" : " https://actions.zapier.com/mcp/actions/" ,
167+ "headers" : {
168+ "Authorization" : " Bearer your-token" ,
169+ "X-Custom-Header" : " your-value"
170+ }
171+ },
172+ "metadata" : {
173+ "protocol" : " sse"
174+ }
175+ }
176+ ]
177+ }
178+ }
179+ ```
180+
124181## Best Practices
125182
126- 1 . ** Dynamic Tool Awareness** : Be aware that the available tools may change between calls
127- 2 . ** Clear Instructions** : Provide clear instructions in your assistant's system message about how to handle dynamic tools
128- 3 . ** Error Handling** : Include fallback responses for cases where tools fail or are unavailable
129- 4 . ** User Communication** : Explain to users what tools you're using and what actions you're taking
130- 5 . ** Security** : Treat the MCP server URL as a credential and keep it secure
183+ 1 . ** Protocol Selection** : Use the default Streamable HTTP protocol for better performance unless you specifically need SSE
184+ 2 . ** Dynamic Tool Awareness** : Be aware that the available tools may change between calls
185+ 3 . ** Clear Instructions** : Provide clear instructions in your assistant's system message about how to handle dynamic tools
186+ 4 . ** Error Handling** : Include fallback responses for cases where tools fail or are unavailable
187+ 5 . ** User Communication** : Explain to users what tools you're using and what actions you're taking
188+ 6 . ** Security** : Treat the MCP server URL as a credential and keep it secure
131189
132190## Example MCP Providers
133191
0 commit comments