Back to Browse

Pbx MCP Server

Developer ToolsLow Risk10.0MCP RegistryLocal
Free

Server data from the Official MCP Registry

Inspect and control Asterisk (AMI) and FreeSWITCH (ESL) PBX servers from your AI assistant.

About

Inspect and control Asterisk (AMI) and FreeSWITCH (ESL) PBX servers from your AI assistant.

Security Report

10.0
Low Risk10.0Low Risk

Valid MCP server (2 strong, 2 medium validity signals). No known CVEs in dependencies. Package registry verified. Imported from the Official MCP Registry.

9 files analyzed · 1 issue found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

database

Check that this permission is expected for this type of plugin.

env_vars

Check that this permission is expected for this type of plugin.

What You'll Need

Set these up before or after installing:

Hostname or IP of the Asterisk server. Set this to enable the Asterisk tools.Optional

Environment variable: ASTERISK_AMI_HOST

Asterisk Manager Interface port. Defaults to 5038.Optional

Environment variable: ASTERISK_AMI_PORT

AMI username from manager.conf.Optional

Environment variable: ASTERISK_AMI_USERNAME

AMI secret from manager.conf.Required

Environment variable: ASTERISK_AMI_PASSWORD

Connect to AMI over TLS. Set true if tlsenable=yes in manager.conf.Optional

Environment variable: ASTERISK_AMI_TLS

Hostname or IP of the FreeSWITCH server. Set this to enable the FreeSWITCH tools.Optional

Environment variable: FREESWITCH_ESL_HOST

FreeSWITCH inbound event socket port. Defaults to 8021.Optional

Environment variable: FREESWITCH_ESL_PORT

Event socket password from event_socket.conf.xml. Defaults to ClueCon, which you should change.Required

Environment variable: FREESWITCH_ESL_PASSWORD

Unlocks call control. When false the server is read-only and the originate and hangup tools are not registered at all. Placing a call on a live trunk costs real money, so leave this off unless you mean it.Optional

Environment variable: PBX_MCP_ALLOW_WRITE

Per command timeout in milliseconds. Defaults to 10000.Optional

Environment variable: PBX_MCP_TIMEOUT_MS

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "io-github-ictinnovations-pbx-mcp": {
      "env": {
        "ASTERISK_AMI_TLS": "your-asterisk-ami-tls-here",
        "ASTERISK_AMI_HOST": "your-asterisk-ami-host-here",
        "ASTERISK_AMI_PORT": "your-asterisk-ami-port-here",
        "PBX_MCP_TIMEOUT_MS": "your-pbx-mcp-timeout-ms-here",
        "FREESWITCH_ESL_HOST": "your-freeswitch-esl-host-here",
        "FREESWITCH_ESL_PORT": "your-freeswitch-esl-port-here",
        "PBX_MCP_ALLOW_WRITE": "your-pbx-mcp-allow-write-here",
        "ASTERISK_AMI_PASSWORD": "your-asterisk-ami-password-here",
        "ASTERISK_AMI_USERNAME": "your-asterisk-ami-username-here",
        "FREESWITCH_ESL_PASSWORD": "your-freeswitch-esl-password-here"
      },
      "args": [
        "-y",
        "pbx-mcp"
      ],
      "command": "npx"
    }
  }
}

Documentation

View on GitHub

From the project's GitHub README.

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.

Install

npm install -g pbx-mcp

Or run it straight from npx, which is what most MCP client configs do:

npx -y pbx-mcp

You need Node 18 or newer.

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

VariableDefaultNotes
ASTERISK_AMI_HOST(required to enable)Hostname or IP of the Asterisk box
ASTERISK_AMI_PORT5038AMI port from manager.conf
ASTERISK_AMI_USERNAMEAMI user
ASTERISK_AMI_PASSWORDAMI secret
ASTERISK_AMI_TLSfalseSet true if tlsenable=yes

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 = command

FreeSWITCH

VariableDefaultNotes
FREESWITCH_ESL_HOST(required to enable)Hostname or IP of the switch
FREESWITCH_ESL_PORT8021Inbound ESL port
FREESWITCH_ESL_PASSWORDClueConFrom event_socket.conf.xml

Shared

VariableDefaultNotes
PBX_MCP_ALLOW_WRITEfalseUnlocks call control. Read the safety section first
PBX_MCP_TIMEOUT_MS10000Per 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.

Tools

Asterisk

ToolWhat it does
asterisk_statusVersion, uptime, active calls and calls processed
asterisk_channelsEvery live channel with caller ID, state, bridge, duration and dialplan position. Optional substring filter
asterisk_endpointsPJSIP endpoints with device state and contact count. Falls back to chan_sip peers on older installs
asterisk_dialplanDumps a context, or one extension inside a context
asterisk_cliAny CLI command, subject to the safety policy below
asterisk_originatePlaces a call. Write mode only
asterisk_hangupKills a channel by name. Write mode only

FreeSWITCH

ToolWhat it does
freeswitch_statusVersion, uptime, current and maximum sessions
freeswitch_channelsEvery live call leg from show channels. Optional substring filter that keeps the header row
freeswitch_registrationsRegistered users on a Sofia profile, with contact URI, user agent and expiry
freeswitch_sofia_statusEvery SIP profile and gateway, including whether trunks are registered upstream
freeswitch_apiAny API command, subject to the safety policy below
freeswitch_originatePlaces a call. Write mode only
freeswitch_hangupuuid_kill on a channel UUID. 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 start

The 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-node
  • freeswitch-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 helpers

Contributing

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.

Reviews

No reviews yet

Be the first to review this server!