@straitlink/mcp 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The Strait authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,252 @@
1
- # Temporary Holding Version
1
+ <h1 align="center">Strait MCP server</h1>
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <p align="center"><strong>Straight to the screen. On the record.</strong><br>
4
+ A tap on a Strait link goes straight to the exact screen in your app (Straight), and every tap is recorded (Stamped).</p>
5
+
6
+ <p align="center">
7
+ <a href="https://straitlink.in/docs/">Docs</a> ·
8
+ <a href="https://straitlink.in/platform-status/">Platform status</a> ·
9
+ <a href="#docs-and-support">Talk to the Strait team</a>
10
+ </p>
11
+
12
+ `@straitlink/mcp` (preview)
13
+
14
+ ```sh
15
+ claude mcp add strait --env STRAIT_SECRET_KEY=st_live_your_key -- npx -y @straitlink/mcp
16
+ ```
17
+
18
+ Use Strait from AI tools such as Claude Code, Cursor and Claude Desktop: create deep links, change or turn them off,
19
+ read analytics, usage and referrals, check App Links / Universal Links files, see where taps on a link go, look after
20
+ webhooks (deliveries, test, redeliver) and search the Strait docs.
21
+
22
+ It is a local stdio server with 16 tools. Six of them write (`create_link`, `batch_create_links`, `update_link`,
23
+ `deactivate_link`, `test_webhook`, `redeliver_webhook_delivery`); the other ten only read. Fourteen need your secret
24
+ key; `check_app_links`, `search_docs` and demo `trace_tap` work without one. Other deep-link vendors also ship MCP servers that can create links, so this README
25
+ makes no "first" or "only" claim; it describes what this server does today.
26
+
27
+ **iPhone is in beta.** iPhone install matching (deferred deep linking on iOS) is in beta; Android uses the Play
28
+ Install Referrer. On iPhone the workspace chooses the method in Dashboard → Settings → iPhone installs (device
29
+ matching, paste handoff, both or neither), and the SDK reads that choice at runtime. Device matching is off for new
30
+ workspaces. The tools report iPhone results the same way, but treat iPhone install attribution as beta.
31
+
32
+ > **Preview.** The remote server (`mcp.strait.link`) is built and deploy-ready but not deployed (see "Deploy the
33
+ > remote server"). Until then, use the local server above.
34
+
35
+ ## Tools
36
+
37
+ | Tool | What it does | Key needed |
38
+ |---|---|---|
39
+ | `create_link` | Create one link and get its `shortUrl` | secret |
40
+ | `batch_create_links` | Create up to 500 links in one call (safe to re-run: existing slugs are per-item 409s) | secret |
41
+ | `get_link` | Read one link by slug | secret |
42
+ | `list_links` | List links, one page at a time | secret |
43
+ | `update_link` | Change destination, title, tags or expiry. **Asks for `confirm: true`**: without it you get a preview and nothing changes | secret |
44
+ | `get_analytics` | Taps, app opens, installs, conversions and revenue, by day / channel / link / platform (`GET /v1/analytics`). iPhone installs come from beta install matching | secret |
45
+ | `check_app_links` | Check a domain's `assetlinks.json` and `apple-app-site-association`, with a fix for each problem | none |
46
+ | `simulate_tap` | Dry-run one tap from one device or app (nothing recorded or billed) | secret |
47
+ | `trace_tap` | Walk a link through WhatsApp, Instagram, Facebook, Chrome, Safari, iPad, computer and preview bots; or read a Live Tap Trace from the website demo | secret (link) / none (demo token) |
48
+ | `get_usage` | This month's taps and new links against the plan, `level` (ok / warn / over) and `new_links_paused` (`GET /v1/usage`) | secret |
49
+ | `get_referrals` | Referral report: taps and referred installs per code (`GET /v1/referrals`, a preview: says "not switched on yet" until it is) | secret |
50
+ | `list_webhook_deliveries` | A webhook's deliveries (status, attempts, last HTTP status, next retry; no payloads). Without `webhookId`: the workspace's webhooks (id, receiver site, events) | secret |
51
+ | `test_webhook` | Send one `ping` to a webhook now and see the receiver's status and time (not stored, not retried) | secret |
52
+ | `redeliver_webhook_delivery` | Send a failed delivery again (same `X-Strait-Delivery` id). **Asks for `confirm: true`** | secret |
53
+ | `deactivate_link` | Turn a link off: taps then get the "link not found" page. **Asks for `confirm: true`**; the API can't turn it back on yet | secret |
54
+ | `search_docs` | Search the Strait docs offline (bundled index) | none |
55
+
56
+ Every tool carries MCP annotations (`readOnlyHint`, `destructiveHint`, …) and its description starts with
57
+ "Read-only." or "Write." for the 0.2 tools. `update_link` and `deactivate_link` are destructive; they and
58
+ `redeliver_webhook_delivery` show a preview first and act only with `confirm: true`. `create_link` and
59
+ `batch_create_links` write new links but never change existing ones. There is no delete tool: a deactivated link
60
+ keeps its history.
61
+
62
+ ## Keys
63
+
64
+ The server needs a **secret key** (`st_live_…`) from **Dashboard → Settings → Secret keys**. A secret key can change your
65
+ links, so:
66
+
67
+ - Create a separate key for your AI tools, so you can revoke it on its own.
68
+ - Keep it in the MCP client's config or environment, never in app or website code.
69
+ - A publishable key (`st_pub_live_…`) does not work here: it is for the SDKs in your apps.
70
+ - The server sends the key only as an `Authorization: Bearer` header to `STRAIT_API_URL`, never logs it, and
71
+ replaces anything shaped like a secret key in tool output or errors with `st_…[redacted]`.
72
+
73
+ Without a key, `check_app_links`, `search_docs` and demo `trace_tap` still work.
74
+
75
+ | Variable | Meaning |
76
+ |---|---|
77
+ | `STRAIT_SECRET_KEY` | Your secret key (`st_live_…`) |
78
+ | `STRAIT_API_URL` | Engine URL. Default `https://strait.link`. Use `http://localhost:3000` for a local engine |
79
+
80
+ ## Install
81
+
82
+ ### Claude Code
83
+
84
+ ```sh
85
+ claude mcp add strait --env STRAIT_SECRET_KEY=st_live_your_key -- npx -y @straitlink/mcp
86
+ ```
87
+
88
+ ### Cursor
89
+
90
+ `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project; don't commit a key):
91
+
92
+ ```json
93
+ {
94
+ "mcpServers": {
95
+ "strait": {
96
+ "command": "npx",
97
+ "args": ["-y", "@straitlink/mcp"],
98
+ "env": { "STRAIT_SECRET_KEY": "st_live_your_key" }
99
+ }
100
+ }
101
+ }
102
+ ```
103
+
104
+ ### Claude Desktop
105
+
106
+ Settings → Developer → Edit config, then add the same `"strait"` entry under `mcpServers` and restart.
107
+
108
+ ### From a checkout
109
+
110
+ ```sh
111
+ cd mcp-server && npm ci && npm run build
112
+ claude mcp add strait --env STRAIT_SECRET_KEY=st_live_your_key -- node "$PWD/dist/stdio.js"
113
+ ```
114
+
115
+ In Cursor or Claude Desktop use `"command": "node", "args": ["/absolute/path/to/mcp-server/dist/stdio.js"]`.
116
+
117
+ ## Try it
118
+
119
+ - "Create a Strait link `summer` to https://shop.hilltop.example/summer with the title Summer sale."
120
+ - "Which channel brought the most installs last month?"
121
+ - "My links open the browser instead of the app. Check hilltop.strait.link and shop.hilltop.example."
122
+ - "What happens when someone taps `summer` inside Instagram on an iPhone?"
123
+ - "How do I receive links in Expo Router?"
124
+ - "How much of this month's plan have we used?"
125
+ - "My webhook stopped firing. Show me its last deliveries, send it a test, and resend the failed ones."
126
+ - "Turn off the `spring-sale` link." (you'll see a preview first)
127
+ - "Which referral codes brought the most installs in October?"
128
+
129
+ Hilltop Shoes (`hilltop.strait.link`, `*.hilltop.example`) is a made-up shop used in examples.
130
+
131
+ ## MCP registry listing (drafted, not published)
132
+
133
+ `server.json` and the `mcpName` field in `package.json` are drafts for the
134
+ [official MCP registry](https://registry.modelcontextprotocol.io). The registry checks that `mcpName` in the published npm package matches `server.json` `name`
135
+ ([package types](https://github.com/modelcontextprotocol/registry/blob/main/docs/modelcontextprotocol-io/package-types.mdx)).
136
+
137
+ - **Namespace `in.straitlink/mcp` (recommended).** Reverse-DNS of `straitlink.in`, so the listing carries the
138
+ product's own domain. It needs DNS authentication: the Strait team adds a TXT record on the apex `straitlink.in`
139
+ (`v=MCPv1; k=ed25519; p=<public key>`) and runs `mcp-publisher login dns --domain straitlink.in --private-key …`
140
+ ([authentication](https://github.com/modelcontextprotocol/registry/blob/main/docs/modelcontextprotocol-io/authentication.mdx)).
141
+ Keep the private key out of the repo.
142
+ - **Alternative `io.github.<owner>/strait-mcp`.** Uses GitHub OAuth (`mcp-publisher login github`) and needs no DNS
143
+ change, but the name shows a personal GitHub account rather than the product domain, and it requires the public
144
+ GitHub repo, which does not exist yet. To switch, change `name` in `server.json` and `mcpName` in `package.json`
145
+ together (a test checks they match).
146
+ - `remotes` is left out until `mcp.strait.link` is deployed; add
147
+ `{"type": "streamable-http", "url": "https://mcp.strait.link/mcp"}` then. Add `"repository": {"url": "https://github.com/bazingga08/strait-mcp", "source": "github"}`
148
+ once the GitHub repo exists.
149
+ - Order when the Strait team is ready: create the repo, publish `@straitlink/mcp` to npm (done: 0.1.0 on 15 Oct,
150
+ `mcpName` matches), add the TXT record, then run the **MCP registry** workflow (`.github/workflows/registry.yml`).
151
+ Without the `MCP_DNS_PRIVATE_KEY` secret it only validates `server.json` (schema, name, version, npm) and stops.
152
+
153
+ ### Founder steps (about 10 minutes, after the GitHub repo exists)
154
+
155
+ 1. Claude makes a key pair on the Mac (`openssl genpkey -algorithm ed25519`) and shows you only the **public** part.
156
+ 2. In the DNS settings for **straitlink.in**, add a **TXT** record on the root (`@`) with the value
157
+ `v=MCPv1; k=ed25519; p=<public key>`. Save. It can take up to an hour to appear.
158
+ 3. In GitHub, repo **strait-mcp → Settings → Secrets → Actions**, add `MCP_DNS_PRIVATE_KEY` with the private key
159
+ (Claude puts it there if you allow secret writes).
160
+ 4. Actions → **MCP registry** → Run workflow. When it's green, search "Strait" on
161
+ registry.modelcontextprotocol.io: that's how you know it worked.
162
+
163
+ ## Licence
164
+
165
+ MIT. See [LICENSE](LICENSE).
166
+
167
+ ## Remote server (built, not deployed)
168
+
169
+ `src/worker.ts` is a Cloudflare Worker serving MCP over Streamable HTTP at `https://mcp.strait.link/mcp`. It answers
170
+ 404 everywhere unless `REMOTE_MCP=on` (only `env.production` in `wrangler.jsonc` turns it on).
171
+
172
+ - **Bearer-key mode:** `Authorization: Bearer st_live_…` on `/mcp`, for clients that take a header.
173
+ - **OAuth** (`@cloudflare/workers-oauth-provider`): dynamic client registration (`/register`), `/authorize`, `/token`,
174
+ authorization-server metadata and RFC 9728 protected-resource metadata
175
+ (`/.well-known/oauth-protected-resource/mcp`). PKCE, registered redirect URIs only.
176
+ - The consent page asks for a secret key, checks it with `GET /v1/links?limit=1`, and keeps it only inside the
177
+ grant, which the provider encrypts with the token (a test checks that KV never holds the key in plain text).
178
+ It shows where the user is sent back to, has a Cancel button (`access_denied` back to the client), and sends
179
+ `X-Frame-Options: DENY`, a strict CSP and `Cache-Control: no-store`.
180
+ - Access tokens last 1 hour; refresh tokens 30 days.
181
+ - Next step before a wide launch: replace the paste-a-key page with dashboard sign-in that mints a scoped key.
182
+ - **`/healthz`** returns `{ ok, service, version, mcp }` with no upstream call, for the post-deploy check.
183
+
184
+ ### Try it locally
185
+
186
+ ```sh
187
+ cp .dev.vars.example .dev.vars # REMOTE_MCP=on, STRAIT_API_URL=http://localhost:3000
188
+ npm run dev:remote # wrangler dev on http://localhost:8787 (local KV, nothing leaves the machine)
189
+ curl http://localhost:8787/healthz
190
+ npx -y @modelcontextprotocol/inspector@0.17.5 # connect to http://localhost:8787/mcp
191
+ ```
192
+
193
+ ### Deploy the remote server (Strait team only)
194
+
195
+ Agents prepare this; only the Strait team deploys. Needs the Cloudflare account that holds the `strait.link` zone
196
+ (`CLOUDFLARE_API_TOKEN` / `CLOUDFLARE_ACCOUNT_ID` from `redirect-engine/.env` work). The bundle is about 1.9 MB
197
+ (360 KB gzipped), inside the free plan's size limit; Workers Paid (already planned) is recommended for its higher
198
+ CPU time per request.
199
+
200
+ ```sh
201
+ cd mcp-server && npm ci
202
+ npm run typecheck && npx vitest run # all green
203
+ # 1. Create the OAuth store once and paste its id into env.production.kv_namespaces in wrangler.jsonc
204
+ npx -y wrangler@4 kv namespace create OAUTH_KV --env production
205
+ npm run deploy:preflight # exit 0 = config ready (fails while the id is a placeholder)
206
+ npm run deploy:check # wrangler dry run, nothing uploaded
207
+ # 2. Deploy. The custom domain creates the mcp.strait.link DNS record and certificate.
208
+ npx -y wrangler@4 deploy --env production
209
+ # 3. Check it
210
+ curl -s https://mcp.strait.link/healthz # {"ok":true,...}
211
+ curl -s https://mcp.strait.link/.well-known/oauth-protected-resource/mcp # resource: https://mcp.strait.link/mcp
212
+ curl -s -o /dev/null -w '%{http_code}\n' -X POST https://mcp.strait.link/mcp # 401 (needs a token)
213
+ claude mcp add --transport http strait https://mcp.strait.link/mcp # then /mcp in Claude Code to sign in
214
+ ```
215
+
216
+ Roll back with `npx -y wrangler@4 rollback --env production`, or switch it off by setting `REMOTE_MCP` to `"off"`
217
+ in `env.production.vars` and deploying again (every route then answers 404). Revoking the secret key a user pasted
218
+ cuts that connection off at the API.
219
+
220
+ ## Claude Code skill
221
+
222
+ `skills/strait-setup/SKILL.md` teaches Claude Code how to add Strait to an app (React Native / Expo, Flutter,
223
+ Android, iOS, Unity, Capacitor, web, and a Node server). Copy the folder into `~/.claude/skills/` or a project's
224
+ `.claude/skills/`, or download it from https://straitlink.in/ai/strait-setup/SKILL.md.
225
+
226
+ The site repo owns it (`site/lib/skill.mjs`, fed by `site.config.json`, so install lines and versions match the
227
+ docs). Don't edit this copy by hand: run `npm run skill:sync` (needs `../site` or `SITE_DIR`). The site's tests fail
228
+ when this copy drifts.
229
+
230
+ ## Develop
231
+
232
+ ```sh
233
+ npm ci
234
+ npm run typecheck # Node, tests and the Worker
235
+ npm test # unit, protocol, Worker and an end-to-end test against a local engine
236
+ npm run build
237
+ npm run inspect # MCP Inspector CLI: lists the tools
238
+ npm run docs-index # rebuild src/docs-index.json from ../site/content/docs
239
+ npm run skill:sync # regenerate skills/strait-setup/SKILL.md from ../site
240
+ npm run deploy:check # wrangler dry run of the production Worker (nothing uploaded)
241
+ ```
242
+
243
+ The end-to-end test (`test/integration.test.ts`) starts the real engine from `../redirect-engine` (or
244
+ `ENGINE_DIR`) with its in-memory store, runs this server over stdio as a child process, creates a link and reads
245
+ it back. It is skipped when no engine checkout with installed dependencies is next to this repo.
246
+
247
+ ## Docs and support
248
+
249
+ - **Docs:** [straitlink.in/docs/](https://straitlink.in/docs/) · [platform status](https://straitlink.in/platform-status/) · [troubleshooting](https://straitlink.in/docs/troubleshooting/)
250
+ - **Talk to the Strait team:** [support@straitlink.in](mailto:support@straitlink.in) (replies within 1 working day, IST) or call +91 81218 61890.
251
+ - **Bugs and feature requests:** [open an issue](https://github.com/bazingga08/strait-mcp/issues) on this repo.
252
+ - **Security:** never in a public issue. Write to security@straitlink.in.
package/dist/client.js ADDED
@@ -0,0 +1,130 @@
1
+ /**
2
+ * A small client for the Strait HTTP API (https://strait.link). Web-standard only
3
+ * (fetch, URL), so the same code runs in Node (stdio server) and in Cloudflare
4
+ * Workers (remote server). Operation names follow the OpenAPI operationIds.
5
+ */
6
+ export const DEFAULT_API_URL = 'https://strait.link';
7
+ /** An error answer from the API, with its status and JSON body. */
8
+ export class StraitApiError extends Error {
9
+ status;
10
+ body;
11
+ operation;
12
+ constructor(status, body, operation) {
13
+ const msg = body && typeof body === 'object' && 'error' in body ? String(body.error) : `HTTP ${status}`;
14
+ super(`${operation}: ${msg} (HTTP ${status})`);
15
+ this.status = status;
16
+ this.body = body;
17
+ this.operation = operation;
18
+ this.name = 'StraitApiError';
19
+ }
20
+ }
21
+ /** True when this looks like a secret key (never a publishable key). */
22
+ export function isSecretKey(key) {
23
+ return !!key && /^st_(live|test)_[A-Za-z0-9_-]+$/.test(key) && !key.startsWith('st_pub_');
24
+ }
25
+ export class StraitClient {
26
+ apiUrl;
27
+ secretKey;
28
+ fetchImpl;
29
+ userAgent;
30
+ constructor(opts = {}) {
31
+ this.apiUrl = (opts.apiUrl ?? DEFAULT_API_URL).replace(/\/+$/, '');
32
+ this.secretKey = opts.secretKey;
33
+ this.fetchImpl = opts.fetch ?? ((...a) => fetch(...a));
34
+ this.userAgent = opts.userAgent;
35
+ }
36
+ get hasSecretKey() {
37
+ return isSecretKey(this.secretKey);
38
+ }
39
+ async call(operation, method, path, opts = {}) {
40
+ const auth = opts.auth ?? true;
41
+ if (auth && !this.hasSecretKey) {
42
+ throw new StraitApiError(401, { error: 'no secret key configured: set STRAIT_SECRET_KEY to a key from Dashboard → Settings → Secret keys (st_live_…)' }, operation);
43
+ }
44
+ const url = new URL(this.apiUrl + path);
45
+ for (const [k, v] of Object.entries(opts.query ?? {}))
46
+ if (v !== undefined && v !== '')
47
+ url.searchParams.set(k, String(v));
48
+ const headers = { accept: 'application/json' };
49
+ if (auth)
50
+ headers.authorization = `Bearer ${this.secretKey}`;
51
+ if (opts.body !== undefined)
52
+ headers['content-type'] = 'application/json';
53
+ if (this.userAgent)
54
+ headers['user-agent'] = this.userAgent;
55
+ const res = await this.fetchImpl(url, { method, headers, body: opts.body === undefined ? undefined : JSON.stringify(opts.body) });
56
+ if (res.status === 204)
57
+ return undefined;
58
+ const text = await res.text();
59
+ let json = text;
60
+ try {
61
+ json = text ? JSON.parse(text) : null;
62
+ }
63
+ catch {
64
+ // not JSON: keep the text
65
+ }
66
+ if (!res.ok)
67
+ throw new StraitApiError(res.status, json, operation);
68
+ return json;
69
+ }
70
+ createLink(link) {
71
+ return this.call('createLink', 'POST', '/v1/links', { body: link });
72
+ }
73
+ batchCreateLinks(links) {
74
+ return this.call('batchCreateLinks', 'POST', '/v1/links/batch', { body: { links } });
75
+ }
76
+ getLink(slug) {
77
+ return this.call('getLink', 'GET', `/v1/links/${encodeURIComponent(slug)}`);
78
+ }
79
+ listLinks(opts = {}) {
80
+ return this.call('listLinks', 'GET', '/v1/links', { query: { limit: opts.limit ?? 50, cursor: opts.cursor } });
81
+ }
82
+ updateLink(slug, patch) {
83
+ return this.call('updateLink', 'PATCH', `/v1/links/${encodeURIComponent(slug)}`, { body: patch });
84
+ }
85
+ getAnalytics(q = {}) {
86
+ return this.call('getAnalytics', 'GET', '/v1/analytics', { query: q });
87
+ }
88
+ simulateTap(url, ua) {
89
+ return this.call('simulateTap', 'GET', '/v1/simulate', { query: { url, ua } });
90
+ }
91
+ checkAppLinks(domain) {
92
+ return this.call('checkAppLinks', 'GET', '/v1/tools/app-links', { query: { domain }, auth: false });
93
+ }
94
+ getUsage() {
95
+ return this.call('getUsage', 'GET', '/v1/usage');
96
+ }
97
+ /** Referral report (preview): the engine answers 404 until referrals are switched on. */
98
+ getReferrals(q = {}) {
99
+ return this.call('getReferrals', 'GET', '/v1/referrals', { query: q });
100
+ }
101
+ /** The workspace's webhooks, from the export (configuration only: the engine never exports signing secrets). */
102
+ listWebhooks() {
103
+ return this.call('exportData', 'GET', '/v1/export', { query: { part: 'webhooks' } });
104
+ }
105
+ listWebhookDeliveries(webhookId, opts = {}) {
106
+ return this.call('listWebhookDeliveries', 'GET', `/v1/webhooks/${encodeURIComponent(webhookId)}/deliveries`, { query: { limit: opts.limit, cursor: opts.cursor } });
107
+ }
108
+ testWebhook(webhookId) {
109
+ return this.call('testWebhook', 'POST', `/v1/webhooks/${encodeURIComponent(webhookId)}/test`);
110
+ }
111
+ redeliverWebhookDelivery(deliveryId) {
112
+ return this.call('redeliverWebhookDelivery', 'POST', `/v1/webhook-deliveries/${encodeURIComponent(deliveryId)}/redeliver`);
113
+ }
114
+ /** DELETE /v1/links/{slug}: 204 deactivated; 404 (empty body) = no active link with that slug. */
115
+ async deactivateLink(slug) {
116
+ try {
117
+ await this.call('deactivateLink', 'DELETE', `/v1/links/${encodeURIComponent(slug)}`);
118
+ }
119
+ catch (err) {
120
+ if (err instanceof StraitApiError && err.status === 404 && !err.body) {
121
+ throw new StraitApiError(404, { error: `no active link with slug "${slug}" in this workspace` }, 'deactivateLink');
122
+ }
123
+ throw err;
124
+ }
125
+ }
126
+ /** Live Tap Trace of the website demo (204 = no tap yet → null). */
127
+ getTapTrace(token) {
128
+ return this.call('getTapTrace', 'GET', `/v1/trace/${encodeURIComponent(token)}`, { auth: false }).then((r) => r ?? null);
129
+ }
130
+ }