@apex-inc/mcp-server 0.9.9 → 0.9.11
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/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +4 -2
- package/dist/api-client.js.map +1 -1
- package/dist/auth.d.ts +8 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +22 -5
- package/dist/auth.js.map +1 -1
- package/dist/experiment-copy.d.ts +16 -0
- package/dist/experiment-copy.d.ts.map +1 -0
- package/dist/experiment-copy.js +23 -0
- package/dist/experiment-copy.js.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/prompts.d.ts +104 -0
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +181 -7
- package/dist/prompts.js.map +1 -1
- package/dist/tools.d.ts +370 -6
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +492 -41
- package/dist/tools.js.map +1 -1
- package/guardrails/apex-experiment-guardrails.mdc +20 -0
- package/guardrails/brand-truth.md +34 -0
- package/guardrails/brand-voice.md +22 -0
- package/guardrails/experiment-rules.md +21 -0
- package/guardrails/lexicon.md +16 -0
- package/package.json +6 -3
- package/skills/apex-experimentation/SKILL.md +17 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Lexicon — word-level rules
|
|
2
|
+
|
|
3
|
+
> Word choices the agent should prefer, avoid, or qualify. Replace every `TODO`.
|
|
4
|
+
|
|
5
|
+
## Preferred words
|
|
6
|
+
<!-- Vocabulary that sounds like you. -->
|
|
7
|
+
- TODO
|
|
8
|
+
|
|
9
|
+
## Banned words
|
|
10
|
+
<!-- e.g. "guaranteed", "best", "#1", "cheap", unqualified "free". -->
|
|
11
|
+
- TODO
|
|
12
|
+
|
|
13
|
+
## Words that require a qualifier
|
|
14
|
+
<!-- e.g. "free shipping" → must state the condition from brand-truth.md.
|
|
15
|
+
Any discount → must cite the real offer from brand-truth.md. -->
|
|
16
|
+
- TODO
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apex-inc/mcp-server",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.11",
|
|
4
4
|
"description": "MCP server for Apex — currently in private beta.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"build": "tsc",
|
|
13
13
|
"dev": "tsc --watch",
|
|
14
14
|
"start": "node dist/index.js",
|
|
15
|
+
"test": "vitest run",
|
|
15
16
|
"prepublishOnly": "npm run build"
|
|
16
17
|
},
|
|
17
18
|
"keywords": [
|
|
@@ -20,7 +21,8 @@
|
|
|
20
21
|
],
|
|
21
22
|
"files": [
|
|
22
23
|
"dist",
|
|
23
|
-
"skills"
|
|
24
|
+
"skills",
|
|
25
|
+
"guardrails"
|
|
24
26
|
],
|
|
25
27
|
"license": "MIT",
|
|
26
28
|
"publishConfig": {
|
|
@@ -35,6 +37,7 @@
|
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
37
39
|
"@types/node": "^20",
|
|
38
|
-
"typescript": "^5"
|
|
40
|
+
"typescript": "^5",
|
|
41
|
+
"vitest": "^3.2.0"
|
|
39
42
|
}
|
|
40
43
|
}
|
|
@@ -7,6 +7,10 @@ description: Design, instrument, and analyze A/B experiments with Apex — SDK a
|
|
|
7
7
|
|
|
8
8
|
Apex treats experiments as part of a scientific loop: **beliefs → hypotheses → predictions → experiments → outcomes → updated beliefs**. Your job is to suggest experiments when product or code changes could be validated with data, and to wire instrumentation correctly.
|
|
9
9
|
|
|
10
|
+
## Grounded experiments — never invent claims
|
|
11
|
+
|
|
12
|
+
Before writing ANY experiment variant copy, read the merchant's guardrail files if present: `.apex/brand-truth.md` (the facts you may claim), `.apex/brand-voice.md` (tone), `.apex/lexicon.md` (word rules). **Every factual claim in variant copy MUST trace to a line in `.apex/brand-truth.md` — cite which line.** If a claim isn't backed there, ASK the user; do not invent it. (Real incident, 2026-06-15: an agent wrote "Free shipping on every order" for an app that charges $8 under $100 — an ungrounded claim that would have invalidated the test.) If the files are missing, scaffold them via **Apex → Set up Apex → Intelligence → "Set up experiment guardrails"** and ask the owner to fill in the facts first.
|
|
13
|
+
|
|
10
14
|
## When to suggest an experiment
|
|
11
15
|
|
|
12
16
|
Proactively offer Apex when you see:
|
|
@@ -27,6 +31,18 @@ Proactively offer Apex when you see:
|
|
|
27
31
|
|
|
28
32
|
Prefer **SDK mode** when the user is in an app codebase. Prefer **snippet mode** only when they explicitly use the marketing snippet and cannot deploy code.
|
|
29
33
|
|
|
34
|
+
## Web vs mobile surface
|
|
35
|
+
|
|
36
|
+
`create_experiment` takes a `surface` argument: `web` (default) for websites and web apps, `mobile` for native / Capacitor apps. Pass `mobile` for a Capacitor / React-Native / native app so the dashboard labels it **iOS App** instead of **Website**. Web variants resolve with `useApexVariant` (`@apex-inc/react`); mobile variants resolve with `Apex.getVariant()` (`@apex-inc/capacitor-plugin`).
|
|
37
|
+
|
|
38
|
+
## Visual / style variants — don't ship two identical arms
|
|
39
|
+
|
|
40
|
+
When the variable under test is **visual** (color, size, spacing, layout) rather than copy:
|
|
41
|
+
|
|
42
|
+
- **Always visually diff the arms.** A style variant that renders identical to control measures nothing. Screenshot both arms and look before activating — the screenshot pipeline exists partly to catch this. (Real incident, 2026-06-15: both arms shipped green because a class override silently lost.)
|
|
43
|
+
- **Class overrides are a trap without tailwind-merge.** Plain `className` concatenation keeps BOTH classes (e.g. `bg-primary` + `bg-black`) and the original usually wins, so the "variant" renders like control. Use an inline `style={{...}}` override or a class with guaranteed precedence.
|
|
44
|
+
- **One variable per test.** Change only the thing under test; keep everything else identical to control.
|
|
45
|
+
|
|
30
46
|
## Connecting from your IDE (no API key needed)
|
|
31
47
|
|
|
32
48
|
Apex MCP uses an **OAuth device flow** — you don't paste an API key. On the
|
|
@@ -47,6 +63,7 @@ Interactive flows: MCP prompts `new-experiment` and `experiment-review` orchestr
|
|
|
47
63
|
## Screenshots, exposure & the wiring gate
|
|
48
64
|
|
|
49
65
|
- **Screenshots are first-class.** For public web URLs, `create_experiment` auto-captures control + variant screenshots and shows them on the dashboard experiment card + detail gallery. For localhost / auth-gated / mobile screens, capture the image yourself and call `attach_experiment_asset({ experimentId, variantKey, imageBase64 })`.
|
|
66
|
+
- **Mobile/Capacitor experiments capture on-device.** When the experiment runs on an authed in-app screen (servers can't reach it), tell the dev to call `Apex.captureVariantScreenshot({ experimentId, variantKey })` on the variant's screen, keyed to the resolved variant in a `useEffect`, in a debug build (`Apex.initialize({ ..., debug: true })`). It no-ops in production and lands the shot on the dashboard card + gallery like web/agent captures.
|
|
50
67
|
- **Exposure auto-fires.** When a variant resolves via `useApexVariant` (web) or `Apex.getVariant()` (mobile), the SDK fires the canonical `experiment_exposure` event — the denominator for results. You don't fire it manually.
|
|
51
68
|
- **Don't launch a dead experiment.** `activate_experiment` is gated on `verify_experiment_wiring`: both arms must be producing `experiment_exposure` events first, or it refuses (pass `force: true` to override). Run `verify_experiment_wiring({ experimentId })` after deploying the variant code to confirm both arms are live before launch.
|
|
52
69
|
|