@vapi-ai/mcp-server 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +130 -112
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/schemas/index.d.ts +799 -12
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +69 -0
- package/dist/tools/assistant.d.ts.map +1 -1
- package/dist/tools/assistant.js +4 -1
- package/dist/tools/call.d.ts.map +1 -1
- package/dist/tools/call.js +4 -1
- package/dist/tools/phone-number.d.ts.map +1 -1
- package/dist/tools/phone-number.js +4 -1
- package/dist/tools/tool.d.ts.map +1 -1
- package/dist/tools/tool.js +16 -3
- package/dist/transformers/index.d.ts +4 -2
- package/dist/transformers/index.d.ts.map +1 -1
- package/dist/transformers/index.js +114 -0
- package/package.json +21 -10
- package/dist/__tests__/mcp-server-e2e.test.d.ts +0 -2
- package/dist/__tests__/mcp-server-e2e.test.d.ts.map +0 -1
- package/dist/__tests__/mcp-server-e2e.test.js +0 -239
- package/dist/__tests__/mcp-server-mock.test.d.ts +0 -2
- package/dist/__tests__/mcp-server-mock.test.d.ts.map +0 -1
- package/dist/__tests__/mcp-server-mock.test.js +0 -34
- package/dist/__tests__/mocks/vapi-client.mock.d.ts +0 -9
- package/dist/__tests__/mocks/vapi-client.mock.d.ts.map +0 -1
- package/dist/__tests__/mocks/vapi-client.mock.js +0 -43
package/README.md
CHANGED
|
@@ -2,33 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://smithery.ai/server/@VapiAI/vapi-mcp-server)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Build AI voice assistants and phone agents with [Vapi](https://vapi.ai) using the [Model Context Protocol](https://modelcontextprotocol.com/).
|
|
6
6
|
|
|
7
7
|
<a href="https://glama.ai/mcp/servers/@VapiAI/mcp-server">
|
|
8
8
|
<img width="380" height="200" src="https://glama.ai/mcp/servers/@VapiAI/mcp-server/badge" alt="Vapi Server MCP server" />
|
|
9
9
|
</a>
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Setup
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
2. Click on the `Developer` tab.
|
|
15
|
-
3. Click on the `Edit Config` button.
|
|
16
|
-
4. This will open the `claude_desktop_config.json` file in your file explorer.
|
|
17
|
-
5. Get your Vapi API key from the Vapi dashboard (<https://dashboard.vapi.ai/org/api-keys>).
|
|
18
|
-
6. Add the following to your `claude_desktop_config.json` file. See [here](https://modelcontextprotocol.io/quickstart/user) for more details.
|
|
19
|
-
7. Restart the Claude Desktop after editing the config file.
|
|
13
|
+
The MCP server requires a Vapi API key. Get one from the [Vapi dashboard](https://dashboard.vapi.ai/org/api-keys).
|
|
20
14
|
|
|
21
|
-
### Local
|
|
15
|
+
### Local Server (stdio)
|
|
16
|
+
|
|
17
|
+
Configure any MCP client that supports local stdio servers to run:
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
npx -y @vapi-ai/mcp-server
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Set `VAPI_TOKEN` in the server environment. MCP client configuration formats vary, but the server definition generally looks like this:
|
|
22
24
|
|
|
23
25
|
```json
|
|
24
26
|
{
|
|
25
27
|
"mcpServers": {
|
|
26
|
-
"vapi
|
|
28
|
+
"vapi": {
|
|
27
29
|
"command": "npx",
|
|
28
|
-
"args": [
|
|
29
|
-
"-y",
|
|
30
|
-
"@vapi-ai/mcp-server"
|
|
31
|
-
],
|
|
30
|
+
"args": ["-y", "@vapi-ai/mcp-server"],
|
|
32
31
|
"env": {
|
|
33
32
|
"VAPI_TOKEN": "<your_vapi_token>"
|
|
34
33
|
}
|
|
@@ -37,12 +36,29 @@ The Vapi [Model Context Protocol](https://modelcontextprotocol.com/) server allo
|
|
|
37
36
|
}
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
### Remote
|
|
39
|
+
### Remote Server (Streamable HTTP)
|
|
40
|
+
|
|
41
|
+
Clients that support remote MCP servers can connect directly:
|
|
42
|
+
|
|
43
|
+
- URL: `https://mcp.vapi.ai/mcp`
|
|
44
|
+
- Header: `Authorization: Bearer your_vapi_api_key_here`
|
|
45
|
+
|
|
46
|
+
### Client-Specific Examples
|
|
47
|
+
|
|
48
|
+
#### Claude Code
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
claude mcp add -e VAPI_TOKEN=your_vapi_token vapi -- npx -y @vapi-ai/mcp-server
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### Claude Desktop
|
|
55
|
+
|
|
56
|
+
Use the local server configuration above in the Claude Desktop configuration file. To connect to the hosted server through an stdio bridge instead:
|
|
41
57
|
|
|
42
58
|
```json
|
|
43
59
|
{
|
|
44
60
|
"mcpServers": {
|
|
45
|
-
"vapi
|
|
61
|
+
"vapi": {
|
|
46
62
|
"command": "npx",
|
|
47
63
|
"args": [
|
|
48
64
|
"mcp-remote",
|
|
@@ -58,40 +74,50 @@ The Vapi [Model Context Protocol](https://modelcontextprotocol.com/) server allo
|
|
|
58
74
|
}
|
|
59
75
|
```
|
|
60
76
|
|
|
61
|
-
###
|
|
77
|
+
### Optional Agent Skill
|
|
62
78
|
|
|
63
|
-
|
|
64
|
-
2. Create a new assistant using the existing 'Appointment Scheduler' template in the Vapi dashboard (<https://dashboard.vapi.ai/assistants>).
|
|
65
|
-
3. Make sure to configure Claude Desktop to use the Vapi MCP server and restart the Claude Desktop app.
|
|
66
|
-
4. Ask Claude to initiate or schedule a call. See examples below:
|
|
79
|
+
The [`skill`](./skill) directory contains reusable instructions for AI coding agents that support Agent Skills. Install it using your host's skill installation process.
|
|
67
80
|
|
|
68
|
-
|
|
81
|
+
For Claude Code:
|
|
69
82
|
|
|
70
|
-
```
|
|
71
|
-
|
|
83
|
+
```bash
|
|
84
|
+
mkdir -p ~/.claude/skills/vapi
|
|
85
|
+
curl -o ~/.claude/skills/vapi/SKILL.md https://raw.githubusercontent.com/VapiAI/mcp-server/main/skill/SKILL.md
|
|
72
86
|
```
|
|
73
87
|
|
|
74
|
-
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Example Usage
|
|
75
91
|
|
|
76
|
-
|
|
77
|
-
|
|
92
|
+
### Create a Voice Assistant
|
|
93
|
+
|
|
94
|
+
Ask your MCP-enabled agent:
|
|
95
|
+
```
|
|
96
|
+
I want to build a voice assistant that can schedule appointments
|
|
78
97
|
```
|
|
79
98
|
|
|
80
|
-
|
|
99
|
+
### Make an Outbound Call
|
|
81
100
|
|
|
82
|
-
```
|
|
83
|
-
|
|
101
|
+
```
|
|
102
|
+
Call +1234567890 using my appointment reminder assistant with these details:
|
|
84
103
|
- Customer name: Sarah Johnson
|
|
85
104
|
- Appointment date: March 25th
|
|
86
105
|
- Appointment time: 2:30 PM
|
|
87
|
-
- Doctor name: Dr. Smith
|
|
88
106
|
```
|
|
89
107
|
|
|
108
|
+
### Schedule a Future Call
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
Schedule a call with my support assistant for next Tuesday at 3:00 PM to +1555123456
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
90
116
|
## Using Variable Values in Assistant Prompts
|
|
91
117
|
|
|
92
|
-
The `create_call` action supports passing dynamic variables through `assistantOverrides.variableValues`.
|
|
118
|
+
The `create_call` action supports passing dynamic variables through `assistantOverrides.variableValues`. Use double curly braces in your assistant's prompts: `{{variableName}}`.
|
|
93
119
|
|
|
94
|
-
### Example
|
|
120
|
+
### Example Prompt with Variables
|
|
95
121
|
|
|
96
122
|
```
|
|
97
123
|
Hello {{customerName}}, this is a reminder about your appointment on {{appointmentDate}} at {{appointmentTime}} with {{doctorName}}.
|
|
@@ -99,7 +125,7 @@ Hello {{customerName}}, this is a reminder about your appointment on {{appointme
|
|
|
99
125
|
|
|
100
126
|
### Default Variables
|
|
101
127
|
|
|
102
|
-
|
|
128
|
+
These are automatically available (no need to pass):
|
|
103
129
|
|
|
104
130
|
- `{{now}}` - Current date and time (UTC)
|
|
105
131
|
- `{{date}}` - Current date (UTC)
|
|
@@ -109,29 +135,58 @@ The following variables are automatically available (no need to pass in variable
|
|
|
109
135
|
- `{{year}}` - Current year (UTC)
|
|
110
136
|
- `{{customer.number}}` - Customer's phone number
|
|
111
137
|
|
|
112
|
-
|
|
138
|
+
See [Vapi documentation](https://docs.vapi.ai/assistants/dynamic-variables#default-variables) for advanced date/time formatting.
|
|
113
139
|
|
|
114
|
-
|
|
140
|
+
---
|
|
115
141
|
|
|
116
|
-
|
|
142
|
+
## Remote MCP Server
|
|
117
143
|
|
|
118
|
-
|
|
144
|
+
Connect to Vapi's hosted MCP server from any MCP client:
|
|
119
145
|
|
|
120
|
-
|
|
146
|
+
### Streamable HTTP (Recommended)
|
|
121
147
|
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
- Example header: `Authorization: Bearer your_vapi_api_key_here`
|
|
148
|
+
- URL: `https://mcp.vapi.ai/mcp`
|
|
149
|
+
- Header: `Authorization: Bearer your_vapi_api_key_here`
|
|
125
150
|
|
|
126
151
|
### SSE (Deprecated)
|
|
127
152
|
|
|
128
|
-
|
|
153
|
+
- URL: `https://mcp.vapi.ai/sse`
|
|
154
|
+
- Header: `Authorization: Bearer your_vapi_api_key_here`
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Available Tools
|
|
159
|
+
|
|
160
|
+
### Assistants
|
|
161
|
+
| Tool | Description |
|
|
162
|
+
|------|-------------|
|
|
163
|
+
| `list_assistants` | List all assistants |
|
|
164
|
+
| `get_assistant` | Get assistant by ID |
|
|
165
|
+
| `create_assistant` | Create new assistant |
|
|
166
|
+
| `update_assistant` | Update assistant |
|
|
129
167
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
168
|
+
### Calls
|
|
169
|
+
| Tool | Description |
|
|
170
|
+
|------|-------------|
|
|
171
|
+
| `list_calls` | List call history |
|
|
172
|
+
| `get_call` | Get call details |
|
|
173
|
+
| `create_call` | Start outbound call (immediate or scheduled) |
|
|
133
174
|
|
|
134
|
-
|
|
175
|
+
### Phone Numbers
|
|
176
|
+
| Tool | Description |
|
|
177
|
+
|------|-------------|
|
|
178
|
+
| `list_phone_numbers` | List phone numbers |
|
|
179
|
+
| `get_phone_number` | Get phone number details |
|
|
180
|
+
|
|
181
|
+
### Tools (Function Calling)
|
|
182
|
+
| Tool | Description |
|
|
183
|
+
|------|-------------|
|
|
184
|
+
| `list_tools` | List custom tools |
|
|
185
|
+
| `get_tool` | Get tool details |
|
|
186
|
+
| `create_tool` | Create tool for API integration |
|
|
187
|
+
| `update_tool` | Update tool |
|
|
188
|
+
|
|
189
|
+
---
|
|
135
190
|
|
|
136
191
|
## Development
|
|
137
192
|
|
|
@@ -139,101 +194,64 @@ This connection allows you to access Vapi's functionality remotely without runni
|
|
|
139
194
|
# Install dependencies
|
|
140
195
|
npm install
|
|
141
196
|
|
|
142
|
-
# Build
|
|
197
|
+
# Build
|
|
143
198
|
npm run build
|
|
144
199
|
|
|
145
|
-
#
|
|
200
|
+
# Test with MCP inspector
|
|
146
201
|
npm run inspector
|
|
147
202
|
```
|
|
148
203
|
|
|
149
|
-
|
|
204
|
+
### Local Development Config
|
|
150
205
|
|
|
151
206
|
```json
|
|
152
207
|
{
|
|
153
208
|
"mcpServers": {
|
|
154
209
|
"vapi-local": {
|
|
155
210
|
"command": "node",
|
|
156
|
-
"args": [
|
|
157
|
-
"<path_to_vapi_mcp_server>/dist/index.js"
|
|
158
|
-
],
|
|
211
|
+
"args": ["<path>/dist/index.js"],
|
|
159
212
|
"env": {
|
|
160
213
|
"VAPI_TOKEN": "<your_vapi_token>"
|
|
161
214
|
}
|
|
162
|
-
}
|
|
215
|
+
}
|
|
163
216
|
}
|
|
164
217
|
}
|
|
165
218
|
```
|
|
166
219
|
|
|
167
220
|
### Testing
|
|
168
221
|
|
|
169
|
-
|
|
222
|
+
```bash
|
|
223
|
+
# Safe default suite (build, mocked execution, contract, and stdio compatibility)
|
|
224
|
+
npm test
|
|
170
225
|
|
|
171
|
-
|
|
226
|
+
# Unit tests (mocked public tool execution and catalog contract)
|
|
227
|
+
npm run test:unit
|
|
172
228
|
|
|
173
|
-
|
|
229
|
+
# Documentation/tool-catalog consistency lint
|
|
230
|
+
npm run test:docs
|
|
174
231
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
npm run test:unit
|
|
178
|
-
```
|
|
232
|
+
# Full TypeScript check (production and test code)
|
|
233
|
+
npm run typecheck
|
|
179
234
|
|
|
180
|
-
|
|
235
|
+
# Build and run local stdio protocol compatibility tests (no Vapi API calls)
|
|
236
|
+
npm run test:stdio
|
|
181
237
|
|
|
182
|
-
|
|
238
|
+
# Pack, install, and launch the package from a clean temporary consumer
|
|
239
|
+
npm run test:package
|
|
183
240
|
|
|
184
|
-
|
|
185
|
-
# Set your Vapi API token
|
|
241
|
+
# Live read-only API tests
|
|
186
242
|
export VAPI_TOKEN=your_token_here
|
|
243
|
+
npm run test:live:readonly
|
|
187
244
|
|
|
188
|
-
#
|
|
189
|
-
|
|
245
|
+
# Live mutating tests (creates and cleans up disposable assistants and tools)
|
|
246
|
+
export VAPI_TOKEN=your_test_org_token_here
|
|
247
|
+
npm run test:live:mutating
|
|
190
248
|
```
|
|
191
249
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
#### Running All Tests
|
|
195
|
-
|
|
196
|
-
To run all tests at once:
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
npm test
|
|
200
|
-
```
|
|
250
|
+
---
|
|
201
251
|
|
|
202
252
|
## References
|
|
203
253
|
|
|
204
|
-
- [
|
|
205
|
-
- [
|
|
206
|
-
- [
|
|
254
|
+
- [Vapi Documentation](https://docs.vapi.ai)
|
|
255
|
+
- [Vapi Dashboard](https://dashboard.vapi.ai)
|
|
256
|
+
- [Vapi Remote MCP Server](https://mcp.vapi.ai/)
|
|
207
257
|
- [Model Context Protocol](https://modelcontextprotocol.com/)
|
|
208
|
-
- [Claude Desktop](https://modelcontextprotocol.io/quickstart/user)
|
|
209
|
-
|
|
210
|
-
## Supported Actions
|
|
211
|
-
|
|
212
|
-
The Vapi MCP Server provides the following tools for integration:
|
|
213
|
-
|
|
214
|
-
### Assistant Tools
|
|
215
|
-
|
|
216
|
-
- `list_assistants`: Lists all Vapi assistants
|
|
217
|
-
- `create_assistant`: Creates a new Vapi assistant
|
|
218
|
-
- `update_assistant`: Updates an existing Vapi assistant
|
|
219
|
-
- `get_assistant`: Gets a Vapi assistant by ID
|
|
220
|
-
|
|
221
|
-
### Call Tools
|
|
222
|
-
|
|
223
|
-
- `list_calls`: Lists all Vapi calls
|
|
224
|
-
- `create_call`: Creates an outbound call with support for:
|
|
225
|
-
- Immediate or scheduled calls
|
|
226
|
-
- Dynamic variable values through `assistantOverrides`
|
|
227
|
-
- `get_call`: Gets details of a specific call
|
|
228
|
-
|
|
229
|
-
> **Note:** The `create_call` action supports scheduling calls for immediate execution or for a future time. You can also pass dynamic variables using `assistantOverrides.variableValues` to personalize assistant messages.
|
|
230
|
-
|
|
231
|
-
### Phone Number Tools
|
|
232
|
-
|
|
233
|
-
- `list_phone_numbers`: Lists all Vapi phone numbers
|
|
234
|
-
- `get_phone_number`: Gets details of a specific phone number
|
|
235
|
-
|
|
236
|
-
### Vapi Tools
|
|
237
|
-
|
|
238
|
-
- `list_tools`: Lists all Vapi tools
|
|
239
|
-
- `get_tool`: Gets details of a specific tool
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYpE,iBAAS,eAAe,cAgBvB;AAgCD,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
2
3
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
4
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
5
|
import { registerAllTools } from './tools/index.js';
|
|
5
6
|
import { createVapiClient } from './client.js';
|
|
6
7
|
import dotenv from 'dotenv';
|
|
7
8
|
dotenv.config();
|
|
9
|
+
const packageMetadata = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
8
10
|
function createMcpServer() {
|
|
9
11
|
const vapiToken = process.env.VAPI_TOKEN;
|
|
10
12
|
if (!vapiToken) {
|
|
@@ -13,8 +15,7 @@ function createMcpServer() {
|
|
|
13
15
|
const vapiClient = createVapiClient(vapiToken);
|
|
14
16
|
const mcpServer = new McpServer({
|
|
15
17
|
name: 'Vapi MCP',
|
|
16
|
-
version:
|
|
17
|
-
capabilities: [],
|
|
18
|
+
version: packageMetadata.version,
|
|
18
19
|
});
|
|
19
20
|
registerAllTools(mcpServer, vapiClient);
|
|
20
21
|
return mcpServer;
|
|
@@ -27,6 +28,7 @@ async function main() {
|
|
|
27
28
|
setupShutdownHandler(mcpServer);
|
|
28
29
|
}
|
|
29
30
|
catch (err) {
|
|
31
|
+
console.error('Failed to start MCP server:', err);
|
|
30
32
|
process.exit(1);
|
|
31
33
|
}
|
|
32
34
|
}
|
|
@@ -42,6 +44,7 @@ function setupShutdownHandler(mcpServer) {
|
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
46
|
main().catch((err) => {
|
|
47
|
+
console.error('Fatal error:', err);
|
|
45
48
|
process.exit(1);
|
|
46
49
|
});
|
|
47
50
|
export { createMcpServer };
|