# Send SMS from a CrewAI agent

Source: https://jointextkit.com/integrations/crewai
Index: https://jointextkit.com/llms.txt

Attach TextKit's MCP server to a CrewAI agent with the `mcps` field, so a
crew can text customers and check what was delivered.

## 1. Get a test key

Create a test key on the [API keys](/console) page of the console. It starts
`ssms_sk_test_`, runs everything in the [sandbox](/docs/sandbox), and texts no
real phone except your own verified one. Put it in your environment as
`TEXTKIT_API_KEY`:

```bash
export TEXTKIT_API_KEY=ssms_sk_test_...
```

## 2. Connect the MCP server

CrewAI's built-in MCP support needs the `mcp` package next to CrewAI:

```bash
uv add crewai mcp
```

```python
import os

from crewai import Agent, Crew, Task
from crewai.mcp import MCPServerHTTP
from crewai.mcp.filters import create_static_tool_filter

textkit = MCPServerHTTP(
    url="https://mcp.jointextkit.com",
    headers={"Authorization": f"Bearer {os.environ['TEXTKIT_API_KEY']}"},
    tool_filter=create_static_tool_filter(
        allowed_tool_names=["send_message", "get_message"]
    ),
)

notifier = Agent(
    role="Customer notifier",
    goal="Send customers short, accurate texts",
    backstory="You write one-line SMS updates and confirm every send.",
    mcps=[textkit],
)

task = Task(
    description='Text +15005550006 "Your order shipped."',
    expected_output="The message id and its status",
    agent=notifier,
)

print(Crew(agents=[notifier], tasks=[task]).kickoff())
```

`MCPServerHTTP` uses Streamable HTTP by default, which is what the TextKit
server speaks. The filter keeps the agent to sending and reading messages;
remove it, or add names, to hand over more. The server exposes 142 tools: messages, verification, numbers, contacts,
segments, broadcasts, automations and account reads. Each one is a single API
call with your key, so the key's scopes, rate limits and send checks apply
unchanged. The full list is on the [MCP server](/docs/mcp) page.

## 3. Check the sandbox run

`+15005550006` is a sandbox number that always ends `delivered`, so the
agent's tool call returns a message with an id starting `msg_` and nothing
reaches a phone. The message also shows in the console's message log, tagged
`Test`. Ask for a text to your own number instead and, once that number is
verified under Settings, it really arrives (up to 10 a day, ending
"- via TextKit sandbox").

## Go live

Swap the test key for a live one (`ssms_sk_live_`). A live text needs a
number on your account: [buy one](/docs/numbers) and
[register your use case](/docs/compliance) with the carriers. When the
account has one number, `from` is optional and the text goes out from it.
To limit what an agent can do with a live key, give it one with only the
[scopes](/docs/authentication) it needs.

## Sources

- [CrewAI: MCP servers as tools](https://docs.crewai.com/en/mcp/overview)
