๐ Blog Post: Learn more about this project in the detailed blog post: Telephony MCP Server for Agentic AI and Language Models This directory contains MCP (Model Context Protocol) Server tools for telephony operations, such as making voice calls and sending SMS messages using the Vonage API. These tools are designed to be integrated with Large Language Model (LLM) applications, enabling LLMs to pe
Add this skill
npx mdskills install khan2a/telephony-mcp-serverWell-documented telephony MCP server with voice and SMS tools, clear setup, but overly broad permissions
1234 ๐ **Blog Post**: Learn more about this project in the detailed blog post: [Telephony MCP Server for Agentic AI and Language Models](https://developer.vonage.com/en/blog/telephony-mcp-server-for-agentic-ai-and-language-models)56# Telephony MCP Server78## Demo Using Claude Desktop9### Agentic Telephony Conversation with Speech Recognition10<img src="./resources/demo-claude-agentic-call-speech-recognition.gif" alt="Agentic Telephony Conversation with Speech Recognition" style="border: 4px solid white; border-radius: 8px;"/>1112### <span style="color: yellow;">Use SMS during mid-conversation</span>13<img src="./resources/demo-claude-desktop.gif" alt="Telephony MCP Server Demo" style="border: 4px solid yellow; border-radius: 8px; display: block; margin-left: 0;"/>1415### <span style="color: #b5651d;">SMS Enquiry (Send and Receive)</span>16<img src="./resources/demo-claude-sms-enquiry.png" alt="SMS Enquiry" style="border: 4px solid #b5651d; border-radius: 8px; display: block; margin-left: 0;" width="800"/>1718## <span style="color: green;">Demo Using GitHub Copilot</span>19<img src="./resources/demo-copilot.gif" alt="Telephony MCP Server Demo" style="border: 4px solid green; border-radius: 8px; display: block; margin-left: 0;"/>2021## Introduction2223This directory contains MCP (Model Context Protocol) Server tools for telephony operations, such as making voice calls and sending SMS messages using the Vonage API. These tools are designed to be integrated with Large Language Model (LLM) applications, enabling LLMs to perform real-world actions beyond simple text generation.2425## LLMs and Tool Integration2627LLMs (Large Language Models) are advanced token generatorsโthey can generate text, images, or even video based on input prompts. However, their core capability is limited to generating content; they cannot access external data or perform actions in the real world on their own.2829To extend their functionality, LLMs can be connected to external tools. For example, when a user asks, "What's the weather today?" the LLM can invoke a backend API tool like `get_weather(city)` via a system prompt, parse the response, and return the result to the user. This tool-calling mechanism transforms a basic LLM into a powerful LLM Application.3031## Tool Calling with MCP and LangChain3233- **LangChain** is a popular framework for developing applications powered by LLMs. It provides a collection of pre-built tools (called a Toolkit) that LLMs can use to interact with external systems.34- **MCP** (Model Context Protocol) follows the same concept: it offers a collection of pre-built tools and a framework for writing new tools and handling function calling.35- Both frameworks allow LLMs to invoke tools, parse their outputs, and integrate the results into their responses.3637## How This Works38391. **Tool Definition**: In this project, tools like `voice_call` and `send_sms` are defined using the MCP framework. Each tool is a function that can be called by an LLM application.402. **LLM Application**: When integrated with an LLM (such as OpenAI's GPT, Anthropic's Claude, etc.), the LLM can decide to call these tools based on user prompts.413. **Execution Flow**:42 - The LLM receives a prompt (e.g., "Call Alice and say hello").43 - The LLM determines that a tool invocation is needed and calls the appropriate MCP tool (e.g., `voice_call`).44 - The tool executes (e.g., initiates a phone call via Vonage) and returns the result.45 - The LLM parses the response and presents it to the user.4647## Running the MCP Tools4849### Prerequisites5051- Python 3.13+52- MCP CLI (`mcp[cli]`), FastAPI, httpx, pyjwt, python-dotenv, uvicorn, pydantic (see `pyproject.toml` for details)53- Vonage API credentials (API key, secret, application ID, private key)54- Public URL for callback server (for production use)5556### Setup57581. **Install dependencies**:59 ```bash60 pip install -r requirements.txt61 ```62 Or, if using Poetry:63 ```bash64 poetry install65 ```66672. **Configure environment variables**:68 - Create a `.env` file with your Vonage credentials:69 ```70 VONAGE_API_KEY=your_api_key71 VONAGE_API_SECRET=your_api_secret72 VONAGE_APPLICATION_ID=your_app_id73 VONAGE_PRIVATE_KEY_PATH=path/to/private.key74 VONAGE_LVN=your_virtual_number75 VONAGE_API_URL=https://api.nexmo.com/v1/calls76 VONAGE_SMS_URL=https://rest.nexmo.com/sms/json77 CALLBACK_SERVER_URL=https://your-public-url # URL for Vonage event callbacks78 ```7980 For the `CALLBACK_SERVER_URL`:81 - In development: You can use `http://localhost:8080` (default if not specified)82 - In production: Use a public URL (such as an ngrok URL or your deployed server)83843. **Run the MCP server**:85 ```bash86 python telephony_server.py87 ```88 The server will start and expose the defined tools for LLM applications.8990### Running with Docker9192You can also run the telephony MCP server using Docker:93941. **Build and start the Docker container**:95 ```bash96 docker compose up --build97 ```98 Or to run in the background:99 ```bash100 docker compose up --build -d101 ```1021032. **Stop the Docker container**:104 ```bash105 docker compose down106 ```1071083. **View logs from the Docker container**:109 ```bash110 docker compose logs -f111 ```112113### Using with LLM Applications114115- **Direct Integration**: Connect your LLM application (e.g., using LangChain via Adapter or a custom MCP client) to the running MCP server. The LLM can now invoke telephony tools as needed.116- **Example**: When the LLM receives a prompt like "Dial this number +123 and read latest news from today", it will call the `voice_call` tool, passing the required parameters.117- **Example**: When the LLM receives a prompt like "Call this number using a British accent", it will call the `voice_call` tool with specific language and style parameters.118- **Example**: When the LLM receives a prompt like "Text the news instead", it will call the `send_sms` tool, passing the required parameters.119120### Using with Claude Desktop or other MCP clients121122To configure an MCP client (like Claude Desktop) to use your telephony MCP server:1231241. **Update your MCP client configuration file** (e.g., `claude_desktop_config.json`):125 ```json126 {127 "mcpServers": {128 "telephony": {129 "command": "docker",130 "args": ["run", "-i", "--rm", "--init", "-e", "DOCKER_CONTAINER=true", "telephony-mcp-server"]131 }132 }133 }134 ```1351362. **Build the Docker image** (if not using docker compose):137 ```bash138 docker build -t telephony-mcp-server .139 ```1401413. Restart your MCP client to apply the changes.142-143## Key Concepts144145- **LLMs are content generators**: They generate text, images, or video, but need external tools for actions like web search, telephony, or database access.146- **Tool calling**: LLMs can invoke backend APIs (tools) to fetch data or perform actions, then parse and present the results.147- **Frameworks**: Both LangChain and MCP provide a structure for defining, registering, and invoking tools from LLMs.148- **MCP**: Helps you write new tools and manage function calling, making it easy to extend LLM applications with custom capabilities.149150## Callback Server for Vonage Events151152The Telephony MCP Server also includes a Vonage Callback Server that listens on port 8080. This server is used to receive event notifications from Vonage Voice API, which are sent when voice calls are initiated, completed, or encounter errors.153154### Features155- Receives and stores Vonage event callbacks156- Provides endpoints to view and manage stored events157- Runs as a separate service within the same application158159### Endpoints160- `GET /` - Health check endpoint161- `POST /event` - Main endpoint for receiving Vonage callbacks162- `GET /events` - List all stored events (with pagination)163- `GET /events/{event_id}` - Get a specific event by ID164- `DELETE /events` - Clear all stored events165166### Configuration167To use the callback server with Vonage Voice API, you need to set the `CALLBACK_SERVER_URL` environment variable to your server's public URL. This URL will be used as the `event_url` parameter in Vonage API calls.168169```bash170export CALLBACK_SERVER_URL="https://your-public-url"171```172173For local development, you can use a service like ngrok to expose your local server to the internet:174175```bash176ngrok http 8080177```178179Then set the `CALLBACK_SERVER_URL` to the ngrok URL.180
Full transparency โ inspect the skill content before installing.