@pofky/asc-mcp 1.0.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/LICENSE +21 -0
- package/README.md +186 -0
- package/dist/auth.d.ts +9 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +85 -0
- package/dist/auth.js.map +1 -0
- package/dist/client.d.ts +25 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +124 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +97 -0
- package/dist/index.js.map +1 -0
- package/dist/license.d.ts +10 -0
- package/dist/license.d.ts.map +1 -0
- package/dist/license.js +47 -0
- package/dist/license.js.map +1 -0
- package/dist/tools/app-details.d.ts +19 -0
- package/dist/tools/app-details.d.ts.map +1 -0
- package/dist/tools/app-details.js +78 -0
- package/dist/tools/app-details.js.map +1 -0
- package/dist/tools/daily-briefing.d.ts +20 -0
- package/dist/tools/daily-briefing.d.ts.map +1 -0
- package/dist/tools/daily-briefing.js +141 -0
- package/dist/tools/daily-briefing.js.map +1 -0
- package/dist/tools/list-apps.d.ts +18 -0
- package/dist/tools/list-apps.d.ts.map +1 -0
- package/dist/tools/list-apps.js +31 -0
- package/dist/tools/list-apps.js.map +1 -0
- package/dist/tools/list-reviews.d.ts +36 -0
- package/dist/tools/list-reviews.d.ts.map +1 -0
- package/dist/tools/list-reviews.js +75 -0
- package/dist/tools/list-reviews.js.map +1 -0
- package/dist/tools/release-notes.d.ts +29 -0
- package/dist/tools/release-notes.d.ts.map +1 -0
- package/dist/tools/release-notes.js +160 -0
- package/dist/tools/release-notes.js.map +1 -0
- package/dist/tools/release-preflight.d.ts +20 -0
- package/dist/tools/release-preflight.d.ts.map +1 -0
- package/dist/tools/release-preflight.js +310 -0
- package/dist/tools/release-preflight.js.map +1 -0
- package/dist/tools/review-status.d.ts +19 -0
- package/dist/tools/review-status.d.ts.map +1 -0
- package/dist/tools/review-status.js +95 -0
- package/dist/tools/review-status.js.map +1 -0
- package/dist/tools/sales-report.d.ts +31 -0
- package/dist/tools/sales-report.d.ts.map +1 -0
- package/dist/tools/sales-report.js +104 -0
- package/dist/tools/sales-report.js.map +1 -0
- package/dist/types.d.ts +85 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/package.json +63 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 pofky
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# App Store Connect MCP Server
|
|
2
|
+
|
|
3
|
+
> **Not another API wrapper.** This MCP server catches rejections before you submit, gives you a morning briefing across all your apps, and writes your release notes from git history. The 5 free tools cover basics. The 3 Pro tools are things no other ASC server does.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g @pofky/asc-mcp
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## What Makes This Different
|
|
10
|
+
|
|
11
|
+
Other ASC MCP servers wrap the API and give you 80-293 raw endpoints. This one gives you 8 tools that think:
|
|
12
|
+
|
|
13
|
+
| You say | What happens |
|
|
14
|
+
|---------|-------------|
|
|
15
|
+
| "Run a preflight check on my app" | Audits metadata, character limits, screenshots, build status. Catches the issues that cause 40% of rejections. |
|
|
16
|
+
| "Give me a morning briefing" | Summarizes all your apps: who's in review, who got rejected, new low-rating reviews, action items. |
|
|
17
|
+
| "Generate release notes from my git history" | Reads commits since last tag, categorizes them, and gives you structured data to write "What's New" text. |
|
|
18
|
+
| "List my apps" | Shows all your iOS/macOS apps with bundle IDs |
|
|
19
|
+
| "Is my app in review?" | Exact review state with context ("typical time: 24-48 hours") |
|
|
20
|
+
| "Show me 1-star reviews" | Customer reviews filtered by rating, territory, sorted by date |
|
|
21
|
+
| "What were my downloads this week?" | Sales and revenue summary by territory |
|
|
22
|
+
|
|
23
|
+
No context switching. No portal. Just ask.
|
|
24
|
+
|
|
25
|
+
## Setup (3 minutes)
|
|
26
|
+
|
|
27
|
+
**Step 1.** Create an API key in [App Store Connect > Keys](https://appstoreconnect.apple.com/access/integrations/api) (Admin or App Manager role). Download the `.p8` file.
|
|
28
|
+
|
|
29
|
+
**Step 2.** Install:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install -g @pofky/asc-mcp
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Add to `~/.claude/settings.json` (Claude Code) or your agent's MCP config:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"mcpServers": {
|
|
40
|
+
"appstore-connect": {
|
|
41
|
+
"command": "asc-mcp",
|
|
42
|
+
"env": {
|
|
43
|
+
"ASC_KEY_ID": "YOUR_KEY_ID",
|
|
44
|
+
"ASC_ISSUER_ID": "YOUR_ISSUER_ID",
|
|
45
|
+
"ASC_PRIVATE_KEY_PATH": "~/.appstore/AuthKey_XXXX.p8"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Step 3.** Ask your agent: "List my App Store Connect apps"
|
|
53
|
+
|
|
54
|
+
Works with **Claude Code**, **Cursor**, **Windsurf**, **Cline**, and any MCP-compatible client.
|
|
55
|
+
|
|
56
|
+
## Tools
|
|
57
|
+
|
|
58
|
+
### Free (no account needed)
|
|
59
|
+
|
|
60
|
+
| Tool | What it does |
|
|
61
|
+
|------|-------------|
|
|
62
|
+
| `list_apps` | List all your apps with name, bundle ID, SKU, platform |
|
|
63
|
+
| `app_details` | Version history, build status, release state, dates |
|
|
64
|
+
| `review_status` | Current review state with human-readable context |
|
|
65
|
+
|
|
66
|
+
### Pro ($9/mo)
|
|
67
|
+
|
|
68
|
+
| Tool | What it does | Why it matters |
|
|
69
|
+
|------|-------------|----------------|
|
|
70
|
+
| `list_reviews` | Customer reviews filtered by rating, territory, sort order | See what users say without opening the portal |
|
|
71
|
+
| `sales_report` | Daily/weekly/monthly downloads and revenue by territory | Know your numbers instantly |
|
|
72
|
+
| `release_preflight` | Pre-submission audit: metadata, char limits, screenshots, builds | Catches 40%+ of common rejection causes before you submit |
|
|
73
|
+
| `daily_briefing` | Morning summary across all apps: status, reviews, rejections | One call replaces 10 minutes of portal clicking |
|
|
74
|
+
| `release_notes` | Git commits since last tag, categorized for writing "What's New" | Your AI agent writes release notes from your actual changes |
|
|
75
|
+
|
|
76
|
+
**Coming next:** review response drafting, keyword/ASO insights, competitor snapshots.
|
|
77
|
+
|
|
78
|
+
[Get Pro](https://buy.polar.sh/polar_cl_Ta3OxEA1EbRyYNPFtSsRXgYWBCCtjwMxlbAeW35RLuu) | [Retrieve your license key](https://asc-mcp-license.remewdy.workers.dev/key)
|
|
79
|
+
|
|
80
|
+
## Real Output Examples
|
|
81
|
+
|
|
82
|
+
**"Run a preflight check before I submit"**
|
|
83
|
+
```
|
|
84
|
+
Release Preflight: v2.3
|
|
85
|
+
|
|
86
|
+
State: PREPARE_FOR_SUBMISSION
|
|
87
|
+
Platform: IOS
|
|
88
|
+
|
|
89
|
+
PASS (with 1 warning)
|
|
90
|
+
|
|
91
|
+
Warnings (recommended):
|
|
92
|
+
- Missing screenshot set for APP_IPHONE_67. May be required.
|
|
93
|
+
|
|
94
|
+
Passing checks: 4
|
|
95
|
+
- [en-US] Description OK (3874/4000 chars).
|
|
96
|
+
- [en-US] Keywords OK (96/100 chars).
|
|
97
|
+
- 2 screenshot set(s) found across 1 locale(s).
|
|
98
|
+
- Build 40 attached and valid.
|
|
99
|
+
|
|
100
|
+
Total: 4 pass, 1 warn, 0 fail
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**"Morning briefing"**
|
|
104
|
+
```
|
|
105
|
+
Daily Briefing - 2026-04-13
|
|
106
|
+
|
|
107
|
+
2 apps in your account
|
|
108
|
+
|
|
109
|
+
Tempo: Habit Builder
|
|
110
|
+
- Latest: v2.3 (IOS) - Waiting for Review
|
|
111
|
+
- Action needed: v2.3 is Waiting for Review
|
|
112
|
+
- Reviews (last 3d): 5 new, avg 4.2 stars
|
|
113
|
+
|
|
114
|
+
NightOwl Weather
|
|
115
|
+
- Latest: v1.1 (IOS) - Live
|
|
116
|
+
- No new reviews in the last 3 days
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**"Generate release notes from git"**
|
|
120
|
+
```
|
|
121
|
+
Git History for Release Notes
|
|
122
|
+
|
|
123
|
+
Since: v2.2.0
|
|
124
|
+
Commits: 8
|
|
125
|
+
Character limit: 4000 chars for "What's New"
|
|
126
|
+
|
|
127
|
+
New Features (3)
|
|
128
|
+
- feat: add habit streak calendar view
|
|
129
|
+
- feat: dark mode support
|
|
130
|
+
- add widget for home screen
|
|
131
|
+
|
|
132
|
+
Bug Fixes (2)
|
|
133
|
+
- fix: notification timing off by 1 hour
|
|
134
|
+
- fix: crash on iPad when rotating
|
|
135
|
+
|
|
136
|
+
Instructions: Write user-facing "What's New" text.
|
|
137
|
+
Lead with the most impactful change. Keep under 4000 chars.
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Why This One Over the Free Alternatives?
|
|
141
|
+
|
|
142
|
+
| | Raw API wrappers (free) | This server |
|
|
143
|
+
|---|---|---|
|
|
144
|
+
| **Tool count** | 80-293 | 8 |
|
|
145
|
+
| **Pre-submission audit** | No | Yes - catches rejections before you submit |
|
|
146
|
+
| **Cross-app briefings** | No | Yes - one call, all apps |
|
|
147
|
+
| **Git-aware release notes** | No | Yes - reads your project's commit history |
|
|
148
|
+
| **Smart review summaries** | No | Yes - sentiment grouping, action items |
|
|
149
|
+
| **Setup** | Build from source (Swift/macOS) | `npm install -g` (any OS) |
|
|
150
|
+
| **Free tier** | Some | Yes - 3 tools, no account needed |
|
|
151
|
+
|
|
152
|
+
Raw wrappers give you endpoints. This gives you answers.
|
|
153
|
+
|
|
154
|
+
## Security
|
|
155
|
+
|
|
156
|
+
Your credentials never leave your machine:
|
|
157
|
+
|
|
158
|
+
- The `.p8` private key is read locally. JWT tokens are generated on your computer.
|
|
159
|
+
- API calls go directly from your machine to `api.appstoreconnect.apple.com`.
|
|
160
|
+
- The license server sees only your license key string. Zero Apple data, zero credentials.
|
|
161
|
+
- Fully open source. [Read the code.](https://github.com/pofky/appstore-connect-mcp)
|
|
162
|
+
|
|
163
|
+
## Works With
|
|
164
|
+
|
|
165
|
+
- [Claude Code](https://claude.ai/code) (Anthropic)
|
|
166
|
+
- [Cursor](https://cursor.com)
|
|
167
|
+
- [Windsurf](https://codeium.com/windsurf)
|
|
168
|
+
- [Cline](https://github.com/cline/cline)
|
|
169
|
+
- Any client supporting the [Model Context Protocol](https://modelcontextprotocol.io)
|
|
170
|
+
|
|
171
|
+
## Requirements
|
|
172
|
+
|
|
173
|
+
- Node.js 18+
|
|
174
|
+
- Apple Developer Program membership
|
|
175
|
+
- App Store Connect API key (Admin or App Manager role)
|
|
176
|
+
|
|
177
|
+
## Legal
|
|
178
|
+
|
|
179
|
+
- [Privacy Policy](https://asc-mcp-license.remewdy.workers.dev/privacy)
|
|
180
|
+
- [Terms of Service](https://asc-mcp-license.remewdy.workers.dev/terms)
|
|
181
|
+
|
|
182
|
+
This project is not affiliated with, endorsed by, or sponsored by Apple Inc. Apple, App Store, App Store Connect, TestFlight, iOS, and macOS are trademarks of Apple Inc.
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
MIT
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a JWT for App Store Connect API authentication.
|
|
3
|
+
* Uses ES256 algorithm with the developer's .p8 private key.
|
|
4
|
+
* Tokens are cached and auto-refreshed before expiry.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getToken(keyId: string, issuerId: string, privateKeyPath: string): Promise<string>;
|
|
7
|
+
/** Clear the cached token (useful for tests or forced refresh). */
|
|
8
|
+
export declare function clearTokenCache(): void;
|
|
9
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC,CAoCjB;AAED,mEAAmE;AACnE,wBAAgB,eAAe,IAAI,IAAI,CAGtC"}
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getToken = getToken;
|
|
37
|
+
exports.clearTokenCache = clearTokenCache;
|
|
38
|
+
const node_fs_1 = require("node:fs");
|
|
39
|
+
const node_path_1 = require("node:path");
|
|
40
|
+
const node_os_1 = require("node:os");
|
|
41
|
+
const jose = __importStar(require("jose"));
|
|
42
|
+
const TOKEN_LIFETIME_SECONDS = 20 * 60; // 20 minutes (Apple max)
|
|
43
|
+
const REFRESH_BUFFER_SECONDS = 60; // Refresh 1 minute before expiry
|
|
44
|
+
let cachedToken = null;
|
|
45
|
+
let tokenExpiresAt = 0;
|
|
46
|
+
/**
|
|
47
|
+
* Generate a JWT for App Store Connect API authentication.
|
|
48
|
+
* Uses ES256 algorithm with the developer's .p8 private key.
|
|
49
|
+
* Tokens are cached and auto-refreshed before expiry.
|
|
50
|
+
*/
|
|
51
|
+
async function getToken(keyId, issuerId, privateKeyPath) {
|
|
52
|
+
const now = Math.floor(Date.now() / 1000);
|
|
53
|
+
if (cachedToken && now < tokenExpiresAt - REFRESH_BUFFER_SECONDS) {
|
|
54
|
+
return cachedToken;
|
|
55
|
+
}
|
|
56
|
+
const resolvedPath = privateKeyPath.startsWith("~")
|
|
57
|
+
? (0, node_path_1.resolve)((0, node_os_1.homedir)(), privateKeyPath.slice(2))
|
|
58
|
+
: (0, node_path_1.resolve)(privateKeyPath);
|
|
59
|
+
const privateKeyPem = (0, node_fs_1.readFileSync)(resolvedPath, "utf-8");
|
|
60
|
+
const privateKey = await jose.importPKCS8(privateKeyPem, "ES256");
|
|
61
|
+
const exp = now + TOKEN_LIFETIME_SECONDS;
|
|
62
|
+
// Individual API keys use `sub: "user"` instead of `iss: issuerId`.
|
|
63
|
+
// Detect by empty/missing issuer ID.
|
|
64
|
+
const builder = new jose.SignJWT({})
|
|
65
|
+
.setProtectedHeader({ alg: "ES256", kid: keyId, typ: "JWT" })
|
|
66
|
+
.setIssuedAt(now)
|
|
67
|
+
.setExpirationTime(exp)
|
|
68
|
+
.setAudience("appstoreconnect-v1");
|
|
69
|
+
if (issuerId) {
|
|
70
|
+
builder.setIssuer(issuerId);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
builder.setSubject("user");
|
|
74
|
+
}
|
|
75
|
+
const jwt = await builder.sign(privateKey);
|
|
76
|
+
cachedToken = jwt;
|
|
77
|
+
tokenExpiresAt = exp;
|
|
78
|
+
return jwt;
|
|
79
|
+
}
|
|
80
|
+
/** Clear the cached token (useful for tests or forced refresh). */
|
|
81
|
+
function clearTokenCache() {
|
|
82
|
+
cachedToken = null;
|
|
83
|
+
tokenExpiresAt = 0;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,4BAwCC;AAGD,0CAGC;AA9DD,qCAAuC;AACvC,yCAAoC;AACpC,qCAAkC;AAClC,2CAA6B;AAE7B,MAAM,sBAAsB,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,yBAAyB;AACjE,MAAM,sBAAsB,GAAG,EAAE,CAAC,CAAC,iCAAiC;AAEpE,IAAI,WAAW,GAAkB,IAAI,CAAC;AACtC,IAAI,cAAc,GAAG,CAAC,CAAC;AAEvB;;;;GAIG;AACI,KAAK,UAAU,QAAQ,CAC5B,KAAa,EACb,QAAgB,EAChB,cAAsB;IAEtB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAE1C,IAAI,WAAW,IAAI,GAAG,GAAG,cAAc,GAAG,sBAAsB,EAAE,CAAC;QACjE,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,MAAM,YAAY,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC;QACjD,CAAC,CAAC,IAAA,mBAAO,EAAC,IAAA,iBAAO,GAAE,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC7C,CAAC,CAAC,IAAA,mBAAO,EAAC,cAAc,CAAC,CAAC;IAE5B,MAAM,aAAa,GAAG,IAAA,sBAAY,EAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC1D,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAElE,MAAM,GAAG,GAAG,GAAG,GAAG,sBAAsB,CAAC;IAEzC,oEAAoE;IACpE,qCAAqC;IACrC,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;SACjC,kBAAkB,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;SAC5D,WAAW,CAAC,GAAG,CAAC;SAChB,iBAAiB,CAAC,GAAG,CAAC;SACtB,WAAW,CAAC,oBAAoB,CAAC,CAAC;IAErC,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAE3C,WAAW,GAAG,GAAG,CAAC;IAClB,cAAc,GAAG,GAAG,CAAC;IAErB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,mEAAmE;AACnE,SAAgB,eAAe;IAC7B,WAAW,GAAG,IAAI,CAAC;IACnB,cAAc,GAAG,CAAC,CAAC;AACrB,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ASCConfig, ASCResponse } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Low-level App Store Connect API client.
|
|
4
|
+
* Handles authentication, pagination, and error mapping.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ASCClient {
|
|
7
|
+
private config;
|
|
8
|
+
constructor(config: ASCConfig);
|
|
9
|
+
/** Make an authenticated GET request to the ASC API. */
|
|
10
|
+
get<T>(path: string, params?: Record<string, string>): Promise<ASCResponse<T>>;
|
|
11
|
+
/** Fetch all pages of a paginated response. */
|
|
12
|
+
getAll<T>(path: string, params?: Record<string, string>, maxPages?: number): Promise<ASCResponse<T>>;
|
|
13
|
+
/**
|
|
14
|
+
* Download a sales/trends report (returns TSV, not JSON).
|
|
15
|
+
* Apple's reporting endpoints return gzipped TSV.
|
|
16
|
+
*/
|
|
17
|
+
getReport(params: Record<string, string>): Promise<string>;
|
|
18
|
+
}
|
|
19
|
+
export declare class ASCAPIError extends Error {
|
|
20
|
+
status: number;
|
|
21
|
+
path: string;
|
|
22
|
+
body: string;
|
|
23
|
+
constructor(status: number, path: string, body: string);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAIzD;;;GAGG;AACH,qBAAa,SAAS;IACR,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC,wDAAwD;IAClD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IA6BpF,+CAA+C;IACzC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,SAAK,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAsCtG;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAiCjE;AAED,qBAAa,WAAY,SAAQ,KAAK;IAE3B,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;gBAFZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM;CAMtB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ASCAPIError = exports.ASCClient = void 0;
|
|
4
|
+
const auth_js_1 = require("./auth.js");
|
|
5
|
+
const BASE_URL = "https://api.appstoreconnect.apple.com";
|
|
6
|
+
/**
|
|
7
|
+
* Low-level App Store Connect API client.
|
|
8
|
+
* Handles authentication, pagination, and error mapping.
|
|
9
|
+
*/
|
|
10
|
+
class ASCClient {
|
|
11
|
+
config;
|
|
12
|
+
constructor(config) {
|
|
13
|
+
this.config = config;
|
|
14
|
+
}
|
|
15
|
+
/** Make an authenticated GET request to the ASC API. */
|
|
16
|
+
async get(path, params) {
|
|
17
|
+
const url = new URL(`${BASE_URL}${path}`);
|
|
18
|
+
if (params) {
|
|
19
|
+
for (const [key, value] of Object.entries(params)) {
|
|
20
|
+
url.searchParams.set(key, value);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const token = await (0, auth_js_1.getToken)(this.config.keyId, this.config.issuerId, this.config.privateKeyPath);
|
|
24
|
+
const response = await fetch(url.toString(), {
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `Bearer ${token}`,
|
|
27
|
+
"Content-Type": "application/json",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
const body = await response.text();
|
|
32
|
+
throw new ASCAPIError(response.status, path, body);
|
|
33
|
+
}
|
|
34
|
+
return (await response.json());
|
|
35
|
+
}
|
|
36
|
+
/** Fetch all pages of a paginated response. */
|
|
37
|
+
async getAll(path, params, maxPages = 10) {
|
|
38
|
+
const firstPage = await this.get(path, params);
|
|
39
|
+
if (!Array.isArray(firstPage.data)) {
|
|
40
|
+
return firstPage;
|
|
41
|
+
}
|
|
42
|
+
const allData = [...firstPage.data];
|
|
43
|
+
let nextUrl = firstPage.links?.next;
|
|
44
|
+
let page = 1;
|
|
45
|
+
while (nextUrl && page < maxPages) {
|
|
46
|
+
const token = await (0, auth_js_1.getToken)(this.config.keyId, this.config.issuerId, this.config.privateKeyPath);
|
|
47
|
+
const response = await fetch(nextUrl, {
|
|
48
|
+
headers: {
|
|
49
|
+
Authorization: `Bearer ${token}`,
|
|
50
|
+
"Content-Type": "application/json",
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
if (!response.ok)
|
|
54
|
+
break;
|
|
55
|
+
const pageData = (await response.json());
|
|
56
|
+
if (Array.isArray(pageData.data)) {
|
|
57
|
+
allData.push(...pageData.data);
|
|
58
|
+
}
|
|
59
|
+
nextUrl = pageData.links?.next;
|
|
60
|
+
page++;
|
|
61
|
+
}
|
|
62
|
+
return { ...firstPage, data: allData };
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Download a sales/trends report (returns TSV, not JSON).
|
|
66
|
+
* Apple's reporting endpoints return gzipped TSV.
|
|
67
|
+
*/
|
|
68
|
+
async getReport(params) {
|
|
69
|
+
const url = new URL(`${BASE_URL}/v1/salesReports`);
|
|
70
|
+
for (const [key, value] of Object.entries(params)) {
|
|
71
|
+
url.searchParams.set(`filter[${key}]`, value);
|
|
72
|
+
}
|
|
73
|
+
const token = await (0, auth_js_1.getToken)(this.config.keyId, this.config.issuerId, this.config.privateKeyPath);
|
|
74
|
+
const response = await fetch(url.toString(), {
|
|
75
|
+
headers: {
|
|
76
|
+
Authorization: `Bearer ${token}`,
|
|
77
|
+
Accept: "application/a-gzip",
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
if (!response.ok) {
|
|
81
|
+
if (response.status === 404) {
|
|
82
|
+
return "No report available for the requested date range.";
|
|
83
|
+
}
|
|
84
|
+
const body = await response.text();
|
|
85
|
+
throw new ASCAPIError(response.status, "/v1/salesReports", body);
|
|
86
|
+
}
|
|
87
|
+
// Response is gzipped TSV
|
|
88
|
+
const buffer = await response.arrayBuffer();
|
|
89
|
+
const { gunzipSync } = await import("node:zlib");
|
|
90
|
+
const decompressed = gunzipSync(Buffer.from(buffer));
|
|
91
|
+
return decompressed.toString("utf-8");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.ASCClient = ASCClient;
|
|
95
|
+
class ASCAPIError extends Error {
|
|
96
|
+
status;
|
|
97
|
+
path;
|
|
98
|
+
body;
|
|
99
|
+
constructor(status, path, body) {
|
|
100
|
+
const detail = tryParseErrorDetail(body);
|
|
101
|
+
super(`ASC API error ${status} on ${path}: ${detail}`);
|
|
102
|
+
this.status = status;
|
|
103
|
+
this.path = path;
|
|
104
|
+
this.body = body;
|
|
105
|
+
this.name = "ASCAPIError";
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.ASCAPIError = ASCAPIError;
|
|
109
|
+
function tryParseErrorDetail(body) {
|
|
110
|
+
try {
|
|
111
|
+
const parsed = JSON.parse(body);
|
|
112
|
+
if (parsed.errors?.[0]?.detail) {
|
|
113
|
+
return parsed.errors[0].detail;
|
|
114
|
+
}
|
|
115
|
+
if (parsed.errors?.[0]?.title) {
|
|
116
|
+
return parsed.errors[0].title;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// Not JSON
|
|
121
|
+
}
|
|
122
|
+
return body.slice(0, 200);
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA,uCAAqC;AAGrC,MAAM,QAAQ,GAAG,uCAAuC,CAAC;AAEzD;;;GAGG;AACH,MAAa,SAAS;IACA;IAApB,YAAoB,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAA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QAEnB,MAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACzC,KAAK,CAAC,iBAAiB,MAAM,OAAO,IAAI,KAAK,MAAM,EAAE,CAAC,CAAC;QALhD,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QACZ,SAAI,GAAJ,IAAI,CAAQ;QAInB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAVD,kCAUC;AAED,SAAS,mBAAmB,CAAC,IAAY;IACvC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;YAC/B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACjC,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;YAC9B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAChC,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,WAAW;IACb,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
5
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const client_js_1 = require("./client.js");
|
|
8
|
+
const license_js_1 = require("./license.js");
|
|
9
|
+
const list_apps_js_1 = require("./tools/list-apps.js");
|
|
10
|
+
const app_details_js_1 = require("./tools/app-details.js");
|
|
11
|
+
const review_status_js_1 = require("./tools/review-status.js");
|
|
12
|
+
const list_reviews_js_1 = require("./tools/list-reviews.js");
|
|
13
|
+
const sales_report_js_1 = require("./tools/sales-report.js");
|
|
14
|
+
const release_preflight_js_1 = require("./tools/release-preflight.js");
|
|
15
|
+
const daily_briefing_js_1 = require("./tools/daily-briefing.js");
|
|
16
|
+
const release_notes_js_1 = require("./tools/release-notes.js");
|
|
17
|
+
function getConfig() {
|
|
18
|
+
const keyId = process.env.ASC_KEY_ID;
|
|
19
|
+
const issuerId = process.env.ASC_ISSUER_ID;
|
|
20
|
+
const privateKeyPath = process.env.ASC_PRIVATE_KEY_PATH;
|
|
21
|
+
if (!keyId || !issuerId || !privateKeyPath) {
|
|
22
|
+
console.error("Missing required environment variables:\n" +
|
|
23
|
+
" ASC_KEY_ID — Your API key ID from App Store Connect\n" +
|
|
24
|
+
" ASC_ISSUER_ID — Your team's issuer ID\n" +
|
|
25
|
+
" ASC_PRIVATE_KEY_PATH — Path to your .p8 private key file\n\n" +
|
|
26
|
+
"Create an API key at:\n" +
|
|
27
|
+
" https://appstoreconnect.apple.com/access/integrations/api");
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
keyId,
|
|
32
|
+
issuerId,
|
|
33
|
+
privateKeyPath,
|
|
34
|
+
licenseKey: process.env.ASC_LICENSE_KEY,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
async function main() {
|
|
38
|
+
const config = getConfig();
|
|
39
|
+
const client = new client_js_1.ASCClient(config);
|
|
40
|
+
const tier = await (0, license_js_1.validateLicense)(config.licenseKey);
|
|
41
|
+
if (tier === "pro") {
|
|
42
|
+
console.error("asc-mcp: Pro license active. All tools available.");
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
console.error("asc-mcp: Free tier (3 tools). Upgrade at https://buy.polar.sh/polar_cl_Ta3OxEA1EbRyYNPFtSsRXgYWBCCtjwMxlbAeW35RLuu");
|
|
46
|
+
}
|
|
47
|
+
const server = new mcp_js_1.McpServer({
|
|
48
|
+
name: "asc-mcp",
|
|
49
|
+
version: "0.1.0",
|
|
50
|
+
});
|
|
51
|
+
// --- Free tools ---
|
|
52
|
+
/** Wrap a tool handler so API errors return messages instead of crashing. */
|
|
53
|
+
function safe(fn) {
|
|
54
|
+
return async (...a) => {
|
|
55
|
+
try {
|
|
56
|
+
return { content: [{ type: "text", text: await fn(...a) }] };
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
60
|
+
return { content: [{ type: "text", text: `Error: ${msg}` }] };
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
server.tool("list_apps", "List all apps in your App Store Connect account with name, bundle ID, and platform.", { limit: zod_1.z.number().optional().describe("Max apps to return (default 50, max 200)") }, safe((args) => (0, list_apps_js_1.listApps)(client, args)));
|
|
65
|
+
server.tool("app_details", "Get detailed info about an app including versions, build status, and release state.", { app_id: zod_1.z.string().regex(/^\d+$/, "App ID must be numeric").describe("App Store Connect app ID (use list_apps to find it)") }, safe((args) => (0, app_details_js_1.appDetails)(client, args)));
|
|
66
|
+
server.tool("review_status", "Check the current App Store review status — in review, waiting, approved, or rejected.", { app_id: zod_1.z.string().regex(/^\d+$/, "App ID must be numeric").describe("App Store Connect app ID") }, safe((args) => (0, review_status_js_1.reviewStatus)(client, args)));
|
|
67
|
+
// --- Pro tools (gated) ---
|
|
68
|
+
server.tool("list_reviews", "List customer reviews for an app. Filter by rating. Pro feature.", {
|
|
69
|
+
app_id: zod_1.z.string().regex(/^\d+$/, "App ID must be numeric").describe("App Store Connect app ID"),
|
|
70
|
+
rating: zod_1.z.number().min(1).max(5).optional().describe("Filter by star rating (1-5)"),
|
|
71
|
+
limit: zod_1.z.number().optional().describe("Max reviews (default 20, max 100)"),
|
|
72
|
+
sort: zod_1.z.enum(["newest", "oldest", "rating_high", "rating_low"]).optional()
|
|
73
|
+
.describe("Sort order (default: newest)"),
|
|
74
|
+
}, safe((args) => (0, list_reviews_js_1.listReviews)(client, args, tier)));
|
|
75
|
+
server.tool("sales_report", "Download sales/downloads summary. Shows units, proceeds, territory. Pro feature.", {
|
|
76
|
+
vendor_number: zod_1.z.string().describe("Vendor number from Payments and Financial Reports"),
|
|
77
|
+
frequency: zod_1.z.enum(["DAILY", "WEEKLY", "MONTHLY", "YEARLY"]).optional()
|
|
78
|
+
.describe("Report frequency (default: DAILY)"),
|
|
79
|
+
report_date: zod_1.z.string().optional()
|
|
80
|
+
.describe("Date in YYYY-MM-DD (daily) or YYYY-MM (monthly). Default: yesterday."),
|
|
81
|
+
}, safe((args) => (0, sales_report_js_1.salesReport)(client, args, tier)));
|
|
82
|
+
// --- Intelligence tools (Pro) ---
|
|
83
|
+
server.tool("release_preflight", "Pre-submission audit: checks metadata, character limits, screenshots, build status. Catches rejection causes before you submit.", { app_id: zod_1.z.string().regex(/^\d+$/, "App ID must be numeric").describe("App Store Connect app ID") }, safe((args) => (0, release_preflight_js_1.releasePreflight)(client, args, tier)));
|
|
84
|
+
server.tool("daily_briefing", "Morning briefing across all apps: version status, recent reviews, rejections, action items. One call for full situational awareness.", { days: zod_1.z.number().optional().describe("Look back N days for reviews (default 3)") }, safe((args) => (0, daily_briefing_js_1.dailyBriefing)(client, args, tier)));
|
|
85
|
+
server.tool("release_notes", "Extract git commits since last tag and return structured data for writing App Store 'What's New' text. Categorizes changes and provides writing guidelines.", {
|
|
86
|
+
project_path: zod_1.z.string().optional().describe("Path to git project (default: current directory)"),
|
|
87
|
+
since_tag: zod_1.z.string().optional().describe("Git tag to diff from (default: latest tag)"),
|
|
88
|
+
max_commits: zod_1.z.number().optional().describe("Max commits to include (default 50)"),
|
|
89
|
+
}, safe((args) => (0, release_notes_js_1.releaseNotes)(args, tier)));
|
|
90
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
91
|
+
await server.connect(transport);
|
|
92
|
+
}
|
|
93
|
+
main().catch((err) => {
|
|
94
|
+
console.error("Fatal error:", err);
|
|
95
|
+
process.exit(1);
|
|
96
|
+
});
|
|
97
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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;AAG/C,uDAAgD;AAChD,2DAAoD;AACpD,+DAAwD;AACxD,6DAAsD;AACtD,6DAAsD;AACtD,uEAAgE;AAChE,iEAA0D;AAC1D,+DAAwD;AAExD,SAAS,SAAS;IAChB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;IACrC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IAC3C,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAExD,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ,IAAI,CAAC,cAAc,EAAE,CAAC;QAC3C,OAAO,CAAC,KAAK,CACX,2CAA2C;YACzC,+DAA+D;YAC/D,8CAA8C;YAC9C,gEAAgE;YAChE,yBAAyB;YACzB,6DAA6D,CAChE,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO;QACL,KAAK;QACL,QAAQ;QACR,cAAc;QACd,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe;KACxC,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,IAAI,qBAAS,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I,CACT,eAAe,EACf,6JAA6J,EAC7J;QACE,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kDAAkD,CAAC;QAChG,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;QACvF,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;KACnF,EACD,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,+BAAY,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CACzC,CAAC;IAEF,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,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,10 @@
|
|
|
1
|
+
import type { Tier } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Validate the license key against the remote license server.
|
|
4
|
+
* Returns the user's tier (free or pro).
|
|
5
|
+
* Results are cached for 24 hours to avoid per-call latency.
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateLicense(licenseKey?: string): Promise<Tier>;
|
|
8
|
+
/** Clear the cached license status (for tests). */
|
|
9
|
+
export declare function clearLicenseCache(): void;
|
|
10
|
+
//# sourceMappingURL=license.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../src/license.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,IAAI,EAAE,MAAM,YAAY,CAAC;AAStD;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BxE;AAED,mDAAmD;AACnD,wBAAgB,iBAAiB,IAAI,IAAI,CAGxC"}
|
package/dist/license.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateLicense = validateLicense;
|
|
4
|
+
exports.clearLicenseCache = clearLicenseCache;
|
|
5
|
+
const LICENSE_API_URL = process.env.ASC_LICENSE_API_URL || "https://asc-mcp-license.remewdy.workers.dev";
|
|
6
|
+
const CACHE_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours
|
|
7
|
+
let cachedStatus = null;
|
|
8
|
+
let cachedAt = 0;
|
|
9
|
+
/**
|
|
10
|
+
* Validate the license key against the remote license server.
|
|
11
|
+
* Returns the user's tier (free or pro).
|
|
12
|
+
* Results are cached for 24 hours to avoid per-call latency.
|
|
13
|
+
*/
|
|
14
|
+
async function validateLicense(licenseKey) {
|
|
15
|
+
if (!licenseKey)
|
|
16
|
+
return "free";
|
|
17
|
+
const now = Date.now();
|
|
18
|
+
if (cachedStatus && now - cachedAt < CACHE_TTL_MS) {
|
|
19
|
+
return cachedStatus.tier;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const response = await fetch(`${LICENSE_API_URL}/validate`, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
headers: { "Content-Type": "application/json" },
|
|
25
|
+
body: JSON.stringify({ key: licenseKey }),
|
|
26
|
+
});
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
console.error(`License validation failed: ${response.status}`);
|
|
29
|
+
return "free";
|
|
30
|
+
}
|
|
31
|
+
const status = (await response.json());
|
|
32
|
+
cachedStatus = status;
|
|
33
|
+
cachedAt = now;
|
|
34
|
+
return status.valid ? status.tier : "free";
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
// Network error — fail open to free tier (don't block the user)
|
|
38
|
+
console.error("License validation network error:", err);
|
|
39
|
+
return "free";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Clear the cached license status (for tests). */
|
|
43
|
+
function clearLicenseCache() {
|
|
44
|
+
cachedStatus = null;
|
|
45
|
+
cachedAt = 0;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=license.js.map
|