@pofky/asc-mcp 1.2.0 → 1.3.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 +14 -3
- package/dist/elicitation.d.ts +39 -0
- package/dist/elicitation.d.ts.map +1 -0
- package/dist/elicitation.js +63 -0
- package/dist/elicitation.js.map +1 -0
- package/dist/index.js +55 -1
- package/dist/index.js.map +1 -1
- package/dist/sampling.d.ts +53 -0
- package/dist/sampling.d.ts.map +1 -0
- package/dist/sampling.js +109 -0
- package/dist/sampling.js.map +1 -0
- package/dist/tools/draft-review-response.d.ts +37 -0
- package/dist/tools/draft-review-response.d.ts.map +1 -0
- package/dist/tools/draft-review-response.js +236 -0
- package/dist/tools/draft-review-response.js.map +1 -0
- package/dist/tools/triage-reviews.d.ts +35 -0
- package/dist/tools/triage-reviews.d.ts.map +1 -0
- package/dist/tools/triage-reviews.js +194 -0
- package/dist/tools/triage-reviews.js.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ asc-mcp install-skill # one-line, optional, for auto-routed review questions
|
|
|
11
11
|
|
|
12
12
|
## What Makes This Different
|
|
13
13
|
|
|
14
|
-
Other ASC MCP servers wrap the API and give you 80 to 293 raw endpoints. This one gives you
|
|
14
|
+
Other ASC MCP servers wrap the API and give you 80 to 293 raw endpoints. This one gives you 13 opinionated tools, 3 slash-command Prompts, and a Claude Skill that all think. Two of the tools use MCP Sampling: your own client's model does the LLM work, so there is no extra cost from this server.
|
|
15
15
|
|
|
16
16
|
| You say | What happens |
|
|
17
17
|
|---------|-------------|
|
|
@@ -78,11 +78,21 @@ Works with **Claude Code**, **Cursor**, **Windsurf**, **Cline**, and any MCP-com
|
|
|
78
78
|
| `keyword_insights` | Analyze keywords against iTunes search competition, difficulty ratings | See which keywords are worth targeting at a glance |
|
|
79
79
|
| `competitor_snapshot` | Look up any app: ratings, reviews, version, price, release notes | Competitive intelligence without leaving your editor |
|
|
80
80
|
| `metadata_diff` | Compare live vs pending version metadata across all locales | Verify exactly what changed before submitting |
|
|
81
|
+
| `triage_reviews` | Pulls recent reviews and clusters them into 3 to 5 themes with counts, action buckets, and quotes, using MCP Sampling | Zero extra cost: your client's model does the clustering |
|
|
82
|
+
| `draft_review_response` | Drafts a public reply to a single review in the review's locale, via Sampling. Elicits tone if your client supports it. Never auto-posts. | Apple guideline 1.2 respected; you paste into ASC yourself |
|
|
81
83
|
|
|
82
|
-
**Coming next (Week
|
|
84
|
+
**Coming next (Week 3):** rejection-risk scoring against the 2026 corpus (guideline 2.3 metadata, 4.0 design, privacy-AI 5.1.2).
|
|
83
85
|
|
|
84
86
|
[Get Pro](https://buy.polar.sh/polar_cl_Ta3OxEA1EbRyYNPFtSsRXgYWBCCtjwMxlbAeW35RLuu) | [Retrieve your license key](https://asc-mcp-license.remewdy.workers.dev/key)
|
|
85
87
|
|
|
88
|
+
## How Sampling works (zero extra cost)
|
|
89
|
+
|
|
90
|
+
`triage_reviews` and `draft_review_response` use the MCP Sampling primitive. When you call one of these tools, this server sends a `sampling/createMessage` request back to your own MCP client. Your client runs the LLM locally (Claude Desktop uses your account; Claude Code uses its session). We never call Anthropic from our side.
|
|
91
|
+
|
|
92
|
+
Outcome: review clustering and reply drafting cost you exactly what you would pay for any other Claude request, not a penny more from this server.
|
|
93
|
+
|
|
94
|
+
If your MCP client does not support Sampling yet, both tools return a structured `degraded: true` result with a clear explanation. Upgrade Claude Desktop or Claude Code to a recent version for full functionality.
|
|
95
|
+
|
|
86
96
|
## Slash Commands (Prompts)
|
|
87
97
|
|
|
88
98
|
Type these in Claude Desktop or Claude Code and the agent runs a pre-built multi-tool workflow:
|
|
@@ -171,8 +181,9 @@ Lead with the most impactful change. Keep under 4000 chars.
|
|
|
171
181
|
|
|
172
182
|
| | Raw API wrappers (free) | This server |
|
|
173
183
|
|---|---|---|
|
|
174
|
-
| **Tool count** | 80 to 293 |
|
|
184
|
+
| **Tool count** | 80 to 293 | 13 opinionated tools |
|
|
175
185
|
| **MCP Prompts (slash commands)** | No | Yes, 3 pre-built workflows |
|
|
186
|
+
| **MCP Sampling (zero server-side LLM cost)** | No | Yes, review triage + response drafts |
|
|
176
187
|
| **Claude Skill bundled** | No | Yes, one-line install |
|
|
177
188
|
| **Pre-submission audit** | No | Yes, catches rejections before you submit |
|
|
178
189
|
| **Cross-app briefings** | No | Yes, one call, all apps |
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Elicitation helper.
|
|
3
|
+
*
|
|
4
|
+
* Lets a tool ask the user structured questions mid-call via
|
|
5
|
+
* `server.elicitInput(...)`. The client renders a dialog with the schema.
|
|
6
|
+
*
|
|
7
|
+
* Capability detection: if the client does not advertise elicitation, we
|
|
8
|
+
* return `{ unsupported: true }` so the caller can fall back to a default.
|
|
9
|
+
*/
|
|
10
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
|
+
export type ElicitationResult = {
|
|
12
|
+
ok: true;
|
|
13
|
+
values: Record<string, unknown>;
|
|
14
|
+
} | {
|
|
15
|
+
ok: false;
|
|
16
|
+
unsupported: true;
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
declined: true;
|
|
20
|
+
} | {
|
|
21
|
+
ok: false;
|
|
22
|
+
cancelled: true;
|
|
23
|
+
} | {
|
|
24
|
+
ok: false;
|
|
25
|
+
error: string;
|
|
26
|
+
};
|
|
27
|
+
export interface ElicitationSchema {
|
|
28
|
+
type: "object";
|
|
29
|
+
properties: Record<string, unknown>;
|
|
30
|
+
required?: string[];
|
|
31
|
+
}
|
|
32
|
+
export interface ElicitationRequest {
|
|
33
|
+
message: string;
|
|
34
|
+
schema: ElicitationSchema;
|
|
35
|
+
timeoutMs?: number;
|
|
36
|
+
}
|
|
37
|
+
export declare function clientSupportsElicitation(server: McpServer): boolean;
|
|
38
|
+
export declare function elicit(server: McpServer, req: ElicitationRequest): Promise<ElicitationResult>;
|
|
39
|
+
//# sourceMappingURL=elicitation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elicitation.d.ts","sourceRoot":"","sources":["../src/elicitation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,MAAM,MAAM,iBAAiB,GACzB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAC7C;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,WAAW,EAAE,IAAI,CAAA;CAAE,GAChC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,IAAI,CAAA;CAAE,GAC7B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,IAAI,CAAA;CAAE,GAC9B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAOpE;AAED,wBAAsB,MAAM,CAC1B,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE,kBAAkB,GACtB,OAAO,CAAC,iBAAiB,CAAC,CA2B5B"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MCP Elicitation helper.
|
|
4
|
+
*
|
|
5
|
+
* Lets a tool ask the user structured questions mid-call via
|
|
6
|
+
* `server.elicitInput(...)`. The client renders a dialog with the schema.
|
|
7
|
+
*
|
|
8
|
+
* Capability detection: if the client does not advertise elicitation, we
|
|
9
|
+
* return `{ unsupported: true }` so the caller can fall back to a default.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.clientSupportsElicitation = clientSupportsElicitation;
|
|
13
|
+
exports.elicit = elicit;
|
|
14
|
+
const DEFAULT_TIMEOUT_MS = 60_000;
|
|
15
|
+
function clientSupportsElicitation(server) {
|
|
16
|
+
try {
|
|
17
|
+
const caps = server.server.getClientCapabilities();
|
|
18
|
+
return Boolean(caps?.elicitation);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async function elicit(server, req) {
|
|
25
|
+
if (!clientSupportsElicitation(server)) {
|
|
26
|
+
return { ok: false, unsupported: true };
|
|
27
|
+
}
|
|
28
|
+
const timeoutMs = req.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
29
|
+
try {
|
|
30
|
+
const result = (await withTimeout(server.server.elicitInput({
|
|
31
|
+
mode: "form",
|
|
32
|
+
message: req.message,
|
|
33
|
+
requestedSchema: req.schema,
|
|
34
|
+
}), timeoutMs));
|
|
35
|
+
if (result.action === "decline")
|
|
36
|
+
return { ok: false, declined: true };
|
|
37
|
+
if (result.action === "cancel")
|
|
38
|
+
return { ok: false, cancelled: true };
|
|
39
|
+
if (result.action !== "accept") {
|
|
40
|
+
return { ok: false, error: `Unknown elicit action: ${result.action}` };
|
|
41
|
+
}
|
|
42
|
+
return { ok: true, values: result.content ?? {} };
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
46
|
+
return { ok: false, error: msg };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function withTimeout(promise, ms) {
|
|
50
|
+
return new Promise((resolve, reject) => {
|
|
51
|
+
const timer = setTimeout(() => {
|
|
52
|
+
reject(new Error(`Elicitation timed out after ${ms}ms`));
|
|
53
|
+
}, ms);
|
|
54
|
+
promise.then((v) => {
|
|
55
|
+
clearTimeout(timer);
|
|
56
|
+
resolve(v);
|
|
57
|
+
}, (e) => {
|
|
58
|
+
clearTimeout(timer);
|
|
59
|
+
reject(e);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=elicitation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elicitation.js","sourceRoot":"","sources":["../src/elicitation.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAyBH,8DAOC;AAED,wBA8BC;AAzCD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,SAAgB,yBAAyB,CAAC,MAAiB;IACzD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC;QACnD,OAAO,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,MAAM,CAC1B,MAAiB,EACjB,GAAuB;IAEvB,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,EAAE,CAAC;QACvC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAC1C,CAAC;IAED,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,IAAI,kBAAkB,CAAC;IAEtD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,CAAC,MAAM,WAAW,CAC/B,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;YACxB,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,eAAe,EAAE,GAAG,CAAC,MAAe;SACr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,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,CAAC,CAAC,CAAC;QACZ,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,9 @@ const release_notes_js_1 = require("./tools/release-notes.js");
|
|
|
19
19
|
const keyword_insights_js_1 = require("./tools/keyword-insights.js");
|
|
20
20
|
const competitor_snapshot_js_1 = require("./tools/competitor-snapshot.js");
|
|
21
21
|
const metadata_diff_js_1 = require("./tools/metadata-diff.js");
|
|
22
|
-
const
|
|
22
|
+
const triage_reviews_js_1 = require("./tools/triage-reviews.js");
|
|
23
|
+
const draft_review_response_js_1 = require("./tools/draft-review-response.js");
|
|
24
|
+
const SERVER_VERSION = "1.3.0";
|
|
23
25
|
function getConfig() {
|
|
24
26
|
const keyId = process.env.ASC_KEY_ID;
|
|
25
27
|
const issuerId = process.env.ASC_ISSUER_ID;
|
|
@@ -58,6 +60,7 @@ async function main() {
|
|
|
58
60
|
tools: {},
|
|
59
61
|
prompts: {},
|
|
60
62
|
},
|
|
63
|
+
instructions: "App Store Connect MCP. Tools query the ASC API. Slash-command Prompts seed multi-tool workflows. triage_reviews and draft_review_response use MCP Sampling (your own client's model, zero extra cost). draft_review_response never auto-posts: it returns a draft only.",
|
|
61
64
|
});
|
|
62
65
|
// --- Free tools ---
|
|
63
66
|
/** Wrap a tool handler so API errors return messages instead of crashing. */
|
|
@@ -109,11 +112,62 @@ async function main() {
|
|
|
109
112
|
server.tool("metadata_diff", "Compare metadata between your live and pending app versions. Shows what changed in descriptions, keywords, and release notes across locales.", {
|
|
110
113
|
app_id: zod_1.z.string().regex(/^\d+$/, "App ID must be numeric").describe("App Store Connect app ID"),
|
|
111
114
|
}, safe((args) => (0, metadata_diff_js_1.metadataDiff)(client, args, tier)));
|
|
115
|
+
// --- Sampling-powered tools (Pro) ---
|
|
116
|
+
server.registerTool("triage_reviews", {
|
|
117
|
+
title: "Triage reviews into themes (Sampling)",
|
|
118
|
+
description: "Pull recent App Store reviews and use MCP Sampling to cluster them into 3 to 5 themes with counts, representative quotes, and action buckets (bug, missing_feature, pricing, ux, content). Sampling uses your own MCP client's model, so there is no extra cost from this server. Pro feature.",
|
|
119
|
+
inputSchema: {
|
|
120
|
+
app_id: zod_1.z.string().regex(/^\d+$/, "App ID must be numeric").describe("App Store Connect app ID"),
|
|
121
|
+
rating: zod_1.z.number().min(1).max(5).optional().describe("Filter by star rating (1 to 5). Omit for all."),
|
|
122
|
+
limit: zod_1.z.number().min(1).max(30).optional().describe("Max reviews (default 30, hard cap 30)"),
|
|
123
|
+
days: zod_1.z.number().min(1).max(90).optional().describe("Look-back window in days (default 30)"),
|
|
124
|
+
},
|
|
125
|
+
}, async (args) => {
|
|
126
|
+
try {
|
|
127
|
+
const result = await (0, triage_reviews_js_1.triageReviews)(server, client, args, tier);
|
|
128
|
+
return {
|
|
129
|
+
content: [{ type: "text", text: (0, triage_reviews_js_1.formatTriageForAgent)(result) }],
|
|
130
|
+
structuredContent: result,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
135
|
+
return { content: [{ type: "text", text: `Error: ${msg}` }] };
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
server.registerTool("draft_review_response", {
|
|
139
|
+
title: "Draft a public response to a review (Sampling + Elicitation)",
|
|
140
|
+
description: "Draft a public reply to a single App Store review via MCP Sampling, in the review's locale. Uses Elicitation (if your client supports it) to ask for tone. NEVER auto-posts. Always returns a draft that you must post via App Store Connect yourself. Pro feature.",
|
|
141
|
+
inputSchema: {
|
|
142
|
+
app_id: zod_1.z.string().regex(/^\d+$/, "App ID must be numeric").describe("App Store Connect app ID"),
|
|
143
|
+
review_id: zod_1.z.string().min(1).describe("Customer review ID (from list_reviews)"),
|
|
144
|
+
tone: zod_1.z.enum(["apologetic", "factual", "promotional", "curious"]).optional()
|
|
145
|
+
.describe("Tone; if omitted and the client supports Elicitation, the user will be asked interactively."),
|
|
146
|
+
include_support_link: zod_1.z.boolean().optional()
|
|
147
|
+
.describe("Mention that users can reach support (no phone/email, per Apple guideline 1.2)."),
|
|
148
|
+
context_note: zod_1.z.string().max(500).optional()
|
|
149
|
+
.describe("Optional context to weave in (e.g. 'fix ships in v2.5')."),
|
|
150
|
+
},
|
|
151
|
+
}, async (args) => {
|
|
152
|
+
try {
|
|
153
|
+
const result = await (0, draft_review_response_js_1.draftReviewResponse)(server, client, args, tier);
|
|
154
|
+
return {
|
|
155
|
+
content: [{ type: "text", text: (0, draft_review_response_js_1.formatDraftForAgent)(result) }],
|
|
156
|
+
structuredContent: result,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
161
|
+
return { content: [{ type: "text", text: `Error: ${msg}` }] };
|
|
162
|
+
}
|
|
163
|
+
});
|
|
112
164
|
// --- Prompts (slash commands in Claude Desktop / Code) ---
|
|
113
165
|
const prompts = (0, prompts_js_1.registerPrompts)(server);
|
|
114
166
|
console.error(`asc-mcp: ${prompts.length} prompt(s) registered: ${prompts.map((p) => "/" + p.name).join(", ")}`);
|
|
115
167
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
116
168
|
await server.connect(transport);
|
|
169
|
+
// Sampling/Elicitation capability is only known after initialize; per-tool
|
|
170
|
+
// degradation handles the mismatch (see triage_reviews + draft_review_response).
|
|
117
171
|
}
|
|
118
172
|
function dispatchCli(argv) {
|
|
119
173
|
const cmd = argv[2];
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,oEAAoE;AACpE,wEAAiF;AACjF,6BAAwB;AACxB,2CAAwC;AACxC,6CAA+C;AAC/C,6CAA+C;AAC/C,6DAAoE;AAGpE,uDAAgD;AAChD,2DAAo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AE,OAAO,IAAA,iCAAY,GAAE,CAAC;IACnD,IAAI,GAAG,KAAK,iBAAiB;QAAE,OAAO,IAAA,mCAAc,GAAE,CAAC;IACvD,IAAI,GAAG,KAAK,WAAW,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QAC7D,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAC5B,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,WAAW,cAAc;;;;;;;sCAOH,CAAC,CAAC;QACpC,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC5C,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;IACvB,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC1B,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Sampling helper.
|
|
3
|
+
*
|
|
4
|
+
* Calls `server.createMessage(...)` on the underlying MCP Server so the
|
|
5
|
+
* user's own client runs the LLM request. Zero cost to us (we do not pay
|
|
6
|
+
* for the user's Anthropic tokens).
|
|
7
|
+
*
|
|
8
|
+
* Capability detection: we check the client's declared capabilities at
|
|
9
|
+
* initialize time. If sampling is not advertised, the caller gets a
|
|
10
|
+
* structured `{ unsupported: true }` response and must degrade gracefully.
|
|
11
|
+
*/
|
|
12
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
13
|
+
import type { ModelPreferences } from "@modelcontextprotocol/sdk/types.js";
|
|
14
|
+
export type SamplingResult = {
|
|
15
|
+
ok: true;
|
|
16
|
+
text: string;
|
|
17
|
+
model: string;
|
|
18
|
+
stopReason: string | undefined;
|
|
19
|
+
} | {
|
|
20
|
+
ok: false;
|
|
21
|
+
unsupported: true;
|
|
22
|
+
} | {
|
|
23
|
+
ok: false;
|
|
24
|
+
error: string;
|
|
25
|
+
};
|
|
26
|
+
export interface SamplingRequest {
|
|
27
|
+
system?: string;
|
|
28
|
+
user: string;
|
|
29
|
+
maxTokens: number;
|
|
30
|
+
temperature?: number;
|
|
31
|
+
modelPreferences?: ModelPreferences;
|
|
32
|
+
timeoutMs?: number;
|
|
33
|
+
}
|
|
34
|
+
export declare function clientSupportsSampling(server: McpServer): boolean;
|
|
35
|
+
export declare function sample(server: McpServer, req: SamplingRequest): Promise<SamplingResult>;
|
|
36
|
+
export declare const MODEL_HINTS: {
|
|
37
|
+
fast: {
|
|
38
|
+
speedPriority: number;
|
|
39
|
+
costPriority: number;
|
|
40
|
+
intelligencePriority: number;
|
|
41
|
+
};
|
|
42
|
+
balanced: {
|
|
43
|
+
speedPriority: number;
|
|
44
|
+
costPriority: number;
|
|
45
|
+
intelligencePriority: number;
|
|
46
|
+
};
|
|
47
|
+
smart: {
|
|
48
|
+
speedPriority: number;
|
|
49
|
+
costPriority: number;
|
|
50
|
+
intelligencePriority: number;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=sampling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampling.d.ts","sourceRoot":"","sources":["../src/sampling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,oCAAoC,CAAC;AAE5C,MAAM,MAAM,cAAc,GACtB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GACzE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,WAAW,EAAE,IAAI,CAAA;CAAE,GAChC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjC,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAOjE;AAED,wBAAsB,MAAM,CAC1B,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE,eAAe,GACnB,OAAO,CAAC,cAAc,CAAC,CAuCzB;AAuCD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBvB,CAAC"}
|
package/dist/sampling.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MCP Sampling helper.
|
|
4
|
+
*
|
|
5
|
+
* Calls `server.createMessage(...)` on the underlying MCP Server so the
|
|
6
|
+
* user's own client runs the LLM request. Zero cost to us (we do not pay
|
|
7
|
+
* for the user's Anthropic tokens).
|
|
8
|
+
*
|
|
9
|
+
* Capability detection: we check the client's declared capabilities at
|
|
10
|
+
* initialize time. If sampling is not advertised, the caller gets a
|
|
11
|
+
* structured `{ unsupported: true }` response and must degrade gracefully.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.MODEL_HINTS = void 0;
|
|
15
|
+
exports.clientSupportsSampling = clientSupportsSampling;
|
|
16
|
+
exports.sample = sample;
|
|
17
|
+
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
18
|
+
function clientSupportsSampling(server) {
|
|
19
|
+
try {
|
|
20
|
+
const caps = server.server.getClientCapabilities();
|
|
21
|
+
return Boolean(caps?.sampling);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function sample(server, req) {
|
|
28
|
+
if (!clientSupportsSampling(server)) {
|
|
29
|
+
return { ok: false, unsupported: true };
|
|
30
|
+
}
|
|
31
|
+
const timeoutMs = req.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
32
|
+
const messages = [
|
|
33
|
+
{
|
|
34
|
+
role: "user",
|
|
35
|
+
content: { type: "text", text: req.user },
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
try {
|
|
39
|
+
const result = (await withTimeout(server.server.createMessage({
|
|
40
|
+
messages,
|
|
41
|
+
systemPrompt: req.system,
|
|
42
|
+
maxTokens: req.maxTokens,
|
|
43
|
+
temperature: req.temperature,
|
|
44
|
+
modelPreferences: req.modelPreferences,
|
|
45
|
+
}), timeoutMs));
|
|
46
|
+
const text = extractText(result);
|
|
47
|
+
if (!text) {
|
|
48
|
+
return { ok: false, error: "Sampling returned no text content." };
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
ok: true,
|
|
52
|
+
text,
|
|
53
|
+
model: result.model ?? "unknown",
|
|
54
|
+
stopReason: result.stopReason,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
59
|
+
return { ok: false, error: msg };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function extractText(result) {
|
|
63
|
+
const content = result.content;
|
|
64
|
+
if (!content)
|
|
65
|
+
return "";
|
|
66
|
+
if (Array.isArray(content)) {
|
|
67
|
+
const textBlocks = content.filter((b) => typeof b === "object" && b !== null && b.type === "text");
|
|
68
|
+
return textBlocks.map((b) => b.text).join("\n").trim();
|
|
69
|
+
}
|
|
70
|
+
if (typeof content === "object" && content !== null) {
|
|
71
|
+
const maybeBlock = content;
|
|
72
|
+
if (maybeBlock.type === "text" && typeof maybeBlock.text === "string") {
|
|
73
|
+
return maybeBlock.text.trim();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return "";
|
|
77
|
+
}
|
|
78
|
+
function withTimeout(promise, ms) {
|
|
79
|
+
return new Promise((resolve, reject) => {
|
|
80
|
+
const timer = setTimeout(() => {
|
|
81
|
+
reject(new Error(`Sampling timed out after ${ms}ms`));
|
|
82
|
+
}, ms);
|
|
83
|
+
promise.then((v) => {
|
|
84
|
+
clearTimeout(timer);
|
|
85
|
+
resolve(v);
|
|
86
|
+
}, (e) => {
|
|
87
|
+
clearTimeout(timer);
|
|
88
|
+
reject(e);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
exports.MODEL_HINTS = {
|
|
93
|
+
fast: {
|
|
94
|
+
speedPriority: 0.6,
|
|
95
|
+
costPriority: 0.3,
|
|
96
|
+
intelligencePriority: 0.1,
|
|
97
|
+
},
|
|
98
|
+
balanced: {
|
|
99
|
+
speedPriority: 0.4,
|
|
100
|
+
costPriority: 0.3,
|
|
101
|
+
intelligencePriority: 0.3,
|
|
102
|
+
},
|
|
103
|
+
smart: {
|
|
104
|
+
speedPriority: 0.2,
|
|
105
|
+
costPriority: 0.2,
|
|
106
|
+
intelligencePriority: 0.6,
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=sampling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampling.js","sourceRoot":"","sources":["../src/sampling.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAwBH,w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AAW,CAAI,OAAmB,EAAE,EAAU;IACrD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,MAAM,CAAC,IAAI,KAAK,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAC,CAAC;QACxD,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,OAAO,CAAC,IAAI,CACV,CAAC,CAAC,EAAE,EAAE;YACJ,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,CAAC,CAAC,CAAC;QACb,CAAC,EACD,CAAC,CAAC,EAAE,EAAE;YACJ,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,CAAC,CAAC,CAAC;QACZ,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAEY,QAAA,WAAW,GAAG;IACzB,IAAI,EAAE;QACJ,aAAa,EAAE,GAAG;QAClB,YAAY,EAAE,GAAG;QACjB,oBAAoB,EAAE,GAAG;KACC;IAC5B,QAAQ,EAAE;QACR,aAAa,EAAE,GAAG;QAClB,YAAY,EAAE,GAAG;QACjB,oBAAoB,EAAE,GAAG;KACC;IAC5B,KAAK,EAAE;QACL,aAAa,EAAE,GAAG;QAClB,YAAY,EAAE,GAAG;QACjB,oBAAoB,EAAE,GAAG;KACC;CAC7B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* draft_review_response tool (Pro). Drafts a public reply to a single
|
|
3
|
+
* App Store review via Sampling, in the review's locale. Never posts.
|
|
4
|
+
*
|
|
5
|
+
* Pipeline:
|
|
6
|
+
* 1. Fetch the target review
|
|
7
|
+
* 2. If `tone` not provided and client supports Elicitation, ask for it
|
|
8
|
+
* 3. Sampling request to draft the reply
|
|
9
|
+
* 4. Post-filter draft for Apple guideline 1.2 violations (disputes,
|
|
10
|
+
* promo-only content, personal info)
|
|
11
|
+
* 5. Return draft with a warning. Never call Apple's POST endpoint.
|
|
12
|
+
*/
|
|
13
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
14
|
+
import type { ASCClient } from "../client.js";
|
|
15
|
+
import type { Tier } from "../types.js";
|
|
16
|
+
type Tone = "apologetic" | "factual" | "promotional" | "curious";
|
|
17
|
+
export interface DraftArgs {
|
|
18
|
+
app_id: string;
|
|
19
|
+
review_id: string;
|
|
20
|
+
tone?: Tone;
|
|
21
|
+
include_support_link?: boolean;
|
|
22
|
+
context_note?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface DraftResult {
|
|
25
|
+
app_id: string;
|
|
26
|
+
review_id: string;
|
|
27
|
+
locale: string;
|
|
28
|
+
tone_used: Tone | "default_factual";
|
|
29
|
+
draft: string;
|
|
30
|
+
warning: string;
|
|
31
|
+
degraded: boolean;
|
|
32
|
+
note?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare function draftReviewResponse(server: McpServer, client: ASCClient, args: DraftArgs, tier: Tier): Promise<DraftResult>;
|
|
35
|
+
export declare function formatDraftForAgent(res: DraftResult): string;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=draft-review-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-review-response.d.ts","sourceRoot":"","sources":["../../src/tools/draft-review-response.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAaxC,KAAK,IAAI,GAAG,YAAY,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;AAGjE,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,GAAG,iBAAiB,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAYD,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,WAAW,CAAC,CAkJtB;AAwED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,CAY5D"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* draft_review_response tool (Pro). Drafts a public reply to a single
|
|
4
|
+
* App Store review via Sampling, in the review's locale. Never posts.
|
|
5
|
+
*
|
|
6
|
+
* Pipeline:
|
|
7
|
+
* 1. Fetch the target review
|
|
8
|
+
* 2. If `tone` not provided and client supports Elicitation, ask for it
|
|
9
|
+
* 3. Sampling request to draft the reply
|
|
10
|
+
* 4. Post-filter draft for Apple guideline 1.2 violations (disputes,
|
|
11
|
+
* promo-only content, personal info)
|
|
12
|
+
* 5. Return draft with a warning. Never call Apple's POST endpoint.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.draftReviewResponse = draftReviewResponse;
|
|
16
|
+
exports.formatDraftForAgent = formatDraftForAgent;
|
|
17
|
+
const sampling_js_1 = require("../sampling.js");
|
|
18
|
+
const elicitation_js_1 = require("../elicitation.js");
|
|
19
|
+
const TONES = ["apologetic", "factual", "promotional", "curious"];
|
|
20
|
+
const APPLE_GUIDELINE_DISCLAIMER = "This is a draft, not a posted response. Always review before posting via App Store Connect. We never post on your behalf.";
|
|
21
|
+
const FORBIDDEN_PATTERNS = [
|
|
22
|
+
{ re: /refund\s+(your|you)|contact\s+apple/i, reason: "avoid directing users to Apple for refunds" },
|
|
23
|
+
{ re: /lawyer|legal action|sue|attorney/i, reason: "no legal threats" },
|
|
24
|
+
{ re: /\b\d{3}[-\s]?\d{3}[-\s]?\d{4}\b/, reason: "remove phone numbers" },
|
|
25
|
+
{ re: /\b[\w.+-]+@[\w-]+\.[\w.-]+\b/, reason: "replace email with a generic support link" },
|
|
26
|
+
];
|
|
27
|
+
async function draftReviewResponse(server, client, args, tier) {
|
|
28
|
+
if (tier !== "pro") {
|
|
29
|
+
return emptyResult(args, "default_factual", {
|
|
30
|
+
note: "draft_review_response requires a Pro license ($9/mo). Get your license at https://buy.polar.sh/polar_cl_Ta3OxEA1EbRyYNPFtSsRXgYWBCCtjwMxlbAeW35RLuu",
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
let review;
|
|
34
|
+
try {
|
|
35
|
+
const response = await client.get(`/v1/customerReviews/${args.review_id}`, { "fields[customerReviews]": "rating,title,body,reviewerNickname,createdDate,territory" });
|
|
36
|
+
const data = Array.isArray(response.data) ? response.data[0] : response.data;
|
|
37
|
+
if (!data) {
|
|
38
|
+
return emptyResult(args, "default_factual", {
|
|
39
|
+
note: `Review ${args.review_id} not found.`,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
review = data.attributes;
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
return emptyResult(args, "default_factual", {
|
|
46
|
+
note: `Could not fetch review: ${err instanceof Error ? err.message : String(err)}`,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const locale = localeFromTerritory(review.territory);
|
|
50
|
+
let tone = args.tone ?? "default_factual";
|
|
51
|
+
let includeSupportLink = args.include_support_link ?? false;
|
|
52
|
+
let contextNote = (args.context_note ?? "").slice(0, 500);
|
|
53
|
+
if (!args.tone && (0, elicitation_js_1.clientSupportsElicitation)(server)) {
|
|
54
|
+
const elicitResult = await (0, elicitation_js_1.elicit)(server, {
|
|
55
|
+
message: `Drafting a response to a ${review.rating}-star review from ${review.territory}. Set the tone.`,
|
|
56
|
+
schema: {
|
|
57
|
+
type: "object",
|
|
58
|
+
properties: {
|
|
59
|
+
tone: {
|
|
60
|
+
type: "string",
|
|
61
|
+
enum: TONES,
|
|
62
|
+
description: "Response tone.",
|
|
63
|
+
},
|
|
64
|
+
include_support_link: {
|
|
65
|
+
type: "boolean",
|
|
66
|
+
description: "Mention that users can reach support with questions.",
|
|
67
|
+
},
|
|
68
|
+
context_note: {
|
|
69
|
+
type: "string",
|
|
70
|
+
description: "Optional context to weave in (release notes, known-fix mention).",
|
|
71
|
+
maxLength: 500,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
required: ["tone"],
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
if (elicitResult.ok) {
|
|
78
|
+
const v = elicitResult.values;
|
|
79
|
+
if (typeof v.tone === "string" && TONES.includes(v.tone)) {
|
|
80
|
+
tone = v.tone;
|
|
81
|
+
}
|
|
82
|
+
if (typeof v.include_support_link === "boolean") {
|
|
83
|
+
includeSupportLink = v.include_support_link;
|
|
84
|
+
}
|
|
85
|
+
if (typeof v.context_note === "string") {
|
|
86
|
+
contextNote = v.context_note.slice(0, 500);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// declined/cancelled/unsupported all fall through to defaults
|
|
90
|
+
}
|
|
91
|
+
const toneDirective = toneToDirective(tone);
|
|
92
|
+
const supportClause = includeSupportLink
|
|
93
|
+
? "Remind the user they can reach us for further help. Do not include a specific email or phone."
|
|
94
|
+
: "";
|
|
95
|
+
const contextClause = contextNote ? `Customer context to respect: ${contextNote}` : "";
|
|
96
|
+
const systemPrompt = [
|
|
97
|
+
"You are drafting a public App Store developer response to a customer review.",
|
|
98
|
+
"Rules:",
|
|
99
|
+
` - Write in the language matching locale ${locale} (ISO code). For en, write English.`,
|
|
100
|
+
" - Apple guideline 1.2 applies: stay factual, courteous, avoid disputing the customer.",
|
|
101
|
+
" - Keep under 500 characters (Apple's practical limit for readability).",
|
|
102
|
+
" - Never include: email addresses, phone numbers, legal threats, refund promises, competitor names, AI disclosures.",
|
|
103
|
+
" - Do not quote the reviewer back at length.",
|
|
104
|
+
" - One paragraph maximum. No headers, no markdown, no emoji unless locale-appropriate.",
|
|
105
|
+
toneDirective,
|
|
106
|
+
supportClause,
|
|
107
|
+
contextClause,
|
|
108
|
+
"Reply with the draft text only, no preamble, no quotes around it.",
|
|
109
|
+
]
|
|
110
|
+
.filter(Boolean)
|
|
111
|
+
.join("\n");
|
|
112
|
+
const userPrompt = [
|
|
113
|
+
`Review (${review.rating}/5):`,
|
|
114
|
+
`Title: ${review.title || "(none)"}`,
|
|
115
|
+
`Body: ${review.body || "(none)"}`,
|
|
116
|
+
`Reviewer: ${review.reviewerNickname || "Anonymous"}`,
|
|
117
|
+
`Territory: ${review.territory}`,
|
|
118
|
+
].join("\n");
|
|
119
|
+
const samplingResult = await (0, sampling_js_1.sample)(server, {
|
|
120
|
+
system: systemPrompt,
|
|
121
|
+
user: userPrompt,
|
|
122
|
+
maxTokens: 500,
|
|
123
|
+
temperature: 0.4,
|
|
124
|
+
modelPreferences: sampling_js_1.MODEL_HINTS.balanced,
|
|
125
|
+
});
|
|
126
|
+
if (!samplingResult.ok) {
|
|
127
|
+
if ("unsupported" in samplingResult && samplingResult.unsupported) {
|
|
128
|
+
return emptyResult(args, tone, {
|
|
129
|
+
locale,
|
|
130
|
+
note: "Your MCP client does not support Sampling. Drafting unavailable. Upgrade Claude Desktop or Claude Code, or draft by hand.",
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return emptyResult(args, tone, {
|
|
134
|
+
locale,
|
|
135
|
+
note: `Sampling failed: ${"error" in samplingResult ? samplingResult.error : "unknown"}`,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
const draft = cleanDraft(samplingResult.text);
|
|
139
|
+
const filterViolation = filterForbidden(draft);
|
|
140
|
+
if (filterViolation) {
|
|
141
|
+
return {
|
|
142
|
+
app_id: args.app_id,
|
|
143
|
+
review_id: args.review_id,
|
|
144
|
+
locale,
|
|
145
|
+
tone_used: tone,
|
|
146
|
+
draft: "",
|
|
147
|
+
warning: `Draft rejected by post-filter: ${filterViolation}. Try a different tone, or edit manually.`,
|
|
148
|
+
degraded: true,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
app_id: args.app_id,
|
|
153
|
+
review_id: args.review_id,
|
|
154
|
+
locale,
|
|
155
|
+
tone_used: tone,
|
|
156
|
+
draft,
|
|
157
|
+
warning: APPLE_GUIDELINE_DISCLAIMER,
|
|
158
|
+
degraded: false,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function emptyResult(args, tone, extras) {
|
|
162
|
+
return {
|
|
163
|
+
app_id: args.app_id,
|
|
164
|
+
review_id: args.review_id,
|
|
165
|
+
locale: extras.locale ?? "en",
|
|
166
|
+
tone_used: tone,
|
|
167
|
+
draft: "",
|
|
168
|
+
warning: APPLE_GUIDELINE_DISCLAIMER,
|
|
169
|
+
degraded: true,
|
|
170
|
+
note: extras.note,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function localeFromTerritory(territory) {
|
|
174
|
+
const map = {
|
|
175
|
+
US: "en", GB: "en", CA: "en", AU: "en", IE: "en", NZ: "en",
|
|
176
|
+
DE: "de", AT: "de", CH: "de",
|
|
177
|
+
FR: "fr", BE: "fr",
|
|
178
|
+
ES: "es", MX: "es", AR: "es", CO: "es", CL: "es",
|
|
179
|
+
IT: "it",
|
|
180
|
+
NL: "nl",
|
|
181
|
+
JP: "ja",
|
|
182
|
+
KR: "ko",
|
|
183
|
+
CN: "zh-Hans", HK: "zh-Hant", TW: "zh-Hant",
|
|
184
|
+
BR: "pt-BR", PT: "pt",
|
|
185
|
+
RU: "ru",
|
|
186
|
+
PL: "pl",
|
|
187
|
+
TR: "tr",
|
|
188
|
+
SE: "sv",
|
|
189
|
+
NO: "nb",
|
|
190
|
+
DK: "da",
|
|
191
|
+
FI: "fi",
|
|
192
|
+
};
|
|
193
|
+
return map[territory] ?? "en";
|
|
194
|
+
}
|
|
195
|
+
function toneToDirective(tone) {
|
|
196
|
+
switch (tone) {
|
|
197
|
+
case "apologetic":
|
|
198
|
+
return "Tone: warmly apologetic. Acknowledge the issue, avoid excuses.";
|
|
199
|
+
case "promotional":
|
|
200
|
+
return "Tone: brief, forward-looking. Mention an upcoming improvement only if it is real and concrete.";
|
|
201
|
+
case "curious":
|
|
202
|
+
return "Tone: curious and inviting. Ask one clarifying question in case they want to share more detail.";
|
|
203
|
+
case "factual":
|
|
204
|
+
case "default_factual":
|
|
205
|
+
default:
|
|
206
|
+
return "Tone: neutral and factual. Acknowledge, then state what you intend to do next.";
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function cleanDraft(text) {
|
|
210
|
+
return text
|
|
211
|
+
.trim()
|
|
212
|
+
.replace(/^["']|["']$/g, "")
|
|
213
|
+
.replace(/^\s*(draft|reply|response)\s*[:\-]\s*/i, "")
|
|
214
|
+
.slice(0, 1200);
|
|
215
|
+
}
|
|
216
|
+
function filterForbidden(draft) {
|
|
217
|
+
for (const { re, reason } of FORBIDDEN_PATTERNS) {
|
|
218
|
+
if (re.test(draft))
|
|
219
|
+
return reason;
|
|
220
|
+
}
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
function formatDraftForAgent(res) {
|
|
224
|
+
if (!res.draft) {
|
|
225
|
+
return res.note ?? "No draft produced.";
|
|
226
|
+
}
|
|
227
|
+
const lines = [
|
|
228
|
+
`# Draft response (locale ${res.locale}, tone ${res.tone_used})`,
|
|
229
|
+
"",
|
|
230
|
+
res.draft,
|
|
231
|
+
"",
|
|
232
|
+
`_${res.warning}_`,
|
|
233
|
+
];
|
|
234
|
+
return lines.join("\n");
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=draft-review-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-review-response.js","sourceRoot":"","sources":["../../src/tools/draft-review-response.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AAiDH,kDAuJC;AAwED,kDAYC;AAvRD,gDAAqD;AACrD,sDAAsE;AAYtE,MAAM,KAAK,GAAW,CAAC,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;AAqB1E,MAAM,0BAA0B,GAC9B,2HAA2H,CAAC;AAE9H,MAAM,kBAAkB,GAA0C;IAChE,EAAE,EAAE,EAAE,sCAAsC,EAAE,MAAM,EAAE,4CAA4C,EAAE;IACpG,EAAE,EAAE,EAAE,mCAAmC,EAAE,MAAM,EAAE,kBAAkB,EAAE;IACvE,EAAE,EAAE,EAAE,iCAAiC,EAAE,MAAM,EAAE,sBAAsB,EAAE;IACzE,EAAE,EAAE,EAAE,8BAA8B,EAAE,MAAM,EAAE,2CAA2C,EAAE;CAC5F,CAAC;AAEK,KAAK,UAAU,mBAAmB,CACvC,MAAiB,EACjB,MAAiB,EACjB,IAAe,EACf,IAAU;IAEV,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,OAAO,WAAW,CAAC,IAAI,EAAE,iBAAiB,EAAE;YAC1C,IAAI,EAAE,qJAAqJ;SAC5J,CAAC,CAAC;IACL,CAAC;IAED,IAAI,MAAwB,CAAC;IAC7B,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAC/B,uBAAuB,IAAI,CAAC,SAAS,EAAE,EACvC,EAAE,yBAAyB,EAAE,0DAA0D,EAAE,CAC1F,CAAC;QACF,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC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CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACf,OAAO,GAAG,CAAC,IAAI,IAAI,oBAAoB,CAAC;IAC1C,CAAC;IACD,MAAM,KAAK,GAAG;QACZ,4BAA4B,GAAG,CAAC,MAAM,UAAU,GAAG,CAAC,SAAS,GAAG;QAChE,EAAE;QACF,GAAG,CAAC,KAAK;QACT,EAAE;QACF,IAAI,GAAG,CAAC,OAAO,GAAG;KACnB,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* triage_reviews tool (Pro). Uses MCP Sampling to cluster customer reviews
|
|
3
|
+
* into themes on the user's own Claude (zero cost to us).
|
|
4
|
+
*
|
|
5
|
+
* Pipeline:
|
|
6
|
+
* 1. Fetch up to `limit` reviews via the ASC API (reuses list_reviews logic)
|
|
7
|
+
* 2. If none, return empty result, skip Sampling
|
|
8
|
+
* 3. Ask the user's client to cluster via Sampling
|
|
9
|
+
* 4. Parse JSON response from the model; degrade gracefully on parse error
|
|
10
|
+
*/
|
|
11
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
12
|
+
import type { ASCClient } from "../client.js";
|
|
13
|
+
import type { Tier } from "../types.js";
|
|
14
|
+
interface Theme {
|
|
15
|
+
theme: string;
|
|
16
|
+
count: number;
|
|
17
|
+
action_bucket: "bug" | "missing_feature" | "pricing" | "ux" | "content" | "other";
|
|
18
|
+
quote: string;
|
|
19
|
+
}
|
|
20
|
+
export interface TriageResult {
|
|
21
|
+
app_id: string;
|
|
22
|
+
reviews_analyzed: number;
|
|
23
|
+
themes: Theme[];
|
|
24
|
+
note?: string;
|
|
25
|
+
degraded: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare function triageReviews(server: McpServer, client: ASCClient, args: {
|
|
28
|
+
app_id: string;
|
|
29
|
+
rating?: number;
|
|
30
|
+
limit?: number;
|
|
31
|
+
days?: number;
|
|
32
|
+
}, tier: Tier): Promise<TriageResult>;
|
|
33
|
+
export declare function formatTriageForAgent(res: TriageResult): string;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=triage-reviews.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triage-reviews.d.ts","sourceRoot":"","sources":["../../src/tools/triage-reviews.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAYxC,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,KAAK,GAAG,iBAAiB,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC;IAClF,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB;AAuBD,wBAAsB,aAAa,CACjC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EACxE,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,YAAY,CAAC,CA4GvB;AA2CD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAkB9D"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* triage_reviews tool (Pro). Uses MCP Sampling to cluster customer reviews
|
|
4
|
+
* into themes on the user's own Claude (zero cost to us).
|
|
5
|
+
*
|
|
6
|
+
* Pipeline:
|
|
7
|
+
* 1. Fetch up to `limit` reviews via the ASC API (reuses list_reviews logic)
|
|
8
|
+
* 2. If none, return empty result, skip Sampling
|
|
9
|
+
* 3. Ask the user's client to cluster via Sampling
|
|
10
|
+
* 4. Parse JSON response from the model; degrade gracefully on parse error
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.triageReviews = triageReviews;
|
|
14
|
+
exports.formatTriageForAgent = formatTriageForAgent;
|
|
15
|
+
const sampling_js_1 = require("../sampling.js");
|
|
16
|
+
const MAX_REVIEWS = 30;
|
|
17
|
+
const MIN_FOR_CLUSTERING = 3;
|
|
18
|
+
const SYSTEM_PROMPT = [
|
|
19
|
+
"You are a product-review triage assistant.",
|
|
20
|
+
"Given a list of App Store reviews, group them into 3 to 5 themes.",
|
|
21
|
+
"Each theme gets:",
|
|
22
|
+
" - a short label (3 to 7 words)",
|
|
23
|
+
" - the exact count of reviews that fit it",
|
|
24
|
+
" - an action_bucket from: bug, missing_feature, pricing, ux, content, other",
|
|
25
|
+
" - a single representative verbatim quote (must be one of the reviews, unedited)",
|
|
26
|
+
"",
|
|
27
|
+
"Rules:",
|
|
28
|
+
" - Reply ONLY with a valid JSON object matching the schema below. No prose, no markdown.",
|
|
29
|
+
" - Never invent themes with zero reviews.",
|
|
30
|
+
" - Never invent quotes; they must appear in the input verbatim.",
|
|
31
|
+
" - If fewer than 3 reviews, still produce 1 to 2 themes.",
|
|
32
|
+
"",
|
|
33
|
+
'Schema: { "themes": [{ "theme": string, "count": number, "action_bucket": string, "quote": string }] }',
|
|
34
|
+
].join("\n");
|
|
35
|
+
async function triageReviews(server, client, args, tier) {
|
|
36
|
+
if (tier !== "pro") {
|
|
37
|
+
return {
|
|
38
|
+
app_id: args.app_id,
|
|
39
|
+
reviews_analyzed: 0,
|
|
40
|
+
themes: [],
|
|
41
|
+
degraded: true,
|
|
42
|
+
note: "Review triage requires a Pro license ($9/mo). Get your license at https://buy.polar.sh/polar_cl_Ta3OxEA1EbRyYNPFtSsRXgYWBCCtjwMxlbAeW35RLuu",
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const limit = Math.min(args.limit ?? 30, MAX_REVIEWS);
|
|
46
|
+
const params = {
|
|
47
|
+
"fields[customerReviews]": "rating,title,body,reviewerNickname,createdDate,territory",
|
|
48
|
+
limit: String(limit),
|
|
49
|
+
sort: "-createdDate",
|
|
50
|
+
};
|
|
51
|
+
if (args.rating && args.rating >= 1 && args.rating <= 5) {
|
|
52
|
+
params["filter[rating]"] = String(args.rating);
|
|
53
|
+
}
|
|
54
|
+
const response = await client.get(`/v1/apps/${args.app_id}/customerReviews`, params);
|
|
55
|
+
const reviews = Array.isArray(response.data) ? response.data : [response.data];
|
|
56
|
+
const total = reviews.length;
|
|
57
|
+
if (total === 0) {
|
|
58
|
+
return {
|
|
59
|
+
app_id: args.app_id,
|
|
60
|
+
reviews_analyzed: 0,
|
|
61
|
+
themes: [],
|
|
62
|
+
degraded: false,
|
|
63
|
+
note: "No reviews found for this app in the requested window.",
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (total < MIN_FOR_CLUSTERING) {
|
|
67
|
+
const themes = reviews.map((r) => {
|
|
68
|
+
const a = r.attributes;
|
|
69
|
+
return {
|
|
70
|
+
theme: (a.title || a.body.slice(0, 40) || "Untitled").slice(0, 60),
|
|
71
|
+
count: 1,
|
|
72
|
+
action_bucket: "other",
|
|
73
|
+
quote: (a.body || a.title || "").slice(0, 240),
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
app_id: args.app_id,
|
|
78
|
+
reviews_analyzed: total,
|
|
79
|
+
themes,
|
|
80
|
+
degraded: false,
|
|
81
|
+
note: `Only ${total} review(s) found; returning pass-through summary without Sampling.`,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const reviewText = reviews
|
|
85
|
+
.map((r, i) => {
|
|
86
|
+
const a = r.attributes;
|
|
87
|
+
return `[${i + 1}] ${a.rating}/5 - ${a.territory} - "${a.title || ""}" :: ${a.body || ""}`;
|
|
88
|
+
})
|
|
89
|
+
.join("\n");
|
|
90
|
+
const samplingResult = await (0, sampling_js_1.sample)(server, {
|
|
91
|
+
system: SYSTEM_PROMPT,
|
|
92
|
+
user: `Cluster these ${total} App Store reviews into 3 to 5 themes. Reply with JSON only.\n\n${reviewText}`,
|
|
93
|
+
maxTokens: 1200,
|
|
94
|
+
modelPreferences: sampling_js_1.MODEL_HINTS.fast,
|
|
95
|
+
});
|
|
96
|
+
if (!samplingResult.ok) {
|
|
97
|
+
if ("unsupported" in samplingResult && samplingResult.unsupported) {
|
|
98
|
+
return {
|
|
99
|
+
app_id: args.app_id,
|
|
100
|
+
reviews_analyzed: total,
|
|
101
|
+
themes: [],
|
|
102
|
+
degraded: true,
|
|
103
|
+
note: "Your MCP client does not support Sampling. Raw review bodies returned; ask your agent to cluster manually.",
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
app_id: args.app_id,
|
|
108
|
+
reviews_analyzed: total,
|
|
109
|
+
themes: [],
|
|
110
|
+
degraded: true,
|
|
111
|
+
note: `Sampling failed: ${"error" in samplingResult ? samplingResult.error : "unknown"}. Raw reviews returned.`,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const parsed = safeParseThemes(samplingResult.text);
|
|
115
|
+
if (!parsed) {
|
|
116
|
+
return {
|
|
117
|
+
app_id: args.app_id,
|
|
118
|
+
reviews_analyzed: total,
|
|
119
|
+
themes: [],
|
|
120
|
+
degraded: true,
|
|
121
|
+
note: `Sampling returned invalid JSON. Raw: ${samplingResult.text.slice(0, 200)}`,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
app_id: args.app_id,
|
|
126
|
+
reviews_analyzed: total,
|
|
127
|
+
themes: parsed,
|
|
128
|
+
degraded: false,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function safeParseThemes(text) {
|
|
132
|
+
let json = text.trim();
|
|
133
|
+
const fenced = json.match(/```(?:json)?\s*([\s\S]+?)```/);
|
|
134
|
+
if (fenced)
|
|
135
|
+
json = fenced[1].trim();
|
|
136
|
+
try {
|
|
137
|
+
const obj = JSON.parse(json);
|
|
138
|
+
if (!obj.themes || !Array.isArray(obj.themes))
|
|
139
|
+
return null;
|
|
140
|
+
const out = [];
|
|
141
|
+
for (const t of obj.themes) {
|
|
142
|
+
if (!t || typeof t !== "object")
|
|
143
|
+
continue;
|
|
144
|
+
const row = t;
|
|
145
|
+
const theme = String(row.theme ?? "").slice(0, 120);
|
|
146
|
+
const count = Number(row.count ?? 0);
|
|
147
|
+
const actionBucket = String(row.action_bucket ?? "other");
|
|
148
|
+
const quote = String(row.quote ?? "").slice(0, 500);
|
|
149
|
+
if (!theme || count <= 0)
|
|
150
|
+
continue;
|
|
151
|
+
out.push({
|
|
152
|
+
theme,
|
|
153
|
+
count,
|
|
154
|
+
action_bucket: validBucket(actionBucket),
|
|
155
|
+
quote,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return out.slice(0, 8);
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function validBucket(s) {
|
|
165
|
+
const allowed = [
|
|
166
|
+
"bug",
|
|
167
|
+
"missing_feature",
|
|
168
|
+
"pricing",
|
|
169
|
+
"ux",
|
|
170
|
+
"content",
|
|
171
|
+
"other",
|
|
172
|
+
];
|
|
173
|
+
return allowed.includes(s) ? s : "other";
|
|
174
|
+
}
|
|
175
|
+
function formatTriageForAgent(res) {
|
|
176
|
+
if (res.themes.length === 0) {
|
|
177
|
+
return res.note ?? "No reviews to triage.";
|
|
178
|
+
}
|
|
179
|
+
const lines = [
|
|
180
|
+
`# Review triage: app ${res.app_id}`,
|
|
181
|
+
`Reviews analyzed: ${res.reviews_analyzed}${res.degraded ? " (degraded)" : ""}`,
|
|
182
|
+
"",
|
|
183
|
+
];
|
|
184
|
+
for (const t of res.themes) {
|
|
185
|
+
lines.push(`## ${t.theme} (${t.count}, ${t.action_bucket})`);
|
|
186
|
+
lines.push(`> ${t.quote}`);
|
|
187
|
+
lines.push("");
|
|
188
|
+
}
|
|
189
|
+
if (res.note) {
|
|
190
|
+
lines.push(`_${res.note}_`);
|
|
191
|
+
}
|
|
192
|
+
return lines.join("\n");
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=triage-reviews.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triage-reviews.js","sourceRoot":"","sources":["../../src/tools/triage-reviews.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAoDH,sCAiHC;AA2CD,oDAkBC;AA7ND,gDAAqD;AA0BrD,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,MAAM,aAAa,GAAG;IACpB,4CAA4C;IAC5C,mEAAmE;IACnE,kBAAkB;IAClB,kCAAkC;IAClC,4CAA4C;IAC5C,8EAA8E;IAC9E,mFAAmF;IACnF,EAAE;IACF,QAAQ;IACR,2FAA2F;IAC3F,4CAA4C;IAC5C,kEAAkE;IAClE,2DAA2D;IAC3D,EAAE;IACF,wGAAwG;CACzG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEN,KAAK,UAAU,aAAa,CACjC,MAAiB,EACjB,MAAiB,EACjB,IAAwE,EACxE,IAAU;IAEV,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,gBAAgB,EAAE,CAAC;YACnB,MAAM,EAAE,EAAE;YACV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,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,CAA4B,CAAC,CAAC,CAAC,OAAO,CAAC;AACrF,CAAC;AAED,SAAgB,oBAAoB,CAAC,GAAiB;IACpD,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,CAAC,IAAI,IAAI,uBAAuB,CAAC;IAC7C,CAAC;IACD,MAAM,KAAK,GAAa;QACtB,wBAAwB,GAAG,CAAC,MAAM,EAAE;QACpC,qBAAqB,GAAG,CAAC,gBAAgB,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE;QAC/E,EAAE;KACH,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC;QAC9D,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACb,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pofky/asc-mcp",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "The App Store Connect intelligence layer for your coding agent.
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "The App Store Connect intelligence layer for your coding agent. 13 tools (including Sampling-powered review triage and locale-aware response drafts), 3 slash-command Prompts, and a bundled Claude Skill. Works with Claude Code, Claude Desktop, Cursor, Windsurf, or any MCP-compatible client. Free tier included.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"asc-mcp": "dist/index.js",
|