@apex-inc/mcp-server 0.33.0 → 0.35.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/README.md +19 -18
- package/dist/api-client.d.ts +5 -0
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +40 -24
- package/dist/api-client.js.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +5 -7
- package/dist/prompts.js.map +1 -1
- package/dist/setup-catchup-tools.d.ts +98 -0
- package/dist/setup-catchup-tools.d.ts.map +1 -1
- package/dist/setup-catchup-tools.js +84 -3
- package/dist/setup-catchup-tools.js.map +1 -1
- package/dist/smoke-tools.d.ts +56 -0
- package/dist/smoke-tools.d.ts.map +1 -0
- package/dist/smoke-tools.js +262 -0
- package/dist/smoke-tools.js.map +1 -0
- package/dist/tool-catalog.d.ts +10 -0
- package/dist/tool-catalog.d.ts.map +1 -0
- package/dist/tool-catalog.js +36 -0
- package/dist/tool-catalog.js.map +1 -0
- package/dist/tool-groups.d.ts +5 -0
- package/dist/tool-groups.d.ts.map +1 -0
- package/dist/tool-groups.js +213 -0
- package/dist/tool-groups.js.map +1 -0
- package/dist/tool-shared.d.ts +300 -0
- package/dist/tool-shared.d.ts.map +1 -0
- package/dist/tool-shared.js +319 -0
- package/dist/tool-shared.js.map +1 -0
- package/dist/tools/accounts.d.ts +124 -0
- package/dist/tools/accounts.d.ts.map +1 -0
- package/dist/tools/accounts.js +99 -0
- package/dist/tools/accounts.js.map +1 -0
- package/dist/tools/adoption.d.ts +499 -0
- package/dist/tools/adoption.d.ts.map +1 -0
- package/dist/tools/adoption.js +447 -0
- package/dist/tools/adoption.js.map +1 -0
- package/dist/tools/context.d.ts +216 -0
- package/dist/tools/context.d.ts.map +1 -0
- package/dist/tools/context.js +328 -0
- package/dist/tools/context.js.map +1 -0
- package/dist/tools/experiments.d.ts +1250 -0
- package/dist/tools/experiments.d.ts.map +1 -0
- package/dist/tools/experiments.js +2563 -0
- package/dist/tools/experiments.js.map +1 -0
- package/dist/tools/letters.d.ts +1107 -0
- package/dist/tools/letters.d.ts.map +1 -0
- package/dist/tools/letters.js +1324 -0
- package/dist/tools/letters.js.map +1 -0
- package/dist/tools/measurement.d.ts +886 -0
- package/dist/tools/measurement.d.ts.map +1 -0
- package/dist/tools/measurement.js +1353 -0
- package/dist/tools/measurement.js.map +1 -0
- package/dist/tools/partners.d.ts +364 -0
- package/dist/tools/partners.d.ts.map +1 -0
- package/dist/tools/partners.js +199 -0
- package/dist/tools/partners.js.map +1 -0
- package/dist/tools.d.ts +3445 -2825
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +26 -6112
- package/dist/tools.js.map +1 -1
- package/package.json +3 -2
- package/skills/apex-communications/SKILL.md +5 -5
- package/skills/apex-experimentation/SKILL.md +43 -11
- package/skills/apex-growth-intelligence/SKILL.md +23 -2
- package/skills/apex-growth-tracking/SKILL.md +10 -1
- package/skills/apex-integration-cookbook/SKILL.md +24 -1
- package/skills/apex-journeys/SKILL.md +19 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { switchWorkspaceHandler, listWorkspacesHandler } from "../tool-shared.js";
|
|
3
|
+
export declare const contextTools: {
|
|
4
|
+
list_workspaces: {
|
|
5
|
+
description: string;
|
|
6
|
+
schema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
7
|
+
handler: typeof listWorkspacesHandler;
|
|
8
|
+
};
|
|
9
|
+
list_projects: {
|
|
10
|
+
description: string;
|
|
11
|
+
schema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
12
|
+
handler: typeof listWorkspacesHandler;
|
|
13
|
+
};
|
|
14
|
+
switch_workspace: {
|
|
15
|
+
description: string;
|
|
16
|
+
schema: z.ZodObject<{
|
|
17
|
+
workspaceKey: z.ZodOptional<z.ZodString>;
|
|
18
|
+
projectKey: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
workspaceKey?: string | undefined;
|
|
21
|
+
projectKey?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
workspaceKey?: string | undefined;
|
|
24
|
+
projectKey?: string | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
handler: typeof switchWorkspaceHandler;
|
|
27
|
+
};
|
|
28
|
+
switch_project: {
|
|
29
|
+
description: string;
|
|
30
|
+
schema: z.ZodObject<{
|
|
31
|
+
workspaceKey: z.ZodOptional<z.ZodString>;
|
|
32
|
+
projectKey: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
workspaceKey?: string | undefined;
|
|
35
|
+
projectKey?: string | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
workspaceKey?: string | undefined;
|
|
38
|
+
projectKey?: string | undefined;
|
|
39
|
+
}>;
|
|
40
|
+
handler: typeof switchWorkspaceHandler;
|
|
41
|
+
};
|
|
42
|
+
list_orgs: {
|
|
43
|
+
description: string;
|
|
44
|
+
schema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
45
|
+
handler: () => Promise<{
|
|
46
|
+
content: {
|
|
47
|
+
type: "text";
|
|
48
|
+
text: string;
|
|
49
|
+
}[];
|
|
50
|
+
}>;
|
|
51
|
+
};
|
|
52
|
+
switch_org: {
|
|
53
|
+
description: string;
|
|
54
|
+
schema: z.ZodObject<{
|
|
55
|
+
orgId: z.ZodString;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
orgId: string;
|
|
58
|
+
}, {
|
|
59
|
+
orgId: string;
|
|
60
|
+
}>;
|
|
61
|
+
handler: (args: {
|
|
62
|
+
orgId: string;
|
|
63
|
+
}) => Promise<{
|
|
64
|
+
content: {
|
|
65
|
+
type: "text";
|
|
66
|
+
text: string;
|
|
67
|
+
}[];
|
|
68
|
+
isError: boolean;
|
|
69
|
+
} | {
|
|
70
|
+
content: {
|
|
71
|
+
type: "text";
|
|
72
|
+
text: string;
|
|
73
|
+
}[];
|
|
74
|
+
isError?: undefined;
|
|
75
|
+
}>;
|
|
76
|
+
};
|
|
77
|
+
get_setup_state: {
|
|
78
|
+
description: string;
|
|
79
|
+
schema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
80
|
+
handler: () => Promise<{
|
|
81
|
+
content: {
|
|
82
|
+
type: "text";
|
|
83
|
+
text: string;
|
|
84
|
+
}[];
|
|
85
|
+
}>;
|
|
86
|
+
};
|
|
87
|
+
list_workspace_environments: {
|
|
88
|
+
description: string;
|
|
89
|
+
schema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
90
|
+
handler: () => Promise<{
|
|
91
|
+
content: {
|
|
92
|
+
type: "text";
|
|
93
|
+
text: string;
|
|
94
|
+
}[];
|
|
95
|
+
}>;
|
|
96
|
+
};
|
|
97
|
+
set_workspace_environments: {
|
|
98
|
+
description: string;
|
|
99
|
+
schema: z.ZodObject<{
|
|
100
|
+
production_hosts: z.ZodArray<z.ZodString, "many">;
|
|
101
|
+
beta_hosts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
102
|
+
}, "strip", z.ZodTypeAny, {
|
|
103
|
+
production_hosts: string[];
|
|
104
|
+
beta_hosts?: string[] | undefined;
|
|
105
|
+
}, {
|
|
106
|
+
production_hosts: string[];
|
|
107
|
+
beta_hosts?: string[] | undefined;
|
|
108
|
+
}>;
|
|
109
|
+
handler: ({ production_hosts, beta_hosts, }: {
|
|
110
|
+
production_hosts: string[];
|
|
111
|
+
beta_hosts?: string[];
|
|
112
|
+
}) => Promise<{
|
|
113
|
+
content: {
|
|
114
|
+
type: "text";
|
|
115
|
+
text: string;
|
|
116
|
+
}[];
|
|
117
|
+
}>;
|
|
118
|
+
};
|
|
119
|
+
check_workspace_readiness: {
|
|
120
|
+
description: string;
|
|
121
|
+
schema: z.ZodObject<{
|
|
122
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
123
|
+
}, "strip", z.ZodTypeAny, {
|
|
124
|
+
repo?: string | undefined;
|
|
125
|
+
}, {
|
|
126
|
+
repo?: string | undefined;
|
|
127
|
+
}>;
|
|
128
|
+
handler: (args: {
|
|
129
|
+
repo?: string;
|
|
130
|
+
}) => Promise<{
|
|
131
|
+
content: {
|
|
132
|
+
type: "text";
|
|
133
|
+
text: string;
|
|
134
|
+
}[];
|
|
135
|
+
}>;
|
|
136
|
+
};
|
|
137
|
+
start_apex_login: {
|
|
138
|
+
description: string;
|
|
139
|
+
schema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
140
|
+
handler: () => Promise<{
|
|
141
|
+
content: {
|
|
142
|
+
type: "text";
|
|
143
|
+
text: string;
|
|
144
|
+
}[];
|
|
145
|
+
}>;
|
|
146
|
+
};
|
|
147
|
+
start_integration_install: {
|
|
148
|
+
description: string;
|
|
149
|
+
schema: z.ZodObject<{
|
|
150
|
+
type: z.ZodString;
|
|
151
|
+
orgId: z.ZodOptional<z.ZodString>;
|
|
152
|
+
}, "strip", z.ZodTypeAny, {
|
|
153
|
+
type: string;
|
|
154
|
+
orgId?: string | undefined;
|
|
155
|
+
}, {
|
|
156
|
+
type: string;
|
|
157
|
+
orgId?: string | undefined;
|
|
158
|
+
}>;
|
|
159
|
+
handler: ({ type, orgId }: {
|
|
160
|
+
type: string;
|
|
161
|
+
orgId?: string;
|
|
162
|
+
}) => Promise<{
|
|
163
|
+
content: {
|
|
164
|
+
type: "text";
|
|
165
|
+
text: string;
|
|
166
|
+
}[];
|
|
167
|
+
}>;
|
|
168
|
+
};
|
|
169
|
+
create_api_key: {
|
|
170
|
+
description: string;
|
|
171
|
+
schema: z.ZodObject<{
|
|
172
|
+
name: z.ZodOptional<z.ZodString>;
|
|
173
|
+
}, "strip", z.ZodTypeAny, {
|
|
174
|
+
name?: string | undefined;
|
|
175
|
+
}, {
|
|
176
|
+
name?: string | undefined;
|
|
177
|
+
}>;
|
|
178
|
+
handler: ({ name }: {
|
|
179
|
+
name?: string;
|
|
180
|
+
}) => Promise<{
|
|
181
|
+
content: {
|
|
182
|
+
type: "text";
|
|
183
|
+
text: string;
|
|
184
|
+
}[];
|
|
185
|
+
}>;
|
|
186
|
+
};
|
|
187
|
+
list_api_keys: {
|
|
188
|
+
description: string;
|
|
189
|
+
schema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
190
|
+
handler: () => Promise<{
|
|
191
|
+
content: {
|
|
192
|
+
type: "text";
|
|
193
|
+
text: string;
|
|
194
|
+
}[];
|
|
195
|
+
}>;
|
|
196
|
+
};
|
|
197
|
+
revoke_api_key: {
|
|
198
|
+
description: string;
|
|
199
|
+
schema: z.ZodObject<{
|
|
200
|
+
keyId: z.ZodString;
|
|
201
|
+
}, "strip", z.ZodTypeAny, {
|
|
202
|
+
keyId: string;
|
|
203
|
+
}, {
|
|
204
|
+
keyId: string;
|
|
205
|
+
}>;
|
|
206
|
+
handler: ({ keyId }: {
|
|
207
|
+
keyId: string;
|
|
208
|
+
}) => Promise<{
|
|
209
|
+
content: {
|
|
210
|
+
type: "text";
|
|
211
|
+
text: string;
|
|
212
|
+
}[];
|
|
213
|
+
}>;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/tools/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,OAAO,EAGL,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAmEC;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qDAqHpC;YACD,gBAAgB,EAAE,MAAM,EAAE,CAAC;YAC3B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;SACvB;;;;;;;;;;;;;;;;wBAwBqB;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCA2GN;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;4BA+CvC;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;;6BA4BhB;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE;;;;;;;CAK/C,CAAC"}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { apiGet, apiPost, apiPut, apiDelete, getActiveWorkspace, setActiveOrg, getActiveOrg, getUserContext, } from "../api-client.js";
|
|
3
|
+
import { APEX, switchWorkspaceSchema, switchWorkspaceHandler, listWorkspacesHandler, } from "../tool-shared.js";
|
|
4
|
+
export const contextTools = {
|
|
5
|
+
list_workspaces: {
|
|
6
|
+
description: "List all workspaces available to your API key. Use this to see which workspaces you can work with.",
|
|
7
|
+
schema: z.object({}),
|
|
8
|
+
handler: listWorkspacesHandler,
|
|
9
|
+
},
|
|
10
|
+
list_projects: {
|
|
11
|
+
description: "DEPRECATED alias of list_workspaces — use list_workspaces. Lists all workspaces available to your API key.",
|
|
12
|
+
schema: z.object({}),
|
|
13
|
+
handler: listWorkspacesHandler,
|
|
14
|
+
},
|
|
15
|
+
// `switch_workspace` is canonical; `switch_project` is the deprecated alias
|
|
16
|
+
// kept for the project→workspace rename. Both point at the same handler/
|
|
17
|
+
// schema so existing agent calls keep working. (Auth-experience fix
|
|
18
|
+
// 2026-06-13; deprecation alias formalized 2026-06-14.),
|
|
19
|
+
switch_workspace: {
|
|
20
|
+
description: "Switch the active workspace for this session. All subsequent API calls will use this workspace. After switching, Apex verifies it can read the workspace and warns if authentication or the workspace key looks wrong.",
|
|
21
|
+
schema: switchWorkspaceSchema,
|
|
22
|
+
handler: switchWorkspaceHandler,
|
|
23
|
+
},
|
|
24
|
+
switch_project: {
|
|
25
|
+
description: "DEPRECATED alias of switch_workspace — use switch_workspace. Switches the active workspace for this session; all subsequent API calls use it.",
|
|
26
|
+
schema: switchWorkspaceSchema,
|
|
27
|
+
handler: switchWorkspaceHandler,
|
|
28
|
+
},
|
|
29
|
+
list_orgs: {
|
|
30
|
+
description: "List all organizations you have access to, with their workspaces. Use this to see which orgs and workspaces are available.",
|
|
31
|
+
schema: z.object({}),
|
|
32
|
+
handler: async () => {
|
|
33
|
+
const ctx = getUserContext();
|
|
34
|
+
if (!ctx || !ctx.orgs.length) {
|
|
35
|
+
return {
|
|
36
|
+
content: [{
|
|
37
|
+
type: "text",
|
|
38
|
+
text: "No organization data available. This requires a user key (apex_uk_). Check your APEX_API_KEY configuration.",
|
|
39
|
+
}],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const activeOrg = getActiveOrg();
|
|
43
|
+
const lines = ctx.orgs.map((org) => {
|
|
44
|
+
const active = org.orgId === activeOrg ? " ← active" : "";
|
|
45
|
+
const workspaces = org.workspaces.map((p) => ` ${p.workspaceKey} — ${p.name}`).join("\n");
|
|
46
|
+
return ` ${org.orgName} (${org.orgId}, ${org.role})${active}\n${workspaces || " (no workspaces)"}`;
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
content: [{
|
|
50
|
+
type: "text",
|
|
51
|
+
text: [`Organizations (${ctx.orgs.length}):`, ...lines].join("\n"),
|
|
52
|
+
}],
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
switch_org: {
|
|
57
|
+
description: "Switch the active organization. This also switches to the first workspace in that org.",
|
|
58
|
+
schema: z.object({
|
|
59
|
+
orgId: z.string().describe("The organization ID to switch to (from list_orgs)"),
|
|
60
|
+
}),
|
|
61
|
+
handler: async (args) => {
|
|
62
|
+
const ctx = getUserContext();
|
|
63
|
+
if (!ctx) {
|
|
64
|
+
return {
|
|
65
|
+
content: [{
|
|
66
|
+
type: "text",
|
|
67
|
+
text: "No organization data available. This requires a user key (apex_uk_).",
|
|
68
|
+
}],
|
|
69
|
+
isError: true,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const org = ctx.orgs.find((o) => o.orgId === args.orgId);
|
|
73
|
+
if (!org) {
|
|
74
|
+
const available = ctx.orgs.map((o) => ` ${o.orgId} — ${o.orgName}`).join("\n");
|
|
75
|
+
return {
|
|
76
|
+
content: [{
|
|
77
|
+
type: "text",
|
|
78
|
+
text: `Organization "${args.orgId}" not found. Available orgs:\n${available}`,
|
|
79
|
+
}],
|
|
80
|
+
isError: true,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
setActiveOrg(args.orgId);
|
|
84
|
+
const workspace = getActiveWorkspace();
|
|
85
|
+
const projectInfo = workspace ? `, active workspace: ${workspace}` : "";
|
|
86
|
+
return {
|
|
87
|
+
content: [{
|
|
88
|
+
type: "text",
|
|
89
|
+
text: `Switched to org: ${org.orgName} (${org.workspaces.length} workspace${org.workspaces.length !== 1 ? "s" : ""})${projectInfo}.`,
|
|
90
|
+
}],
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
// ─── Communications ─────────────────────────────────────────────────────────,
|
|
95
|
+
get_setup_state: {
|
|
96
|
+
description: `${APEX} — READ-ONLY. Returns the current Set up Apex state for the active workspace: live signal flags (shop named, vertical, snippet installed, sender domain verified, etc.) plus any steps the merchant marked complete or skipped in the hub. Use to answer "where am I in onboarding?" If first-run is incomplete, name the merchant with update_organization / update_workspace before inventing events. This tool never writes. WRITE tools that stamp a step complete (complete_setup_step, skip_setup_step) are never exposed — steps finish when the real thing happens.`,
|
|
97
|
+
schema: z.object({}),
|
|
98
|
+
handler: async () => {
|
|
99
|
+
// The active workspace key is encoded in the x-apex-workspace header
|
|
100
|
+
// that apiGet sends automatically.
|
|
101
|
+
const data = await apiGet("/api/setup-state");
|
|
102
|
+
const { overrides, signal, workspaceKey } = data.data;
|
|
103
|
+
const completedSteps = overrides
|
|
104
|
+
.filter((o) => o.action === "complete")
|
|
105
|
+
.map((o) => o.stepId);
|
|
106
|
+
const skippedSteps = overrides
|
|
107
|
+
.filter((o) => o.action === "skipped")
|
|
108
|
+
.map((o) => o.stepId);
|
|
109
|
+
const signalLines = Object.entries(signal)
|
|
110
|
+
.filter(([, v]) => typeof v === "boolean")
|
|
111
|
+
.map(([k, v]) => `- ${k}: ${v ? "✓" : "—"}`)
|
|
112
|
+
.join("\n");
|
|
113
|
+
const text = `# Set up Apex — workspace ${workspaceKey}
|
|
114
|
+
|
|
115
|
+
## Live signal
|
|
116
|
+
${signalLines || "_no signal data yet_"}
|
|
117
|
+
|
|
118
|
+
## Completed steps (${completedSteps.length})
|
|
119
|
+
${completedSteps.length ? completedSteps.map((s) => `- ${s}`).join("\n") : "_none_"}
|
|
120
|
+
|
|
121
|
+
## Skipped steps (${skippedSteps.length})
|
|
122
|
+
${skippedSteps.length ? skippedSteps.map((s) => `- ${s}`).join("\n") : "_none_"}
|
|
123
|
+
|
|
124
|
+
_Suggest the next step the user should tackle based on what's incomplete in the signal._`;
|
|
125
|
+
return { content: [{ type: "text", text }] };
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
list_workspace_environments: {
|
|
129
|
+
description: `${APEX} — Read the sites this workspace named as Production and Beta, plus unclassified sites Apex has seen. Name sites before you trust the Production slice. Do not invent a second workspace.`,
|
|
130
|
+
schema: z.object({}),
|
|
131
|
+
handler: async () => {
|
|
132
|
+
const json = await apiGet("/api/workspace/environments");
|
|
133
|
+
return {
|
|
134
|
+
content: [{ type: "text", text: JSON.stringify(json.data, null, 2) }],
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
set_workspace_environments: {
|
|
139
|
+
description: `${APEX} — Name Production sites (and optional Beta sites). Apex will not guess staging. / qa. / dev. Naming reclassifies events from those sites at read time.`,
|
|
140
|
+
schema: z.object({
|
|
141
|
+
production_hosts: z.array(z.string()).describe("Hostnames that are live (shop.example.com)."),
|
|
142
|
+
beta_hosts: z.array(z.string()).optional().describe("Hostnames that are testers. Never guessed from staging."),
|
|
143
|
+
}),
|
|
144
|
+
handler: async ({ production_hosts, beta_hosts, }) => {
|
|
145
|
+
const json = await apiPut("/api/workspace/environments", {
|
|
146
|
+
production_hosts,
|
|
147
|
+
beta_hosts: beta_hosts ?? [],
|
|
148
|
+
});
|
|
149
|
+
return {
|
|
150
|
+
content: [{ type: "text", text: JSON.stringify(json.data, null, 2) }],
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
// ─── Data Sources + unified analytics ──────────────────────────────────,
|
|
155
|
+
check_workspace_readiness: {
|
|
156
|
+
description: `${APEX} — Check whether the workspace is ready for the Graduation Pipeline flow: Apex auth, GitHub App install, and (if you pass a repo) whether Apex may write to it. Run this at the top of /apex-experiment, /apex-graduate, etc., and resolve any gaps before proceeding.`,
|
|
157
|
+
schema: z.object({
|
|
158
|
+
repo: z.string().optional().describe('Current repo "owner/name" to check write opt-in for'),
|
|
159
|
+
}),
|
|
160
|
+
handler: async (args) => {
|
|
161
|
+
const apexAuthed = Boolean(getActiveWorkspace());
|
|
162
|
+
/**
|
|
163
|
+
* "unknown" is a distinct state from false. These checks used to collapse
|
|
164
|
+
* a failed API call into "not installed", so a 404 (this tool called a
|
|
165
|
+
* path that never existed until 2026-08-03), an expired key, and a
|
|
166
|
+
* genuinely uninstalled GitHub App were indistinguishable — and the
|
|
167
|
+
* agent would tell the developer to install an app they already had.
|
|
168
|
+
*/
|
|
169
|
+
let githubAppInstalled = false;
|
|
170
|
+
let currentRepoWritable = false;
|
|
171
|
+
const checkErrors = [];
|
|
172
|
+
const note = (what, err) => checkErrors.push(`${what}: ${err instanceof Error ? err.message : String(err)}`);
|
|
173
|
+
try {
|
|
174
|
+
const connectors = await apiGet("/api/integrations");
|
|
175
|
+
const list = Array.isArray(connectors) ? connectors : [];
|
|
176
|
+
githubAppInstalled = list.some((c) => c.type === "github" && (c.isConnected || c.status === "connected"));
|
|
177
|
+
}
|
|
178
|
+
catch (err) {
|
|
179
|
+
githubAppInstalled = "unknown";
|
|
180
|
+
note("GitHub App check failed", err);
|
|
181
|
+
}
|
|
182
|
+
if (args.repo && githubAppInstalled !== false) {
|
|
183
|
+
try {
|
|
184
|
+
const auto = await apiGet("/api/graduation-pipeline/automation");
|
|
185
|
+
currentRepoWritable = (auto.data?.writeRepos ?? []).includes(args.repo);
|
|
186
|
+
}
|
|
187
|
+
catch (err) {
|
|
188
|
+
currentRepoWritable = "unknown";
|
|
189
|
+
note("Repo write opt-in check failed", err);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const readiness = {
|
|
193
|
+
apexAuthed,
|
|
194
|
+
githubAppInstalled,
|
|
195
|
+
currentRepoWritable,
|
|
196
|
+
// The agent verifies these locally (presence of @apex-inc/sdk + repo access).
|
|
197
|
+
sdkInstalled: "check-locally",
|
|
198
|
+
currentRepoAuthorized: githubAppInstalled === false ? false : "check-locally",
|
|
199
|
+
...(checkErrors.length > 0
|
|
200
|
+
? {
|
|
201
|
+
checkErrors,
|
|
202
|
+
guidance: "A check that failed is NOT a check that came back negative. Report the error to the developer and resolve it before telling them anything is missing or unconfigured.",
|
|
203
|
+
}
|
|
204
|
+
: {}),
|
|
205
|
+
};
|
|
206
|
+
return { content: [{ type: "text", text: JSON.stringify(readiness, null, 2) }] };
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
start_apex_login: {
|
|
210
|
+
description: `${APEX} — Begin the in-IDE Apex sign-in. Returns a browser URL; open it, the developer signs in (Google / GitHub / email / SSO — unchanged), and this tool polls until a workspace-scoped API key is minted. Save the returned key to your Cursor MCP config (with the developer's consent).`,
|
|
211
|
+
schema: z.object({}),
|
|
212
|
+
handler: async () => {
|
|
213
|
+
const start = await apiPost("/api/auth/cli-login/start", {});
|
|
214
|
+
const lines = [
|
|
215
|
+
`Open this URL in your browser to sign in to Apex:`,
|
|
216
|
+
start.url,
|
|
217
|
+
``,
|
|
218
|
+
`Waiting for sign-in…`,
|
|
219
|
+
];
|
|
220
|
+
// Poll up to ~90s.
|
|
221
|
+
for (let i = 0; i < 45; i++) {
|
|
222
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
223
|
+
try {
|
|
224
|
+
const status = await apiGet(`/api/auth/login-status?state=${encodeURIComponent(start.state)}`);
|
|
225
|
+
if (status.state === "logged_in" && status.apiKey) {
|
|
226
|
+
return {
|
|
227
|
+
content: [
|
|
228
|
+
{
|
|
229
|
+
type: "text",
|
|
230
|
+
text: `Signed in. Save this API key to your Cursor MCP config (APEX_API_KEY) with the developer's consent:\n\n${status.apiKey}\n\nWorkspace: ${status.workspace || "(default)"}`,
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
if (status.state === "failed") {
|
|
236
|
+
return { content: [{ type: "text", text: `Sign-in session expired. Re-run /apex-login.` }] };
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
catch { /* keep polling */ }
|
|
240
|
+
}
|
|
241
|
+
return { content: [{ type: "text", text: `${lines.join("\n")}\n\nStill waiting — re-run /apex-login if you didn't finish in the browser.` }] };
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
start_integration_install: {
|
|
245
|
+
description: `${APEX} — Begin a browser hop to connect GitHub, Stripe, Meta, Google, LinkedIn, or TikTok. Returns a URL; open it. Legal acknowledgements stay on the opened page — this tool does not confirm them. Polls until connected, same as GitHub.`,
|
|
246
|
+
schema: z.object({
|
|
247
|
+
type: z
|
|
248
|
+
.string()
|
|
249
|
+
.describe('github, stripe, meta, google, linkedin, or tiktok. Ads also accept hub names (meta-ads, google-ads, linkedin-ads, tiktok-ads).'),
|
|
250
|
+
orgId: z
|
|
251
|
+
.string()
|
|
252
|
+
.optional()
|
|
253
|
+
.describe("Required for Stripe Connect. Defaults to the active org."),
|
|
254
|
+
}),
|
|
255
|
+
handler: async ({ type, orgId }) => {
|
|
256
|
+
const resolvedOrg = orgId?.trim() || getActiveOrg();
|
|
257
|
+
if (type === "stripe" && !resolvedOrg) {
|
|
258
|
+
return {
|
|
259
|
+
content: [
|
|
260
|
+
{
|
|
261
|
+
type: "text",
|
|
262
|
+
text: JSON.stringify({
|
|
263
|
+
data: null,
|
|
264
|
+
error: "Stripe Connect needs an organization. Pass org_id or switch_org first.",
|
|
265
|
+
}),
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
const start = await apiPost("/api/integrations/cli-install/start", { type, org_id: resolvedOrg });
|
|
271
|
+
for (let i = 0; i < 60; i++) {
|
|
272
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
273
|
+
try {
|
|
274
|
+
const status = await apiGet(`/api/integrations/install-status?state=${encodeURIComponent(start.state)}`);
|
|
275
|
+
if (status.state === "installed") {
|
|
276
|
+
return { content: [{ type: "text", text: `${type} connected. Continuing.` }] };
|
|
277
|
+
}
|
|
278
|
+
if (status.state === "failed") {
|
|
279
|
+
return { content: [{ type: "text", text: `Install session expired. Re-run the install.` }] };
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
catch { /* keep polling */ }
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
content: [
|
|
286
|
+
{
|
|
287
|
+
type: "text",
|
|
288
|
+
text: `Open this URL to install ${type}:\n${start.url}\n\nI'll keep waiting — say "continue" once you've finished, or skip for now (the merge gate won't arm until it's connected).`,
|
|
289
|
+
},
|
|
290
|
+
],
|
|
291
|
+
};
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
create_api_key: {
|
|
295
|
+
description: `${APEX} — Create a new Apex API key for the current user. Returns the raw key once.`,
|
|
296
|
+
schema: z.object({ name: z.string().optional().describe("A label for the key") }),
|
|
297
|
+
handler: async ({ name }) => {
|
|
298
|
+
const res = await apiPost("/api/user/api-keys", {
|
|
299
|
+
name: name ?? "Cursor (Apex MCP)",
|
|
300
|
+
});
|
|
301
|
+
const text = res.rawKey
|
|
302
|
+
? `Created API key "${name ?? "Cursor (Apex MCP)"}". Store it securely — shown once:\n${res.rawKey}`
|
|
303
|
+
: `Could not create API key.`;
|
|
304
|
+
return { content: [{ type: "text", text }] };
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
list_api_keys: {
|
|
308
|
+
description: `${APEX} — List the current user's Apex API keys (names + ids; never the secret).`,
|
|
309
|
+
schema: z.object({}),
|
|
310
|
+
handler: async () => {
|
|
311
|
+
const keys = await apiGet("/api/user/api-keys");
|
|
312
|
+
const list = Array.isArray(keys) ? keys : [];
|
|
313
|
+
if (list.length === 0)
|
|
314
|
+
return { content: [{ type: "text", text: "No API keys." }] };
|
|
315
|
+
const lines = list.map((k) => `- ${k.name} (${k.id})${k.lastUsedAt ? ` — last used ${k.lastUsedAt}` : ""}`);
|
|
316
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
revoke_api_key: {
|
|
320
|
+
description: `${APEX} — Revoke (delete) an Apex API key by id.`,
|
|
321
|
+
schema: z.object({ keyId: z.string().describe("The API key id to revoke") }),
|
|
322
|
+
handler: async ({ keyId }) => {
|
|
323
|
+
await apiDelete(`/api/user/api-keys/${encodeURIComponent(keyId)}`);
|
|
324
|
+
return { content: [{ type: "text", text: `Revoked API key ${keyId}.` }] };
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
};
|
|
328
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/tools/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EACL,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