Connect your AI agent to AgenText
AgenText lets an AI agent send and receive text messages through your own Android phone. The phone runs AgenText Messenger and relays every text, so messages go out from your real number and show up in your normal conversations. Agents connect over MCP, the REST API or signed webhooks.
1. Get an API key
- Install AgenText Messenger on your Android phone and sign in. Signing in creates your workspace and links the phone.
- Keep API Bridge turned on in the app. Your agent can only text while the phone is online.
- Open the AgenText portal (same account), and under API keys create a key for each agent.
Keys start with
mbk_, are shown once, and can be revoked at any time.
2. The MCP server
https://api.agentext.app/mcp
- Transport: Streamable HTTP, stateless, JSON responses. Some clients call this HTTP or streamable-http; it is not the older SSE transport.
- Auth: send the header
Authorization: Bearer mbk_…on every request. A missing or invalid key returns401. There is no OAuth sign-in yet, so use clients that let you set a header. - Server name:
agentext. In the MCP Registry:app.agentext/agentext.
Tools
-
send_sms(to, body?, media_urls?, device_id?, sim_slot?, idempotency_key?)Send a text from a linked phone. to is E.164 (+14155550123), a short code, or a list of numbers for a group text. media_urls (https, up to 5) attaches photos or files. Returns the queued message. -
list_messages(phone_number?, conversation_key?, direction?, device_id?, limit?)Recent messages, newest first. Use direction="inbound" to read replies and conversation_key (from list_conversations) for group texts. limit ≤ 100, default 20. -
get_message(message_id)One message with its delivery status (queued, dispatched, sent, delivered, failed, expired). -
list_conversations(device_id?, limit?)One row per conversation (1:1 or group) with the last message and a message count, most recent first. -
get_media(media_id)An attachment from a message's media. Photos come back as images; other files as a download link valid for one hour. -
list_devices()Linked phones with online status and SIMs. Pass device_id to the other tools when there is more than one.
Every tool returns one JSON text block. Errors come back as tool errors with a message, for example
device_required when you have more than one phone and didn't pass device_id.
Reading incoming texts
- Poll: call
list_messageswithdirection: "inbound"(andphone_numberto follow one conversation). Over REST:GET /v1/messages?direction=inbound. - Push: register a webhook with
POST /v1/webhooksand{"url": "https://…", "events": ["message.received"]}. The response includes a signing secret, shown once. Each delivery has anMB-Signature: t=<unix>,v1=<hex>header, wherev1is HMAC-SHA256 of"<t>.<raw body>"with that secret. Reject requests more than 5 minutes old, and de-duplicate onMB-Event-Id, because failed deliveries are retried for up to a day. Other events:message.status_updated,device.status_updated.
3. Set up your client
Replace mbk_… with your key. Treat it like a password: anyone with it can text from your phone.
Grok Bot
Grok Bot (xAI's agent that runs in Cursor's cloud) is in beta, and its connector screens are still changing. Add AgenText as a custom MCP server where your plan offers one: Connect apps in the sidebar, or for Teams and Enterprise, an admin adds it under Plugins & MCPs in the Cursor Team Marketplace. Use:
- Name:
agentext - URL:
https://api.agentext.app/mcp - Header:
Authorization=Bearer mbk_…
Grok Bot follows your Cursor MCP settings, so the Cursor entry below also works. If a screen only offers connectors that sign in with OAuth, AgenText can't be added there yet. The same applies to custom connectors on grok.com.
Grok Build CLI
Add --scope project to save it for one project only. Then run grok mcp doctor agentext to check the connection.
grok mcp add --transport http agentext https://api.agentext.app/mcp \ --header 'Authorization: Bearer mbk_…'
xAI API (remote MCP tool)
Grok calls AgenText's tools for you during a Responses API request. Add AgenText to tools:
curl https://api.x.ai/v1/responses \
-H "Authorization: Bearer $XAI_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "grok-4.7",
"input": "Text +14155550123: running 10 minutes late",
"tools": [
{
"type": "mcp",
"server_url": "https://api.agentext.app/mcp",
"server_label": "agentext",
"headers": {
"Authorization": "Bearer mbk_…"
}
}
]
}'
With the xAI Python SDK:
from xai_sdk.tools import mcp
agentext = mcp(server_url="https://api.agentext.app/mcp", server_label="agentext",
extra_headers={"Authorization": "Bearer mbk_…"})
# chat = client.chat.create(model="grok-4.7", tools=[agentext])
Claude Code
Add --scope user to use it in every project, or --scope project to share it through .mcp.json.
claude mcp add --transport http agentext https://api.agentext.app/mcp \ --header 'Authorization: Bearer mbk_…'
Claude Desktop
If your organization has request headers for connectors: Customize → Connectors → Add custom connector,
URL https://api.agentext.app/mcp, authentication No sign-in, and a request header Authorization with the
value Bearer mbk_…. Otherwise, add this to claude_desktop_config.json (needs Node.js), which bridges through
mcp-remote:
{
"mcpServers": {
"agentext": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://api.agentext.app/mcp",
"--header",
"Authorization:${AGENTEXT_AUTH}"
],
"env": {
"AGENTEXT_AUTH": "Bearer mbk_…"
}
}
}
}
Cursor
Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project):
{
"mcpServers": {
"agentext": {
"url": "https://api.agentext.app/mcp",
"headers": {
"Authorization": "Bearer mbk_…"
}
}
}
}
Other MCP clients
Any client that supports Streamable HTTP with custom headers works with the URL and header above.
REST API and curl
Base URL https://api.agentext.app/v1, same Authorization header. The full reference is in the
OpenAPI document (browse it).
# Send a text
curl -X POST https://api.agentext.app/v1/messages \
-H 'Authorization: Bearer mbk_…' \
-H 'Content-Type: application/json' \
-d '{"to": "+14155550123", "body": "Hello from my agent"}'
# Read replies, newest first
curl 'https://api.agentext.app/v1/messages?direction=inbound&limit=20' \
-H 'Authorization: Bearer mbk_…'
Send returns 202 with the message in status queued. Poll
GET /v1/messages/{id} or use webhooks to follow it to delivered. Pass an
Idempotency-Key header to retry a send safely.
For agents: a plain-text version of this page is at /llms.txt.