Skip to content

Commit 2fd5f0f

Browse files
committed
feat: docs mcp server, vapi mcp command
1 parent 3607ef0 commit 2fd5f0f

File tree

20 files changed

+11244
-33
lines changed

20 files changed

+11244
-33
lines changed

Makefile

Lines changed: 94 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ GOTEST=$(GOCMD) test
88
GOGET=$(GOCMD) get
99
GOMOD=$(GOCMD) mod
1010

11+
# Node.js parameters for MCP server
12+
NPM=npm
13+
MCP_DIR=mcp-docs-server
14+
MCP_DIST=$(MCP_DIR)/dist
15+
1116
# Binary details
1217
BINARY_NAME=vapi
1318
BUILD_DIR=build
@@ -21,20 +26,56 @@ GIT_COMMIT=$(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
2126
# Build flags - note the lowercase variable names to match main.go
2227
LDFLAGS=-ldflags "-X main.version=$(VERSION) -X main.commit=$(GIT_COMMIT) -X main.date=$(BUILD_TIME) -X main.builtBy=make"
2328

24-
# Default target
25-
all: test build
29+
# Default target - build both CLI and MCP server
30+
all: test build build-mcp
2631

2732
# Create build directory
2833
$(BUILD_DIR):
2934
@mkdir -p $(BUILD_DIR)
3035

31-
# Build the binary
36+
# Build the CLI binary
3237
build: $(BUILD_DIR)
3338
@echo "Building $(BINARY_NAME)..."
3439
$(GOBUILD) $(LDFLAGS) -o $(BINARY_PATH) -v
3540

41+
# Build MCP server
42+
build-mcp:
43+
@echo "Building MCP docs server..."
44+
@if [ ! -d "$(MCP_DIR)/node_modules" ]; then \
45+
echo "Installing MCP server dependencies..."; \
46+
cd $(MCP_DIR) && $(NPM) install; \
47+
fi
48+
@cd $(MCP_DIR) && $(NPM) run build
49+
@echo "✅ MCP server built successfully"
50+
51+
# Install MCP server dependencies
52+
mcp-deps:
53+
@echo "Installing MCP server dependencies..."
54+
@cd $(MCP_DIR) && $(NPM) install
55+
56+
# Clean MCP server
57+
clean-mcp:
58+
@echo "Cleaning MCP server..."
59+
@rm -rf $(MCP_DIR)/dist
60+
@rm -rf $(MCP_DIR)/node_modules
61+
62+
# Test MCP server
63+
test-mcp:
64+
@echo "Testing MCP server..."
65+
@cd $(MCP_DIR) && $(NPM) test
66+
67+
# Lint MCP server
68+
lint-mcp:
69+
@echo "Linting MCP server..."
70+
@cd $(MCP_DIR) && $(NPM) run lint
71+
72+
# Publish MCP server to npm
73+
publish-mcp:
74+
@echo "Publishing MCP server to npm..."
75+
@cd $(MCP_DIR) && $(NPM) publish
76+
3677
# Build for all platforms
37-
build-all: $(BUILD_DIR)
78+
build-all: $(BUILD_DIR) build-mcp
3879
@echo "Building for all platforms..."
3980
# macOS AMD64
4081
GOOS=darwin GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64
@@ -50,6 +91,9 @@ test:
5091
@echo "Running tests..."
5192
$(GOTEST) -v ./...
5293

94+
# Run all tests (CLI + MCP server)
95+
test-all: test test-mcp
96+
5397
# Run tests with coverage
5498
test-coverage:
5599
@echo "Running tests with coverage..."
@@ -63,6 +107,9 @@ clean:
63107
rm -rf $(BUILD_DIR)
64108
rm -f coverage.out coverage.html
65109

110+
# Clean everything (CLI + MCP server)
111+
clean-all: clean clean-mcp
112+
66113
# Run go mod tidy
67114
tidy:
68115
@echo "Tidying modules..."
@@ -73,18 +120,33 @@ deps:
73120
@echo "Downloading dependencies..."
74121
$(GOMOD) download
75122

123+
# Install all dependencies (CLI + MCP server)
124+
deps-all: deps mcp-deps
125+
76126
# Run linters
77127
lint:
78128
@echo "Running linters..."
79129
golangci-lint run
80130

131+
# Run all linters (CLI + MCP server)
132+
lint-all: lint lint-mcp
133+
81134
# Install the binary locally
82135
install: build
83136
@echo "Installing $(BINARY_NAME)..."
84137
@mkdir -p $(HOME)/.local/bin
85138
@cp $(BINARY_PATH) $(HOME)/.local/bin/
86139
@echo "Installed to $(HOME)/.local/bin/$(BINARY_NAME)"
87140

141+
# Install MCP server globally
142+
install-mcp: build-mcp
143+
@echo "Installing MCP server globally..."
144+
@cd $(MCP_DIR) && $(NPM) install -g .
145+
@echo "✅ MCP server installed globally"
146+
147+
# Install everything
148+
install-all: install install-mcp
149+
88150
# Run the binary
89151
run: build
90152
$(BINARY_PATH)
@@ -114,22 +176,43 @@ version-bump-patch:
114176

115177
# Help target to show available commands
116178
help:
117-
@echo "Available targets:"
179+
@echo "🚀 Vapi CLI & MCP Server Build System"
180+
@echo ""
181+
@echo "📦 CLI Commands:"
118182
@echo " build Build the CLI binary"
119183
@echo " install Install the CLI to ~/.local/bin"
120-
@echo " test Run all tests"
121-
@echo " lint Run linters"
122-
@echo " clean Clean build artifacts"
184+
@echo " test Run CLI tests"
185+
@echo " lint Run CLI linters"
186+
@echo " clean Clean CLI build artifacts"
187+
@echo ""
188+
@echo "🔧 MCP Server Commands:"
189+
@echo " build-mcp Build the MCP docs server"
190+
@echo " install-mcp Install MCP server globally"
191+
@echo " test-mcp Run MCP server tests"
192+
@echo " lint-mcp Run MCP server linters"
193+
@echo " clean-mcp Clean MCP server artifacts"
194+
@echo " publish-mcp Publish MCP server to npm"
195+
@echo ""
196+
@echo "🎯 Combined Commands:"
197+
@echo " all Build both CLI and MCP server"
198+
@echo " build-all Build CLI for all platforms + MCP server"
199+
@echo " test-all Run all tests (CLI + MCP server)"
200+
@echo " lint-all Run all linters (CLI + MCP server)"
201+
@echo " clean-all Clean everything"
202+
@echo " deps-all Install all dependencies"
203+
@echo " install-all Install CLI and MCP server"
123204
@echo ""
124-
@echo "Version management:"
205+
@echo "📋 Version management:"
125206
@echo " version Show current version"
126207
@echo " version-set Set version (requires VERSION=x.y.z)"
127208
@echo " version-bump-major Bump major version (1.2.3 -> 2.0.0)"
128209
@echo " version-bump-minor Bump minor version (1.2.3 -> 1.3.0)"
129210
@echo " version-bump-patch Bump patch version (1.2.3 -> 1.2.4)"
130211
@echo ""
131212
@echo "Examples:"
213+
@echo " make all # Build everything"
214+
@echo " make install-all # Install CLI + MCP server"
132215
@echo " make version-set VERSION=1.2.3"
133-
@echo " make version-bump-patch"
216+
@echo " make publish-mcp # Publish MCP server to npm"
134217

135-
.PHONY: all build build-all test test-coverage clean tidy deps lint install run help
218+
.PHONY: all build build-mcp build-all test test-mcp test-all test-coverage clean clean-mcp clean-all tidy deps mcp-deps deps-all lint lint-mcp lint-all install install-mcp install-all run publish-mcp help

README.md

Lines changed: 128 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,45 @@ The `init` command will:
192192
- Generate example code and components
193193
- Create environment configuration templates
194194

195+
### MCP Integration - Turn Your IDE into a Vapi Expert
196+
197+
Set up Model Context Protocol (MCP) integration to give your IDE's AI assistant complete knowledge about Vapi:
198+
199+
```bash
200+
# Auto-detect and configure all IDEs
201+
vapi mcp setup
202+
203+
# Configure a specific IDE
204+
vapi mcp setup cursor # For Cursor
205+
vapi mcp setup windsurf # For Windsurf
206+
vapi mcp setup vscode # For VSCode
207+
208+
# Check configuration status
209+
vapi mcp status
210+
```
211+
212+
Once configured, your IDE's AI assistant will have access to:
213+
214+
- **Complete Vapi Documentation** - No more hallucinated API info
215+
- **Code Examples & Templates** - Real working examples
216+
- **Best Practices & Guides** - Expert-level implementation patterns
217+
- **Latest Features** - Always up-to-date with new releases
218+
219+
**Supported IDEs:**
220+
221+
- [Cursor](https://cursor.sh) - AI-powered code editor
222+
- [Windsurf](https://codeium.com/windsurf) - Codeium's AI IDE
223+
- [VSCode](https://code.visualstudio.com) - With GitHub Copilot
224+
225+
**What this does:**
226+
227+
- Configures your IDE to use the Vapi MCP docs server
228+
- Creates appropriate configuration files (`.cursor/mcp.json`, etc.)
229+
- Eliminates AI hallucination about Vapi features and APIs
230+
- Enables intelligent code suggestions specific to Vapi
231+
232+
Try asking your IDE's AI: _"How do I create a voice assistant with Vapi?"_ and watch it provide accurate, up-to-date information!
233+
195234
### Configuration
196235

197236
```bash
@@ -422,35 +461,75 @@ The CLI will automatically check for updates periodically and notify you when a
422461

423462
## Project Structure
424463

464+
This is a **monorepo** containing both the Go CLI and the TypeScript MCP server:
465+
425466
```
426-
cli/
427-
├── cmd/ # Command implementations
428-
│ ├── root.go # Main CLI setup
429-
│ ├── assistant.go # Assistant commands
430-
│ ├── workflow.go # Workflow commands
431-
│ ├── campaign.go # Campaign commands
432-
│ ├── call.go # Call commands
433-
│ ├── config.go # Configuration commands
434-
│ ├── init.go # Project initialization
435-
│ └── login.go # Authentication
436-
├── pkg/ # Core packages
437-
│ ├── auth/ # Authentication logic
438-
│ ├── client/ # Vapi API client
439-
│ ├── config/ # Configuration management
440-
│ ├── integrations/ # Framework integrations
441-
│ └── output/ # Output formatting
442-
├── build/ # Build artifacts (git-ignored)
443-
├── main.go # Entry point
444-
├── Makefile # Build automation
445-
└── README.md # This file
467+
vapi-cli/ # 🏠 Main repository
468+
├── cmd/ # Go CLI command implementations
469+
│ ├── root.go # Main CLI setup & auth
470+
│ ├── assistant.go # Assistant management
471+
│ ├── workflow.go # Workflow commands
472+
│ ├── campaign.go # Campaign management
473+
│ ├── call.go # Call operations
474+
│ ├── config.go # Configuration
475+
│ ├── init.go # Project integration
476+
│ ├── mcp.go # MCP server setup ✨
477+
│ └── login.go # Authentication
478+
├── pkg/ # Go core packages
479+
│ ├── auth/ # Authentication logic
480+
│ ├── client/ # Vapi API client
481+
│ ├── config/ # Configuration management
482+
│ ├── integrations/ # Framework detection
483+
│ └── output/ # Output formatting
484+
├── mcp-docs-server/ # 📦 MCP Server (TypeScript)
485+
│ ├── src/ # TypeScript source
486+
│ │ ├── index.ts # MCP server entry point
487+
│ │ ├── server.ts # Core server logic
488+
│ │ ├── tools/ # MCP tools (5 tools)
489+
│ │ ├── resources/ # MCP resources
490+
│ │ └── utils/ # Utilities & data
491+
│ ├── dist/ # Built JavaScript
492+
│ ├── package.json # npm package config
493+
│ └── README.md # MCP server docs
494+
├── build/ # Build artifacts (git-ignored)
495+
├── main.go # Go CLI entry point
496+
├── Makefile # Unified build system ⚡
497+
└── README.md # This file
446498
```
447499

500+
### Monorepo Benefits
501+
502+
- **🔄 Synchronized Development** - CLI and MCP server stay in sync
503+
- **📦 Single Source of Truth** - All Vapi tooling in one place
504+
- **🚀 Unified Build System** - `make all` builds everything
505+
- **🎯 Consistent Versioning** - CLI and MCP server versions aligned
506+
448507
## Development
449508

509+
This monorepo includes both Go (CLI) and TypeScript (MCP server) components. The unified Makefile handles both.
510+
511+
### Quick Start
512+
513+
```bash
514+
# Build everything (CLI + MCP server)
515+
make all
516+
517+
# Install everything locally
518+
make install-all
519+
520+
# Test everything
521+
make test-all
522+
523+
# Clean everything
524+
make clean-all
525+
```
526+
450527
### Building
451528

529+
#### CLI (Go)
530+
452531
```bash
453-
# Build for current platform
532+
# Build CLI only
454533
make build
455534

456535
# Build for all platforms
@@ -460,6 +539,34 @@ make build-all
460539
go run main.go
461540
```
462541

542+
#### MCP Server (TypeScript)
543+
544+
```bash
545+
# Build MCP server only
546+
make build-mcp
547+
548+
# Install MCP server globally
549+
make install-mcp
550+
551+
# Publish to npm
552+
make publish-mcp
553+
```
554+
555+
### Development Requirements
556+
557+
- **Go 1.21+** - [Install Go](https://golang.org/doc/install)
558+
- **Node.js 18+** - [Install Node.js](https://nodejs.org/)
559+
- **golangci-lint** - For Go code linting
560+
- **npm** - For MCP server dependencies
561+
562+
```bash
563+
# macOS
564+
brew install go node golangci-lint
565+
566+
# Install dependencies for both projects
567+
make deps-all
568+
```
569+
463570
### Testing
464571

465572
```bash

0 commit comments

Comments
 (0)