diff --git a/fern/cli/mcp-integration.mdx b/fern/cli/mcp-integration.mdx deleted file mode 100644 index b19bb985f..000000000 --- a/fern/cli/mcp-integration.mdx +++ /dev/null @@ -1,394 +0,0 @@ ---- -title: MCP integration -description: Turn your IDE into a Vapi expert with Model Context Protocol -slug: cli/mcp ---- - -## 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: - -```bash -vapi mcp setup -``` - -Or configure a specific IDE: - -```bash -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 - - - - AI-first code editor with deep MCP integration - - **Setup:** Creates `.cursor/mcp.json` - - - Codeium's AI-powered IDE - - **Setup:** Creates `.windsurf/mcp.json` - - - With GitHub Copilot extension - - **Setup:** Configures Copilot settings - - - -## 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` - ```json - { - "servers": { - "vapi-docs": { - "command": "npx", - "args": ["@vapi-ai/mcp-server"] - } - } - } - ``` - - - **File:** `.windsurf/mcp.json` - ```json - { - "servers": { - "vapi-docs": { - "command": "npx", - "args": ["@vapi-ai/mcp-server"] - } - } - } - ``` - - - **Settings:** Updates workspace settings - ```json - { - "github.copilot.advanced": { - "mcp.servers": { - "vapi-docs": { - "command": "npx", - "args": ["@vapi-ai/mcp-server"] - } - } - } - } - ``` - - - -### 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: - ```typescript - import { VapiClient } from "@vapi-ai/server-sdk"; - - const client = new VapiClient({ token: process.env.VAPI_API_KEY }); - - const assistant = await client.assistants.create({ - name: "Customer Support", - model: { - provider: "openai", - model: "gpt-4", - systemPrompt: "You are a helpful customer support agent..." - }, - voice: { - provider: "11labs", - voiceId: "rachel" - } - }); - ``` - - - - **Prompt:** "Show me how to handle Vapi webhooks" - - Get complete webhook examples: - ```typescript - app.post('/webhook', async (req, res) => { - const { type, call, assistant } = req.body; - - switch (type) { - case 'call-started': - console.log(`Call ${call.id} started`); - break; - case 'speech-update': - console.log(`User said: ${req.body.transcript}`); - break; - case 'function-call': - // Handle tool calls - const { functionName, parameters } = req.body.functionCall; - const result = await handleFunction(functionName, parameters); - res.json({ result }); - return; - } - - res.status(200).send(); - }); - ``` - - - - **Prompt:** "How do I set up call recording with custom storage?" - - Get detailed implementation: - ```typescript - const assistant = await client.assistants.create({ - name: "Recorded Assistant", - recordingEnabled: true, - artifactPlan: { - recordingEnabled: true, - videoRecordingEnabled: false, - recordingPath: "s3://my-bucket/recordings/{call_id}" - }, - credentialIds: ["aws-s3-credential-id"] - }); - ``` - - - -### Best practices - - - - Ask detailed questions about Vapi features: - - ✅ "How do I transfer calls to a human agent in Vapi?" - - ❌ "How do I transfer calls?" - - - - Ask for working code samples: - - "Show me a complete example of..." - - "Generate a working implementation of..." - - - - 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: - -```bash -vapi mcp status -``` - -Output: -```text -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: - -```bash -# 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: - -```bash -# 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: - - - - Semantic search across all Vapi docs - - **Example:** "How to handle voicemail detection" - - - Retrieve code samples for any feature - - **Example:** "WebSocket connection example" - - - Get detailed API endpoint information - - **Example:** "POST /assistant parameters" - - - Step-by-step guides for complex features - - **Example:** "Function tool 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 - - ```bash - # Verify installation - npm list -g @vapi-ai/mcp-server - ``` - - - - For permission issues: - - ```bash - # 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: - ```bash - npm update -g @vapi-ai/mcp-server - ``` - - 2. Clear your IDE's cache - 3. 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: - -```json -{ - "servers": { - "vapi-docs": { - "command": "npx", - "args": ["@vapi-ai/mcp-server"], - "env": { - "VAPI_MCP_LOG_LEVEL": "debug" - } - } - } -} -``` - -### 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: -```markdown -## Development Setup - -This project uses Vapi MCP for enhanced IDE support: - -1. Install Vapi CLI: `curl -sSL https://vapi.ai/install.sh | bash` -2. Set up MCP: `vapi mcp setup` -3. Restart your IDE -``` - -## Next steps - -Now that MCP is configured: - -- **[Create assistants](/quickstart/phone):** Build your first voice AI -- **[Test webhooks locally](/cli/webhook):** Debug webhooks with tunneling services -- **[Manage resources](/cli#common-commands):** Use CLI commands - ---- - -**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! diff --git a/fern/cli/overview.mdx b/fern/cli/overview.mdx index ac52a3515..c40f06565 100644 --- a/fern/cli/overview.mdx +++ b/fern/cli/overview.mdx @@ -82,16 +82,6 @@ vapi init Supports React, Vue, Next.js, Python, Go, Flutter, React Native, and dozens more frameworks. -### 🤖 MCP integration - -Turn your IDE into a Vapi expert with Model Context Protocol: - -```bash -vapi mcp setup -``` - -Your IDE's AI assistant (Cursor, Windsurf, VSCode) gains complete, accurate knowledge of Vapi's APIs and best practices. No more hallucinated code or outdated examples. - ### 🔗 Local webhook testing Forward webhooks to your local server for debugging: @@ -241,7 +231,7 @@ vapi update Now that you have the Vapi CLI installed: - **[Initialize a project](/cli/init):** Add Vapi to your existing codebase -- **[Set up MCP](/cli/mcp):** Enhance your IDE with Vapi intelligence +- **[Connect your coding agent](/sdk/mcp-server):** Use the hosted Vapi MCP server - **[Test webhooks locally](/cli/webhook):** Debug webhooks with tunneling services - **[Manage authentication](/cli/auth):** Work with multiple accounts diff --git a/fern/cli/project-integration.mdx b/fern/cli/project-integration.mdx index 3b1279586..1e70d81da 100644 --- a/fern/cli/project-integration.mdx +++ b/fern/cli/project-integration.mdx @@ -320,7 +320,7 @@ After initializing your project: - **[Test locally](/cli/webhook):** Use `vapi listen` to test webhooks - **[Create assistants](/quickstart/phone):** Build your first voice assistant -- **[Set up MCP](/cli/mcp):** Enhance your IDE with Vapi intelligence +- **[Connect your coding agent](/sdk/mcp-server):** Use the hosted Vapi MCP server --- diff --git a/fern/docs.yml b/fern/docs.yml index 58e8fdfb0..6b6a3f92a 100644 --- a/fern/docs.yml +++ b/fern/docs.yml @@ -1154,9 +1154,6 @@ navigation: - page: Project Integration path: cli/project-integration.mdx icon: fa-light fa-folder-plus - - page: MCP Integration - path: cli/mcp-integration.mdx - icon: fa-light fa-brain-circuit - page: Webhook Testing path: cli/webhook-testing.mdx icon: fa-light fa-webhook @@ -1175,6 +1172,8 @@ navigation: - tab: changelog redirects: + - source: /cli/mcp + destination: /sdk/mcp-server - source: /documentation/best-practices/enterprise-environments-dev-uat-prod destination: /config-as-code#development-staging-and-production - source: /providers/voice/microsoft diff --git a/fern/resources.mdx b/fern/resources.mdx index 93a7a19a0..57de9fbad 100644 --- a/fern/resources.mdx +++ b/fern/resources.mdx @@ -12,7 +12,7 @@ description: Explore the Vapi ecosystem in one place, with links to the CLI, cli Vapi AI Ecosystem -Vapi CLIOverview · GitHub · Project Integration · MCP Setup · Webhook Testing +Vapi CLIOverview · GitHub · Project Integration · Webhook Testing Real-time SDKsWeb · Flutter · React Native · iOS · Python · Vanilla Client ExamplesNext.js · React · Flutter · React Native Server ExamplesVercel · Cloudflare · Supabase · Node · Bun · Deno · Flask · Laravel · Go · Rust diff --git a/fern/sdk/mcp-server.mdx b/fern/sdk/mcp-server.mdx index 20d9c3d29..94d2b74ee 100644 --- a/fern/sdk/mcp-server.mdx +++ b/fern/sdk/mcp-server.mdx @@ -16,55 +16,147 @@ Use this server to connect your AI workflows to real-world telephony, automate v -**Using the Vapi CLI?** Auto-configure MCP in your IDE with one command: + Connect your coding agent directly to the hosted MCP server using its native MCP settings. The Vapi CLI is not required. For public agent skills and installation instructions, see [VapiAI/skills](https://github.com/VapiAI/skills). + -```bash -vapi mcp setup -``` + + If an earlier CLI release configured `@vapi-ai/mcp-docs-server` in your agent, replace that legacy entry with the hosted connection below. Existing agent configurations are not removed automatically. + -This automatically configures Cursor, Windsurf, or VSCode with the Vapi MCP server. [Learn more →](/cli/mcp) - +Use **Streamable HTTP** at `https://mcp.vapi.ai/mcp` for remote connections. The legacy HTTP+SSE transport is deprecated; migrate existing remote configurations to this endpoint. -## Quickstart: Claude Desktop Config +## Connect your agent -**Fastest way to get started:** connect Claude Desktop to the Vapi MCP Server. +Get a [Vapi API key](/security-and-privacy/api-keys), then choose your client. These connections use the hosted server; you do not need to install the Vapi CLI or run a Vapi MCP server locally. + + + + For the Codex CLI, set your API key and register the remote server: + + ```bash + export VAPI_API_KEY="YOUR_VAPI_API_KEY" + codex mcp add vapi --url https://mcp.vapi.ai/mcp \ + --bearer-token-env-var VAPI_API_KEY + codex mcp list + ``` + + Codex saves the connection in `~/.codex/config.toml` and reads the key from `VAPI_API_KEY` when it connects. Keep that variable available whenever you launch Codex. If you use the desktop app or IDE extension, its launch environment must also contain the variable. + + Start a new Codex session and use `/mcp` to inspect the connection. See [Codex MCP setup](https://developers.openai.com/codex/mcp). + + + Set your API key and add the server to your private user configuration: + + ```bash + export VAPI_API_KEY="YOUR_VAPI_API_KEY" + claude mcp add --transport http --scope user vapi \ + https://mcp.vapi.ai/mcp \ + --header 'Authorization: Bearer ${VAPI_API_KEY}' + claude mcp get vapi + ``` + + The single quotes preserve the environment-variable reference in `~/.claude.json`. Keep `VAPI_API_KEY` set whenever you launch Claude Code. Start a new session and use `/mcp` to check the connection. + + See [Claude Code MCP setup](https://code.claude.com/docs/en/mcp). + + + Register the hosted server with header authentication: + + ```bash + hermes mcp add vapi --url https://mcp.vapi.ai/mcp --auth header + ``` + + Confirm that the server requires authentication, then paste your Vapi API key at the masked **API key / Bearer token** prompt. Enter the key without the `Bearer` prefix. Select the tools you want to enable and finish saving the connection. + + Hermes saves the connection in your active profile's `config.yaml` and the key in its `.env` file. Start a new session, or run `/reload-mcp` in an existing session. To test the connection: + + ```bash + hermes mcp test vapi + ``` + + See [Hermes MCP setup](https://hermes-agent.nousresearch.com/docs/user-guide/features/mcp). + + + Add this entry to your private user configuration at `~/.cursor/mcp.json`, preserving any other servers: - - - Follow the [Vapi API key guide](/security-and-privacy/api-keys) to create, view, or copy an API key. - - - Open Settings → Developer tab → Edit Config. - - - Insert this into your claude_desktop_config.json: ```json { "mcpServers": { - "vapi-mcp": { + "vapi": { + "url": "https://mcp.vapi.ai/mcp", + "headers": { + "Authorization": "Bearer YOUR_VAPI_API_KEY" + } + } + } + } + ``` + + Replace `YOUR_VAPI_API_KEY` with your Vapi API key. Open Cursor's MCP settings and enable `vapi`, then start a new chat. Keep this user configuration private and update the header after rotating your key. + + See [Cursor MCP setup](https://cursor.com/docs/mcp). + + + Run **MCP: Open User Configuration** from the Command Palette. Add this entry to `mcp.json`, preserving any other servers: + + ```json + { + "inputs": [ + { + "type": "promptString", + "id": "vapi-api-key", + "description": "Vapi API key", + "password": true + } + ], + "servers": { + "vapi": { + "type": "http", + "url": "https://mcp.vapi.ai/mcp", + "headers": { + "Authorization": "Bearer ${input:vapi-api-key}" + } + } + } + } + ``` + + Start `vapi` from **MCP: List Servers** and enter your API key when prompted. Use a **Local** chat session and enable its tools. VS Code does not forward servers that use input prompts to Copilot harness sessions. + + See [VS Code MCP setup](https://code.visualstudio.com/docs/agents/reference/mcp-configuration). + + + To connect through Claude Desktop's local stdio configuration, use `mcp-remote` as a bridge to the hosted server. This option requires Node.js and `npx` to be available to Claude Desktop. + + Open **Settings → Developer → Edit Config**. Add this entry to `claude_desktop_config.json`, preserving any other servers: + + ```json + { + "mcpServers": { + "vapi": { "command": "npx", "args": [ + "-y", "mcp-remote", "https://mcp.vapi.ai/mcp", + "--transport", + "http-only", "--header", - "Authorization: Bearer ${VAPI_TOKEN}" + "Authorization: Bearer ${VAPI_API_KEY}" ], "env": { - "VAPI_TOKEN": "YOUR_VAPI_API_KEY" + "VAPI_API_KEY": "YOUR_VAPI_API_KEY" } } } } ``` - Replace YOUR_VAPI_API_KEY with your API key. - - - Save and restart Claude Desktop. - - -**Example prompt:** -> "Have my customer support assistant call Jeremy at +1555123456." + Replace `YOUR_VAPI_API_KEY` with your Vapi API key and restart Claude Desktop. Keep this configuration private and update the key after rotating it. This starts a local adapter; Vapi's MCP server stays hosted. + + + +Once connected, try asking your agent: "List my Vapi assistants." --- @@ -94,70 +186,20 @@ The Vapi MCP Server exposes these actions as MCP tools: ## Integration Options - - Connect to the Vapi-hosted MCP server using the streamable-HTTP protocol. + + Connect to the Vapi-hosted MCP server using the Streamable HTTP protocol. Recommended for most production use cases. - Use this for clients or SDKs that support streamable-HTTP transport. + Use this for clients or SDKs that support Streamable HTTP transport. - **Endpoint:** `https://mcp.vapi.ai/mcp` - **Authentication:** Pass your Vapi API key as a bearer token:
Authorization: Bearer YOUR_VAPI_API_KEY - Example config: - ```json - { - "mcpServers": { - "vapi-mcp": { - "command": "npx", - "args": [ - "mcp-remote", - "https://mcp.vapi.ai/mcp", - "--header", - "Authorization: Bearer ${VAPI_TOKEN}" - ], - "env": { - "VAPI_TOKEN": "YOUR_VAPI_API_KEY" - } - } - } - } - ``` -
- - Connect to the Vapi-hosted MCP server using Server-Sent Events (SSE). - - - Use this for clients or SDKs that support SSE transport. - - - - **Endpoint:** `https://mcp.vapi.ai/sse` - - **Authentication:** Pass your Vapi API key as a bearer token: -
Authorization: Bearer YOUR_VAPI_API_KEY - - Example config for Claude: - ```json - { - "mcpServers": { - "vapi-sse": { - "command": "npx", - "args": [ - "mcp-remote", - "https://mcp.vapi.ai/sse", - "--header", - "Authorization: Bearer ${VAPI_TOKEN}" - ], - "env": { - "VAPI_TOKEN": "YOUR_VAPI_API_KEY" - } - } - } - } - ``` - + Configure the URL and authentication header directly in clients with remote MCP support. For a client that needs a local stdio adapter, use the [Claude Desktop tab](#connect-your-agent) above.
@@ -235,7 +277,7 @@ The Vapi MCP Server exposes these actions as MCP tools: Use this for clients or SDKs that support local command-based MCP servers. - Connect your client or SDK to the local server endpoint (default: `http://localhost:3000`). + The client launches this server as a subprocess and communicates over **stdio**. This configuration does not start an HTTP endpoint.
@@ -255,7 +297,7 @@ You can use any MCP-compatible client (SDKs available for multiple languages). - [C#](https://github.com/modelcontextprotocol/csharp-sdk) - Set up your SDK to connect to the Vapi MCP Server (https://mcp.vapi.ai/sse) and authenticate with your API key. + Set up your SDK to connect to https://mcp.vapi.ai/mcp using **Streamable HTTP** and authenticate with your Vapi API key in the Authorization: Bearer YOUR_VAPI_API_KEY header. Query available tools, list assistants, create calls, etc, via your SDK. @@ -266,9 +308,6 @@ You can use any MCP-compatible client (SDKs available for multiple languages). ### Example: Build a client with Node.js - - - ```javascript import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'; @@ -292,40 +331,8 @@ async function main() { main(); ``` - - - -```javascript -import { Client } from '@modelcontextprotocol/sdk/client/index.js'; -import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'; -import dotenv from 'dotenv'; - -dotenv.config(); - -const mcpClient = new Client({ name: 'vapi-client', version: '1.0.0' }); -const transport = new SSEClientTransport( - new URL('https://mcp.vapi.ai/sse'), - { requestInit: { headers: { Authorization: `Bearer ${process.env.VAPI_TOKEN}` } } } -); - -async function main() { - await mcpClient.connect(transport); - const assistants = await mcpClient.callTool({ name: 'list_assistants', arguments: {} }); - console.log(assistants); - await mcpClient.close(); -} - -main(); -``` - - - - ### Detailed example: Build a client with Node.js - - - ```javascript #!/usr/bin/env node import { Client } from '@modelcontextprotocol/sdk/client/index.js'; @@ -348,7 +355,7 @@ async function main() { name: 'vapi-client-example', version: '1.0.0', }); - // Create Streamable-HTTP transport for connection to remote Vapi MCP server + // Create Streamable HTTP transport for connection to remote Vapi MCP server const serverUrl = 'https://mcp.vapi.ai/mcp'; const headers = { Authorization: `Bearer ${process.env.VAPI_TOKEN}`, @@ -454,145 +461,6 @@ async function main() { main(); ``` - - - -```javascript -#!/usr/bin/env node -import { Client } from '@modelcontextprotocol/sdk/client/index.js'; -import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'; -import dotenv from 'dotenv'; - -// Load environment variables from .env file -dotenv.config(); - -// Ensure API key is available -if (!process.env.VAPI_TOKEN) { - console.error('Error: VAPI_TOKEN environment variable is required'); - process.exit(1); -} - -async function main() { - try { - // Initialize MCP client - const mcpClient = new Client({ - name: 'vapi-client-example', - version: '1.0.0', - }); - // Create SSE transport for connection to remote Vapi MCP server - const serverUrl = 'https://mcp.vapi.ai/sse'; - const headers = { - Authorization: `Bearer ${process.env.VAPI_TOKEN}`, - }; - const options = { - requestInit: { headers: headers }, - eventSourceInit: { - fetch: (url, init) => { - return fetch(url, { - ...(init || {}), - headers: { - ...(init?.headers || {}), - ...headers, - }, - }); - }, - }, - }; - const transport = new SSEClientTransport(new URL(serverUrl), options); - console.log('Connecting to Vapi MCP server via SSE...'); - await mcpClient.connect(transport); - console.log('Connected successfully'); - - // Helper function to parse tool responses - function parseToolResponse(response) { - if (!response?.content) return response; - const textItem = response.content.find(item => item.type === 'text'); - if (textItem?.text) { - try { - return JSON.parse(textItem.text); - } catch { - return textItem.text; - } - } - return response; - } - - try { - // List available tools - const toolsResult = await mcpClient.listTools(); - console.log('Available tools:'); - toolsResult.tools.forEach((tool) => { - console.log(`- ${tool.name}: ${tool.description}`); - }); - - // List assistants - console.log('\nListing assistants...'); - const assistantsResponse = await mcpClient.callTool({ - name: 'list_assistants', - arguments: {}, - }); - const assistants = parseToolResponse(assistantsResponse); - if (!(Array.isArray(assistants) && assistants.length > 0)) { - console.log('No assistants found. Please create an assistant in the Vapi dashboard first.'); - return; - } - console.log('Your assistants:'); - assistants.forEach((assistant) => { - console.log(`- ${assistant.name} (${assistant.id})`); - }); - - // List phone numbers - console.log('\nListing phone numbers...'); - const phoneNumbersResponse = await mcpClient.callTool({ - name: 'list_phone_numbers', - arguments: {}, - }); - const phoneNumbers = parseToolResponse(phoneNumbersResponse); - if (!(Array.isArray(phoneNumbers) && phoneNumbers.length > 0)) { - console.log('No phone numbers found. Please add a phone number in the Vapi dashboard first.'); - return; - } - console.log('Your phone numbers:'); - phoneNumbers.forEach((phoneNumber) => { - console.log(`- ${phoneNumber.phoneNumber} (${phoneNumber.id})`); - }); - - // Create a call using the first assistant and first phone number. - // Outbound calls need an imported number. With free Vapi numbers, only inbound calls are supported. - const phoneNumberId = phoneNumbers[0].id; - const assistantId = assistants[0].id; - console.log(`\nCreating a call using assistant (${assistantId}) and phone number (${phoneNumberId})...`); - const createCallResponse = await mcpClient.callTool({ - name: 'create_call', - arguments: { - assistantId: assistantId, - phoneNumberId: phoneNumberId, - customer: { - phoneNumber: "+1234567890" // Replace with actual customer phone number - } - // Optional: schedule a call for the future - // scheduledAt: "2025-04-15T15:30:00Z" - }, - }); - const createdCall = parseToolResponse(createCallResponse); - console.log('Call created:', JSON.stringify(createdCall, null, 2)); - } finally { - console.log('\nDisconnecting from server...'); - await mcpClient.close(); - console.log('Disconnected'); - } - } catch (error) { - console.error('Error:', error); - process.exit(1); - } -} - -main(); -``` - - - - For more detailed examples and complete client implementations, see the [MCP Client Quickstart](https://modelcontextprotocol.io/quickstart/client). ## References diff --git a/fern/tools/mcp.mdx b/fern/tools/mcp.mdx index a64d400b1..72d0b2366 100644 --- a/fern/tools/mcp.mdx +++ b/fern/tools/mcp.mdx @@ -35,7 +35,7 @@ Creating or updating an MCP tool doesn't contact the server. The first request h ## Prerequisites -- An MCP server URL. The server must support Streamable HTTP, or Server-Sent Events (SSE) for older servers. For Zapier, Composio, and Make, see [MCP providers](/tools/mcp/providers). +- An MCP server URL. Use a server that supports **Streamable HTTP**. The legacy HTTP+SSE transport is deprecated. For Zapier, Composio, and Make, see [MCP providers](/tools/mcp/providers). - Any authentication the server needs. See [Authentication](/tools/mcp/configure#authentication). ## Create an MCP tool @@ -65,7 +65,7 @@ Creating or updating an MCP tool doesn't contact the server. The first request h Under **Encryption Settings**, add the argument paths to encrypt. This needs a custom credential with encryption enabled. See [Encrypt sensitive arguments](/tools/mcp/configure#encrypt-sensitive-arguments). - Under **MCP Settings**, keep **Streamable HTTP** unless your server only supports SSE. See [Transport](/tools/mcp/configure#transport). + Under **MCP Settings**, keep **Streamable HTTP** selected. See [Transport](/tools/mcp/configure#transport). Under **Messages**, click **Add Message** to set what the caller hears while a tool runs. These messages apply to every tool from the server. See [Spoken messages during tool calls](/tools/mcp/messages-and-results#spoken-messages-during-tool-calls). diff --git a/fern/tools/mcp/configure.mdx b/fern/tools/mcp/configure.mdx index 8a3ccf701..c01094145 100644 --- a/fern/tools/mcp/configure.mdx +++ b/fern/tools/mcp/configure.mdx @@ -19,7 +19,7 @@ The following fields configure an MCP tool through the API. Only `type` and `ser | `server.credentialId` | The ID of a saved credential used to authenticate. See [Authentication](#authentication). | | `server.timeoutSeconds` | How long Vapi waits for each request to the server. Default 20 seconds. | | `server.encryptedPaths` | Argument paths to encrypt before Vapi sends a tool call. See [Encrypt sensitive arguments](#encrypt-sensitive-arguments). | -| `metadata.protocol` | `"shttp"` (Streamable HTTP, the default) or `"sse"`. See [Transport](#transport). | +| `metadata.protocol` | Use `"shttp"` (Streamable HTTP, the default), or omit this field. See [Transport](#transport). | | `messages` | Spoken messages for every tool from this server. See [Spoken messages during tool calls](/tools/mcp/messages-and-results#spoken-messages-during-tool-calls). | | `toolMessages` | Spoken messages for individual tools, matched by the tool's name on the server. API only. | | `function.name`, `function.description` | The Dashboard's **Tool Name** and **Description**, which identify this MCP tool. | @@ -112,19 +112,16 @@ Vapi removes the prefix before sending the tool call, so your server receives it ## Transport -Vapi supports two MCP transports, set with `metadata.protocol`: - -- **`shttp` (Streamable HTTP):** the default. Use it for any server that supports it. -- **`sse` (Server-Sent Events):** the older transport. Use it only if your server doesn't support Streamable HTTP. +Use **Streamable HTTP**, the default transport. Set `metadata.protocol` to `"shttp"`, or omit it, and use your provider's Streamable HTTP endpoint. The legacy HTTP+SSE transport is deprecated; migrate existing SSE configurations to the provider's Streamable HTTP endpoint. ```json { "type": "mcp", "server": { - "url": "https://mcp.example.com/sse" + "url": "https://mcp.example.com/mcp" }, "metadata": { - "protocol": "sse" + "protocol": "shttp" } } ```