@sentientui/mcp 0.19.0 → 0.20.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/AGENTS.md +58 -26
- package/README.md +44 -28
- package/dist/{chunk-HT23NB6F.js → chunk-35I5EJTS.js} +424 -46
- package/dist/index.cjs +429 -46
- package/dist/index.js +6 -1
- package/dist/lib.cjs +473 -46
- package/dist/lib.d.cts +29 -2
- package/dist/lib.d.ts +29 -2
- package/dist/lib.js +48 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -9,43 +9,64 @@ SentientUI is a UI personalization platform that assigns visitors to variant com
|
|
|
9
9
|
**Variant** — a version of an adaptive component. There are **two kinds**, and the difference matters:
|
|
10
10
|
|
|
11
11
|
- **Code-native variants** are declared in the customer's code (`<Adaptive variants={{…}}>`). They **register automatically** the first time the SDK requests an assignment after deploy, and they go **live immediately** — there is no draft step and no `create_variant` call. Their content lives in the repo, not in SentientUI.
|
|
12
|
-
- **No-code / managed variants** have no code; their content is stored on the SentientUI API (dashboard WYSIWYG, `<AdaptiveText>`, or `create_variant`). These start as **draft** after `create_variant
|
|
12
|
+
- **No-code / managed variants** have no code; their content is stored on the SentientUI API (dashboard WYSIWYG, `<AdaptiveText>`, or `create_variant`). These start as **draft** after `create_variant`; no traffic is assigned until one is activated — with `update_variant` (`status: active`) or from the dashboard. `update_variant` `status: draft` takes it back out of serving, and `delete_variant_draft` removes a draft entirely.
|
|
13
13
|
|
|
14
14
|
Only call `create_variant` for the no-code path. If the user is writing (or you are writing) the variant in code, do **not** call `create_variant` — deploying the code registers it.
|
|
15
15
|
|
|
16
|
-
**Guardrail** — automatic safety circuit that pauses
|
|
16
|
+
**Guardrail** — automatic safety circuit that pauses a variant once its CVR is shown (anytime-valid bounds, checked every 5 minutes) to be more than the configured threshold below the best variant's. `list_guardrail_events` lists every variant a guardrail has paused that is still paused (`days` narrows it to recent pauses). `resume_variant` clears a pause — a guardrail pause or one from `pause_variant` — so check why the guardrail fired before resuming.
|
|
17
17
|
|
|
18
18
|
**Shadow mode** — project-level flag (toggled in dashboard settings). When ON: personalization is computed and logged but visitors receive the default layout/variant. Use it to validate the algorithm before committing to live changes.
|
|
19
19
|
|
|
20
|
-
**Insights** — AI-generated. Two tiers: narrator observations (
|
|
20
|
+
**Insights** — AI-generated. Two tiers: narrator observations (`refresh_insights` needs Starter or higher and an editor/admin role, since each refresh is a paid model call; Free plans can only view already-stored bullets) + advisor recommendations (Growth tier). Insights go stale after 6 hours. Always check `isStale` before presenting them.
|
|
21
|
+
|
|
22
|
+
**Review mode** — project-level setting (dashboard). When ON, `generate_cell` output does not publish on its own: it waits in `list_cell_reviews` until `review_cell` approves (publishes) or rejects it. When OFF, a generated version publishes automatically once the worker writes it — `generate_cell` tells you which applies.
|
|
21
23
|
|
|
22
24
|
**Layout stats** — per-persona section ordering driven by a bandit algorithm. `pulls` = times a layout was applied, `avgReward` = normalized conversion signal (not raw CVR).
|
|
23
25
|
|
|
24
26
|
## Auth
|
|
25
27
|
|
|
26
|
-
Server keys start with `sk_` — required for the management API. Public keys (`pk_`) are for the React SDK only and will be rejected.
|
|
28
|
+
Server keys start with `sk_` — required for the management API, available on every plan including Free. Public keys (`pk_`) are for the React SDK only and will be rejected. An `sk_` key is scoped to **one project**: `list_projects` returns only that project and other project ids are refused. For several projects, connect by URL with an OAuth sign-in. `create_project` needs that OAuth login.
|
|
27
29
|
|
|
28
30
|
## Tool Quick Reference
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
|
34
|
-
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
32
|
+
Every write tool changes what real visitors see or what the project accepts — confirm with the user before calling one.
|
|
33
|
+
|
|
34
|
+
<!-- mcp-tools:start -->
|
|
35
|
+
| Tool | Access | Notes |
|
|
36
|
+
|------|--------|-------|
|
|
37
|
+
| `list_projects` | read | Start here to get project IDs (an `sk_` key sees only its own project) |
|
|
38
|
+
| `create_project` | write | Onboard a new user: creates a project + returns its `pk_` key. Needs an account login (OAuth) — refuses `sk_` project keys and demo tokens. Follow with `get_integration_guide` |
|
|
39
|
+
| `get_project_stats` | read | Health status + 24h event/session volume. `agentCalls` counts calls to the `/v1/agent` API (all retained history) — not MCP tool calls |
|
|
40
|
+
| `add_origin` | write | Allow-list a site origin so the SDK's events from it are accepted. Idempotent |
|
|
41
|
+
| `list_components` | read | Components + variant counts + impression totals |
|
|
42
|
+
| `get_variant_performance` | read | Per-(component, variant) rate with its n (converting / exposed sessions, range/from/to; default 7d), plus the server's evidence verdict on that windowed rate vs the component's baseline (`verdict`: ahead / behind / unclear; `verdictBasis` says window, or all_time on older APIs) and the all-time verdict as reliability (`evidenceState`, `reliabilityVerdict`). Only ahead/behind is a result; the preceding-window change is an untested descriptor |
|
|
43
|
+
| `get_variant_brief` | read | **Start here to optimize a component.** Evidence-driven brief for writing a new CODE-NATIVE variant: each arm's rate with n and server evidence verdict, audience, measured findings for the component, evidence state (EMPTY / COLLECTING / DIRECTIONAL / DECIDED) + best-practice fallback, and code instructions |
|
|
44
|
+
| `get_test_brief` | read | Ready-to-paste test code that forces one of a component's real variants |
|
|
45
|
+
| `create_variant` | write | Creates a no-code **managed text** DRAFT. Fallback only; not for code-native variants |
|
|
46
|
+
| `update_variant` | write | Managed variants only: rename, change text, or `status: active` (starts serving) / `status: draft` (stops) |
|
|
47
|
+
| `delete_variant_draft` | write | Deletes a managed variant that is still a draft |
|
|
48
|
+
| `pause_variant` | write | Stops new traffic to a variant. Undo with `resume_variant` |
|
|
49
|
+
| `resume_variant` | write | Clears a pause — manual or guardrail |
|
|
50
|
+
| `retire_variant` | write | Archives an active variant (409 if it is the promoted one — unpromote first). Undo with `restore_variant` |
|
|
51
|
+
| `restore_variant` | write | Brings a retired variant back to active. Does not unpause it |
|
|
52
|
+
| `get_goal_funnel` | read | Per-goal conversion summary (windowed) + descriptive per-variant all-time completion rates, each with its n and a low-sample flag (descriptive — no verdict). Not a step funnel; for drop-off use `get_funnel_report` |
|
|
53
|
+
| `list_goals` | read | Defined goals, including ones with no conversions yet |
|
|
54
|
+
| `list_funnels` | read | Defined multi-step funnels |
|
|
55
|
+
| `get_funnel_report` | read | Step-by-step funnel drop-off |
|
|
56
|
+
| `list_guardrail_events` | read | Every variant still paused by a guardrail; `days` narrows to recent pauses |
|
|
57
|
+
| `get_persona_breakdown` | read | Cluster distribution + avg reliability per cluster (all retained sessions, not windowed) |
|
|
58
|
+
| `get_layout_stats` | read | Per-persona layout order + bandit pulls/reward (cumulative state, not windowed) |
|
|
59
|
+
| `get_insights` | read | Ranked measured findings (tier + sample, low-sample flagged; `limit`, default 10) + (Growth) AI narrations, which are unmeasured |
|
|
60
|
+
| `refresh_insights` | write | Async trigger — wait ~15s then call `get_insights`. Starter+ and an editor/admin role |
|
|
61
|
+
| `get_cell_matrix` | read | "Who sees what": per-(visitor type, region) generation state + traffic share. A missing cell = they see the original |
|
|
62
|
+
| `get_cell_detail` | read | One cell's generated option, its stored rationale, and a plain-language performance verdict |
|
|
63
|
+
| `generate_cell` | write | Queues async AI generation for one cell (also retries failed ones). Publishes automatically, or waits for `review_cell` when review mode is on. Free includes 5 generations/month |
|
|
64
|
+
| `list_cell_reviews` | read | Generated versions waiting for approval |
|
|
65
|
+
| `review_cell` | write | Approve (publishes to live traffic) or reject one waiting version |
|
|
66
|
+
| `get_agent_traffic` | read | AI crawlers / agentic browsers / agent API callers reading the site (windowed; paid plans) |
|
|
67
|
+
| `get_agent_legibility` | read | Whether agent-read pages are machine-legible, with fixes (paid plans) |
|
|
68
|
+
| `get_integration_guide` | read | SDK setup guide (static) |
|
|
69
|
+
<!-- mcp-tools:end -->
|
|
49
70
|
|
|
50
71
|
## Canonical Workflows
|
|
51
72
|
|
|
@@ -68,7 +89,16 @@ The evidence state (from the brief) drives the change. It is keyed on the server
|
|
|
68
89
|
**Add a no-code managed text variant (fallback — text only, less powerful)**
|
|
69
90
|
1. `list_components` — confirm the component ID
|
|
70
91
|
2. `create_variant` with `content` — creates a managed text draft (generate the copy from `get_variant_brief` context)
|
|
71
|
-
3.
|
|
92
|
+
3. Show the user the draft; once they confirm, `update_variant` with `status: active` starts serving it (or they activate it from the dashboard)
|
|
93
|
+
|
|
94
|
+
**Pause, and undo a pause**
|
|
95
|
+
1. Confirm with the user before `pause_variant` — it stops new traffic immediately
|
|
96
|
+
2. `resume_variant` puts it back; for a guardrail pause, check `list_guardrail_events` and the variant's evidence first — the guardrail fired for a reason
|
|
97
|
+
|
|
98
|
+
**Fill generated versions**
|
|
99
|
+
1. `get_cell_matrix` — which (visitor type, region) cells are empty
|
|
100
|
+
2. Confirm with the user, then `generate_cell` — the result says whether the project auto-publishes or uses review mode
|
|
101
|
+
3. Review mode: `list_cell_reviews`, show the user the version, then `review_cell` with `approve` or `reject`
|
|
72
102
|
|
|
73
103
|
**Understand the audience**
|
|
74
104
|
1. `get_persona_breakdown` — cluster sizes + reliability
|
|
@@ -83,10 +113,12 @@ The evidence state (from the brief) drives the change. It is keyed on the server
|
|
|
83
113
|
## Common Mistakes
|
|
84
114
|
|
|
85
115
|
- Presenting stale insights without checking `isStale` — always check, and offer to `refresh_insights`
|
|
86
|
-
- Assuming `create_variant` is live — it's always a draft
|
|
116
|
+
- Assuming `create_variant` is live — it's always a draft until `update_variant` sets `status: active`
|
|
87
117
|
- Calling `create_variant` for a variant that's being written in code — it creates an empty managed draft, not your code variant. Code-native variants auto-register on deploy; only use `create_variant` for no-code/managed variants whose content lives in SentientUI
|
|
88
118
|
- Optimizing a component without calling `get_variant_brief` first — it gives you the per-arm evidence, audience, findings, and evidence-state fallback you need to write a variant that actually makes sense (and the right steps when there is no data yet)
|
|
89
119
|
- Ranking variants by raw conversion rate — a rate on 10 sessions is noise. Only a server `verdict` of ahead/behind is a comparison; every rate carries its n for this reason
|
|
90
|
-
- Calling `pause_variant` without
|
|
120
|
+
- Calling any write tool (`pause_variant`, `retire_variant`, `update_variant`, `review_cell`, …) without the user's confirmation — they change what real visitors see
|
|
121
|
+
- Resuming a guardrail-paused variant without checking why the guardrail fired
|
|
122
|
+
- Using `restore_variant` to activate a draft — it is for retired variants; activate drafts with `update_variant` `status: active`
|
|
91
123
|
- Using a `pk_` key instead of `sk_` — it will be rejected
|
|
92
124
|
- Interpreting `avgReward` in layout stats as a conversion rate — it's a bandit reward signal, not CVR
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ MCP server for [SentientUI](https://sentient-ui.com) — gives AI agents in Clau
|
|
|
14
14
|
|
|
15
15
|
**1. Get a server key**
|
|
16
16
|
|
|
17
|
-
Dashboard → Project → **Settings → API key → Server key** → Generate
|
|
17
|
+
Dashboard → Project → **Settings → API key → Server key** → Generate. Available on every plan, including Free. A server key belongs to **one project**: it can read and change only that project, and generating a new one revokes the previous key.
|
|
18
18
|
|
|
19
19
|
**2. Add to your AI assistant**
|
|
20
20
|
|
|
@@ -78,36 +78,52 @@ No account? Run without an API key:
|
|
|
78
78
|
npx @sentientui/mcp
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
A
|
|
81
|
+
A demo token is provisioned automatically — 10 calls/month, read-only (write tools require an account with an `sk_` key or an OAuth sign-in), no sign-up required. It points at an **empty** sandbox project with no fixture data, so the read tools return empty results: it shows the tool surface, not a populated example. The token is cached in `~/.config/sentientui/mcp-anon.json`.
|
|
82
82
|
|
|
83
83
|
## Tools
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
107
|
-
|
|
108
|
-
|
|
85
|
+
<!-- mcp-tools:start -->
|
|
86
|
+
| Tool | Access | What it does |
|
|
87
|
+
|------|--------|-------------|
|
|
88
|
+
| `list_projects` | read | List the projects this credential can see (an `sk_` key sees only its own project) |
|
|
89
|
+
| `create_project` | write | Create a project and return its `pk_` public key (account login only — not an `sk_` key or demo token) |
|
|
90
|
+
| `get_project_stats` | read | Ingestion health: status, 24h events and sessions, and calls to the `/v1/agent` API (`agentCalls` — not MCP tool calls) |
|
|
91
|
+
| `add_origin` | write | Allow-list a site origin so the SDK's events from it are accepted (idempotent) |
|
|
92
|
+
| `list_components` | read | Adaptive components with variant counts and impressions |
|
|
93
|
+
| `get_variant_performance` | read | Per-(component, variant) rates with their n and the server's evidence verdict vs the baseline (range 7d/30d/90d/all or from/to; default 7d; the verdict judges the windowed rate, with all-time reliability reported separately) |
|
|
94
|
+
| `get_variant_brief` | read | Evidence-driven brief for writing a new **code-native** variant: per-arm rates with n and evidence verdicts, audience, measured findings, an evidence state (with a best-practice fallback while nothing is decided), and step-by-step code instructions |
|
|
95
|
+
| `get_test_brief` | read | Ready-to-paste test code (RTL, mock server, Playwright/Cypress) that forces one of a component's real variants |
|
|
96
|
+
| `create_variant` | write | Create a no-code managed text variant as a draft — fallback for text-only variants without a code change |
|
|
97
|
+
| `update_variant` | write | Edit a managed variant's name or text, or activate a draft (`status: active` — it starts serving) / move it back to draft |
|
|
98
|
+
| `delete_variant_draft` | write | Delete a managed variant that is still a draft |
|
|
99
|
+
| `pause_variant` | write | Pause a variant so no new traffic is assigned to it (undo with `resume_variant`) |
|
|
100
|
+
| `resume_variant` | write | Resume a paused variant — manual or guardrail pause |
|
|
101
|
+
| `retire_variant` | write | Retire (archive) an active variant (undo with `restore_variant`; a promoted variant must be unpromoted first) |
|
|
102
|
+
| `restore_variant` | write | Bring a retired variant back to active (does not unpause it) |
|
|
103
|
+
| `get_goal_funnel` | read | Per-goal conversion summary (windowed; default 30d) with descriptive all-time per-variant rates — not a step funnel (use `get_funnel_report` for drop-off); the id is kept for compatibility |
|
|
104
|
+
| `list_goals` | read | Defined goals (id, role, event, status), including ones with no conversions yet |
|
|
105
|
+
| `list_funnels` | read | Defined multi-step funnels |
|
|
106
|
+
| `get_funnel_report` | read | Step-by-step funnel drop-off |
|
|
107
|
+
| `list_guardrail_events` | read | Every variant currently paused by a guardrail (pass `days` to see only pauses from the last N days) |
|
|
108
|
+
| `get_persona_breakdown` | read | Visitor clusters with session counts and reliability (all retained sessions) |
|
|
109
|
+
| `get_layout_stats` | read | Per-persona section order with bandit pulls and reward (cumulative state) |
|
|
110
|
+
| `get_insights` | read | Ranked measured findings with their sample (low samples flagged), plus AI narrations marked unmeasured |
|
|
111
|
+
| `refresh_insights` | write | Regenerate AI insights — needs Starter or higher and an editor/admin role (a paid model call); advisor recommendations are Growth+ |
|
|
112
|
+
| `get_cell_matrix` | read | The "Who sees what" matrix of generated versions per visitor type and region |
|
|
113
|
+
| `get_cell_detail` | read | One cell's generated version, why it was written, and how it performs |
|
|
114
|
+
| `generate_cell` | write | Queue AI generation for one cell — publishes automatically, or waits for approval when review mode is on (Free includes 5 generations/month) |
|
|
115
|
+
| `list_cell_reviews` | read | Generated versions waiting for approval (review mode) |
|
|
116
|
+
| `review_cell` | write | Approve (publish) or reject one generated version waiting for review |
|
|
117
|
+
| `get_agent_traffic` | read | Which AI crawlers, agentic browsers and agent API callers read the site (windowed; paid plans) |
|
|
118
|
+
| `get_agent_legibility` | read | Whether the pages agents read are machine-legible, with fixes (paid plans) |
|
|
119
|
+
| `get_integration_guide` | read | SDK setup guide (static — same for every project) |
|
|
120
|
+
<!-- mcp-tools:end -->
|
|
121
|
+
|
|
122
|
+
> **Write tools ask first.** Every write tool changes what real visitors see or what the project accepts, so an assistant should confirm with you before calling one. The common ones are reversible: `pause_variant` → `resume_variant`, `retire_variant` → `restore_variant`, `update_variant` `status: active` → `status: draft`.
|
|
109
123
|
>
|
|
110
|
-
> **
|
|
124
|
+
> **Generated versions.** An `<Adaptive id="…">` that wraps your original as children (no `variants`) registers as a personalizable region once it is mounted and deployed. Its versions per visitor type are written in SentientUI — inspect and fill them with `get_cell_matrix`, `get_cell_detail`, and `generate_cell` — with no code change or redeploy. When the project has review mode on, a generated version waits in `list_cell_reviews` until `review_cell` approves it.
|
|
125
|
+
>
|
|
126
|
+
> **Code-native vs no-code variants.** Variants you declare in your app (`<Adaptive variants={{…}}>`) register automatically the first time the SDK requests an assignment after you deploy — they go live immediately and need **no** `create_variant` call. Use `create_variant` only for **no-code** variants whose content is stored in SentientUI and rendered without a code change; these start as drafts — activate one with `update_variant` (`status: active`) or from the dashboard.
|
|
111
127
|
>
|
|
112
128
|
> **Optimizing a component?** Call `get_variant_brief` first. It returns each variant's rate with its sample and the server's evidence verdict, the audience, measured findings, and an evidence-state assessment — then your AI assistant writes a new on-brand variant directly into your code (which auto-registers on deploy). While nothing is decided, the brief falls back to best-practice priors for your project's context type so the assistant still makes a sensible change.
|
|
113
129
|
|
|
@@ -130,7 +146,7 @@ A sandboxed demo token is provisioned automatically — 10 calls/month, read-onl
|
|
|
130
146
|
|
|
131
147
|
## Auth model
|
|
132
148
|
|
|
133
|
-
The server key you provide is passed as a `Bearer` token on every call to the SentientUI management API. It is scoped to
|
|
149
|
+
The server key you provide is passed as a `Bearer` token on every call to the SentientUI management API. It is scoped to **one project**: `list_projects` returns only that project, and calls naming any other project are refused. To work across several projects, connect by URL with an OAuth sign-in instead. Keys are never logged or stored by the MCP package; they exist only in the process environment.
|
|
134
150
|
|
|
135
151
|
Server keys start with `sk_` (not `pk_`). Public keys (`pk_`) are for the React SDK only and will be rejected by the management API.
|
|
136
152
|
|