diff --git a/fern/cli/overview.mdx b/fern/cli/overview.mdx
index c40f06565..621e05eda 100644
--- a/fern/cli/overview.mdx
+++ b/fern/cli/overview.mdx
@@ -13,7 +13,7 @@ The Vapi CLI is the official command-line interface that brings world-class deve
- Initialize Vapi in existing projects
- Manage assistants, phone numbers, and calls from your terminal
- Forward webhooks to your local development server
-- Turn your IDE into a Vapi expert with MCP integration
+- Turn your coding agent into a Vapi expert with the [Vapi MCP server](/sdk/mcp-server)
## Installation
diff --git a/fern/docs.yml b/fern/docs.yml
index 4bdd30dc2..c7969c8d4 100644
--- a/fern/docs.yml
+++ b/fern/docs.yml
@@ -1098,6 +1098,9 @@ navigation:
- page: MCP server
path: sdk/mcp-server.mdx
icon: fa-light fa-server
+ - link: MCP tools
+ href: /tools/mcp
+ icon: fa-light fa-network-wired
- tab: sdks
layout:
diff --git a/fern/sdk/mcp-server.mdx b/fern/sdk/mcp-server.mdx
index 94d2b74ee..a640a0364 100644
--- a/fern/sdk/mcp-server.mdx
+++ b/fern/sdk/mcp-server.mdx
@@ -1,74 +1,66 @@
---
-title: Vapi MCP Server
-subtitle: Connect Vapi to AI assistants with Model Context Protocol (MCP)
+title: Vapi MCP server
+subtitle: Connect your coding agent to Vapi with Model Context Protocol (MCP)
slug: sdk/mcp-server
-description: Use the Vapi MCP Server to expose Vapi APIs as tools over the Model Context Protocol, managing assistants, phone numbers, and calls from any MCP client.
+description: Connect Codex, Claude Code, Hermes, Cursor, VS Code, or Claude Desktop to the Vapi MCP server by signing in with your Vapi account, to search the docs and manage assistants, calls, tools, and simulations.
---
## Overview
-The **Vapi MCP Server** exposes Vapi APIs as tools via the Model Context Protocol (MCP), so you can manage assistants, phone numbers, and calls from any MCP-compatible AI assistant (like Claude Desktop) or agent framework.
+The **Vapi MCP server** gives AI agents Vapi tools over the Model Context Protocol (MCP). Once connected, your agent can search Vapi's documentation and manage your assistants, phone numbers, and calls.
-Use this server to connect your AI workflows to real-world telephony, automate voice tasks, and build richer conversational agents.
+Vapi hosts the server at `https://mcp.vapi.ai/mcp`, using the **Streamable HTTP** transport. You connect by [signing in with your Vapi account](#how-signing-in-works), not with an API key, and you don't need the Vapi CLI. You can also [run the server locally](#run-the-server-locally).
- Looking to use MCP tools *inside* a Vapi assistant? See the [MCP Tool documentation](/tools/mcp) for integrating *external* MCP servers with your Vapi agents.
+ Looking to use MCP tools *inside* a Vapi assistant? See [MCP tools](/tools/mcp).
-
- 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).
-
-
-
- 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.
-
-
-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.
-
## Connect your agent
-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.
+The hosted server uses OAuth, so there's nothing to copy and paste. Add the URL to your agent, then complete the sign-in in your browser.
- For the Codex CLI, set your API key and register the remote server:
+ Register the remote server, then sign in:
```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 mcp add vapi --url https://mcp.vapi.ai/mcp
+ codex mcp login vapi
```
- 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.
+ Codex saves the connection in `~/.codex/config.toml` and registers itself with Vapi automatically. `codex mcp login` opens your browser; on a remote or headless machine, add `--no-browser` and paste the redirect URL back into the terminal.
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:
+ Add the server to your private user configuration, then sign in:
```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
+ claude mcp add --transport http --scope user vapi https://mcp.vapi.ai/mcp
+ claude mcp login 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.
+ You can also sign in from inside a session: run `/mcp`, select `vapi`, and follow the browser prompts. The same menu has **Clear authentication** if you need to sign in again or switch organizations.
See [Claude Code MCP setup](https://code.claude.com/docs/en/mcp).
- Register the hosted server with header authentication:
+ Add this entry to your active profile's `config.yaml`, preserving any other servers:
- ```bash
- hermes mcp add vapi --url https://mcp.vapi.ai/mcp --auth header
+ ```yaml
+ mcp_servers:
+ vapi:
+ url: "https://mcp.vapi.ai/mcp"
+ auth: oauth
```
- 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.
+ Then sign in:
+
+ ```bash
+ hermes mcp login vapi
+ ```
- 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:
+ Hermes handles registration and PKCE for you and stores the tokens under `~/.hermes/mcp-tokens/`. On a headless host, use `hermes mcp login vapi --flow device` to authorize with a code instead of a browser callback. Start a new session, or run `/reload-mcp` in an existing one, then:
```bash
hermes mcp test vapi
@@ -83,16 +75,13 @@ Get a [Vapi API key](/security-and-privacy/api-keys), then choose your client. T
{
"mcpServers": {
"vapi": {
- "url": "https://mcp.vapi.ai/mcp",
- "headers": {
- "Authorization": "Bearer YOUR_VAPI_API_KEY"
- }
+ "url": "https://mcp.vapi.ai/mcp"
}
}
}
```
- 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.
+ No headers or keys are needed. Open Cursor's MCP settings, enable `vapi`, and complete the Vapi sign-in in your browser when Cursor prompts you. Then start a new chat.
See [Cursor MCP setup](https://cursor.com/docs/mcp).
@@ -101,212 +90,269 @@ Get a [Vapi API key](/security-and-privacy/api-keys), then choose your client. T
```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}"
- }
+ "url": "https://mcp.vapi.ai/mcp"
}
}
}
```
- 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.
+ Start `vapi` from **MCP: List Servers**. VS Code opens a browser window for the Vapi sign-in on the first connection. Then enable the server's tools in a chat session.
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.
+ Claude Desktop connects to remote servers as a custom connector, so no local bridge is needed.
+
+
+
+ Open **Customize**, then **Connectors**. Click **+ Add**, then click **Add custom connector**.
+
+
+ Enter a name, and enter `https://mcp.vapi.ai/mcp` as the remote MCP server URL. Click **Continue**.
+
+
+ Leave the OAuth client option on **Register automatically**, then click **Add**.
+
+
+ Click **Connect** on the new connector and sign in to Vapi in your browser.
+
+
+
+ On Team and Enterprise plans, an organization Owner adds the connector under **Organization settings → Connectors**.
+
+ See [custom connectors via remote MCP](https://support.claude.com/en/articles/11175166-about-custom-connectors-via-remote-mcp).
+
+
- Open **Settings → Developer → Edit Config**. Add this entry to `claude_desktop_config.json`, preserving any other servers:
+Once connected, try asking your agent: "List my Vapi assistants."
- ```json
- {
- "mcpServers": {
- "vapi": {
- "command": "npx",
- "args": [
- "-y",
- "mcp-remote",
- "https://mcp.vapi.ai/mcp",
- "--transport",
- "http-only",
- "--header",
- "Authorization: Bearer ${VAPI_API_KEY}"
- ],
- "env": {
- "VAPI_API_KEY": "YOUR_VAPI_API_KEY"
- }
- }
+## How signing in works
+
+When your agent first connects, Vapi's server tells it where to sign in, and the agent opens that page in your browser. You sign in with your Vapi account and choose which organization the agent may act in. Sign-in uses the same credentials, MFA, and SSO as the dashboard. The agent then receives a short-lived access token and refreshes it as needed.
+
+What this means day to day:
+
+- **Your agent acts as you.** Every tool call runs with your own role and permissions in the organization you picked. A teammate connecting the same way sees only what their role allows.
+- **One organization per connection.** To switch organizations, sign out and reconnect: `claude mcp logout vapi` then `claude mcp login vapi` in Claude Code, or the equivalent in your agent. Use the `get_connection_info` tool to check which user and organization the current connection is authorized as.
+- **Some actions are always off-limits.** The hosted server can't read or create API keys, provider credentials, or billing settings, even if you're an admin.
+- **Access follows your account.** Removing someone from your Vapi organization ends their agent's access; there's no separate key to find and rotate.
+
+## Upgrade from API key authentication
+
+Before November 10, 2026, the hosted server accepted a Vapi API key in an `Authorization: Bearer` header and also served the `https://mcp.vapi.ai/sse` endpoint. Both have been removed, and existing agent configurations don't update automatically.
+
+To upgrade an existing `vapi` entry:
+
+- Delete the `headers` block or the `--bearer-token-env-var` flag.
+- Keep the same `https://mcp.vapi.ai/mcp` URL.
+- Sign in using the steps for your agent in [Connect your agent](#connect-your-agent).
+
+If your agent uses `@vapi-ai/mcp-docs-server` from an earlier CLI release, replace that entry too, because the hosted server includes documentation search. For documentation-only access with no sign-in, see [Search the docs without signing in](#search-the-docs-without-signing-in).
+
+Vapi API keys still work for the [Vapi API](/api-reference).
+
+## Run the server locally
+
+You can run the open-source [Vapi MCP server](https://github.com/VapiAI/mcp-server) on your own machine instead of connecting to the hosted one, for example to develop against it. This requires Node.js. Your client starts the server as a subprocess and talks to it over stdio, so no HTTP endpoint is started.
+
+The local server authenticates with a [Vapi API key](/security-and-privacy/api-keys) rather than sign-in, which also makes it the option for unattended automation. Because an API key carries full organization access, keep this configuration private.
+
+Add this entry to your client's MCP configuration in place of the hosted connection. The local server reads your API key from `VAPI_TOKEN`:
+
+```json
+{
+ "mcpServers": {
+ "vapi": {
+ "command": "npx",
+ "args": ["-y", "@vapi-ai/mcp-server"],
+ "env": {
+ "VAPI_TOKEN": "YOUR_VAPI_API_KEY"
}
}
- ```
+ }
+}
+```
- 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.
-
-
+In Claude Code, run:
-Once connected, try asking your agent: "List my Vapi assistants."
+```bash
+claude mcp add -e VAPI_TOKEN=YOUR_VAPI_API_KEY vapi -- npx -y @vapi-ai/mcp-server
+```
----
+## Search the docs without signing in
+
+For documentation search alone, connect your agent to Vapi's documentation MCP server at `https://docs.vapi.ai/_mcp/server`. It needs no account and provides a `searchDocs` tool. The Vapi MCP server's `ask_vapi_docs` tool runs the same search.
+
+If your client can't connect to a remote server directly, run it through the `mcp-remote` adapter:
+
+```json
+{
+ "mcpServers": {
+ "vapi-docs": {
+ "command": "npx",
+ "args": ["-y", "mcp-remote", "https://docs.vapi.ai/_mcp/server"]
+ }
+ }
+}
+```
+
+## Available tools
+
+The Vapi MCP server exposes the tools below. The hosted server and the [local server](#run-the-server-locally) expose the same set, except for `get_connection_info`, which only the hosted server provides.
-## Core Tools
+### Connection
-The Vapi MCP Server exposes these actions as MCP tools:
+| Tool | Description |
+|-----------------------|-------------------------------------------------------------------------------------|
+| `get_connection_info` | Show the Vapi user, organization, and OAuth client this connection is authorized as |
-| Tool | Description | Example Usage |
-|------------------------|--------------------------------------------------|-----------------------------------------------|
-| `list_assistants` | List all Vapi assistants | Show all configured assistants |
-| `create_assistant` | Create a new Vapi assistant | Add a new assistant for a use case |
-| `get_assistant` | Get a Vapi assistant by ID | View assistant config |
-| `list_calls` | List all calls | Review call activity |
-| `create_call` | Create an outbound call (now or scheduled) | Initiate or schedule a call |
-| `get_call` | Get details for a specific call | Check status or result of a call |
-| `list_phone_numbers` | List all Vapi phone numbers | See available numbers |
-| `get_phone_number` | Get details of a specific phone number | Inspect a phone number |
-| `list_tools` | List all available Vapi tools | Tool discovery |
-| `get_tool` | Get details of a specific tool | Tool integration info |
+### Documentation and reference
+
+| Tool | Description |
+|------------------|-----------------------------------------------------------------------------|
+| `ask_vapi_docs` | Search Vapi documentation and return relevant passages with source URLs |
+| `get_api_schema` | Look up a schema in the Vapi API reference, the OpenAPI spec the SDKs are generated from |
+| `search_skills` | Find Vapi agent skills in the public `VapiAI/skills` repository |
+| `load_skill` | Read a public Vapi skill or one of its supporting files |
+
+The `load_skill` tool returns instructions for the agent to follow. It does not install skills or run scripts.
+
+### Assistants
+
+| Tool | Description |
+|--------------------|------------------------------------|
+| `list_assistants` | List all Vapi assistants |
+| `get_assistant` | Get a Vapi assistant by ID |
+| `create_assistant` | Create a new Vapi assistant |
+| `update_assistant` | Update an existing Vapi assistant |
+
+### Calls
+
+| Tool | Description |
+|---------------|------------------------------------|
+| `list_calls` | List all calls |
+| `get_call` | Get details for a specific call |
+| `create_call` | Create an outbound call, now or scheduled |
+
+To schedule a call, pass the optional `scheduledAt` parameter to `create_call`.
+
+
+ The `create_call` tool places a real phone call.
+
+
+### Phone numbers
+
+| Tool | Description |
+|----------------------|----------------------------------------|
+| `list_phone_numbers` | List all Vapi phone numbers |
+| `get_phone_number` | Get details of a specific phone number |
+
+### Vapi tools
+
+| Tool | Description |
+|---------------|-----------------------------------|
+| `list_tools` | List all Vapi tools |
+| `get_tool` | Get details of a specific tool |
+| `create_tool` | Create a new Vapi tool |
+| `update_tool` | Update an existing Vapi tool |
+
+### Simulations
+
+These tools drive [simulations](/observability/simulations-overview), which test an assistant against an AI tester.
+
+| Tool | Description |
+|----------------------------------|-----------------------------------------------------------------------------|
+| `list_simulation_personalities` | List simulation personalities, which set how the AI tester behaves |
+| `create_simulation_personality` | Create a personality that sets how the AI tester behaves |
+| `list_simulation_scenarios` | List simulation scenarios, the AI tester's intent and the checks that decide pass or fail |
+| `create_simulation_scenario` | Create a scenario: AI tester instructions plus the evaluations that decide pass or fail |
+| `list_simulations` | List simulations, each pairing one scenario with one personality |
+| `create_simulation` | Create a simulation that pairs a scenario with a personality |
+| `list_simulation_suites` | List simulation suites, which are named groups of simulations |
+| `create_simulation_suite` | Create a suite that groups simulations so they can be run together |
+| `run_simulations` | Start a run of simulations or suites against an assistant or squad |
+| `list_simulation_runs` | List simulation runs, newest first |
+| `get_simulation_run` | Get a run with its status, item counts, and item summaries |
+| `get_simulation_run_item` | Get one run item in full, including results, call snapshots, and transcript |
+
+
+ Each `run_simulations` tool call starts a billed simulation run. For more information, see [Simulations overview](/observability/simulations-overview).
+
+
+Which tools succeed depends on your role in the organization you signed in to. A call that your role doesn't permit fails with an authorization error.
+
+## Use the server from your own code
+
+Any MCP client can connect to `https://mcp.vapi.ai/mcp` over Streamable HTTP, but it has to complete the same browser sign-in. The server rejects Vapi API keys. A request without a valid token gets a `401` response with a `WWW-Authenticate` challenge. The challenge points to the server's metadata at `https://mcp.vapi.ai/.well-known/oauth-protected-resource/mcp`, which tells the client where to sign in.
- Scheduling calls: The create_call action supports scheduling with the optional scheduledAt parameter.
+ Signing in requires a person at a browser, and the resulting tokens are short-lived. For unattended server-to-server automation, call the [Vapi API](/api-reference) directly with an API key, or [run the server locally](#run-the-server-locally) with `VAPI_TOKEN`.
----
+The simplest option is the `mcp-remote` adapter, which performs the sign-in once, caches the tokens under `~/.mcp-auth`, and exposes the server over stdio:
-## Integration Options
+```bash
+npx -y mcp-remote https://mcp.vapi.ai/mcp
+```
-
-
- 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.
-
-
- - **Endpoint:** `https://mcp.vapi.ai/mcp`
- - **Authentication:** Pass your Vapi API key as a bearer token:
-
Authorization: Bearer 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.
-
-
-
- The OpenAI responses API now supports MCP. Read more here.
-
-
- ```typescript title="typescript"
- import OpenAI from 'openai';
- // Replace with your actual OpenAI API key
- const openai = new OpenAI({ apiKey: 'YOUR_OPENAI_API_KEY' });
- async function main() {
- const response = await openai.responses.create({
- model: 'gpt-4.1',
- tools: [
- {
- type: 'mcp',
- server_label: 'vapi-mcp',
- server_url: 'https://mcp.vapi.ai/mcp',
- headers: { "Authorization": "Bearer YOUR_VAPI_API_KEY" }
- },
- ],
- input: 'What vapi tools do you have available?',
- });
- console.dir(response, { depth: null });
- }
- main();
- ```
- ```python title="python"
- import openai
- # Replace with your actual OpenAI API key
- openai.api_key = 'YOUR_OPENAI_API_KEY'
- response = openai.responses.create(
- model="gpt-4.1",
- tools=[
- {
- "type": "mcp",
- "server_label": "vapi-mcp",
- "server_url": "https://mcp.vapi.ai/mcp",
- "headers": {"Authorization": "Bearer YOUR_VAPI_API_KEY"}
- },
- ],
- input="What vapi tools do you have available?",
- )
- print(response)
- ```
-
-
-
- Run the MCP server on your own machine for development or testing.
-
- - **Start locally:**
- ```bash
- npx -y @vapi-ai/mcp-server
- ```
- - **Authentication:** Set the `VAPI_TOKEN` environment variable to your API key.
-
- Example config for Claude:
- ```json
+### Hosted agent platforms
+
+Platforms that call remote MCP servers on your behalf, such as the [OpenAI Responses API](https://developers.openai.com/api/docs/guides/tools-connectors-mcp), can use the hosted server. Pass an access token from the sign-in flow in the `authorization` field, not a Vapi API key:
+
+
+```typescript title="typescript"
+import OpenAI from 'openai';
+
+const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
+
+const response = await openai.responses.create({
+ model: 'gpt-4.1',
+ tools: [
{
- "mcpServers": {
- "vapi-mcp-server": {
- "command": "npx",
- "args": [
- "-y",
- "@vapi-ai/mcp-server"
- ],
- "env": {
- "VAPI_TOKEN": "YOUR_VAPI_API_KEY"
- }
- }
- }
- }
- ```
-
- Use this for clients or SDKs that support local command-based MCP servers.
-
-
- The client launches this server as a subprocess and communicates over **stdio**. This configuration does not start an HTTP endpoint.
-
-
+ type: 'mcp',
+ server_label: 'vapi',
+ server_url: 'https://mcp.vapi.ai/mcp',
+ authorization: process.env.VAPI_MCP_ACCESS_TOKEN,
+ },
+ ],
+ input: 'List my Vapi assistants.',
+});
+
+console.dir(response, { depth: null });
+```
+```python title="python"
+import os
+from openai import OpenAI
----
+client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
-## Custom MCP Client Integration
-
-You can use any MCP-compatible client (SDKs available for multiple languages).
-
-
-
- Choose a language:
- - [TypeScript](https://github.com/modelcontextprotocol/typescript-sdk)
- - [Python](https://github.com/modelcontextprotocol/python-sdk)
- - [Java](https://github.com/modelcontextprotocol/java-sdk)
- - [Kotlin](https://github.com/modelcontextprotocol/kotlin-sdk)
- - [C#](https://github.com/modelcontextprotocol/csharp-sdk)
-
-
- 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.
-
-
+response = client.responses.create(
+ model="gpt-4.1",
+ tools=[
+ {
+ "type": "mcp",
+ "server_label": "vapi",
+ "server_url": "https://mcp.vapi.ai/mcp",
+ "authorization": os.environ["VAPI_MCP_ACCESS_TOKEN"],
+ },
+ ],
+ input="List my Vapi assistants.",
+)
----
+print(response)
+```
+
+
+The token is short-lived and the platform does not store it, so send a current one with every request. The Responses API also asks for your approval before calling a remote server unless you set `require_approval`.
-### Example: Build a client with Node.js
+### MCP client SDKs
+
+Official MCP SDKs are available for [TypeScript](https://github.com/modelcontextprotocol/typescript-sdk), [Python](https://github.com/modelcontextprotocol/python-sdk), [Java](https://github.com/modelcontextprotocol/java-sdk), [Kotlin](https://github.com/modelcontextprotocol/kotlin-sdk), and [C#](https://github.com/modelcontextprotocol/csharp-sdk). They include OAuth helpers that run the sign-in and refresh tokens for you; see the [MCP authorization spec](https://modelcontextprotocol.io/specification/latest/basic/authorization) for how the flow works.
+
+If you already hold a valid access token, pass it to the transport. This minimal Node.js client lists your assistants:
```javascript
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
@@ -318,7 +364,7 @@ dotenv.config();
const mcpClient = new Client({ name: 'vapi-client', version: '1.0.0' });
const transport = new StreamableHTTPClientTransport(
new URL('https://mcp.vapi.ai/mcp'),
- { requestInit: { headers: { Authorization: `Bearer ${process.env.VAPI_TOKEN}` } } }
+ { requestInit: { headers: { Authorization: `Bearer ${process.env.VAPI_MCP_ACCESS_TOKEN}` } } }
);
async function main() {
@@ -331,7 +377,9 @@ async function main() {
main();
```
-### Detailed example: Build a client with Node.js
+The `VAPI_MCP_ACCESS_TOKEN` variable holds an access token from the sign-in flow, not a Vapi API key. It expires, so production clients should use an SDK OAuth provider that refreshes it instead of a token pasted into the environment.
+
+This fuller example lists tools, assistants, and phone numbers, then creates a call:
```javascript
#!/usr/bin/env node
@@ -342,9 +390,9 @@ 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');
+// Ensure an access token from the sign-in flow is available
+if (!process.env.VAPI_MCP_ACCESS_TOKEN) {
+ console.error('Error: VAPI_MCP_ACCESS_TOKEN environment variable is required');
process.exit(1);
}
@@ -358,7 +406,7 @@ async function main() {
// 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}`,
+ Authorization: `Bearer ${process.env.VAPI_MCP_ACCESS_TOKEN}`,
};
const options = {
requestInit: { headers: headers },
@@ -461,14 +509,13 @@ async function main() {
main();
```
- For more detailed examples and complete client implementations, see the [MCP Client Quickstart](https://modelcontextprotocol.io/quickstart/client).
-
## References
-- [Github repo](https://github.com/VapiAI/mcp-server)
+- [Vapi MCP server on GitHub](https://github.com/VapiAI/mcp-server)
+- [Vapi agent skills](https://github.com/VapiAI/skills)
- [Model Context Protocol docs](https://modelcontextprotocol.io)
-- [Vapi dashboard](https://dashboard.vapi.ai)
- [MCP client quickstart](https://modelcontextprotocol.io/quickstart/client)
+- [Vapi dashboard](https://dashboard.vapi.ai)