# Use Strait from Claude, Cursor or Codex (MCP)

> After this page, your AI tool can create, find and pause Strait links, read your taps, installs and events, and check your App Links setup when you ask, with 31 tools and a secret key of its own.

- Time: About 5 minutes
- You need: A Strait workspace and Claude Code, Cursor, Claude Desktop or Codex (Node.js 20 or newer only for the local server)
- Works on: Any (the hosted server) · macOS, Windows and Linux (the local server)

Source: https://straitlink.in/docs/mcp/

MCP (Model Context Protocol) is the standard way AI tools such as Claude and Cursor plug into other services. Strait gives you the same 31 tools two ways:

- **Hosted:** `https://strait.link/mcp`. Nothing to install: your tool sends your secret key in an `Authorization` header. Works in Claude Code, Cursor, VS Code and any client that can send a header.
- **Local:** `@straitlink/mcp` on npm (version 0.5.0 since 26 October 2026). Your tool starts it on your computer. Use it for Claude Desktop and Codex.

Sign-in with OAuth (no key to copy) is not available yet, so the Claude web connector, which needs OAuth, can't use the hosted server today.

## 1. Make a secret key for your AI tool

**Do this:** open **Dashboard → Settings → Secret keys** and create a key named after the tool, for example `claude-code`. Pick **Read only** if the tool should only look, or **Full access** to let it create and pause links ([what each access allows](https://straitlink.in/docs/keys/)). Copy it (it starts with `st_live_…`). The dashboard shows it only once.

> **The secret key stays out of code and chats**
>
> A secret key can create and change your links. Put it only in your AI tool's settings. Never put it in an app, a website, a git repository or a chat message. The publishable key (`st_pub_live_…`) doesn't work here: it is for the SDKs in your app.

**You should see:** the new key in the list, with its name. A key of its own means you can revoke it later without touching your servers.

## 2. Add Strait to your AI tool

**Do this:** pick your tool and paste its block. Put your key where it says `st_live_…your_key`.

**Claude Code** (plugin, hosted): in Claude Code, run `/plugin install strait --marketplace strait-link/strait-mcp`. It asks for the key when you enable it, keeps it in your system's credential store, and also adds the `strait-setup` skill that sets Strait up in an app. Or, without the plugin, in a terminal run:

```bash
claude mcp add --transport http strait https://strait.link/mcp --header "Authorization: Bearer st_live_…your_key"
```

**Cursor** (hosted): put this in `~/.cursor/mcp.json` (every project) or `.cursor/mcp.json` (one project; don't commit that file with a key in it):

```json title="~/.cursor/mcp.json"
{
  "mcpServers": {
    "strait": {
      "url": "https://strait.link/mcp",
      "headers": { "Authorization": "Bearer st_live_…your_key" }
    }
  }
}
```

**Claude Desktop** (local): open **Settings → Developer → Edit config**, add this inside the file, then quit and reopen Claude Desktop.

```json title="claude_desktop_config.json"
{
  "mcpServers": {
    "strait": {
      "command": "npx",
      "args": ["-y", "@straitlink/mcp"],
      "env": { "STRAIT_SECRET_KEY": "st_live_…your_key" }
    }
  }
}
```

**Codex** (local): add this to `~/.codex/config.toml`:

```toml title="~/.codex/config.toml"
[mcp_servers.strait]
command = "npx"
args = ["-y", "@straitlink/mcp"]
env = { STRAIT_SECRET_KEY = "st_live_…your_key" }
```

The local server also works in Claude Code and Cursor: `claude mcp add strait --env STRAIT_SECRET_KEY=st_live_…your_key -- npx -y @straitlink/mcp`.

**You should see:** a server called `strait` marked connected, with 31 tools under it. In Claude Code, type `/mcp`; in Cursor, open **Settings → MCP**.

## 3. Ask it something that reads

**Do this:** in a chat, ask: "List my Strait links."

**You should see:** your links with their short URLs, the same ones as **Dashboard → Links**. With no links yet, the answer is an empty list.

## 4. Make a test link, then pause it

**Do this:** ask: "Create a Strait link `mcp-test` to https://shop.example.com/product/42." Then ask: "Pause `mcp-test`."

**You should see:** a short URL like `https://hilltop.strait.link/mcp-test`, listed in **Dashboard → Links**. For the pause, the tool first shows you the link and asks you to confirm; nothing changes until you say yes.

## What the 31 tools do

Eleven tools write; twenty only read. Every write that changes something live shows a preview first and acts only after you confirm. There is no delete tool: a paused link keeps its history.

| Group | Tools |
|---|---|
| [Links and QR codes](https://straitlink.in/docs/mcp/links/) | create, batch create, get, list, search, update, pause, resume, deactivate, QR code |
| [Analytics, taps and events](https://straitlink.in/docs/mcp/analytics/) | analytics, compare two periods, top links, recent taps, recent events, record an event, usage, referrals |
| [Setup checks and custom domains](https://straitlink.in/docs/mcp/setup/) | your workspace and key, App Links check, any-link check, simulate a tap, trace a link, custom domains, docs search |
| [Webhooks](https://straitlink.in/docs/mcp/webhooks/) | list webhooks, deliveries, send a test, redeliver |

Things to ask: "How did this week do against last week, by channel?", "Did my test tap just now open the app?", "Is links.example.com set up yet?", "My webhook stopped firing: show its last deliveries and send it a test."

## Common errors

- **401 "invalid API key" or "needs a secret key".** The key is missing, mistyped, revoked or a publishable key. Make a secret key in step 1 and paste it again, keeping `Bearer ` before it for the hosted server.
- **429 "rate_limited".** The hosted server takes 60 requests in a burst, then 1 a second, per key; 20 wrong keys from one network pause it for a minute. Wait a moment and ask again.
- **The local server doesn't start.** Check `node --version` prints 20 or higher, or use the hosted server instead.

## Next steps

- [Every link tool, with examples](https://straitlink.in/docs/mcp/links/)
- [Keys: publishable, secret and rotation](https://straitlink.in/docs/keys/)
