@apex-inc/mcp-server 0.75.0 → 0.79.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 +8 -0
- package/dist/api-client.d.ts +13 -21
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +203 -61
- 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 +34 -0
- package/dist/hosted.d.ts.map +1 -0
- package/dist/hosted.js +74 -0
- package/dist/hosted.js.map +1 -0
- package/dist/index.js +49 -117
- package/dist/index.js.map +1 -1
- package/dist/letter-blocks.d.ts.map +1 -1
- package/dist/letter-blocks.js +13 -22
- package/dist/letter-blocks.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 +40 -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 +31 -0
- package/dist/server-factory.d.ts.map +1 -0
- package/dist/server-factory.js +585 -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 +33 -67
- 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-mode.d.ts +48 -0
- package/dist/tool-mode.d.ts.map +1 -0
- package/dist/tool-mode.js +189 -0
- package/dist/tool-mode.js.map +1 -0
- package/dist/tool-shared.d.ts +9 -1
- package/dist/tool-shared.d.ts.map +1 -1
- package/dist/tool-shared.js +52 -6
- 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 +394 -0
- package/dist/tools/apex-campaigns.d.ts.map +1 -1
- package/dist/tools/apex-campaigns.js +256 -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 +140 -76
- 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 +240 -44
- 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 +165 -27
- package/dist/tools/measurement.js.map +1 -1
- package/dist/tools.d.ts +774 -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 +2 -1
- package/skills/apex-spec/SKILL.md +6 -1
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { toJsonSchemaCompat } from "@modelcontextprotocol/sdk/server/zod-json-schema-compat.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { toolDefinitions } from "./tools.js";
|
|
6
|
+
import { resourceDefinitions } from "./resources.js";
|
|
7
|
+
import { promptDefinitions } from "./prompts.js";
|
|
8
|
+
import { applyEditorStalePrefix, getRequestContext, isEditorStale, runWithRequestContext, takeUpdateNotice, } from "./api-client.js";
|
|
9
|
+
import { MCP_SERVER_VERSION } from "./version.js";
|
|
10
|
+
import { REPO_BINDING_INSTRUCTION } from "./repo-binding.js";
|
|
11
|
+
import { advertiseShape, restoreArgs, normalizeInbound } from "./param-casing.js";
|
|
12
|
+
import { advertisedToolNames, annotationsForTool, resolveToolCallName, } from "./tool-catalog.js";
|
|
13
|
+
import { TOOL_GROUPS, toolGroup } from "./tool-groups.js";
|
|
14
|
+
import { COMPACT_META_TOOL_SET, COMPACT_MODE_INSTRUCTION, CORE_DIRECT_TOOL_SET, parseToolGroups, resolveStdioMode, } from "./tool-mode.js";
|
|
15
|
+
/**
|
|
16
|
+
* Account-level or auth tools that do not operate on a single workspace and
|
|
17
|
+
* therefore should not advertise a per-call `workspace_key` override.
|
|
18
|
+
*/
|
|
19
|
+
const NON_WORKSPACE_TOOLS = new Set([
|
|
20
|
+
"list_workspaces",
|
|
21
|
+
"list_projects",
|
|
22
|
+
"switch_workspace",
|
|
23
|
+
"switch_project",
|
|
24
|
+
"list_orgs",
|
|
25
|
+
"switch_org",
|
|
26
|
+
"start_apex_login",
|
|
27
|
+
"wait_for_apex_approval",
|
|
28
|
+
"create_api_key",
|
|
29
|
+
"list_api_keys",
|
|
30
|
+
"revoke_api_key",
|
|
31
|
+
"create_organization",
|
|
32
|
+
"create_workspace",
|
|
33
|
+
]);
|
|
34
|
+
export const APEX_SERVER_INSTRUCTIONS = [
|
|
35
|
+
"You are connected to the Apex growth platform, which manages experiments.",
|
|
36
|
+
"Do NOT call list_experiments on ordinary coding, debugging, or product work that does not mention",
|
|
37
|
+
"experiments — do not dump the test list when they are fixing a button.",
|
|
38
|
+
"DO call check_live_tests before you edit a page, commit, or push, even if the user did not mention",
|
|
39
|
+
"experiments or Apex. That check is ordinary coding. Do not skip it because they are fixing a button.",
|
|
40
|
+
"Pass the file paths and their full contents (not just the diff hunk).",
|
|
41
|
+
"Also call check_live_tests before edit_communication, publish_communication, publish_journey,",
|
|
42
|
+
"update_adoption_milestone, or delete_adoption_milestone. Pass communication_ids, journey_ids,",
|
|
43
|
+
"or milestone_ids. If a letter, Adaptive Journey, or Milestone is live, stop and ask.",
|
|
44
|
+
"If check_live_tests returns a running high-confidence hit, stop and ask. Do not edit. Do not commit.",
|
|
45
|
+
"Do not pass confirmLiveExperiment, confirmTreatmentChange, or confirmLiveMilestone unless they picked an out.",
|
|
46
|
+
"Three outs: end the experiment then ship; wait until it ends; or say this change is not this experiment.",
|
|
47
|
+
"When the user does ask about their experiments (e.g. 'what experiments are running?',",
|
|
48
|
+
"'check Apex', 'any experiments ready to graduate?'), use list_experiments to check their status.",
|
|
49
|
+
"If any experiments show PENDING GRADUATION in that context, mention them and offer to",
|
|
50
|
+
"make the winning changes permanent using graduate_experiment.",
|
|
51
|
+
"Graduation is optional — the Apex snippet keeps serving the winner — but graduating",
|
|
52
|
+
"removes the runtime dependency and makes the changes part of the source code.",
|
|
53
|
+
"VOCABULARY: each workspace picks its own word for a person based on its vertical —",
|
|
54
|
+
"Customer, Lead, User, Client, or Contact — and its dashboard says that word everywhere.",
|
|
55
|
+
"Tool names, parameter names and API paths do NOT adapt (contactId and /api/customers",
|
|
56
|
+
"are contract), but when you describe results to the user, use the word their workspace",
|
|
57
|
+
"uses. Tool output already carries it; mirror the word the output uses rather than",
|
|
58
|
+
"defaulting to 'customer'.",
|
|
59
|
+
"If a tool result starts with APEX_EDITOR_STALE, stop. Do not keep calling Apex tools.",
|
|
60
|
+
"Tell the user to Update Cursor on Set up Apex or AI Agents so it asks before it ships onto a live test.",
|
|
61
|
+
"If a tool result starts with APEX_UPDATE_AVAILABLE, mention the update to the user once and keep working.",
|
|
62
|
+
"If get_setup_state shows first-run incomplete, name the merchant before inventing events.",
|
|
63
|
+
"After ads are connected, make a paid Apex Link before inventing UTMs. Do not stamp conversion ack.",
|
|
64
|
+
REPO_BINDING_INSTRUCTION,
|
|
65
|
+
"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.",
|
|
66
|
+
"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.",
|
|
67
|
+
"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.",
|
|
68
|
+
"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).",
|
|
69
|
+
"If only core tools plus find_apex_tools are listed, call find_apex_tools to look up any other Apex tool (including tools named in skills) and invoke it with call_apex_read or call_apex_write.",
|
|
70
|
+
].join(" ");
|
|
71
|
+
const HOSTED_EXCLUDED_TOOLS = new Set([
|
|
72
|
+
"start_apex_login",
|
|
73
|
+
"wait_for_apex_approval",
|
|
74
|
+
]);
|
|
75
|
+
const FIND_TOOLS_SHAPE = {
|
|
76
|
+
query: z
|
|
77
|
+
.string()
|
|
78
|
+
.optional()
|
|
79
|
+
.describe("Keywords to match tool names, groups, or descriptions."),
|
|
80
|
+
group: z
|
|
81
|
+
.string()
|
|
82
|
+
.optional()
|
|
83
|
+
.describe("Optional group filter: Experiments, Letters, Adoption, Partners, Measurement, Accounts, Context."),
|
|
84
|
+
names: z
|
|
85
|
+
.array(z.string().min(1))
|
|
86
|
+
.max(15)
|
|
87
|
+
.optional()
|
|
88
|
+
.describe("Exact tool names to fetch full schemas for (e.g. from a skill)."),
|
|
89
|
+
include_schema: z
|
|
90
|
+
.boolean()
|
|
91
|
+
.optional()
|
|
92
|
+
.describe("Include JSON input schemas (default true for names or <=4 matches)."),
|
|
93
|
+
limit: z
|
|
94
|
+
.number()
|
|
95
|
+
.int()
|
|
96
|
+
.min(1)
|
|
97
|
+
.max(15)
|
|
98
|
+
.optional()
|
|
99
|
+
.describe("Max matches to return (default 8, max 15)."),
|
|
100
|
+
};
|
|
101
|
+
const DISPATCH_TOOL_SHAPE = {
|
|
102
|
+
tool_name: z
|
|
103
|
+
.string()
|
|
104
|
+
.min(1)
|
|
105
|
+
.describe("Exact Apex tool name from find_apex_tools."),
|
|
106
|
+
arguments: z
|
|
107
|
+
.record(z.unknown())
|
|
108
|
+
.optional()
|
|
109
|
+
.describe("Arguments object matching the tool's input_schema."),
|
|
110
|
+
};
|
|
111
|
+
const META_TOOL_SHAPES = {
|
|
112
|
+
find_apex_tools: FIND_TOOLS_SHAPE,
|
|
113
|
+
call_apex_read: DISPATCH_TOOL_SHAPE,
|
|
114
|
+
call_apex_write: DISPATCH_TOOL_SHAPE,
|
|
115
|
+
};
|
|
116
|
+
function withWorkspaceOverrideShape(name, shape) {
|
|
117
|
+
const advertised = advertiseShape(shape);
|
|
118
|
+
if (NON_WORKSPACE_TOOLS.has(name) || "workspace_key" in advertised) {
|
|
119
|
+
return { advertised, injectsWorkspaceOverride: false };
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
advertised: {
|
|
123
|
+
...advertised,
|
|
124
|
+
workspace_key: z
|
|
125
|
+
.string()
|
|
126
|
+
.min(1)
|
|
127
|
+
.optional()
|
|
128
|
+
.describe("Target workspace key for this call only."),
|
|
129
|
+
},
|
|
130
|
+
injectsWorkspaceOverride: true,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function toCompactInputSchema(shape) {
|
|
134
|
+
const raw = toJsonSchemaCompat(z.object(shape), {
|
|
135
|
+
strictUnions: true,
|
|
136
|
+
pipeStrategy: "input",
|
|
137
|
+
});
|
|
138
|
+
const { $schema: _ignored, ...clean } = raw;
|
|
139
|
+
void _ignored;
|
|
140
|
+
return clean;
|
|
141
|
+
}
|
|
142
|
+
function oneLineSummary(description) {
|
|
143
|
+
const stripped = description
|
|
144
|
+
.replace(/^Apex\s*[—-]\s*/i, "")
|
|
145
|
+
.replace(/\s+/g, " ")
|
|
146
|
+
.trim();
|
|
147
|
+
const firstSentence = stripped.match(/^[^.!?]+[.!?]/)?.[0] ?? stripped;
|
|
148
|
+
return firstSentence.length > 160
|
|
149
|
+
? `${firstSentence.slice(0, 157)}...`
|
|
150
|
+
: firstSentence;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Normalize an inbound JSON-RPC `tools/call` message (resolving legacy tool
|
|
154
|
+
* aliases and folding camelCase argument keys to their advertised snake_case
|
|
155
|
+
* spelling before SDK Zod validation).
|
|
156
|
+
*/
|
|
157
|
+
export function normalizeInboundToolCallMessage(message) {
|
|
158
|
+
try {
|
|
159
|
+
const m = message;
|
|
160
|
+
if (m?.method === "tools/call" &&
|
|
161
|
+
m.params?.name &&
|
|
162
|
+
m.params.arguments &&
|
|
163
|
+
typeof m.params.arguments === "object") {
|
|
164
|
+
if (COMPACT_META_TOOL_SET.has(m.params.name)) {
|
|
165
|
+
const metaShape = META_TOOL_SHAPES[m.params.name];
|
|
166
|
+
if (metaShape) {
|
|
167
|
+
m.params.arguments = normalizeInbound(m.params.arguments, metaShape);
|
|
168
|
+
}
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
m.params.name = resolveToolCallName(m.params.name);
|
|
172
|
+
const def = toolDefinitions[m.params.name];
|
|
173
|
+
if (def) {
|
|
174
|
+
const { advertised } = withWorkspaceOverrideShape(m.params.name, def.schema.shape);
|
|
175
|
+
m.params.arguments = normalizeInbound(m.params.arguments, advertised);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
// Never let normalization block a request.
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function getSerializedTool(entry) {
|
|
184
|
+
if (!entry.serialized) {
|
|
185
|
+
entry.serialized = {
|
|
186
|
+
name: entry.name,
|
|
187
|
+
description: entry.description,
|
|
188
|
+
inputSchema: toCompactInputSchema(entry.advertised),
|
|
189
|
+
annotations: entry.annotations,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
return entry.serialized;
|
|
193
|
+
}
|
|
194
|
+
export function createApexMcpServer(options = {}) {
|
|
195
|
+
const baseInstructions = options.instructions ?? APEX_SERVER_INSTRUCTIONS;
|
|
196
|
+
const instructions = options.mode === "compact" && !baseInstructions.includes("find_apex_tools")
|
|
197
|
+
? `${baseInstructions} ${COMPACT_MODE_INSTRUCTION}`
|
|
198
|
+
: baseInstructions;
|
|
199
|
+
const server = new McpServer({
|
|
200
|
+
name: "apex",
|
|
201
|
+
title: "Apex",
|
|
202
|
+
version: MCP_SERVER_VERSION,
|
|
203
|
+
websiteUrl: "https://apex.inc",
|
|
204
|
+
// Clients must support PNG; SVG is optional in the MCP spec.
|
|
205
|
+
icons: [
|
|
206
|
+
{ src: "https://apex.inc/apple-touch-icon.png", mimeType: "image/png", sizes: ["180x180"] },
|
|
207
|
+
{ src: "https://apex.inc/favicon.svg", mimeType: "image/svg+xml", sizes: ["any"] },
|
|
208
|
+
],
|
|
209
|
+
}, { instructions });
|
|
210
|
+
const selectedGroups = options.groups && options.groups.length > 0 ? new Set(options.groups) : null;
|
|
211
|
+
const eligibleTools = new Map();
|
|
212
|
+
const fullVisibleNames = [];
|
|
213
|
+
const compactCoreNames = [];
|
|
214
|
+
for (const name of advertisedToolNames(Object.keys(toolDefinitions))) {
|
|
215
|
+
if (options.hostedMode && HOSTED_EXCLUDED_TOOLS.has(name))
|
|
216
|
+
continue;
|
|
217
|
+
const group = toolGroup(name);
|
|
218
|
+
if (!group)
|
|
219
|
+
continue;
|
|
220
|
+
const isCore = CORE_DIRECT_TOOL_SET.has(name);
|
|
221
|
+
if (selectedGroups && !selectedGroups.has(group) && !isCore)
|
|
222
|
+
continue;
|
|
223
|
+
const def = toolDefinitions[name];
|
|
224
|
+
const annotations = annotationsForTool(name);
|
|
225
|
+
const { advertised, injectsWorkspaceOverride } = withWorkspaceOverrideShape(name, def.schema.shape);
|
|
226
|
+
const entry = {
|
|
227
|
+
name,
|
|
228
|
+
group,
|
|
229
|
+
description: def.description,
|
|
230
|
+
sourceShape: def.schema.shape,
|
|
231
|
+
advertised,
|
|
232
|
+
injectsWorkspaceOverride,
|
|
233
|
+
annotations,
|
|
234
|
+
handler: def.handler,
|
|
235
|
+
};
|
|
236
|
+
eligibleTools.set(name, entry);
|
|
237
|
+
fullVisibleNames.push(name);
|
|
238
|
+
if (isCore)
|
|
239
|
+
compactCoreNames.push(name);
|
|
240
|
+
}
|
|
241
|
+
async function executeToolEntry(entry, args) {
|
|
242
|
+
try {
|
|
243
|
+
const reqCtx = getRequestContext();
|
|
244
|
+
const readOnly = Boolean(options.readOnly || reqCtx?.readOnly);
|
|
245
|
+
if (readOnly && !entry.annotations.readOnlyHint) {
|
|
246
|
+
return {
|
|
247
|
+
content: [
|
|
248
|
+
{
|
|
249
|
+
type: "text",
|
|
250
|
+
text: `Apex This connection is authorized for read-only access and cannot run "${entry.name}". Re-authorize with write access to make changes.`,
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
isError: true,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
let overrideWorkspaceKey;
|
|
257
|
+
let handlerArgs = args;
|
|
258
|
+
if (entry.injectsWorkspaceOverride && typeof args.workspace_key === "string") {
|
|
259
|
+
const trimmed = args.workspace_key.trim();
|
|
260
|
+
if (trimmed)
|
|
261
|
+
overrideWorkspaceKey = trimmed;
|
|
262
|
+
const { workspace_key: _ignored, ...rest } = args;
|
|
263
|
+
void _ignored;
|
|
264
|
+
handlerArgs = rest;
|
|
265
|
+
}
|
|
266
|
+
if (overrideWorkspaceKey &&
|
|
267
|
+
reqCtx?.pinnedWorkspaceKey &&
|
|
268
|
+
reqCtx.pinnedWorkspaceKey !== overrideWorkspaceKey) {
|
|
269
|
+
return {
|
|
270
|
+
content: [
|
|
271
|
+
{
|
|
272
|
+
type: "text",
|
|
273
|
+
text: `Apex This connection is pinned to workspace "${reqCtx.pinnedWorkspaceKey}" and cannot access "${overrideWorkspaceKey}". Re-authorize with access to all workspaces or pick "${overrideWorkspaceKey}".`,
|
|
274
|
+
},
|
|
275
|
+
],
|
|
276
|
+
isError: true,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
const invoke = () => entry.handler(restoreArgs(handlerArgs, entry.sourceShape));
|
|
280
|
+
const result = await runWithRequestContext({
|
|
281
|
+
toolName: entry.name,
|
|
282
|
+
...(overrideWorkspaceKey ? { workspaceKey: overrideWorkspaceKey } : {}),
|
|
283
|
+
}, invoke);
|
|
284
|
+
if (!options.hostedMode && isEditorStale() && result && Array.isArray(result.content)) {
|
|
285
|
+
for (const part of result.content) {
|
|
286
|
+
if (part.type === "text" && typeof part.text === "string") {
|
|
287
|
+
part.text = applyEditorStalePrefix(part.text);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (!options.hostedMode && result && Array.isArray(result.content)) {
|
|
292
|
+
const notice = takeUpdateNotice();
|
|
293
|
+
if (notice)
|
|
294
|
+
result.content.unshift({ type: "text", text: notice });
|
|
295
|
+
}
|
|
296
|
+
return result;
|
|
297
|
+
}
|
|
298
|
+
catch (err) {
|
|
299
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
300
|
+
return {
|
|
301
|
+
content: [
|
|
302
|
+
{
|
|
303
|
+
type: "text",
|
|
304
|
+
text: options.hostedMode
|
|
305
|
+
? `Error: ${message}`
|
|
306
|
+
: applyEditorStalePrefix(`Error: ${message}`),
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
isError: true,
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
async function dispatchByName(requestedName, rawArgs, requireReadOnly) {
|
|
314
|
+
const resolvedName = resolveToolCallName(requestedName.trim());
|
|
315
|
+
const entry = eligibleTools.get(resolvedName);
|
|
316
|
+
if (!entry) {
|
|
317
|
+
return {
|
|
318
|
+
content: [
|
|
319
|
+
{
|
|
320
|
+
type: "text",
|
|
321
|
+
text: `Apex Unknown or unavailable tool "${requestedName}". Call find_apex_tools to look up available tool names.`,
|
|
322
|
+
},
|
|
323
|
+
],
|
|
324
|
+
isError: true,
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
const reqCtx = getRequestContext();
|
|
328
|
+
const connReadOnly = Boolean(options.readOnly || reqCtx?.readOnly);
|
|
329
|
+
if (requireReadOnly && !entry.annotations.readOnlyHint) {
|
|
330
|
+
if (connReadOnly) {
|
|
331
|
+
return {
|
|
332
|
+
content: [
|
|
333
|
+
{
|
|
334
|
+
type: "text",
|
|
335
|
+
text: `Apex This connection is authorized for read-only access and cannot run "${entry.name}". Re-authorize with write access to make changes.`,
|
|
336
|
+
},
|
|
337
|
+
],
|
|
338
|
+
isError: true,
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
return {
|
|
342
|
+
content: [
|
|
343
|
+
{
|
|
344
|
+
type: "text",
|
|
345
|
+
text: `Apex Tool "${entry.name}" modifies Apex data and cannot run via call_apex_read. Call it with call_apex_write instead.`,
|
|
346
|
+
},
|
|
347
|
+
],
|
|
348
|
+
isError: true,
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
const normalized = normalizeInbound(rawArgs ?? {}, entry.advertised);
|
|
352
|
+
const parsed = z.object(entry.advertised).safeParse(normalized);
|
|
353
|
+
if (!parsed.success) {
|
|
354
|
+
const issues = parsed.error.issues
|
|
355
|
+
.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`)
|
|
356
|
+
.join("; ");
|
|
357
|
+
return {
|
|
358
|
+
content: [
|
|
359
|
+
{
|
|
360
|
+
type: "text",
|
|
361
|
+
text: `Apex Invalid arguments for "${entry.name}": ${issues}. Call find_apex_tools({ names: ["${entry.name}"] }) to inspect its schema.`,
|
|
362
|
+
},
|
|
363
|
+
],
|
|
364
|
+
isError: true,
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
return executeToolEntry(entry, parsed.data);
|
|
368
|
+
}
|
|
369
|
+
// --- Register eligible domain tools ---
|
|
370
|
+
for (const entry of eligibleTools.values()) {
|
|
371
|
+
server.tool(entry.name, entry.description, entry.advertised, entry.annotations, async (args) => executeToolEntry(entry, args));
|
|
372
|
+
}
|
|
373
|
+
// --- Register compact discovery & dispatch meta-tools ---
|
|
374
|
+
const metaSerialized = new Map();
|
|
375
|
+
const registerMetaTool = (name, description, shape, annotations, handler) => {
|
|
376
|
+
metaSerialized.set(name, {
|
|
377
|
+
name,
|
|
378
|
+
description,
|
|
379
|
+
inputSchema: toCompactInputSchema(shape),
|
|
380
|
+
annotations,
|
|
381
|
+
});
|
|
382
|
+
server.tool(name, description, shape, annotations, handler);
|
|
383
|
+
};
|
|
384
|
+
registerMetaTool("find_apex_tools", "Apex — Search the full Apex tool catalog by keyword, group, or exact tool names and return their schemas for call_apex_read / call_apex_write.", FIND_TOOLS_SHAPE, { readOnlyHint: true, destructiveHint: false }, async (args) => {
|
|
385
|
+
const reqCtx = getRequestContext();
|
|
386
|
+
const connReadOnly = Boolean(options.readOnly || reqCtx?.readOnly);
|
|
387
|
+
const names = Array.isArray(args.names) ? args.names : undefined;
|
|
388
|
+
const query = typeof args.query === "string" ? args.query.trim() : "";
|
|
389
|
+
const rawGroup = typeof args.group === "string" ? args.group.trim() : "";
|
|
390
|
+
const limit = typeof args.limit === "number" && Number.isFinite(args.limit)
|
|
391
|
+
? Math.max(1, Math.min(15, Math.floor(args.limit)))
|
|
392
|
+
: 8;
|
|
393
|
+
const visiblePool = Array.from(eligibleTools.values()).filter((entry) => !connReadOnly || entry.annotations.readOnlyHint);
|
|
394
|
+
// Exact name lookup (e.g. from a Skill or prior search)
|
|
395
|
+
if (names && names.length > 0) {
|
|
396
|
+
const found = [];
|
|
397
|
+
const missing = [];
|
|
398
|
+
const seen = new Set();
|
|
399
|
+
for (const rawName of names) {
|
|
400
|
+
const resolved = resolveToolCallName(rawName.trim());
|
|
401
|
+
if (seen.has(resolved))
|
|
402
|
+
continue;
|
|
403
|
+
seen.add(resolved);
|
|
404
|
+
const entry = eligibleTools.get(resolved);
|
|
405
|
+
if (!entry || (connReadOnly && !entry.annotations.readOnlyHint)) {
|
|
406
|
+
missing.push(rawName);
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
const serialized = getSerializedTool(entry);
|
|
410
|
+
found.push({
|
|
411
|
+
name: entry.name,
|
|
412
|
+
group: entry.group,
|
|
413
|
+
dispatch: entry.annotations.readOnlyHint ? "call_apex_read" : "call_apex_write",
|
|
414
|
+
description: entry.description,
|
|
415
|
+
input_schema: serialized.inputSchema,
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
return {
|
|
419
|
+
content: [
|
|
420
|
+
{
|
|
421
|
+
type: "text",
|
|
422
|
+
text: JSON.stringify({
|
|
423
|
+
tools: found,
|
|
424
|
+
...(missing.length > 0 ? { not_found: missing } : {}),
|
|
425
|
+
}, null, 2),
|
|
426
|
+
},
|
|
427
|
+
],
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
// Directory overview when called with no filters
|
|
431
|
+
if (!query && !rawGroup) {
|
|
432
|
+
const counts = {};
|
|
433
|
+
for (const g of TOOL_GROUPS)
|
|
434
|
+
counts[g] = 0;
|
|
435
|
+
for (const entry of visiblePool) {
|
|
436
|
+
counts[entry.group] = (counts[entry.group] ?? 0) + 1;
|
|
437
|
+
}
|
|
438
|
+
const groups = Object.entries(counts)
|
|
439
|
+
.filter(([, count]) => count > 0)
|
|
440
|
+
.map(([group, count]) => ({ group, count }));
|
|
441
|
+
return {
|
|
442
|
+
content: [
|
|
443
|
+
{
|
|
444
|
+
type: "text",
|
|
445
|
+
text: JSON.stringify({
|
|
446
|
+
total_tools: visiblePool.length,
|
|
447
|
+
...(connReadOnly ? { read_only: true } : {}),
|
|
448
|
+
groups,
|
|
449
|
+
hint: "Pass query (e.g. 'experiment', 'journey', 'partner payout'), group, or exact names: ['create_experiment'] to inspect schemas.",
|
|
450
|
+
}, null, 2),
|
|
451
|
+
},
|
|
452
|
+
],
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
let pool = visiblePool;
|
|
456
|
+
if (rawGroup) {
|
|
457
|
+
const parsedGroup = parseToolGroups(rawGroup);
|
|
458
|
+
if (!parsedGroup.groups || parsedGroup.groups.length === 0) {
|
|
459
|
+
return {
|
|
460
|
+
content: [
|
|
461
|
+
{
|
|
462
|
+
type: "text",
|
|
463
|
+
text: `Apex Unknown group "${rawGroup}". Valid groups: ${TOOL_GROUPS.join(", ")}.`,
|
|
464
|
+
},
|
|
465
|
+
],
|
|
466
|
+
isError: true,
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
const allowed = new Set(parsedGroup.groups);
|
|
470
|
+
pool = pool.filter((entry) => allowed.has(entry.group));
|
|
471
|
+
}
|
|
472
|
+
let ranked = pool;
|
|
473
|
+
if (query) {
|
|
474
|
+
const terms = query
|
|
475
|
+
.toLowerCase()
|
|
476
|
+
.split(/[^a-z0-9]+/)
|
|
477
|
+
.filter(Boolean);
|
|
478
|
+
const scored = [];
|
|
479
|
+
for (const entry of pool) {
|
|
480
|
+
const nameLower = entry.name.toLowerCase();
|
|
481
|
+
const descLower = entry.description.toLowerCase();
|
|
482
|
+
const groupLower = entry.group.toLowerCase();
|
|
483
|
+
let score = 0;
|
|
484
|
+
if (nameLower === query.toLowerCase())
|
|
485
|
+
score += 100;
|
|
486
|
+
if (nameLower.includes(query.toLowerCase()))
|
|
487
|
+
score += 40;
|
|
488
|
+
for (const term of terms) {
|
|
489
|
+
if (nameLower.includes(term))
|
|
490
|
+
score += 15;
|
|
491
|
+
else if (groupLower.includes(term))
|
|
492
|
+
score += 6;
|
|
493
|
+
else if (descLower.includes(term))
|
|
494
|
+
score += 4;
|
|
495
|
+
}
|
|
496
|
+
if (score > 0)
|
|
497
|
+
scored.push({ entry, score });
|
|
498
|
+
}
|
|
499
|
+
scored.sort((a, b) => b.score - a.score || a.entry.name.localeCompare(b.entry.name));
|
|
500
|
+
ranked = scored.map((s) => s.entry);
|
|
501
|
+
}
|
|
502
|
+
const slice = ranked.slice(0, limit);
|
|
503
|
+
const includeSchema = args.include_schema === true ||
|
|
504
|
+
(args.include_schema !== false && slice.length <= 4);
|
|
505
|
+
const items = slice.map((entry) => {
|
|
506
|
+
const base = {
|
|
507
|
+
name: entry.name,
|
|
508
|
+
group: entry.group,
|
|
509
|
+
dispatch: entry.annotations.readOnlyHint ? "call_apex_read" : "call_apex_write",
|
|
510
|
+
summary: oneLineSummary(entry.description),
|
|
511
|
+
};
|
|
512
|
+
if (includeSchema) {
|
|
513
|
+
base.input_schema = getSerializedTool(entry).inputSchema;
|
|
514
|
+
}
|
|
515
|
+
return base;
|
|
516
|
+
});
|
|
517
|
+
return {
|
|
518
|
+
content: [
|
|
519
|
+
{
|
|
520
|
+
type: "text",
|
|
521
|
+
text: JSON.stringify({
|
|
522
|
+
total_matches: ranked.length,
|
|
523
|
+
returned: items.length,
|
|
524
|
+
tools: items,
|
|
525
|
+
...(!includeSchema && items.length > 0
|
|
526
|
+
? { hint: "Call find_apex_tools with names: [...] or include_schema: true to fetch input schemas." }
|
|
527
|
+
: {}),
|
|
528
|
+
}, null, 2),
|
|
529
|
+
},
|
|
530
|
+
],
|
|
531
|
+
};
|
|
532
|
+
});
|
|
533
|
+
registerMetaTool("call_apex_read", "Apex — Invoke any read-only Apex tool discovered via find_apex_tools.", DISPATCH_TOOL_SHAPE, { readOnlyHint: true, destructiveHint: false }, async (args) => dispatchByName(String(args.tool_name ?? ""), args.arguments ?? {}, true));
|
|
534
|
+
const includeWriteMeta = !options.readOnly;
|
|
535
|
+
if (includeWriteMeta) {
|
|
536
|
+
registerMetaTool("call_apex_write", "Apex — Invoke any Apex tool that creates, updates, publishes, or deletes data (discovered via find_apex_tools).", DISPATCH_TOOL_SHAPE, { readOnlyHint: false, destructiveHint: true }, async (args) => dispatchByName(String(args.tool_name ?? ""), args.arguments ?? {}, false));
|
|
537
|
+
}
|
|
538
|
+
const compactVisibleNames = [
|
|
539
|
+
...compactCoreNames,
|
|
540
|
+
"find_apex_tools",
|
|
541
|
+
"call_apex_read",
|
|
542
|
+
...(includeWriteMeta ? ["call_apex_write"] : []),
|
|
543
|
+
];
|
|
544
|
+
// Override ListTools to enforce mode (auto/compact/full) and strip redundant $schema
|
|
545
|
+
// without triggering tools/list_changed notifications during initialization.
|
|
546
|
+
server.server.setRequestHandler(ListToolsRequestSchema, () => {
|
|
547
|
+
const mode = options.mode ?? "auto";
|
|
548
|
+
const effectiveMode = mode === "compact" || mode === "full"
|
|
549
|
+
? mode
|
|
550
|
+
: resolveStdioMode(mode, server.server.getClientVersion()?.name, options.groups);
|
|
551
|
+
if (effectiveMode === "compact") {
|
|
552
|
+
return {
|
|
553
|
+
tools: compactVisibleNames
|
|
554
|
+
.map((name) => {
|
|
555
|
+
const meta = metaSerialized.get(name);
|
|
556
|
+
if (meta)
|
|
557
|
+
return meta;
|
|
558
|
+
const entry = eligibleTools.get(name);
|
|
559
|
+
return entry ? getSerializedTool(entry) : null;
|
|
560
|
+
})
|
|
561
|
+
.filter((t) => t !== null),
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
return {
|
|
565
|
+
tools: fullVisibleNames.map((name) => getSerializedTool(eligibleTools.get(name))),
|
|
566
|
+
};
|
|
567
|
+
});
|
|
568
|
+
// --- Register resources ---
|
|
569
|
+
for (const def of Object.values(resourceDefinitions)) {
|
|
570
|
+
server.resource(def.name, def.uri, { description: def.description, mimeType: def.mimeType }, async () => await def.handler());
|
|
571
|
+
}
|
|
572
|
+
// --- Register prompts ---
|
|
573
|
+
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));
|
|
574
|
+
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));
|
|
575
|
+
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));
|
|
576
|
+
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));
|
|
577
|
+
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));
|
|
578
|
+
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));
|
|
579
|
+
if (!options.hostedMode) {
|
|
580
|
+
server.prompt("apex-login", "Sign in to Apex from the terminal (browser + poll)", {}, () => promptDefinitions["apex-login"].handler());
|
|
581
|
+
}
|
|
582
|
+
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));
|
|
583
|
+
return server;
|
|
584
|
+
}
|
|
585
|
+
//# sourceMappingURL=server-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-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BAAiB,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,IAA8B,CAAC,CACjF,CAAC;IAEF,MAAM,CAAC,MAAM,CACX,eAAe,EACf,oEAAoE,EACpE,EAAE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC,EAAE,EACjF,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,IAA8B,CAAC,CACrF,CAAC;IAEF,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,CAAC,MAAM,CACX,YAAY,EACZ,oDAAoD,EACpD,EAAE,EACF,GAAG,EAAE,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAChD,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,MAAM,CACX,WAAW,EACX,mCAAmC,EACnC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC,EAAE,EACpE,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,IAA8B,CAAC,CACjF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -333,22 +333,26 @@ export declare const setupCatchupTools: {
|
|
|
333
333
|
addMyAddress: z.ZodOptional<z.ZodBoolean>;
|
|
334
334
|
addresses: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
335
335
|
browserLink: z.ZodOptional<z.ZodEnum<["create", "remove"]>>;
|
|
336
|
+
excludeIdPatterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
336
337
|
host: z.ZodOptional<z.ZodString>;
|
|
337
338
|
}, "strip", z.ZodTypeAny, {
|
|
338
339
|
host?: string | undefined;
|
|
339
340
|
addMyAddress?: boolean | undefined;
|
|
340
341
|
addresses?: string[] | undefined;
|
|
341
342
|
browserLink?: "create" | "remove" | undefined;
|
|
343
|
+
excludeIdPatterns?: string[] | undefined;
|
|
342
344
|
}, {
|
|
343
345
|
host?: string | undefined;
|
|
344
346
|
addMyAddress?: boolean | undefined;
|
|
345
347
|
addresses?: string[] | undefined;
|
|
346
348
|
browserLink?: "create" | "remove" | undefined;
|
|
349
|
+
excludeIdPatterns?: string[] | undefined;
|
|
347
350
|
}>;
|
|
348
351
|
handler: (args: {
|
|
349
352
|
addMyAddress?: boolean;
|
|
350
353
|
addresses?: string[];
|
|
351
354
|
browserLink?: "create" | "remove";
|
|
355
|
+
excludeIdPatterns?: string[];
|
|
352
356
|
host?: string;
|
|
353
357
|
}) => Promise<{
|
|
354
358
|
content: {
|