Give your Lovable app a phone number
Lovable connects to custom MCP servers in the project chat, so you can set up AgentPhone while you build. The published app then texts and calls through the REST API. Both halves, with the exact steps.

Lovable builds full-stack apps from a conversation. It also lets that conversation reach outside tools through MCP connectors, which is useful in a specific way: while you are building, the chat can create your AgentPhone agent, buy the number and wire the webhook, so the app you ship already has a phone. The app itself calls the REST API at runtime. This page keeps those two halves straight.
Connect AgentPhone in the project chat
- 1Open Connectors, choose Add custom, then MCP server.
- 2Server name:
AgentPhone. Server URL:https://mcp.agentphone.ai/mcp. - 3Authentication: leave OAuth selected and click Add & authorize to sign in through the browser, or switch to a bearer token and paste an API key.
- 4Back in the chat, ask: "Using AgentPhone, create an agent called Support, buy a US number and attach it, then set the webhook to this app's /api/sms route."
Lovable calls the tools and shows what it did. Connectors are available on every plan, and workspace admins can turn them off. One thing to know from Lovable's own docs: chat connections do not extend to the published app. The connector is for building; the running app needs the API.
Make the app send and receive
Ask Lovable to add the runtime code, with the key in Lovable Cloud secrets rather than in source:
“Add a server function that sends an SMS through AgentPhone when a booking is confirmed. Read AGENTPHONE_API_KEY and AGENTPHONE_NUMBER_ID from secrets. POST to https://api.agentphone.ai/v1/messages with number_id, to_number and body.”
const res = await fetch('https://api.agentphone.ai/v1/messages', {method: 'POST',headers: { Authorization: `Bearer ${Deno.env.get('AGENTPHONE_API_KEY')}`, 'Content-Type': 'application/json' },body: JSON.stringify({ number_id: Deno.env.get('AGENTPHONE_NUMBER_ID'), to_number: booking.phone, body: `Hi ${booking.name}, you're booked for ${booking.when}. Reply here to change it.` }),});
For replies, ask for an endpoint that accepts POST, checks X-Webhook-Signature (an HMAC over {X-Webhook-Timestamp}.{raw body} with the webhook secret) and reads data.message and data.from from the agent.message event. Point the AgentPhone webhook at that route and every text, iMessage or WhatsApp message on the number reaches your app.
Things to know
- The connector key and the runtime key should be different. The connector can buy numbers; the app only needs to send and read.
- Numbers are $3 a month and SMS is $0.02 a segment; the $5 signup credit covers the number and about 100 segments of testing.
- Inbound texts work immediately. Outbound SMS from a US number needs 10DLC registration, which we submit for you, with carrier approval in one to three business days. Start it before launch day.
- Hosted voice is $0.22 a minute if you want the number to answer calls from a system prompt. The chat can set that up with one request.
FAQ
How do I add AgentPhone to Lovable? Connectors → Add custom → MCP server, with https://mcp.agentphone.ai/mcp as the server URL and OAuth or a bearer token for auth. Then ask the chat to create your agent and number.
Will the connector work in my published app? No. Lovable's chat connectors are for the build conversation only. The published app calls the AgentPhone REST API with a key stored in your project secrets.
How does the app receive texts? Through a POST route you set as the AgentPhone webhook. Every inbound message arrives as an agent.message event with the conversation history, signed so you can verify it.
What does it cost? $3 a month per number and $0.02 per SMS segment, with $5 of free credit on signup and no card to start.
Do I need 10DLC registration? For sending SMS from a US number, yes. We submit it for you and carriers usually approve in one to three business days. Receiving works without it.


