pbx-mcp
The server allows AI assistants to inspect and optionally control Asterisk and FreeSWITCH PBXs through a unified interface. It provides:
Asterisk monitoring: view server status (version, uptime, calls), list active channels (with filtering), check PJSIP endpoint registration (fallback to chan_sip), inspect dialplan, and execute read-only CLI commands.
FreeSWITCH monitoring: view server status (version, uptime, sessions), list active channels, check SIP registrations on Sofia profiles, inspect Sofia profile and gateway status, and execute read-only API commands.
Call control: originate calls and hangup channels become available when write mode is enabled (PBX_MCP_ALLOW_WRITE=true).
Safety: operates read-only by default; write tools are hidden unless allowed. Additional safeguards include command allow-listing, word-level scanning for destructive FreeSWITCH commands, shell metacharacter rejection, AMI header injection blocking, and output clamping.
Configuration: set environment variables for Asterisk AMI and/or FreeSWITCH ESL credentials; only tools for configured systems are registered. Supports connecting to both PBX types simultaneously. Runs via stdio with npm/npx or Docker.
Provides tools for inspecting and controlling an Asterisk PBX, including status, channels, endpoints, dialplan, CLI commands, and call control (originate/hangup).
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@pbx-mcpwhich extensions are offline right now?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
pbx-mcp
An MCP server that lets an AI assistant inspect and control Asterisk and FreeSWITCH.
Ask "which extensions are offline right now?" or "why is my SIP trunk not registering?" and get a real answer from the live switch, not a guess.
Developed by Tahir Almas at ICT Innovations, the team behind ICTCore, ICTContact, ICTDialer, ICTFax and ICTPBX. The AMI and ESL clients in this repo are the same protocol groundwork those products run on.
Why
Debugging a PBX means memorising two very different command sets. Asterisk speaks AMI and a CLI with hundreds of verbs. FreeSWITCH speaks ESL with its own vocabulary. If you run both, you're context switching all day.
pbx-mcp puts a single, well described tool surface in front of both, so your assistant can go from "calls are failing" to sofia status gateway without you spelling out each step.
New here? The user guide walks through PBX setup, client config, worked examples and troubleshooting. This README is the quick reference.
Related MCP server: Telnyx MCP Server
Install
npm install -g pbx-mcpOr run it straight from npx, which is what most MCP client configs do:
npx -y pbx-mcpYou need Node 18 or newer.
Docker
There's a prebuilt image if you'd rather not put Node on the machine that talks to your PBX.
docker run -i --rm \
-e ASTERISK_AMI_HOST=10.0.0.10 \
-e ASTERISK_AMI_USERNAME=mcp \
-e ASTERISK_AMI_PASSWORD=change-me \
ghcr.io/ictinnovations/pbx-mcpThe same image is on Docker Hub as ictinnovations/pbx-mcp if that registry is an easier pull for you.
Three things to know:
-iis not optional. The server speaks MCP over stdio, so without stdin attached the container starts and then sits there saying nothing, which looks exactly like a broken server.There is no port to publish. Nothing listens.
Your PBX has to be reachable from inside the container. If Asterisk runs on the Docker host itself, swap the IP above for
host.docker.internalon Mac and Windows, or add--network hoston Linux.
The image runs as a non-root user and, like every other way of running this, starts read only.
Configure
Everything comes from environment variables. Set the Asterisk block, the FreeSWITCH block, or both. The server only registers tools for what you've actually configured, so an Asterisk-only shop never sees a FreeSWITCH tool.
Asterisk
Variable | Default | Notes |
| (required to enable) | Hostname or IP of the Asterisk box |
|
| AMI port from |
| AMI user | |
| AMI secret | |
|
| Set |
Your manager.conf user needs at least read = system,call,command and write = command. Add originate only if you plan to turn on write mode.
[mcp]
secret = change-me
read = system,call,command
write = commandFreeSWITCH
Variable | Default | Notes |
| (required to enable) | Hostname or IP of the switch |
|
| Inbound ESL port |
|
| From |
Shared
Variable | Default | Notes |
|
| Unlocks call control. Read the safety section first |
|
| Per command timeout |
Claude Desktop
Add this to claude_desktop_config.json:
{
"mcpServers": {
"pbx": {
"command": "npx",
"args": ["-y", "pbx-mcp"],
"env": {
"ASTERISK_AMI_HOST": "10.0.0.10",
"ASTERISK_AMI_USERNAME": "mcp",
"ASTERISK_AMI_PASSWORD": "change-me",
"FREESWITCH_ESL_HOST": "10.0.0.11",
"FREESWITCH_ESL_PASSWORD": "ClueCon"
}
}
}
}The same shape works for any MCP client that speaks stdio. There's a copy in examples/claude_desktop_config.json.
To run the container instead of npx, keep the env block and point command at Docker:
{
"mcpServers": {
"pbx": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "ASTERISK_AMI_HOST",
"-e", "ASTERISK_AMI_USERNAME",
"-e", "ASTERISK_AMI_PASSWORD",
"ghcr.io/ictinnovations/pbx-mcp"
],
"env": {
"ASTERISK_AMI_HOST": "10.0.0.10",
"ASTERISK_AMI_USERNAME": "mcp",
"ASTERISK_AMI_PASSWORD": "change-me"
}
}
}
}Each -e NAME with no value forwards that variable from env into the container, which keeps the secrets out of the argument list.
Tools
Asterisk
Tool | What it does |
| Version, uptime, active calls and calls processed |
| Every live channel with caller ID, state, bridge, duration and dialplan position. Optional substring filter |
| PJSIP endpoints with device state and contact count. Falls back to |
| Dumps a context, or one extension inside a context |
| Any CLI command, subject to the safety policy below |
| Places a call. Write mode only |
| Kills a channel by name. Write mode only |
FreeSWITCH
Tool | What it does |
| Version, uptime, current and maximum sessions |
| Every live call leg from |
| Registered users on a Sofia profile, with contact URI, user agent and expiry |
| Every SIP profile and gateway, including whether trunks are registered upstream |
| Any API command, subject to the safety policy below |
| Places a call. Write mode only |
|
|
Safety
A PBX is not a scratch pad. Reloading a profile drops registrations, and an originate spends real money on a live trunk. So the default posture is read-only and the guards are layered:
Read-only by default. asterisk_cli accepts an allow list of inspection prefixes (core show, pjsip show, dialplan show, queue show and friends). freeswitch_api accepts an allow list of inspection verbs (status, show, sofia, version and friends).
Word level scanning on FreeSWITCH. sofia is allow listed, but sofia profile internal restart is not a read. Every word in the command is checked against a list of state changing verbs, so the destructive tail gets caught even when the leading verb looks harmless.
Write tools aren't registered at all in read-only mode. asterisk_originate and the other three never appear in tools/list unless you set PBX_MCP_ALLOW_WRITE=true. A model can't call a tool it can't see.
Shell metacharacters are rejected on both transports before a command is sent.
AMI header injection is blocked. Every field that lands in an AMI action is checked for carriage returns and newlines, so a caller ID string can't smuggle in an extra header.
Output is clamped to 20,000 characters. One show channels on a busy switch won't flood the context window.
Even with all that, give the AMI user the narrowest permission set that answers your questions, and put the PBX behind a firewall rather than on the public internet.
Build from source
git clone https://github.com/ictinnovations/pbx-mcp.git
cd pbx-mcp
npm install
npm run build
npm startThe AMI and ESL clients have no third party dependencies. Both protocols are just framed text over TCP, and hand rolling them keeps the install small and the behaviour predictable. The only runtime dependencies are the MCP SDK and Zod.
The protocol clients, on their own
If you want to talk to a PBX from your own Node code and don't need MCP at all, the two clients underneath this server are published separately. Same protocol work, no MCP SDK, no Zod, nothing:
asterisk-ami-node - Asterisk Manager Interface client.
npm install asterisk-ami-nodefreeswitch-esl-node - FreeSWITCH Event Socket client, inbound mode.
npm install freeswitch-esl-node
Both are zero dependency, TypeScript, ESM and CommonJS, Node 18 or newer, and tested against mock switches so you can run the suite without a PBX.
Layout
src/
index.ts entry point, config to transport wiring
ami.ts Asterisk Manager Interface client
esl.ts FreeSWITCH Event Socket Layer client
config.ts environment config and the command safety policy
tools/
asterisk.ts Asterisk tool definitions
freeswitch.ts FreeSWITCH tool definitions
format.ts text table and truncation helpersContributing
Issues and pull requests are welcome. If you're adding a tool, describe it the way you'd describe it to a colleague who has never seen your dialplan. The model picks tools from those descriptions, so a vague one is a broken one.
About
Built and maintained by Tahir Almas, founder of ICT Innovations.
ICT Innovations has shipped open source and commercial telephony since 2005. If pbx-mcp is useful to you, the wider stack behind it might be too:
ICTCore - open source telephony framework, the base for the products below
ICTPBX - white label multi tenant IP PBX, with a free community edition on GitHub
ICTContact - contact center and unified communications
ICTDialer - auto and predictive dialer
ICTFax - open source fax server
asterisk-ami-node and freeswitch-esl-node - the protocol clients from this repo, published on their own
Questions about the commercial products go through the ICT Innovations support portal. Questions about pbx-mcp itself belong in GitHub issues, where everyone can read the answer.
License
MIT. See LICENSE.
Maintenance
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP Server for automated conversational phone calls using Asterisk with Speech-to-Speech capabilities, allowing users to make phone conversations as easily as writing a prompt.9226MIT
- FlicenseCqualityDmaintenanceMCP server enabling interaction with Telnyx telephony, messaging, and AI assistant APIs through natural language.46

VoIPbin MCP Serverofficial
AlicenseBqualityCmaintenanceAn MCP server that enables AI assistants to interact with the VoIPbin CPaaS platform, exposing tools for managing calls, flows, messaging, conferencing, and more.521MIT- Alicense-qualityAmaintenanceAn MCP server that enables AI assistants to manage Cisco Unified Communications Manager (CUCM) via AXL SOAP API, supporting provisioning, configuration, and database queries through natural language.337MIT
Related MCP Connectors
MCP server for AI dialogue using various LLM models via AceDataCloud
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
Self-hosted MCP gateway: turn any API, database or MCP server into AI connectors — no code.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ictinnovations/pbx-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server