@ggaiteam/appstore-connect-mcp 1.0.1 → 1.0.3
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 +89 -40
- package/dist/server.d.ts +7 -10
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +171 -116
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# App Store Connect MCP
|
|
2
2
|
|
|
3
|
-
A [Model Context Protocol](https://modelcontextprotocol.io/) server that exposes the entire **Apple App Store Connect API** (1,200+ operations)
|
|
3
|
+
A [Model Context Protocol](https://modelcontextprotocol.io/) server that exposes the entire **Apple App Store Connect API** (1,200+ operations) via 4 lightweight MCP tools. Query apps, manage builds, handle submissions, read analytics, manage users, and more — all from your AI assistant.
|
|
4
|
+
|
|
5
|
+
> **Why only 4 tools?** Registering 1,216 tools would consume ~140K tokens of LLM context, making the server unusable. Instead, the LLM uses `search_apis` → `get_tool_details` → `call_api` to discover and execute any operation on demand — keeping context tiny while maintaining full API coverage.
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/@ggaiteam/appstore-connect-mcp)
|
|
6
8
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -9,11 +11,13 @@ A [Model Context Protocol](https://modelcontextprotocol.io/) server that exposes
|
|
|
9
11
|
## Features
|
|
10
12
|
|
|
11
13
|
- **Complete API coverage** — all 1,216 operations from the App Store Connect API v4.4
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
14
|
+
- **Context-friendly** — only 4 MCP tools registered (not 1,216), protecting LLM context window
|
|
15
|
+
- **Tool discovery workflow** — `search_apis` → `get_tool_details` → `call_api`
|
|
16
|
+
- **Response truncation** — large API responses truncated at 25KB to fit LLM context
|
|
17
|
+
- **Two transports** — `stdio` for local use (ggcode, Claude Desktop, Cursor), `HTTP` for remote deployment
|
|
14
18
|
- **JWT authentication** — automatic ES256 token generation and caching
|
|
15
19
|
- **Docker ready** — multi-stage Dockerfile with health checks
|
|
16
|
-
- **Auto-publish** —
|
|
20
|
+
- **Auto-publish** — push a git tag `v1.x.x` to publish to npm (OIDC, no token needed)
|
|
17
21
|
|
|
18
22
|
## Quick Start
|
|
19
23
|
|
|
@@ -50,6 +54,37 @@ docker pull ghcr.io/topcheer/appstore-connect-mcp:latest
|
|
|
50
54
|
|
|
51
55
|
### 3. Configure Your MCP Client
|
|
52
56
|
|
|
57
|
+
#### ggcode (topcheer/ggcode) — Recommended
|
|
58
|
+
|
|
59
|
+
Add to `~/.ggcode/ggcode.yaml` under `mcp_servers`:
|
|
60
|
+
|
|
61
|
+
```yaml
|
|
62
|
+
mcp_servers:
|
|
63
|
+
- args:
|
|
64
|
+
- -y
|
|
65
|
+
- '@ggaiteam/appstore-connect-mcp@latest'
|
|
66
|
+
command: npx
|
|
67
|
+
env:
|
|
68
|
+
APP_STORE_CONNECT_ISSUER_ID: your-issuer-id-here
|
|
69
|
+
APP_STORE_CONNECT_KEY_ID: your-key-id-here
|
|
70
|
+
APP_STORE_CONNECT_P8_FILE: /path/to/AuthKey_XXXXXXXXXX.p8
|
|
71
|
+
name: appstore-connect
|
|
72
|
+
type: stdio
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Restart ggcode. The 4 MCP tools (`search_apis`, `get_tool_details`, `call_api`, `list_categories`) will be available immediately.
|
|
76
|
+
|
|
77
|
+
**Example session in ggcode:**
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
> 列出我的 App Store Connect 应用列表
|
|
81
|
+
|
|
82
|
+
# ggcode will:
|
|
83
|
+
# 1. call_api("apps_getCollection", {arguments: {limit: 50}})
|
|
84
|
+
# 2. For each app, call_api("appStoreVersions_getToManyRelated", ...)
|
|
85
|
+
# 3. Summarize the results
|
|
86
|
+
```
|
|
87
|
+
|
|
53
88
|
#### Claude Desktop
|
|
54
89
|
|
|
55
90
|
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
@@ -58,7 +93,8 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
|
58
93
|
{
|
|
59
94
|
"mcpServers": {
|
|
60
95
|
"appstore-connect": {
|
|
61
|
-
"command": "
|
|
96
|
+
"command": "npx",
|
|
97
|
+
"args": ["-y", "@ggaiteam/appstore-connect-mcp"],
|
|
62
98
|
"env": {
|
|
63
99
|
"APP_STORE_CONNECT_ISSUER_ID": "your-issuer-id",
|
|
64
100
|
"APP_STORE_CONNECT_KEY_ID": "your-key-id",
|
|
@@ -78,7 +114,7 @@ Add to your Cursor MCP settings:
|
|
|
78
114
|
"mcpServers": {
|
|
79
115
|
"appstore-connect": {
|
|
80
116
|
"command": "npx",
|
|
81
|
-
"args": ["@ggaiteam/appstore-connect-mcp"],
|
|
117
|
+
"args": ["-y", "@ggaiteam/appstore-connect-mcp"],
|
|
82
118
|
"env": {
|
|
83
119
|
"APP_STORE_CONNECT_ISSUER_ID": "your-issuer-id",
|
|
84
120
|
"APP_STORE_CONNECT_KEY_ID": "your-key-id",
|
|
@@ -94,9 +130,9 @@ Add to your Cursor MCP settings:
|
|
|
94
130
|
> "APP_STORE_CONNECT_PRIVATE_KEY": "-----BEGIN PRIVATE KEY-----\nMIGTAg...\n-----END PRIVATE KEY-----"
|
|
95
131
|
> ```
|
|
96
132
|
|
|
97
|
-
Restart your client.
|
|
133
|
+
Restart your client.
|
|
98
134
|
|
|
99
|
-
## Usage
|
|
135
|
+
## Usage
|
|
100
136
|
|
|
101
137
|
Once connected, ask your AI assistant:
|
|
102
138
|
|
|
@@ -108,25 +144,38 @@ Once connected, ask your AI assistant:
|
|
|
108
144
|
|
|
109
145
|
> "Search for subscription-related API operations"
|
|
110
146
|
|
|
111
|
-
The AI uses
|
|
147
|
+
The AI uses `search_apis` → `get_tool_details` → `call_api` to discover and execute operations.
|
|
112
148
|
|
|
113
|
-
###
|
|
149
|
+
### 4 MCP Tools
|
|
114
150
|
|
|
115
151
|
| Tool | Description |
|
|
116
152
|
|------|-------------|
|
|
117
|
-
| `search_apis` | Search API operations by keyword, category, or HTTP method |
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
153
|
+
| `search_apis` | Search 1,216 API operations by keyword, category, or HTTP method |
|
|
154
|
+
| `get_tool_details` | Get full parameter schema + usage example for one operation |
|
|
155
|
+
| `call_api` | Execute any API operation by name + arguments |
|
|
156
|
+
| `list_categories` | List all 192 API resource categories with operation counts |
|
|
120
157
|
|
|
121
|
-
###
|
|
158
|
+
### How It Works
|
|
122
159
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
160
|
+
```
|
|
161
|
+
User: "List my apps"
|
|
162
|
+
↓
|
|
163
|
+
AI calls: search_apis("apps")
|
|
164
|
+
→ finds: apps_getCollection (GET /v1/apps)
|
|
165
|
+
↓
|
|
166
|
+
AI calls: call_api("apps_getCollection", {arguments: {limit: 10}})
|
|
167
|
+
→ returns: [{name: "MyApp", bundleId: "com.example.myapp"}, ...]
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Common Operations
|
|
171
|
+
|
|
172
|
+
| What | Operation |
|
|
173
|
+
|------|----------|
|
|
174
|
+
| List apps | `call_api("apps_getCollection", {})` |
|
|
175
|
+
| List builds | `call_api("builds_getCollection", {arguments: {"filter[preReleaseVersion.build.app]": "app-id"}})` |
|
|
176
|
+
| App versions | `call_api("appStoreVersions_getCollection", {arguments: {"filter[app]": "app-id"}})` |
|
|
177
|
+
| Beta testers | `call_api("betaTesters_getCollection", {})` |
|
|
178
|
+
| Sales reports | `call_api("salesReports_getCollection", {arguments: {"filter[frequency]": "DAILY"}})` |
|
|
130
179
|
|
|
131
180
|
## Remote Deployment (HTTP Mode)
|
|
132
181
|
|
|
@@ -233,9 +282,9 @@ appstore-connect-mcp --verbose
|
|
|
233
282
|
```
|
|
234
283
|
|
|
235
284
|
- **Tool data** is generated from Apple's OpenAPI spec (`scripts/generate-tools.py`)
|
|
236
|
-
- **Runtime** loads `tools.json`
|
|
285
|
+
- **Runtime** loads `tools.json` (1,216 ops) but only registers 4 MCP tools
|
|
237
286
|
- **JWT tokens** are cached and auto-refreshed (20-minute TTL)
|
|
238
|
-
- **Responses** are truncated at
|
|
287
|
+
- **Responses** are truncated at 25KB to fit LLM context windows
|
|
239
288
|
|
|
240
289
|
### Regenerating Tools
|
|
241
290
|
|
|
@@ -283,7 +332,7 @@ npm start
|
|
|
283
332
|
│ └── install.sh # One-line installer
|
|
284
333
|
├── src/
|
|
285
334
|
│ ├── index.ts # Entry point + CLI
|
|
286
|
-
│ ├── server.ts # MCP server (
|
|
335
|
+
│ ├── server.ts # MCP server (4 tools: search/details/call/list)
|
|
287
336
|
│ ├── transport.ts # stdio + HTTP transports
|
|
288
337
|
│ ├── auth.ts # JWT (ES256) token generation
|
|
289
338
|
│ ├── client.ts # App Store Connect API client
|
|
@@ -301,27 +350,27 @@ npm start
|
|
|
301
350
|
|
|
302
351
|
## npm Publishing
|
|
303
352
|
|
|
304
|
-
Publishing is automated via GitHub Actions
|
|
353
|
+
Publishing is fully automated via GitHub Actions with OIDC trusted publishing — **no NPM_TOKEN needed**.
|
|
305
354
|
|
|
306
|
-
|
|
307
|
-
2. The `npm-publish.yml` workflow automatically:
|
|
308
|
-
- Builds the package
|
|
309
|
-
- Publishes to npm
|
|
310
|
-
- With [provenance](https://docs.npmjs.com/generating-provenance-statements)
|
|
355
|
+
### Release a new version
|
|
311
356
|
|
|
312
|
-
|
|
357
|
+
```bash
|
|
358
|
+
git tag v1.0.3
|
|
359
|
+
git push origin v1.0.3
|
|
360
|
+
```
|
|
313
361
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
362
|
+
That's it. The workflow will:
|
|
363
|
+
1. Extract version from the tag
|
|
364
|
+
2. Check if version already exists on npm (skip if so)
|
|
365
|
+
3. Build the package
|
|
366
|
+
4. Publish to npm with `--provenance=false --access public`
|
|
367
|
+
5. Auto-create a GitHub Release
|
|
317
368
|
|
|
318
|
-
###
|
|
369
|
+
### First-time setup (already done)
|
|
319
370
|
|
|
320
|
-
|
|
321
|
-
npm
|
|
322
|
-
|
|
323
|
-
npm publish
|
|
324
|
-
```
|
|
371
|
+
1. Package must exist on npm (first publish is manual: `npm publish --access public`)
|
|
372
|
+
2. Configure trusted publishing on npm: link the package to `topcheer/appstore-connect-mcp`
|
|
373
|
+
3. No NPM_TOKEN secret needed — OIDC handles authentication
|
|
325
374
|
|
|
326
375
|
## API Coverage
|
|
327
376
|
|
package/dist/server.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* server.ts — MCP server core.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Exposes 4 MCP tools instead of 1200+ to keep LLM context small:
|
|
5
|
+
* - search_apis → find the right operation by keyword
|
|
6
|
+
* - get_tool_details → get full parameter schema for an operation
|
|
7
|
+
* - call_api → execute any App Store Connect API operation
|
|
8
|
+
* - list_categories → browse API resource groups
|
|
9
|
+
*
|
|
10
|
+
* The LLM workflow: search → get details → call_api.
|
|
7
11
|
*/
|
|
8
12
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
9
13
|
import type { ASCCredentials } from "./types.js";
|
|
@@ -11,12 +15,5 @@ export interface CreateServerOptions {
|
|
|
11
15
|
credentials: ASCCredentials;
|
|
12
16
|
verbose?: boolean;
|
|
13
17
|
}
|
|
14
|
-
/**
|
|
15
|
-
* Create and configure the MCP server.
|
|
16
|
-
*
|
|
17
|
-
* Registers:
|
|
18
|
-
* - ListTools handler → returns all generated tools + 3 meta-tools
|
|
19
|
-
* - CallTool handler → dispatches to the API or meta-tool
|
|
20
|
-
*/
|
|
21
18
|
export declare function createMcpServer(opts: CreateServerOptions): Server;
|
|
22
19
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAKnE,OAAO,KAAK,EAAE,cAAc,EAAW,MAAM,YAAY,CAAC;AAG1D,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,cAAc,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CA8QjE"}
|
package/dist/server.js
CHANGED
|
@@ -1,98 +1,103 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* server.ts — MCP server core.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Exposes 4 MCP tools instead of 1200+ to keep LLM context small:
|
|
5
|
+
* - search_apis → find the right operation by keyword
|
|
6
|
+
* - get_tool_details → get full parameter schema for an operation
|
|
7
|
+
* - call_api → execute any App Store Connect API operation
|
|
8
|
+
* - list_categories → browse API resource groups
|
|
9
|
+
*
|
|
10
|
+
* The LLM workflow: search → get details → call_api.
|
|
7
11
|
*/
|
|
8
12
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
9
13
|
import { ListToolsRequestSchema, CallToolRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
10
|
-
import { loadTools,
|
|
11
|
-
/**
|
|
12
|
-
* Create and configure the MCP server.
|
|
13
|
-
*
|
|
14
|
-
* Registers:
|
|
15
|
-
* - ListTools handler → returns all generated tools + 3 meta-tools
|
|
16
|
-
* - CallTool handler → dispatches to the API or meta-tool
|
|
17
|
-
*/
|
|
14
|
+
import { loadTools, executeTool } from "./tools.js";
|
|
18
15
|
export function createMcpServer(opts) {
|
|
19
16
|
const { credentials, verbose } = opts;
|
|
20
17
|
const toolsData = loadTools();
|
|
21
|
-
// Build a lookup map for O(1) dispatch
|
|
22
18
|
const toolMap = new Map();
|
|
23
19
|
for (const t of toolsData.tools) {
|
|
24
20
|
toolMap.set(t.name, t);
|
|
25
21
|
}
|
|
26
|
-
const server = new Server({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
inputSchema: {
|
|
53
|
-
type: "object",
|
|
54
|
-
properties: {
|
|
55
|
-
query: {
|
|
56
|
-
type: "string",
|
|
57
|
-
description: "Search keyword (e.g. 'app', 'build', 'subscription', 'review')",
|
|
58
|
-
},
|
|
59
|
-
category: {
|
|
60
|
-
type: "string",
|
|
61
|
-
description: "Filter by category (e.g. 'Apps', 'Builds')",
|
|
62
|
-
},
|
|
63
|
-
method: {
|
|
64
|
-
type: "string",
|
|
65
|
-
enum: ["GET", "POST", "PATCH", "DELETE"],
|
|
66
|
-
description: "Filter by HTTP method",
|
|
22
|
+
const server = new Server({ name: "appstore-connect-mcp", version: "1.0.0" }, { capabilities: { tools: {} } });
|
|
23
|
+
// ── Only register 4 tools ──────────────────────────────────────
|
|
24
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
25
|
+
return {
|
|
26
|
+
tools: [
|
|
27
|
+
{
|
|
28
|
+
name: "search_apis",
|
|
29
|
+
description: "Search App Store Connect API operations by keyword. " +
|
|
30
|
+
"Returns matching tool names, methods, paths, and categories. " +
|
|
31
|
+
"Use this first to find the right operation before calling call_api.",
|
|
32
|
+
inputSchema: {
|
|
33
|
+
type: "object",
|
|
34
|
+
properties: {
|
|
35
|
+
query: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "Search keyword (e.g. 'app', 'build', 'subscription', 'review', 'beta tester')",
|
|
38
|
+
},
|
|
39
|
+
category: {
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "Filter by category. Use list_categories to see all options.",
|
|
42
|
+
},
|
|
43
|
+
method: {
|
|
44
|
+
type: "string",
|
|
45
|
+
enum: ["GET", "POST", "PATCH", "DELETE"],
|
|
46
|
+
description: "Filter by HTTP method",
|
|
47
|
+
},
|
|
67
48
|
},
|
|
49
|
+
required: ["query"],
|
|
68
50
|
},
|
|
69
|
-
required: ["query"],
|
|
70
51
|
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
52
|
+
{
|
|
53
|
+
name: "get_tool_details",
|
|
54
|
+
description: "Get full details of a specific API operation: all parameters, " +
|
|
55
|
+
"their types, descriptions, and required/optional status. " +
|
|
56
|
+
"Call this after search_apis to learn what arguments call_api needs.",
|
|
57
|
+
inputSchema: {
|
|
58
|
+
type: "object",
|
|
59
|
+
properties: {
|
|
60
|
+
name: {
|
|
61
|
+
type: "string",
|
|
62
|
+
description: "The tool name (operationId), e.g. 'apps_getCollection'",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
required: ["name"],
|
|
66
|
+
},
|
|
77
67
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
68
|
+
{
|
|
69
|
+
name: "call_api",
|
|
70
|
+
description: "Execute any App Store Connect API operation. " +
|
|
71
|
+
"Use search_apis to find the operation name, then get_tool_details " +
|
|
72
|
+
"to see required parameters, then call_api to execute it.",
|
|
73
|
+
inputSchema: {
|
|
74
|
+
type: "object",
|
|
75
|
+
properties: {
|
|
76
|
+
name: {
|
|
77
|
+
type: "string",
|
|
78
|
+
description: "The operation name (from search_apis), e.g. 'apps_getCollection'",
|
|
79
|
+
},
|
|
80
|
+
arguments: {
|
|
81
|
+
type: "object",
|
|
82
|
+
description: "Arguments for the operation. " +
|
|
83
|
+
"Path params: e.g. {\"id\": \"123456\"}. " +
|
|
84
|
+
"Query params: e.g. {\"filter[name]\": \"MyApp\", \"limit\": 10}. " +
|
|
85
|
+
"For POST/PATCH: include \"_body\" with the JSON:API request body.",
|
|
86
|
+
additionalProperties: true,
|
|
87
|
+
},
|
|
87
88
|
},
|
|
89
|
+
required: ["name"],
|
|
88
90
|
},
|
|
89
|
-
required: ["name"],
|
|
90
91
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
{
|
|
93
|
+
name: "list_categories",
|
|
94
|
+
description: "List all API categories (resource groups) and total operation count.",
|
|
95
|
+
inputSchema: {
|
|
96
|
+
type: "object",
|
|
97
|
+
properties: {},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
],
|
|
96
101
|
};
|
|
97
102
|
});
|
|
98
103
|
// ── CallTool handler ───────────────────────────────────────────
|
|
@@ -102,7 +107,7 @@ export function createMcpServer(opts) {
|
|
|
102
107
|
if (verbose) {
|
|
103
108
|
console.error(`[appstore-connect-mcp] tool call: ${name}`);
|
|
104
109
|
}
|
|
105
|
-
// ──
|
|
110
|
+
// ── search_apis ──────────────────────────────────────────────
|
|
106
111
|
if (name === "search_apis") {
|
|
107
112
|
const query = String(toolArgs.query || "").toLowerCase();
|
|
108
113
|
const category = toolArgs.category;
|
|
@@ -136,21 +141,7 @@ export function createMcpServer(opts) {
|
|
|
136
141
|
],
|
|
137
142
|
};
|
|
138
143
|
}
|
|
139
|
-
|
|
140
|
-
return {
|
|
141
|
-
content: [
|
|
142
|
-
{
|
|
143
|
-
type: "text",
|
|
144
|
-
text: JSON.stringify({
|
|
145
|
-
apiVersion: toolsData.apiVersion,
|
|
146
|
-
totalTools: toolsData.stats.total,
|
|
147
|
-
totalCategories: toolsData.categories.length,
|
|
148
|
-
categories: toolsData.categories,
|
|
149
|
-
}, null, 2),
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
};
|
|
153
|
-
}
|
|
144
|
+
// ── get_tool_details ─────────────────────────────────────────
|
|
154
145
|
if (name === "get_tool_details") {
|
|
155
146
|
const toolName = String(toolArgs.name);
|
|
156
147
|
const tool = toolMap.get(toolName);
|
|
@@ -160,49 +151,113 @@ export function createMcpServer(opts) {
|
|
|
160
151
|
isError: true,
|
|
161
152
|
};
|
|
162
153
|
}
|
|
154
|
+
// Return tool def + computed input schema so LLM knows what to pass
|
|
163
155
|
return {
|
|
164
156
|
content: [
|
|
165
157
|
{
|
|
166
158
|
type: "text",
|
|
167
|
-
text: JSON.stringify(
|
|
159
|
+
text: JSON.stringify({
|
|
160
|
+
name: tool.name,
|
|
161
|
+
summary: tool.summary,
|
|
162
|
+
method: tool.method,
|
|
163
|
+
path: tool.path,
|
|
164
|
+
category: tool.category,
|
|
165
|
+
pathParams: tool.pathParams,
|
|
166
|
+
queryParams: tool.queryParams.map((p) => ({
|
|
167
|
+
name: p.name,
|
|
168
|
+
required: p.required,
|
|
169
|
+
description: p.description,
|
|
170
|
+
type: p.schema.type,
|
|
171
|
+
...(p.schema.items?.enum ? { enum: p.schema.items.enum } : {}),
|
|
172
|
+
...(p.schema.enum ? { enum: p.schema.enum } : {}),
|
|
173
|
+
})),
|
|
174
|
+
hasBody: tool.hasBody,
|
|
175
|
+
example: buildExample(tool),
|
|
176
|
+
}, null, 2),
|
|
168
177
|
},
|
|
169
178
|
],
|
|
170
179
|
};
|
|
171
180
|
}
|
|
172
|
-
// ──
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
// ── call_api ─────────────────────────────────────────────────
|
|
182
|
+
if (name === "call_api") {
|
|
183
|
+
const opName = String(toolArgs.name);
|
|
184
|
+
const opArgs = (toolArgs.arguments ?? {});
|
|
185
|
+
const tool = toolMap.get(opName);
|
|
186
|
+
if (!tool) {
|
|
187
|
+
return {
|
|
188
|
+
content: [
|
|
189
|
+
{
|
|
190
|
+
type: "text",
|
|
191
|
+
text: `Unknown operation: ${opName}. Use search_apis to find available operations.`,
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
isError: true,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
const result = await executeTool(tool, opArgs, credentials);
|
|
199
|
+
const text = typeof result === "string" ? result : JSON.stringify(result, null, 2);
|
|
200
|
+
// Truncate large responses to protect LLM context
|
|
201
|
+
const MAX = 25000;
|
|
202
|
+
return {
|
|
203
|
+
content: [
|
|
204
|
+
{
|
|
205
|
+
type: "text",
|
|
206
|
+
text: text.length > MAX
|
|
207
|
+
? text.slice(0, MAX) +
|
|
208
|
+
`\n\n... (truncated, ${text.length - MAX} more bytes)`
|
|
209
|
+
: text,
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
216
|
+
return {
|
|
217
|
+
content: [{ type: "text", text: `API Error: ${message}` }],
|
|
218
|
+
isError: true,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
184
221
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
// Format response — ensure it's compact text for the LLM
|
|
188
|
-
const text = typeof result === "string" ? result : JSON.stringify(result, null, 2);
|
|
222
|
+
// ── list_categories ──────────────────────────────────────────
|
|
223
|
+
if (name === "list_categories") {
|
|
189
224
|
return {
|
|
190
225
|
content: [
|
|
191
226
|
{
|
|
192
227
|
type: "text",
|
|
193
|
-
text:
|
|
228
|
+
text: JSON.stringify({
|
|
229
|
+
apiVersion: toolsData.apiVersion,
|
|
230
|
+
totalTools: toolsData.stats.total,
|
|
231
|
+
totalCategories: toolsData.categories.length,
|
|
232
|
+
byMethod: toolsData.stats.by_method,
|
|
233
|
+
categories: toolsData.categories,
|
|
234
|
+
}, null, 2),
|
|
194
235
|
},
|
|
195
236
|
],
|
|
196
237
|
};
|
|
197
238
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
isError: true,
|
|
203
|
-
};
|
|
204
|
-
}
|
|
239
|
+
return {
|
|
240
|
+
content: [{ type: "text", text: `Unknown tool: ${name}` }],
|
|
241
|
+
isError: true,
|
|
242
|
+
};
|
|
205
243
|
});
|
|
206
244
|
return server;
|
|
207
245
|
}
|
|
246
|
+
/** Build a usage example for a tool to help the LLM call it correctly. */
|
|
247
|
+
function buildExample(tool) {
|
|
248
|
+
const example = {};
|
|
249
|
+
for (const p of tool.pathParams) {
|
|
250
|
+
example[p.name] = p.name === "id" ? "1234567890" : `<${p.name}>`;
|
|
251
|
+
}
|
|
252
|
+
if (tool.queryParams.length > 0) {
|
|
253
|
+
const first = tool.queryParams[0];
|
|
254
|
+
example[first.name] = first.schema.type === "array" ? ["value1"] : "value";
|
|
255
|
+
}
|
|
256
|
+
if (tool.hasBody) {
|
|
257
|
+
example["_body"] = {
|
|
258
|
+
data: { type: "resourceType", attributes: {} },
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
return example;
|
|
262
|
+
}
|
|
208
263
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oCAAoC,CA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C,MAAM,OAAO,GAA4B,EAAE,CAAC;IAC5C,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QAChC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC;IACnE,CAAC;IACD,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAC7E,CAAC;IACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,OAAO,CAAC,OAAO,CAAC,GAAG;YACjB,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,EAAE;SAC/C,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ggaiteam/appstore-connect-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "MCP server for the Apple App Store Connect API — exposes all 1200+ operations as MCP tools. Supports local (stdio) and remote (HTTP) deployment.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "appstore-connect-mcp contributors",
|