AiPBX
Məhsul Xüsusiyyətlər İnteqrasiyalar
Quraşdırma Mobil
Resurslar Sənədlər Suallar & Texnologiya Niyə PHP? Videolar
Sına Əlaqə GitHub-da sponsor olun UpCloud ($250 Pulsuz Kredit) YouTube GitHub
Ana Səhifə / Documentation / PBX MCP Server pilot

Texniki sənədlər yalnız ingilis dilindədir; GitHub və AiPBX portalındakı (Admin → Help) mətnlə eynidir.

PBX MCP Server pilot

AiPBX serves read-only PBX tools to native MCP clients. The bundled PBX MCP Server plugin starts disabled.

  1. Enable PBX MCP Server in Integrations → Plugins.
  2. Open the plugin's Settings screen. Copy the server URL and create a dedicated mcp:read key. Set its lifetime, request limit and the client's source IP allowlist. Copy the secret when it appears. The key list shows expiry, restrictions and last use. Each key can follow server settings or have a selection of its own. You can change the selection on an existing key without issuing a new secret.
  3. In your MCP client, select Streamable HTTP and enter https://pbx.example.com/api/plugins/pbx-mcp with your PBX hostname. Set its Authorization header to Bearer <token> using the client's secret storage.

The pilot supports MCP revisions 2025-11-25 and 2025-06-18 with JSON replies. For the API-key connection, use a native client that supports a custom authorization header. A client can use a tool when it is enabled on the server and allowed on its key. An explicit empty selection blocks all tools for that key. Existing keys follow the server settings until you restrict them.

Test local connection checks that the local HTTPS endpoint responds with an authorization challenge and that MCP discovery returns the configured tools. External connectivity, public certificates and the client's key still need testing from the client itself.

ToolInputReturns
pbx_healthNoneMost recent check states and times
extension_statusInternal extension as a stringActive status, DND and the SIP device states, when available
queue_summaryNoneWaiting call counts and IDs for up to 100 active queues
call_statisticsOptional hours from 1 to 24Aggregate call counts and call durations in seconds
registration_summaryNoneActive extensions with registered desk, web and mobile devices, plus the number with no registrations
trunk_registration_summaryNoneActive SIP trunks counted by outbound registration state
queue_performancequeue_id from queue_summary, optional hours from 1 to 24 (default 1)Offered, answered and lost calls, wait and talk times, and service level at a 20-second target
call_historyOptional hours (1–168), limit (1–50), direction and statusRecent grouped CDRs and call durations
recording_searchSame filters as call_historyCalls with attached audio and a portal link protected by existing recording permissions

The original four tools are enabled on an unconfigured installation. Enable the device registration, SIP trunk registration and queue performance tools in the plugin settings if clients need them. Disabled tools disappear from discovery and reject calls from all clients.

Tool responses exclude credentials, audio contents, transcripts, caller numbers, employee names and raw Asterisk output. Revoke the API key to remove access for a client, or disable the plugin to turn off the endpoint for all clients.

Connect a hosted client with OAuth

Configure an existing OAuth authorization server with authorization code and S256 PKCE, the client's registration method and redirect URI, and an RFC 7662 introspection endpoint that accepts HTTP Basic client authentication. Register the exact MCP server URL as the resource and ensure the authorization server returns that URL in the access token audience. With an OAuth provider configured, use the same MCP URL in the hosted client's connection form.

Set these values in the PBX's /etc/ai-pbx.env:

AIPBX_MCP_OAUTH_ISSUER=https://login.example.com/issuer
AIPBX_MCP_OAUTH_INTROSPECTION_URL=https://login.example.com/issuer/introspect
AIPBX_MCP_OAUTH_CLIENT_ID=pbx-introspection
AIPBX_MCP_OAUTH_CLIENT_SECRET=replace-with-the-introspection-client-secret
AIPBX_MCP_OAUTH_SUBJECTS='{"provider-subject-value":123}'

The issuer and introspection URL must use the same HTTPS origin. Map each allowed provider subject to the ID of an active AiPBX administrator. Introspection must return the expected issuer, audience, subject, expiry and space-delimited scopes. Grant mcp:read for ordinary read tools. Enable call history and recording search separately in the plugin and grant mcp:cdr and mcp:recordings, respectively, at the provider. Use a separate OAuth client or provider policy to control these scopes and mcp:propose.

Choose a policy for MCP changes

Set Policy for all MCP write operations in the plugin's Change proposals panel:

  • Disabled keeps MCP read-only.
  • Require administrator approval shows the old and requested values in the portal for 15 minutes. Approval queues the change for AiPBX Apply. Stale proposals are refused.
  • Apply automatically accepts new authorized requests immediately. AiPBX reloads the general dialplan when this is the only queued change. If another change is pending or the reload fails, the request returns pending_apply and stays in the usual Apply queue. Existing proposals still require a decision in the portal.

The propose_extension_dnd tool takes an internal SIP extension and a boolean enabled value. All modes keep the existing OAuth scope checks and audit logging.

View or edit this page on GitHub

On This Page