appmockupgenerator-mcp 1.0.0 → 1.0.1

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/dist/api.js CHANGED
@@ -50,6 +50,9 @@ function mapApiError(status, body, context) {
50
50
  if (status === 404 && /session/i.test(serverMsg ?? '')) {
51
51
  return new AppMockupError('SESSION_EXPIRED', 'The title preview expired (previews last 1 hour).', 'Run preview_titles again, or call generate_screenshots with the files directly.');
52
52
  }
53
+ if (status === 404) {
54
+ return new AppMockupError('SERVICE_UNAVAILABLE', `${context}: this AppMockup API endpoint was not found.`, 'The server may not support MCP yet, or APPMOCKUP_API_URL points to the wrong environment (amk_test_ keys use /test-api, amk_live_ keys use /api).');
55
+ }
53
56
  if (status === 400 || status === 413) {
54
57
  return new AppMockupError('INVALID_INPUT', serverMsg ? `${context}: ${serverMsg}` : `${context}: the request was rejected.`, 'Check the screenshots and options, then retry.');
55
58
  }
package/dist/config.js CHANGED
@@ -3,8 +3,14 @@ import path from 'node:path';
3
3
  import { AppMockupError, API_KEYS_URL } from './errors.js';
4
4
  export const VERSION = '1.0.0';
5
5
  const KEY_RE = /^amk_(live|test)_[A-Za-z0-9]{40}$/;
6
- function parseBaseUrl(raw) {
7
- const value = (raw ?? '').trim() || 'https://api.appmockupgenerator.com/api';
6
+ const PRODUCTION_API = 'https://api.appmockupgenerator.com/api';
7
+ const STAGING_API = 'https://api.appmockupgenerator.com/test-api';
8
+ /** amk_test_ keys belong to the staging project, so they default to the staging API. */
9
+ function defaultBaseUrl(apiKey) {
10
+ return apiKey?.startsWith('amk_test_') ? STAGING_API : PRODUCTION_API;
11
+ }
12
+ function parseBaseUrl(raw, apiKey) {
13
+ const value = (raw ?? '').trim() || defaultBaseUrl(apiKey);
8
14
  let url;
9
15
  try {
10
16
  url = new URL(value);
@@ -23,7 +29,7 @@ export function loadConfig(env = process.env) {
23
29
  const outputDir = (env.APPMOCKUP_OUTPUT_DIR ?? '').trim();
24
30
  return {
25
31
  apiKey,
26
- apiBaseUrl: parseBaseUrl(env.APPMOCKUP_API_URL),
32
+ apiBaseUrl: parseBaseUrl(env.APPMOCKUP_API_URL, apiKey),
27
33
  outputDir: outputDir ? path.resolve(outputDir.replace(/^~(?=$|[\\/])/, os.homedir())) : null,
28
34
  allowedCdnHosts: ['cdn.appmockupgenerator.com', 'cdn-staging.appmockupgenerator.com'],
29
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appmockupgenerator-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "AppMockup MCP server: turn raw app screenshots into App Store and Google Play marketing screenshots from Claude Code, Cursor, VS Code or Claude Desktop.",
5
5
  "type": "module",
6
6
  "bin": {