diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..2d5e547 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,15 @@ +{ + "name": "vapi", + "description": "Build AI voice assistants and phone agents with Vapi", + "version": "0.0.10", + "author": { + "name": "Vapi AI", + "url": "https://vapi.ai" + }, + "homepage": "https://github.com/VapiAI/mcp-server#readme", + "repository": "https://github.com/VapiAI/mcp-server", + "license": "MIT", + "keywords": ["vapi", "voice", "ai", "phone", "assistant", "mcp"], + "mcpServers": "./.mcp.json", + "skills": "./skills/" +} diff --git a/.mcp.json b/.mcp.json new file mode 100644 index 0000000..f29b803 --- /dev/null +++ b/.mcp.json @@ -0,0 +1,8 @@ +{ + "mcpServers": { + "vapi": { + "command": "node", + "args": ["${CLAUDE_PLUGIN_ROOT}/dist/index.js"] + } + } +} diff --git a/package.json b/package.json index b447975..b2a1aee 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,10 @@ "files": [ "dist", "dist/**/*.d.ts", - "dist/**/*.d.ts.map" + "dist/**/*.d.ts.map", + ".claude-plugin", + ".mcp.json", + "skills" ], "dependencies": { "@modelcontextprotocol/sdk": "^1.12.3", diff --git a/skill/PROMPT_GUIDE.md b/skills/vapi/PROMPT_GUIDE.md similarity index 100% rename from skill/PROMPT_GUIDE.md rename to skills/vapi/PROMPT_GUIDE.md diff --git a/skill/SKILL.md b/skills/vapi/SKILL.md similarity index 69% rename from skill/SKILL.md rename to skills/vapi/SKILL.md index 431ceaa..1f8e3c7 100644 --- a/skill/SKILL.md +++ b/skills/vapi/SKILL.md @@ -11,17 +11,7 @@ Build AI-powered voice assistants, phone agents, and conversational AI applicati When a user wants to build a voice assistant or phone agent, follow these steps: -### Step 1: Check if Vapi MCP is Installed - -First, check if the Vapi MCP server is available by looking for `vapi_` tools. If not available, tell the user to run: - -```bash -claude mcp add vapi -- npx -y @vapi-ai/mcp-server -``` - -Then restart Claude Code and continue with Step 2. - -### Step 2: Authenticate with Vapi +### Step 1: Authenticate with Vapi If the user hasn't authenticated yet (tools return auth errors): @@ -29,9 +19,9 @@ If the user hasn't authenticated yet (tools return auth errors): 2. Tell the user to open the provided URL and sign in 3. Once authenticated, proceed with their request -### Step 3: Build the Voice Assistant +### Step 2: Build the Voice Assistant -Before creating an assistant, fetch the latest prompt engineering guidelines from the [Prompt Guide](https://raw.githubusercontent.com/VapiAI/mcp-server/main/skill/PROMPT_GUIDE.md). +Before creating an assistant, read the prompt engineering guidelines from the MCP resource `vapi://prompt-guide` from server `plugin:vapi:vapi` (use `ReadMcpResourceTool` with server `plugin:vapi:vapi` and uri `vapi://prompt-guide`). Use these guidelines to craft effective voice assistant prompts based on what the user wants to build. @@ -70,19 +60,18 @@ Use these guidelines to craft effective voice assistant prompts based on what th **User:** "I want to build a voice assistant that can schedule appointments" **Claude should:** -1. Check for Vapi MCP -> install if needed -2. Authenticate if needed -3. Fetch the prompt guide for best practices -4. Ask about their business to understand context -5. Create an assistant with a scheduling-focused prompt -6. Offer to set up a phone number -7. Help create calendar integration tools if needed +1. Authenticate if needed +2. Read the prompt guide resource for best practices +3. Ask about their business to understand context +4. Create an assistant with a scheduling-focused prompt +5. Offer to set up a phone number +6. Help create calendar integration tools if needed **User:** "Make me a phone bot that answers questions about my business" **Claude should:** -1. Ensure Vapi MCP is installed and authenticated -2. Fetch the prompt guide for best practices +1. Authenticate if needed +2. Read the prompt guide resource for best practices 3. Ask about the business: name, services, hours, common questions 4. Craft a system prompt following the guidelines 5. Create the assistant diff --git a/src/index.ts b/src/index.ts index 1c03b67..cbbfb90 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,9 +6,15 @@ import { VapiClient } from '@vapi-ai/server-sdk'; import { hasValidToken, getToken, startAuthFlow, isAuthInProgress, getAuthUrl, clearConfig } from './auth.js'; import { registerAllTools } from './tools/index.js'; +import { readFileSync } from 'fs'; +import { fileURLToPath } from 'url'; +import { dirname, join } from 'path'; import dotenv from 'dotenv'; dotenv.config(); +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + // Lazy-initialized Vapi client let vapiClient: VapiClient | null = null; @@ -124,6 +130,20 @@ function createMcpServer() { registerAllTools(mcpServer, clientProxy); + // Expose the prompt guide as an MCP resource + mcpServer.resource( + 'prompt-guide', + 'vapi://prompt-guide', + { description: 'Voice assistant prompt engineering guide with best practices for crafting Vapi assistant prompts', mimeType: 'text/markdown' }, + async (uri) => { + const guidePath = join(__dirname, '..', 'skills', 'vapi', 'PROMPT_GUIDE.md'); + const content = readFileSync(guidePath, 'utf-8'); + return { + contents: [{ uri: uri.href, text: content }], + }; + } + ); + return mcpServer; }