5.1 KiB
Handoff Notes
Last updated: 2026-04-21
Current State
This repo now contains three related pieces:
- A standalone PHP VoIP.ms library under
src/. - A CLI tool at
voipms-cli.php. - A test HTTP MCP server under
mcp/, launched withbin/serve-mcp.sh.
The original phonebook.php file is intentionally unchanged as a simple cURL
reference example.
Library
Main files:
src/VoipMsClient.phpsrc/VoipMsResponse.phpsrc/PhonebookGroupEnsureResult.phpsrc/PhonebookGroupUpdateResult.phpsrc/PhonebookNumberGroupResult.php
The client supports generic raw API access:
$client->request('getDIDsInfo', ['did' => '5551234567']);
$client->call('getBalance');
It also has convenience helpers for:
- Balance lookup.
- DID lookup.
- CDR lookup with default call-status flags.
- Account filter lookup through
getAccounts()/getCallAccounts(). - Call recording listing, retrieval, and email delivery.
- Phonebook entries and groups.
- Idempotently adding a number to a phonebook group.
- Removing matching numbers from a phonebook group.
- CallerID Filtering.
- Call account filters.
- SMS sending.
Important phonebook behavior:
- VoIP.ms phonebook groups store
membersas semicolon-separated phonebook entry IDs. - A group can exist with no entries.
- VoIP.ms may allow duplicate phonebook entries for the same number.
- Library helpers try to avoid creating duplicates and avoid duplicate group membership.
CLI
The CLI can call raw VoIP.ms API methods:
./voipms-cli.php getBalance
./voipms-cli.php getPhonebookGroups
./voipms-cli.php getPhonebook Spam
Useful CLI features:
--dry-run--format pretty|json|rawhelp <command>and<command> helplistcompletion bash
Friendlier behavior currently implemented:
cdralias maps normal options togetCDRparameters.cdrdefaults to all call statuses to avoid VoIP.msno_callstatus.getPhonebook 16389maps togroup=16389.getPhonebook Spammaps togroup_name=Spam.getPhonebookGroups Spammaps toname=Spam.
Test MCP Server
Files:
mcp/http-server.phpbin/serve-mcp.shdocs/mcp.md
Start it:
export VOIPMS_API_USERNAME='you@example.com'
export VOIPMS_API_PASSWORD='your-api-password'
export MCP_AUTH_TOKEN='choose-a-long-random-token'
./bin/serve-mcp.sh
Defaults:
MCP_HOST=0.0.0.0
MCP_PORT=8787
MCP endpoint: http://0.0.0.0:8787/mcp
Health endpoint: http://0.0.0.0:8787/health
For Grok or hosted clients that cannot send custom headers, query-token auth is available for testing:
http://YOUR_HOST:8787/mcp?token=YOUR_TOKEN
http://YOUR_HOST:8787/sse?token=YOUR_TOKEN
Prefer Authorization: Bearer <token> when the client supports it.
MCP Compatibility Work
The first MCP server only handled POST JSON-RPC. It was updated after Grok could connect over HTTP but reported the server did not work.
Current compatibility support:
POST /mcpJSON-RPC.GET /mcpStreamable HTTP-style SSE probe.GET /sselegacy SSE probe with anendpointevent pointing to/mcp.DELETE /mcp.OPTIONSCORS preflight.Mcp-Session-Idresponse header.- Protocol negotiation for
2024-11-05,2025-03-26, and2025-06-18. - JSON-RPC notifications return
202 Accepted. - Query-token auth fallback.
Current MCP tools:
voipms_get_balancevoipms_get_phonebook_groupsvoipms_get_phonebook_entriesvoipms_get_callerid_filtersvoipms_get_accountsvoipms_get_call_accountsvoipms_get_call_recordingsvoipms_get_call_recordingvoipms_send_call_recording_emailvoipms_get_call_transcriptvoipms_get_recent_cdrvoipms_add_number_to_phonebook_groupvoipms_remove_number_from_phonebook_group
Mutation tools default to dry_run=true.
voipms_get_call_transcript is a placeholder until transcript storage and a
transcription provider are added.
Last Verification Done
No live VoIP.ms API calls were made during MCP compatibility testing.
Verified locally:
php -l mcp/http-server.phpbash -n bin/serve-mcp.shPOST /mcp initializePOST /mcp tools/listPOST /mcp notifications/initializedGET /mcpGET /sse- Query-token auth
- Unauthorized request returns
401
Temporary local test server was stopped afterward.
Likely Next Steps
-
Try Grok again with:
http://YOUR_HOST:8787/mcp?token=YOUR_TOKENIf Grok has a separate SSE mode, try:
http://YOUR_HOST:8787/sse?token=YOUR_TOKEN -
If Grok still fails, capture server log lines showing:
- HTTP method
- path
- status code
- whether it hit
/mcp,/sse,/message,/health, or another path
-
Add more MCP tools after basic connection works:
voipms_inspect_numbervoipms_suggest_spam_numbersvoipms_mark_number_as_spamvoipms_unmark_number_as_spam- real transcript generation/storage behind
voipms_get_call_transcript
-
Consider adding an audit log for MCP mutation tool calls before exposing
dry_run=falseto remote agents. -
Eventually replace the PHP built-in server with a more production-suitable deployment if this becomes more than a test endpoint.