# AgenText > AgenText lets AI agents send and receive SMS through a person's own Android phone. The phone > runs the AgenText Messenger app and relays texts; agents use an MCP server, a REST API (/v1) > or signed webhooks. Every request is authorized with an API key (`mbk_…`) that the phone's > owner creates at https://app.agentext.app/app. Texts go out from the owner's real number and appear in their normal conversation list. Phone numbers use E.164 format (+14155550123). A message is `queued` until the phone picks it up, then `dispatched`, `sent`, `delivered`, or `failed`/`expired`. ## MCP server - Endpoint: https://api.agentext.app/mcp - Transport: Streamable HTTP, stateless, JSON responses (no SSE session needed) - Auth header: `Authorization: Bearer mbk_…` (missing or invalid key → HTTP 401) - Server name: `agentext`; MCP Registry name: `app.agentext/agentext` - Every tool returns one JSON text block; errors come back as tool errors (`isError: true`) 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. Reading incoming texts: call `list_messages` with `direction="inbound"` (optionally `phone_number`), newest first. For push delivery, register a webhook through the REST API and handle `message.received` events. ## Client setup - Grok Build CLI: `grok mcp add --transport http agentext https://api.agentext.app/mcp --header 'Authorization: Bearer mbk_…'` - Claude Code: `claude mcp add --transport http agentext https://api.agentext.app/mcp --header 'Authorization: Bearer mbk_…'` - xAI API (Responses): add `{"type": "mcp", "server_url": "https://api.agentext.app/mcp", "server_label": "agentext", "headers": {"Authorization": "Bearer mbk_…"}}` to `tools` - Cursor, Grok Bot and other clients with a JSON config: `{"mcpServers": {"agentext": {"url": "https://api.agentext.app/mcp", "headers": {"Authorization": "Bearer mbk_…"}}}}` - Clients that only support OAuth connectors (grok.com, Claude without request headers) can't connect yet. ## REST API - Base: https://api.agentext.app/v1, same `Authorization: Bearer mbk_…` header - Send: `POST /v1/messages` with `{"to": "+14155550123", "body": "Hi"}` → 202 and the message (optional `Idempotency-Key` header, optional `device_id` when more than one phone is linked) - Read: `GET /v1/messages?direction=inbound`, `GET /v1/messages/{id}`, `GET /v1/conversations` - Errors: `{"error": {"code": "…", "message": "…"}}` - Webhooks: `POST /v1/webhooks` with `{"url": "https://…", "events": ["message.received"]}` returns a signing secret once. Deliveries carry `MB-Signature: t=,v1=` where v1 = HMAC-SHA256(secret, "."); reject if |now − t| > 300 s; dedupe on `MB-Event-Id`. ## Docs - [Agent setup guide](https://app.agentext.app/docs/agents): MCP setup for Grok, Claude, Cursor and curl, tools, webhooks - [OpenAPI document](https://api.agentext.app/openapi.json): every agent-facing REST endpoint and schema - [API reference (Swagger UI)](https://api.agentext.app/docs) ## Optional - [Portal](https://app.agentext.app/app): sign in, link a phone, create and revoke API keys