# Set up twitr.sh (instructions for AI agents)

You are helping a user connect **twitr.sh**, the X (Twitter) API for AI agents, to the app
they're using. They gave you an API key that starts with `tw_live_`. Use it exactly as given and
never print it back in full.

Do these steps in order, then run the test at the end.

## 1. Add the MCP server (the tools)

**Claude Code**: run in the terminal:

```
claude mcp add --transport http twitr https://twitr.sh/api/mcp --header "Authorization: Bearer <KEY>"
```

**Cursor, Windsurf, VS Code, Claude Desktop and other MCP clients**: add this server to the
client's MCP config file (for Cursor: `~/.cursor/mcp.json`). Merge it with any servers that
are already there:

```json
{
  "mcpServers": {
    "twitr": {
      "url": "https://twitr.sh/api/mcp",
      "headers": { "Authorization": "Bearer <KEY>" }
    }
  }
}
```

## 2. Add the skill (how to use the tools well)

**Claude Code**:

```
claude plugin marketplace add lnvestor/twitr-skills
claude plugin install twitr-skills@twitr
```

**Any other agent**: read https://twitr.sh/skill.md and keep it as your guide for X tasks.

## 3. Restart and test

Ask the user to restart their app (in Claude Code, `/mcp` shows `twitr` as connected). Then run
one search to prove it works:

- MCP: call the `x_search` tool with `{ "q": "AI agents", "resultsLimit": 5 }`
- HTTP, if MCP isn't available:

```
curl -X POST https://twitr.sh/api/tools/x_search \
  -H "Authorization: Bearer <KEY>" -H "Content-Type: application/json" \
  -d '{"q":"AI agents","resultsLimit":5}'
```

Tell the user it worked and show the top post. A 5-result search costs about $0.006.

## Good to know

- Calls are paid from the user's prepaid balance. New keys come with $0.50 free. The user
  can top up at https://twitr.sh/start.
- `402 payment-insufficient` means the balance ran out, and nothing was charged.
  `401` means the key is wrong or was revoked.
- To post, reply, like or DM, the user first connects their X account at
  https://twitr.sh/dashboard.
- Every tool and price: https://twitr.sh/openapi.json and https://twitr.sh/llms.txt
