Skip to main content
Glama
App Store Connect MCP Server

App Store Connect MCP Server

App Store Connect MCP 服务器 — 代码模式

923 个端点。2 个工具。规范即实现。

TypeScript MCP SDK License: MIT API Version

问题所在

传统的 MCP 服务器将每个 API 端点包装为单独的工具。Apple 的 App Store Connect API 拥有 923 个端点。这意味着需要 923 个工具定义,占用超过 10 万个上下文 Token,并且每次 Apple 添加端点时都需要发布新版本。

Related MCP server: App Store Connect MCP

解决方案

代码模式:2 个工具替代 923 个。

工具

功能

search(code)

编写 JS 来查询 Apple 的 OpenAPI 规范。发现端点、检查参数、读取架构。

execute(code)

编写 JS 来调用 API。自动处理身份验证。支持链式调用。

LLM 编写查询。规范即实现。添加端点 = Apple 更新其规范。我们无需更改任何代码。

Traditional MCP:  923 endpoints → 923 tools → ~100K tokens → constant maintenance
Code Mode:        923 endpoints → 2 tools   → ~1K tokens   → zero maintenance

快速入门

1. 获取 App Store Connect 凭据

  1. 前往 App Store Connect → 用户和访问 → 集成 → 密钥

  2. 点击“+”生成新密钥(管理员或财务角色)

  3. 下载 .p8 文件(仅可下载一次!)

  4. 记录您的密钥 ID (Key ID) 和发行人 ID (Issuer ID)

2. 通过 Claude Code 安装

claude mcp add appstore-connect -s user \
  -e APP_STORE_KEY_ID=YOUR_KEY_ID \
  -e APP_STORE_ISSUER_ID=YOUR_ISSUER_ID \
  -e APP_STORE_P8_PATH=/absolute/path/to/AuthKey_XXXXXXXXXX.p8 \
  -e APP_STORE_VENDOR_NUMBER=YOUR_VENDOR_NUMBER \
  -- npx -y @trialanderror-ai/appstore-connect-mcp

-s user 使服务器在您的所有项目中可用。如果您不需要财务报告,可以省略 -e APP_STORE_VENDOR_NUMBER。

或者跳过内联环境变量形式,直接在您的 shell 或 MCP 配置中设置它们(见下文)。

3. 配置凭据

三个必需的环境变量(一个可选):

变量

描述

APP_STORE_KEY_ID

10 位字符的密钥 ID

APP_STORE_ISSUER_ID

UUID 发行人 ID

APP_STORE_P8_PATH

.p8 文件的绝对路径

APP_STORE_VENDOR_NUMBER (可选)

财务报告必需

为 Claude Code 配置

可以在 shell 中设置环境变量,或通过 .mcp.json 传递:

{
  "mcpServers": {
    "appstore-connect": {
      "command": "npx",
      "args": ["-y", "@trialanderror-ai/appstore-connect-mcp"],
      "env": {
        "APP_STORE_KEY_ID": "YOUR_KEY_ID",
        "APP_STORE_ISSUER_ID": "YOUR_ISSUER_ID",
        "APP_STORE_P8_PATH": "/path/to/AuthKey_XXXXXXXXXX.p8",
        "APP_STORE_VENDOR_NUMBER": "YOUR_VENDOR_NUMBER"
      }
    }
  }
}

为 Claude Desktop 配置

添加到 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "appstore-connect": {
      "command": "npx",
      "args": ["-y", "@trialanderror-ai/appstore-connect-mcp"],
      "env": {
        "APP_STORE_KEY_ID": "YOUR_KEY_ID",
        "APP_STORE_ISSUER_ID": "YOUR_ISSUER_ID",
        "APP_STORE_P8_PATH": "/path/to/AuthKey_XXXXXXXXXX.p8"
      }
    }
  }
}

从源码构建(替代方案)

git clone https://github.com/TrialAndErrorAI/appstore-connect-mcp
cd appstore-connect-mcp
npm install
npm run build

然后将您的 MCP 配置指向 node /path/to/appstore-connect-mcp/dist/index.js 而不是 npx。

使用示例

发现端点

search: "Find all endpoints related to customer reviews"

LLM 编写:

const reviews = Object.entries(spec.paths)
  .filter(([p]) => p.includes('customerReview'))
  .map(([path, methods]) => ({
    path,
    methods: Object.keys(methods).map(m => m.toUpperCase())
  }));
return reviews;

列出您的应用

execute: "List all my apps"

LLM 编写:

const apps = await api.request({ method: 'GET', path: '/v1/apps' });
return apps.data.map(a => ({ id: a.id, name: a.attributes.name }));

链式调用

execute: "Get latest reviews for my first app"

LLM 编写:

const apps = await api.request({ method: 'GET', path: '/v1/apps', params: { limit: '1' } });
const appId = apps.data[0].id;
const reviews = await api.request({
  method: 'GET',
  path: `/v1/apps/${appId}/customerReviews`,
  params: { limit: '5', sort: '-createdDate' }
});
return {
  app: apps.data[0].attributes.name,
  reviews: reviews.data.map(r => ({
    rating: r.attributes.rating,
    title: r.attributes.title,
    body: r.attributes.body
  }))
};

您可以访问的内容

全部 923 个 App Store Connect API 端点,包括:

类别

端点

您可以获得

应用元数据

29

标题、副标题、关键词、描述 — 读取和写入

分析

10

展示次数、页面浏览量、下载量、来源归因

销售与财务

2

各国收入、单位、收益

客户评论

5

评分、评论文本、回复评论

订阅

30

订阅管理、定价、组、优惠

App 内购买

29

IAP 管理、优惠代码

版本

28

版本管理、分阶段发布

屏幕截图

12

上传、重新排序、管理截图集

A/B 测试

24

产品页面实验、处理变体

自定义产品页面

18

每个广告系列的自定义落地页

TestFlight

23

Beta 组、测试人员、构建版本

定价

11

各地区定价、价格点

构建版本

29

构建版本管理、处理状态

查看 API-COVERAGE.md 获取完整的分组映射。

工作原理

Claude writes JavaScript
    │
    ▼
┌─────────────────────────────────────────────────┐
│ search({ code })                                │
│  Sandbox executes code against OpenAPI spec     │
│  923 paths, 1337 schemas — pre-resolved $refs   │
│  Returns: matching endpoints + parameters       │
└─────────────────────────────────────────────────┘
    │
    ▼
┌─────────────────────────────────────────────────┐
│ execute({ code })                               │
│  Sandbox executes code against auth'd client    │
│  JWT injected — code never sees credentials     │
│  Supports GET/POST/PATCH/DELETE + chaining      │
│  Auto-decompresses gzipped report responses     │
│  Returns: API response (truncated to 40K chars) │
└─────────────────────────────────────────────────┘

安全性

  • 代码在 Node.js vm 沙箱中运行

  • 不提供 fetch、require、process、eval、setTimeout

  • 凭据通过绑定注入 — 对生成的代码不可见

  • 响应被截断以防止上下文膨胀

  • 仅提供 spec (搜索) 或 api (执行) 作为全局变量

架构

src/
├── auth/jwt-manager.ts      — JWT with P8 key, ES256, 19-min cache
├── api/client.ts             — HTTP client, rate limiting, gzip handling
├── spec/
│   ├── openapi.json          — Apple's official spec (923 endpoints)
│   └── loader.ts             — Loads + resolves $refs for flat traversal
├── executor/sandbox.ts       — vm-based sandboxed execution
├── server/mcp-server.ts      — MCP server (search, execute, test_connection)
└── index.ts                  — Entry point

为什么选择代码模式?

传统 MCP

代码模式

工具

每个端点 1 个 (923)

总共 2 个

上下文 Token

~100K+

~1K

添加端点

新工具 + 代码 + 架构 + 发布

Apple 更新规范。无需更改。

链式调用

在每次调用之间重新进入 LLM

单次执行,多次调用

维护

更新 923 个工具定义

更新 1 个规范文件

灵感来自 Cloudflare 的代码模式。

开发

npm install          # Install dependencies
npm run build        # Compile + copy spec
npm run dev          # Watch mode (tsx)
npm start            # Run compiled server
npm run type-check   # TypeScript check

许可证

MIT — 使用它、修改它、出售它。只要让它运行起来就行。

致谢

由 Trial and Error Inc 构建。在生产环境中被 RenovateAI 使用,这是一款适用于 iOS、Android 和 Web 的 AI 驱动家居设计应用。代码模式源自 Cloudflare。


“我们不实现单个端点。我们实现调用任何端点的能力。”

Related MCP Connectors

Related MCP Servers