@apex-inc/mcp-server 0.75.0 → 0.78.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/dist/api-client.d.ts +13 -19
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +173 -59
- package/dist/api-client.js.map +1 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +7 -6
- package/dist/auth.js.map +1 -1
- package/dist/fetch-timeout.d.ts +23 -0
- package/dist/fetch-timeout.d.ts.map +1 -0
- package/dist/fetch-timeout.js +78 -0
- package/dist/fetch-timeout.js.map +1 -0
- package/dist/hosted.d.ts +28 -0
- package/dist/hosted.d.ts.map +1 -0
- package/dist/hosted.js +56 -0
- package/dist/hosted.js.map +1 -0
- package/dist/index.js +40 -118
- package/dist/index.js.map +1 -1
- package/dist/live-test-files.d.ts +35 -0
- package/dist/live-test-files.d.ts.map +1 -0
- package/dist/live-test-files.js +114 -0
- package/dist/live-test-files.js.map +1 -0
- package/dist/live-test-guard.d.ts.map +1 -1
- package/dist/live-test-guard.js +7 -1
- package/dist/live-test-guard.js.map +1 -1
- package/dist/request-context.d.ts +38 -0
- package/dist/request-context.d.ts.map +1 -0
- package/dist/request-context.js +11 -0
- package/dist/request-context.js.map +1 -0
- package/dist/server-factory.d.ts +18 -0
- package/dist/server-factory.d.ts.map +1 -0
- package/dist/server-factory.js +221 -0
- package/dist/server-factory.js.map +1 -0
- package/dist/setup-catchup-tools.d.ts +4 -0
- package/dist/setup-catchup-tools.d.ts.map +1 -1
- package/dist/setup-catchup-tools.js +16 -5
- package/dist/setup-catchup-tools.js.map +1 -1
- package/dist/smoke-tools.d.ts.map +1 -1
- package/dist/smoke-tools.js +2 -0
- package/dist/smoke-tools.js.map +1 -1
- package/dist/tool-catalog.d.ts +2 -0
- package/dist/tool-catalog.d.ts.map +1 -1
- package/dist/tool-catalog.js +6 -1
- package/dist/tool-catalog.js.map +1 -1
- package/dist/tool-groups.d.ts.map +1 -1
- package/dist/tool-groups.js +12 -0
- package/dist/tool-groups.js.map +1 -1
- package/dist/tool-shared.d.ts +2 -1
- package/dist/tool-shared.d.ts.map +1 -1
- package/dist/tool-shared.js +17 -2
- package/dist/tool-shared.js.map +1 -1
- package/dist/tools/adoption.d.ts.map +1 -1
- package/dist/tools/adoption.js +2 -1
- package/dist/tools/adoption.js.map +1 -1
- package/dist/tools/apex-campaigns.d.ts +390 -0
- package/dist/tools/apex-campaigns.d.ts.map +1 -1
- package/dist/tools/apex-campaigns.js +253 -1
- package/dist/tools/apex-campaigns.js.map +1 -1
- package/dist/tools/context.d.ts +2 -2
- package/dist/tools/experiments.d.ts +69 -1
- package/dist/tools/experiments.d.ts.map +1 -1
- package/dist/tools/experiments.js +88 -24
- package/dist/tools/experiments.js.map +1 -1
- package/dist/tools/letters.d.ts +214 -48
- package/dist/tools/letters.d.ts.map +1 -1
- package/dist/tools/letters.js +233 -16
- package/dist/tools/letters.js.map +1 -1
- package/dist/tools/measurement.d.ts +70 -28
- package/dist/tools/measurement.d.ts.map +1 -1
- package/dist/tools/measurement.js +151 -13
- package/dist/tools/measurement.js.map +1 -1
- package/dist/tools.d.ts +770 -76
- package/dist/tools.d.ts.map +1 -1
- package/package.json +11 -1
- package/skills/apex-growth-intelligence/SKILL.md +4 -0
- package/skills/apex-growth-tracking/SKILL.md +1 -1
- package/skills/apex-integration-cookbook/SKILL.md +23 -3
- package/skills/apex-setup/SKILL.md +1 -1
- package/skills/apex-spec/SKILL.md +6 -1
package/dist/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO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AC,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AAC3E,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,mBAAmB;IACjC,IAAI,YAAY,EAAE;QAAE,OAAO,IAAI,CAAC;IAChC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,KAAK,GAAG,SAAS,EAAE,CAAC;QACpB,MAAM,GAAG,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,KAAK,IAAI,IAAI,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request time limits for every HTTP call the Apex MCP server makes.
|
|
3
|
+
*
|
|
4
|
+
* Without an explicit abort signal, a stalled connection leaves the editor
|
|
5
|
+
* waiting indefinitely. Every call gets a bounded deadline (30 s by default,
|
|
6
|
+
* overridable via APEX_MCP_TIMEOUT_MS or per-call opts) and an error that
|
|
7
|
+
* tells the caller to check before retrying a write.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_REQUEST_TIMEOUT_MS = 30000;
|
|
10
|
+
export declare const LONG_REQUEST_TIMEOUT_MS = 90000;
|
|
11
|
+
export declare function resolveTimeoutMs(overrideMs?: number): number;
|
|
12
|
+
export declare class ApexRequestTimeoutError extends Error {
|
|
13
|
+
readonly method: string;
|
|
14
|
+
readonly path: string;
|
|
15
|
+
readonly timeoutMs: number;
|
|
16
|
+
constructor(method: string, path: string, timeoutMs: number);
|
|
17
|
+
}
|
|
18
|
+
export declare function fetchWithTimeout(url: string, init?: RequestInit, opts?: {
|
|
19
|
+
method?: string;
|
|
20
|
+
path?: string;
|
|
21
|
+
timeoutMs?: number;
|
|
22
|
+
}): Promise<Response>;
|
|
23
|
+
//# sourceMappingURL=fetch-timeout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-timeout.d.ts","sourceRoot":"","sources":["../src/fetch-timeout.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,0BAA0B,QAAS,CAAC;AACjD,eAAO,MAAM,uBAAuB,QAAS,CAAC;AAE9C,wBAAgB,gBAAgB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAU5D;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAa5D;AAED,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,WAAgB,EACtB,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAChE,OAAO,CAAC,QAAQ,CAAC,CAqCnB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request time limits for every HTTP call the Apex MCP server makes.
|
|
3
|
+
*
|
|
4
|
+
* Without an explicit abort signal, a stalled connection leaves the editor
|
|
5
|
+
* waiting indefinitely. Every call gets a bounded deadline (30 s by default,
|
|
6
|
+
* overridable via APEX_MCP_TIMEOUT_MS or per-call opts) and an error that
|
|
7
|
+
* tells the caller to check before retrying a write.
|
|
8
|
+
*/
|
|
9
|
+
export const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
|
|
10
|
+
export const LONG_REQUEST_TIMEOUT_MS = 90_000;
|
|
11
|
+
export function resolveTimeoutMs(overrideMs) {
|
|
12
|
+
if (typeof overrideMs === "number" && Number.isFinite(overrideMs) && overrideMs > 0) {
|
|
13
|
+
return overrideMs;
|
|
14
|
+
}
|
|
15
|
+
const envRaw = process.env.APEX_MCP_TIMEOUT_MS?.trim();
|
|
16
|
+
if (envRaw) {
|
|
17
|
+
const parsed = Number(envRaw);
|
|
18
|
+
if (Number.isFinite(parsed) && parsed > 0)
|
|
19
|
+
return parsed;
|
|
20
|
+
}
|
|
21
|
+
return DEFAULT_REQUEST_TIMEOUT_MS;
|
|
22
|
+
}
|
|
23
|
+
export class ApexRequestTimeoutError extends Error {
|
|
24
|
+
method;
|
|
25
|
+
path;
|
|
26
|
+
timeoutMs;
|
|
27
|
+
constructor(method, path, timeoutMs) {
|
|
28
|
+
const upper = method.toUpperCase();
|
|
29
|
+
const secs = Math.max(1, Math.round(timeoutMs / 1000));
|
|
30
|
+
const isRead = upper === "GET" || upper === "HEAD";
|
|
31
|
+
const suffix = isRead
|
|
32
|
+
? " Check your connection and try again."
|
|
33
|
+
: " If this made a change, it may still finish on Apex's side. Check before retrying.";
|
|
34
|
+
super(`Apex did not answer within ${secs}s (${upper} ${path}).${suffix}`);
|
|
35
|
+
this.name = "ApexRequestTimeoutError";
|
|
36
|
+
this.method = upper;
|
|
37
|
+
this.path = path;
|
|
38
|
+
this.timeoutMs = timeoutMs;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export async function fetchWithTimeout(url, init = {}, opts = {}) {
|
|
42
|
+
const timeoutMs = resolveTimeoutMs(opts.timeoutMs);
|
|
43
|
+
const method = (opts.method ?? init.method ?? "GET").toUpperCase();
|
|
44
|
+
const path = opts.path ?? url;
|
|
45
|
+
const controller = new AbortController();
|
|
46
|
+
let timedOut = false;
|
|
47
|
+
const outerSignal = init.signal;
|
|
48
|
+
const onOuterAbort = () => controller.abort();
|
|
49
|
+
if (outerSignal) {
|
|
50
|
+
if (outerSignal.aborted) {
|
|
51
|
+
controller.abort();
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
outerSignal.addEventListener("abort", onOuterAbort, { once: true });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const timer = setTimeout(() => {
|
|
58
|
+
timedOut = true;
|
|
59
|
+
controller.abort();
|
|
60
|
+
}, timeoutMs);
|
|
61
|
+
timer.unref?.();
|
|
62
|
+
try {
|
|
63
|
+
return await fetch(url, { ...init, signal: controller.signal });
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
if (timedOut) {
|
|
67
|
+
throw new ApexRequestTimeoutError(method, path, timeoutMs);
|
|
68
|
+
}
|
|
69
|
+
throw err;
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
clearTimeout(timer);
|
|
73
|
+
if (outerSignal) {
|
|
74
|
+
outerSignal.removeEventListener("abort", onOuterAbort);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=fetch-timeout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-timeout.js","sourceRoot":"","sources":["../src/fetch-timeout.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;AACjD,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAE9C,MAAM,UAAU,gBAAgB,CAAC,UAAmB;IAClD,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACpF,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,IAAI,EAAE,CAAC;IACvD,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC;YAAE,OAAO,MAAM,CAAC;IAC3D,CAAC;IACD,OAAO,0BAA0B,CAAC;AACpC,CAAC;AAED,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACvC,MAAM,CAAS;IACf,IAAI,CAAS;I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AE,CAAC;QAChB,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YACxB,UAAU,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;IAED,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;QAC5B,QAAQ,GAAG,IAAI,CAAC;QAChB,UAAU,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC,EAAE,SAAS,CAAC,CAAC;IACd,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;IAEhB,IAAI,CAAC;QACH,OAAO,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;IAClE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,IAAI,uBAAuB,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QAC7D,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,IAAI,WAAW,EAAE,CAAC;YAChB,WAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/hosted.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hosted Streamable HTTP entrypoint for Apex's MCP server (`/api/mcp`).
|
|
3
|
+
*
|
|
4
|
+
* Runs the EXACT same tool catalog (`createApexMcpServer`) as the local stdio
|
|
5
|
+
* CLI (`@apex-inc/mcp-server`), inside an `AsyncLocalStorage` request context
|
|
6
|
+
* scoped to the caller's verified OAuth / API-key credential.
|
|
7
|
+
*
|
|
8
|
+
* Uses `WebStandardStreamableHTTPServerTransport` in stateless JSON mode so it
|
|
9
|
+
* scales cleanly across multiple ECS Fargate tasks with zero sticky sessions.
|
|
10
|
+
*/
|
|
11
|
+
export interface HostedMcpOptions {
|
|
12
|
+
/** Verified Apex credential (`apex_oa_...`, `apex_at_...`, `apex_uk_...`, or `apex_sk_...`). */
|
|
13
|
+
token: string;
|
|
14
|
+
/** Internal HTTP origin for calling Apex REST endpoints (e.g. `http://127.0.0.1:3000`). */
|
|
15
|
+
apiBaseUrl: string;
|
|
16
|
+
/** Public app origin printed in merchant-facing dashboard links (e.g. `https://app.apex.inc`). */
|
|
17
|
+
publicBaseUrl: string;
|
|
18
|
+
/** Active workspace remembered on the caller's OAuth token, if any. */
|
|
19
|
+
workspaceKey?: string;
|
|
20
|
+
/** When set, locks this connection to a single workspace. */
|
|
21
|
+
pinnedWorkspaceKey?: string;
|
|
22
|
+
/** When true, blocks all write / destructive tools. */
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
/** Optional persistence hook when the agent invokes `switch_workspace`. */
|
|
25
|
+
onWorkspaceChange?: (workspaceKey: string, orgId?: string) => void | Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export declare function handleHostedMcpRequest(request: Request, options: HostedMcpOptions): Promise<Response>;
|
|
28
|
+
//# sourceMappingURL=hosted.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted.d.ts","sourceRoot":"","sources":["../src/hosted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,MAAM,WAAW,gBAAgB;IAC/B,gGAAgG;IAChG,KAAK,EAAE,MAAM,CAAC;IACd,2FAA2F;IAC3F,UAAU,EAAE,MAAM,CAAC;IACnB,kGAAkG;IAClG,aAAa,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,iBAAiB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpF;AASD,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,QAAQ,CAAC,CA0CnB"}
|
package/dist/hosted.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hosted Streamable HTTP entrypoint for Apex's MCP server (`/api/mcp`).
|
|
3
|
+
*
|
|
4
|
+
* Runs the EXACT same tool catalog (`createApexMcpServer`) as the local stdio
|
|
5
|
+
* CLI (`@apex-inc/mcp-server`), inside an `AsyncLocalStorage` request context
|
|
6
|
+
* scoped to the caller's verified OAuth / API-key credential.
|
|
7
|
+
*
|
|
8
|
+
* Uses `WebStandardStreamableHTTPServerTransport` in stateless JSON mode so it
|
|
9
|
+
* scales cleanly across multiple ECS Fargate tasks with zero sticky sessions.
|
|
10
|
+
*/
|
|
11
|
+
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
12
|
+
import { runWithRequestContext } from "./api-client.js";
|
|
13
|
+
import { createApexMcpServer, normalizeInboundToolCallMessage, } from "./server-factory.js";
|
|
14
|
+
const HOSTED_INSTRUCTIONS = "You are connected to the Apex growth platform via its hosted MCP server. " +
|
|
15
|
+
"This connection is scoped to the signed-in Apex user and can access every workspace they belong to (unless pinned to one workspace at sign-in). " +
|
|
16
|
+
"Use list_workspaces to inspect available workspaces, switch_workspace to change the default workspace, or pass workspace_key on any individual tool call to target a workspace without changing global state. " +
|
|
17
|
+
"Before editing a page, letter, Adaptive Journey, or Milestone, call check_live_tests first; if a live test is running on it, stop and ask the owner before changing it. " +
|
|
18
|
+
"Use the workspace's own word for a person (Customer, Lead, User, Client, or Contact) as returned by Apex tools.";
|
|
19
|
+
export async function handleHostedMcpRequest(request, options) {
|
|
20
|
+
return runWithRequestContext({
|
|
21
|
+
hostedMode: true,
|
|
22
|
+
token: options.token,
|
|
23
|
+
baseUrl: options.apiBaseUrl,
|
|
24
|
+
publicBaseUrl: options.publicBaseUrl,
|
|
25
|
+
workspaceKey: options.pinnedWorkspaceKey ?? options.workspaceKey,
|
|
26
|
+
pinnedWorkspaceKey: options.pinnedWorkspaceKey,
|
|
27
|
+
readOnly: options.readOnly,
|
|
28
|
+
onWorkspaceChange: options.onWorkspaceChange,
|
|
29
|
+
}, async () => {
|
|
30
|
+
const server = createApexMcpServer({
|
|
31
|
+
instructions: HOSTED_INSTRUCTIONS,
|
|
32
|
+
hostedMode: true,
|
|
33
|
+
readOnly: options.readOnly,
|
|
34
|
+
});
|
|
35
|
+
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
36
|
+
sessionIdGenerator: undefined,
|
|
37
|
+
enableJsonResponse: true,
|
|
38
|
+
});
|
|
39
|
+
await server.connect(transport);
|
|
40
|
+
const originalOnMessage = transport.onmessage;
|
|
41
|
+
if (originalOnMessage) {
|
|
42
|
+
transport.onmessage = (message, extra) => {
|
|
43
|
+
normalizeInboundToolCallMessage(message);
|
|
44
|
+
originalOnMessage(message, extra);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
return await transport.handleRequest(request);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
await transport.close().catch(() => { });
|
|
52
|
+
await server.close().catch(() => { });
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=hosted.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted.js","sourceRoot":"","sources":["../src/hosted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,wCAAwC,EAAE,MAAM,+DA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C,CAAC;YACpC,CAAC,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,OAAO,MAAM,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAChD,CAAC;gBAAS,CAAC;YACT,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YACxC,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
-
import {
|
|
5
|
-
import { toolDefinitions } from "./tools.js";
|
|
6
|
-
import { resourceDefinitions } from "./resources.js";
|
|
7
|
-
import { promptDefinitions } from "./prompts.js";
|
|
8
|
-
import { sendStartupPing, discoverContext, applyEditorStalePrefix, isEditorStale, setEditorClient, takeUpdateNotice, } from "./api-client.js";
|
|
3
|
+
import { sendStartupPing, discoverContext, applyEditorStalePrefix, setEditorClient, } from "./api-client.js";
|
|
9
4
|
import { MCP_SERVER_VERSION } from "./version.js";
|
|
10
5
|
import { REPO_BINDING_INSTRUCTION } from "./repo-binding.js";
|
|
11
|
-
import {
|
|
12
|
-
import { advertisedToolNames, annotationsForTool, resolveToolCallName, } from "./tool-catalog.js";
|
|
6
|
+
import { createApexMcpServer, normalizeInboundToolCallMessage, } from "./server-factory.js";
|
|
13
7
|
// Subcommand dispatch: `npx @apex-inc/mcp-server screenshot <opts>` runs the
|
|
14
8
|
// Playwright capture flow (experiment arm or Milestone still) and exits,
|
|
15
9
|
// instead of starting the stdio server.
|
|
@@ -19,100 +13,43 @@ if (process.argv[2] === "screenshot") {
|
|
|
19
13
|
await runScreenshotCli(process.argv.slice(3));
|
|
20
14
|
process.exit(process.exitCode ?? 0);
|
|
21
15
|
}
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"Tell the user to Update Cursor on Set up Apex or AI Agents so it asks before it ships onto a live test.",
|
|
60
|
-
"If a tool result starts with APEX_UPDATE_AVAILABLE, mention the update to the user once and keep working.",
|
|
61
|
-
"If get_setup_state shows first-run incomplete, name the merchant before inventing events.",
|
|
62
|
-
"After ads are connected, make a paid Apex Link before inventing UTMs. Do not stamp conversion ack.",
|
|
63
|
-
REPO_BINDING_INSTRUCTION,
|
|
64
|
-
"Setup replies name the workspace they wrote to (workspace). If it is not the workspace this repo belongs to, stop and switch_workspace before the next write.",
|
|
65
|
-
"DRAFT BEFORE PUBLISHING: Never publish a partner program, letter, journey, or Smart Banner live until the owner has reviewed it and explicitly said yes. create_partner_program creates a paused draft by default; call update_partner_program with updates: { status: 'active' } only after approval.",
|
|
66
|
-
"PREVIEWS AND APEX UI LINKS: For partner programs, show the Marketplace card directly in chat (render an interactive card with a Marketplace card / Terms and codes toggle if your editor supports inline HTML visuals, or embed the returned local preview_image_path with ) AND always include the direct Apex UI link so the owner can inspect or edit the partner card in Apex if they prefer. For emails, Adaptive Journeys, and Smart Banners, do NOT try to redraw them in chat: summarize what was drafted or changed and give the owner the direct link into Apex's UI (where they have light/dark mode, email client previews, the visual journey canvas, and live Smart Banner settings).",
|
|
67
|
-
].join(" "),
|
|
68
|
-
});
|
|
69
|
-
// --- Register tools ---
|
|
70
|
-
// Tools are advertised in snake_case (Apex's uniform agent-facing convention);
|
|
71
|
-
// `restoreArgs` hands each handler the source key casing it was authored
|
|
72
|
-
// against, so handler code stays idiomatic + type-checked. See param-casing.ts.
|
|
73
|
-
for (const name of advertisedToolNames(Object.keys(toolDefinitions))) {
|
|
74
|
-
const def = toolDefinitions[name];
|
|
75
|
-
server.tool(name, def.description, advertiseShape(def.schema.shape), annotationsForTool(name), async (args) => {
|
|
76
|
-
try {
|
|
77
|
-
const result = await def.handler(restoreArgs(args, def.schema.shape));
|
|
78
|
-
if (isEditorStale() && result && Array.isArray(result.content)) {
|
|
79
|
-
for (const part of result.content) {
|
|
80
|
-
if (part.type === "text" && typeof part.text === "string") {
|
|
81
|
-
part.text = applyEditorStalePrefix(part.text);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (result && Array.isArray(result.content)) {
|
|
86
|
-
const notice = takeUpdateNotice();
|
|
87
|
-
if (notice)
|
|
88
|
-
result.content.unshift({ type: "text", text: notice });
|
|
89
|
-
}
|
|
90
|
-
return result;
|
|
91
|
-
}
|
|
92
|
-
catch (err) {
|
|
93
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
94
|
-
return {
|
|
95
|
-
content: [{ type: "text", text: applyEditorStalePrefix(`Error: ${message}`) }],
|
|
96
|
-
isError: true,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
// --- Register resources ---
|
|
102
|
-
for (const def of Object.values(resourceDefinitions)) {
|
|
103
|
-
server.resource(def.name, def.uri, { description: def.description, mimeType: def.mimeType }, async () => {
|
|
104
|
-
return await def.handler();
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
// --- Register prompts ---
|
|
108
|
-
server.prompt("new-experiment", "Walk through setting up a new experiment: goal, assumption, expected outcome, and test design", { decision: z.string().optional().describe("What you want to improve") }, (args) => promptDefinitions["new-experiment"].handler(args));
|
|
109
|
-
server.prompt("experiment-review", "Review experiment results, see what you learned, and decide what to do next", { experimentId: z.string().describe("The experiment ID to review") }, (args) => promptDefinitions["experiment-review"].handler(args));
|
|
110
|
-
server.prompt("apex-graduate", "Graduate a winning experiment from inside Cursor — apply the recipe locally and open the PR yourself", { experimentId: z.string().describe("The experiment ID to graduate") }, (args) => promptDefinitions["apex-graduate"].handler(args));
|
|
111
|
-
server.prompt("apex-experiment", "Propose + ship an experiment from Cursor: author the variant, open the PR, arm the merge gate", { idea: z.string().optional().describe("What you want to test") }, (args) => promptDefinitions["apex-experiment"].handler(args));
|
|
112
|
-
server.prompt("apex-link", "Bind an already-open PR to an experiment", { experimentId: z.string().describe("The experiment ID") }, (args) => promptDefinitions["apex-link"].handler(args));
|
|
113
|
-
server.prompt("apex-followup", "Author the next experiment in a series, seeded by the prior result", { experimentId: z.string().describe("The concluded experiment to follow up on") }, (args) => promptDefinitions["apex-followup"].handler(args));
|
|
114
|
-
server.prompt("apex-login", "Sign in to Apex from the terminal (browser + poll)", {}, () => promptDefinitions["apex-login"].handler());
|
|
115
|
-
server.prompt("apex-keys", "Manage Apex API keys from the IDE", { action: z.string().optional().describe("list | create | revoke") }, (args) => promptDefinitions["apex-keys"].handler(args));
|
|
16
|
+
const INSTRUCTIONS = [
|
|
17
|
+
"You are connected to the Apex growth platform, which manages experiments.",
|
|
18
|
+
"Do NOT call list_experiments on ordinary coding, debugging, or product work that does not mention",
|
|
19
|
+
"experiments — do not dump the test list when they are fixing a button.",
|
|
20
|
+
"DO call check_live_tests before you edit a page, commit, or push, even if the user did not mention",
|
|
21
|
+
"experiments or Apex. That check is ordinary coding. Do not skip it because they are fixing a button.",
|
|
22
|
+
"Pass the file paths and their full contents (not just the diff hunk).",
|
|
23
|
+
"Also call check_live_tests before edit_communication, publish_communication, publish_journey,",
|
|
24
|
+
"update_adoption_milestone, or delete_adoption_milestone. Pass communication_ids, journey_ids,",
|
|
25
|
+
"or milestone_ids. If a letter, Adaptive Journey, or Milestone is live, stop and ask.",
|
|
26
|
+
"If check_live_tests returns a running high-confidence hit, stop and ask. Do not edit. Do not commit.",
|
|
27
|
+
"Do not pass confirmLiveExperiment, confirmTreatmentChange, or confirmLiveMilestone unless they picked an out.",
|
|
28
|
+
"Three outs: end the experiment then ship; wait until it ends; or say this change is not this experiment.",
|
|
29
|
+
"When the user does ask about their experiments (e.g. 'what experiments are running?',",
|
|
30
|
+
"'check Apex', 'any experiments ready to graduate?'), use list_experiments to check their status.",
|
|
31
|
+
"If any experiments show PENDING GRADUATION in that context, mention them and offer to",
|
|
32
|
+
"make the winning changes permanent using graduate_experiment.",
|
|
33
|
+
"Graduation is optional — the Apex snippet keeps serving the winner — but graduating",
|
|
34
|
+
"removes the runtime dependency and makes the changes part of the source code.",
|
|
35
|
+
"VOCABULARY: each workspace picks its own word for a person based on its vertical —",
|
|
36
|
+
"Customer, Lead, User, Client, or Contact — and its dashboard says that word everywhere.",
|
|
37
|
+
"Tool names, parameter names and API paths do NOT adapt (contactId and /api/customers",
|
|
38
|
+
"are contract), but when you describe results to the user, use the word their workspace",
|
|
39
|
+
"uses. Tool output already carries it; mirror the word the output uses rather than",
|
|
40
|
+
"defaulting to 'customer'.",
|
|
41
|
+
"If a tool result starts with APEX_EDITOR_STALE, stop. Do not keep calling Apex tools.",
|
|
42
|
+
"Tell the user to Update Cursor on Set up Apex or AI Agents so it asks before it ships onto a live test.",
|
|
43
|
+
"If a tool result starts with APEX_UPDATE_AVAILABLE, mention the update to the user once and keep working.",
|
|
44
|
+
"If get_setup_state shows first-run incomplete, name the merchant before inventing events.",
|
|
45
|
+
"After ads are connected, make a paid Apex Link before inventing UTMs. Do not stamp conversion ack.",
|
|
46
|
+
REPO_BINDING_INSTRUCTION,
|
|
47
|
+
"Setup replies name the workspace they wrote to (workspace). If it is not the workspace this repo belongs to, stop and switch_workspace before the next write.",
|
|
48
|
+
"MULTI-WORKSPACE: One user-scoped Apex connection covers all organizations and workspaces the user belongs to. Use switch_workspace to change the default workspace for the session, or pass workspace_key on any workspace-scoped tool call to target one workspace for that call only without changing the session default.",
|
|
49
|
+
"DRAFT BEFORE PUBLISHING: Never publish a partner program, letter, journey, or Smart Banner live until the owner has reviewed it and explicitly said yes. create_partner_program creates a paused draft by default; call update_partner_program with updates: { status: 'active' } only after approval.",
|
|
50
|
+
"PREVIEWS AND APEX UI LINKS: For partner programs, show the Marketplace card directly in chat (render an interactive card with a Marketplace card / Terms and codes toggle if your editor supports inline HTML visuals, or embed the returned local preview_image_path with ) AND always include the direct Apex UI link so the owner can inspect or edit the partner card in Apex if they prefer. For emails, Adaptive Journeys, and Smart Banners, do NOT try to redraw them in chat: summarize what was drafted or changed and give the owner the direct link into Apex's UI (where they have light/dark mode, email client previews, the visual journey canvas, and live Smart Banner settings).",
|
|
51
|
+
].join(" ");
|
|
52
|
+
const server = createApexMcpServer({ instructions: INSTRUCTIONS });
|
|
116
53
|
// --- Start ---
|
|
117
54
|
async function main() {
|
|
118
55
|
const transport = new StdioServerTransport();
|
|
@@ -130,22 +67,7 @@ async function main() {
|
|
|
130
67
|
// works. Wrapping `onmessage` after connect keeps the SDK's handler intact.
|
|
131
68
|
const innerOnMessage = transport.onmessage?.bind(transport);
|
|
132
69
|
transport.onmessage = (message) => {
|
|
133
|
-
|
|
134
|
-
const m = message;
|
|
135
|
-
if (m?.method === "tools/call" &&
|
|
136
|
-
m.params?.name &&
|
|
137
|
-
m.params.arguments &&
|
|
138
|
-
typeof m.params.arguments === "object") {
|
|
139
|
-
m.params.name = resolveToolCallName(m.params.name);
|
|
140
|
-
const def = toolDefinitions[m.params.name];
|
|
141
|
-
if (def) {
|
|
142
|
-
m.params.arguments = normalizeInbound(m.params.arguments, def.schema.shape);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
catch {
|
|
147
|
-
// Never let normalization block a request.
|
|
148
|
-
}
|
|
70
|
+
normalizeInboundToolCallMessage(message);
|
|
149
71
|
return innerOnMessage?.(message);
|
|
150
72
|
};
|
|
151
73
|
// NON-BLOCKING: never wait for browser approval at startup (Cursor treats a
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,qBAAqB,CAAC;AAE7B,6EAA6E;AAC7E,yEAAyE;AACzE,wCAAwC;AACxC,oEAAoE;AACpE,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,YAAY,EAAE,CAAC;IACrC,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC;IACjE,MAAM,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,YAAY,GAAG;IACnB,2EAA2E;IAC3E,mGAAmG;IACnG,wEAAwE;IACxE,oGAAoG;IACpG,sGAAsG;IACtG,uEAAuE;IACvE,+FAA+F;IAC/F,+FAA+F;IAC/F,sFAAsF;IACtF,s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AE,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC,CAAC;IACF,4EAA4E;IAC5E,2EAA2E;IAC3E,0EAA0E;IAC1E,+DAA+D;IAC/D,MAAM,UAAU,GAAG,MAAM,eAAe,EAAE,CAAC;IAC3C,MAAM,SAAS,CAAC;IAChB,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAE,IAAI,CAAC,CAAC;IACxD,MAAM,eAAe,EAAE,CAAC;IACxB,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,UAAU,sBAAsB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve file paths and contents for check_live_tests without falling into
|
|
3
|
+
* the worktree trap (reading the main checkout at process.cwd() or sending
|
|
4
|
+
* raw machine paths that fail repo-relative mount-tree matching).
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Walk upward from startDir to find the nearest git checkout or worktree root.
|
|
8
|
+
* Works for both regular checkouts (.git directory) and git worktrees (.git file).
|
|
9
|
+
*/
|
|
10
|
+
export declare function findGitRoot(startDir: string): string | null;
|
|
11
|
+
export interface LiveCheckFileInput {
|
|
12
|
+
filePaths?: string[];
|
|
13
|
+
fileContents?: Array<{
|
|
14
|
+
path: string;
|
|
15
|
+
content: string;
|
|
16
|
+
}>;
|
|
17
|
+
repoRoot?: string;
|
|
18
|
+
cwd?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ResolvedLiveCheckFile {
|
|
21
|
+
path: string;
|
|
22
|
+
content: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resolve every file passed to check_live_tests:
|
|
26
|
+
* - Honors `repoRoot` when provided (required for relative paths in a worktree
|
|
27
|
+
* when the MCP process started in a different folder).
|
|
28
|
+
* - For absolute paths (in either `fileContents` or `filePaths`), reads that
|
|
29
|
+
* exact file and normalizes the path sent to Apex against its git root so
|
|
30
|
+
* server-side mount-tree matching still hits.
|
|
31
|
+
* - Refuses to silently drop missing or out-of-root `filePaths` when
|
|
32
|
+
* `fileContents` wasn't provided, preventing false "nothing live" answers.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveLiveCheckFiles(input: LiveCheckFileInput): ResolvedLiveCheckFile[];
|
|
35
|
+
//# sourceMappingURL=live-test-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-test-files.d.ts","sourceRoot":"","sources":["../src/live-test-files.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ3D;AAyBD,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,kBAAkB,GACxB,qBAAqB,EAAE,CAsEzB"}
|