Purpose
telephony-mcp-server is a minimalist MCP (Model Context Protocol) server with no superfluous design, providing telephony communication tools such as voice calls and SMS. It is used to integrate into LLM (Large Language Model) applications, enabling LLMs to perform real-world operations beyond text generation, such as making phone calls and sending text messages.
Main Capabilities
- Voice call: Initiate phone calls via the Vonage API.
- SMS (sending and receiving): Send and receive text messages.
- Speech-to-Text and Speech Recognition: Based on the Vonage API.
- Call and SMS services can be used together in a conversation, for example using SMS mid-session for inquiries (sending and receiving).
- Includes a Vonage callback server for receiving event notifications from the Vonage Voice API (sent when a call is initiated, completed, or errors occur).
Usage
The project can be run in the following ways:
- Install dependencies:
pip install -r requirements.txt, or use Poetry:poetry install. Dependencies include MCP CLI (mcp[cli]), FastAPI, httpx, pyjwt, python-dotenv, uvicorn, pydantic, etc. (see pyproject.toml for details). - Configure environment variables: Create a .env file and fill in the Vonage credentials, including:
- VONAGE_API_KEY=your_api_key
- VONAGE_API_SECRET=your_api_secret
- VONAGE_APPLICATION_ID=your_app_id
- VONAGE_PRIVATE_KEY_PATH=path/to/private.key
- VONAGE_LVN=your_virtual_number
- VONAGE_API_URL=https://api.nexmo.com/v1/calls
- VONAGE_SMS_URL=https://rest.nexmo.com/sms/json
- CALLBACK_SERVER_URL=https://your-public-url(用于 Vonage event callback) In the development environment, CALLBACK_SERVER_URL can use http://localhost:8080(未指定时为默认值);生产环境需使用公开 URL (such as an ngrok URL or a deployed server).
- Run the MCP server:
python telephony_server.py. After the server starts, it exposes the defined tools to the LLM application.
Run with Docker:
- Build and start:
docker compose up --build, for background running add-d:docker compose up --build -d. - Stop:
docker compose down. - View logs:
docker compose logs -f.
Integrate with an LLM application: Connect the LLM application (for example, using LangChain through an Adapter, or a custom MCP client) to the running MCP server, and the LLM can call the telephony tools as needed. Example: When the LLM receives a prompt such as "Dial this number +123 and read latest news from today", it will call the voice_call tool and pass in the required parameters; when it receives "Call this number using a British accent", it will call voice_call with specific language and style parameters; when it receives "Text the news instead", it will call the send_sms tool and pass in the required parameters.
Use with Claude Desktop or other MCP clients: Update the MCP client configuration file (for example, claude_desktop_config.json):
{
"mcpServers": {
"telephony": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--init",
"-e",
"DOCKER_CONTAINER=true",
"telephony-mcp-server"
]
}
}
}
If not using docker compose, you can build the image:docker build -t telephony-mcp-server ., then restart the MCP client for the changes to take effect.
Callback Server
The Telephony MCP Server includes a Vonage callback server listening on port 8080, used to receive event notifications sent by the Vonage Voice API. It can receive and store Vonage event callbacks, and provides endpoints for viewing and managing stored events. Relevant endpoints:
- GET /: Health check endpoint.
- POST /event: The main endpoint for receiving Vonage callbacks.
- GET /events: List all stored events (supports pagination).
- GET /events/{event_id}: Get a specific event by ID.
- DELETE /events: Clear all stored events.
When using the callback server, you need to set the CALLBACK_SERVER_URL environment variable to the server's public URL; this URL will be used as the event_url parameter in Vonage API calls. For local development, you can use services such as ngrok to expose the local server to the internet, and set CALLBACK_SERVER_URL to the ngrok URL.
Background
LLMs are content generators that can generate text, images, or video, but they need external tools to perform operations such as web search, telephony communication, or database access. The tool calling mechanism enables LLMs to call backend APIs (tools) to obtain data or perform operations, and then parse and present the results. Both LangChain and MCP provide structures for defining, registering, and invoking LLM tools; MCP helps write new tools and manage function calls, making it easy to extend LLM applications with custom capabilities. Tools such as voice_call and send_sms in this project are defined using the MCP framework, and each tool is a function that can be called by an LLM application.
Applicable Scenarios and Limitations
It is suitable for scenarios where you want LLM applications to have real telephony and SMS capabilities, for example, letting the model make phone calls, send text messages, or use SMS inquiries in conversations according to user prompts. When using it, you need Vonage API credentials (API key, secret, application ID, private key) and a public URL for callbacks (production environment). The materials do not provide specific information about fees, pricing, supported platforms, or effectiveness.