Skip to content
Markets open
Quickstart · Webhooks and agents

Connect an AI agent over MCP

The hosted MCP server exposes the same public API as a set of tools. Point any MCP client at one URL with your key in the Authorization header; there is nothing to install or run.
Calls
POST https://packetexchange.io/mcp/http
Scope
the scopes of each tool
Cost
Connecting is free, and the discovery and preview tools are free. Tools that send, call or verify bill exactly like the REST API, and say so in their descriptions.

Get an API key

Open an account, then create a key under Dashboard, API keys. Live keys (wmmn_live_sk_) send real traffic and charge your balance. Test keys (wmmn_test_sk_) run the same request through routing and pricing without delivering it, and draw on test credit, which comes with an invite code.

The key goes in the client configuration as an Authorization header, never in a chat or a tool argument, so it never reaches the model. Use a key scoped to what the agent needs, and a test key while you build.

Every sample reads the key from the environment. Keep it out of source control.

export PACKETEXCHANGE_API_KEY=wmmn_live_sk_...

Fund the balance

PacketExchange is prepaid. Top up from $5 by card or crypto, or from $100 by wire, under Dashboard, Billing. An agent can top itself up with x402. There is no contract and no monthly fee.

Browsing is free. For tools that spend, fund the balance, or let the agent top itself up with wmmn_topup_x402 (USDC on Base, $5 to $50,000).

CostConnecting is free, and the discovery and preview tools are free. Tools that send, call or verify bill exactly like the REST API, and say so in their descriptions.

Make the request

MCP clients do this for you, but it is plain JSON-RPC over HTTP. This is the tools/call an agent makes to preview the cheapest route for a number. The endpoint is stateless: every POST stands alone, with no session to open first.

# One JSON-RPC call to the hosted MCP server: the same tool an agent would call.
# The key rides in the Authorization header, never in the tool arguments.
curl -s https://packetexchange.io/mcp/http \
  -H "Authorization: Bearer $PACKETEXCHANGE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "wmmn_resolve_route",
      "arguments": { "to": "+447700900123", "type": "voice", "strategy": "cheapest" }
    }
  }' | jq -r '.result.content[0].text'
Save as request.sh, run bash request.shNeeds curl, plus jq for the multi-step samples

Handle the response

The tool result is text holding the same JSON the REST API returns. A tool that fails returns isError: true with the reason.

200 OKtools/call wmmn_resolve_route
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{ \"strategy\": \"cheapest\", \"selected\": { ... }, \"alternatives\": [ ... ] }"
      }
    ]
  }
}

Values in angle brackets are placeholders for your own ids, times and amounts.

result.content[0].text
The tool output: the REST response data as JSON text.
result.isError
true when the tool failed, with the reason in the text.
Accept
Send application/json, text/event-stream; the server answers with plain JSON.

When something goes wrong

  • An account tool on a connection with no key returns a tool error asking for the Authorization header.
  • wmmn_list_routes, wmmn_route_details and wmmn_market_summary work with no key at all.
  • Clients that only speak SSE can use https://packetexchange.io/mcp/sse through mcp-remote --transport sse-only.

Go further

Start building

Run it with your own key

Open an account, add credit from $5 and create a key. You pay the carrier's rate plus a fee capped at $0.001.