CherryHQ/cherry-studio · error · Error

Invalid manifest: server.mcp_config.args must be an array

Error message

Invalid manifest: server.mcp_config.args must be an array

What it means

Thrown during MCP package installation when `server.mcp_config.args` exists but is not an array. The runtime expects args to be an array of strings passed to the command. Since the check is `!Array.isArray(...)`, a missing args field (undefined) also triggers this — args is required, not optional.

Source

Thrown at src/main/ai/mcp/McpPackageService.ts:565

        manifest = { ...parsedManifest, dxt_version: parsedManifest.dxt_version }
      }
      if (!manifest.name) {
        throw new Error('Invalid manifest: missing name')
      }
      if (!manifest.version) {
        throw new Error('Invalid manifest: missing version')
      }
      if (!manifest.server) {
        throw new Error('Invalid manifest: missing server configuration')
      }
      if (!manifest.server.mcp_config) {
        throw new Error('Invalid manifest: missing server.mcp_config')
      }
      if (!manifest.server.mcp_config.command) {
        throw new Error('Invalid manifest: missing server.mcp_config.command')
      }
      if (!Array.isArray(manifest.server.mcp_config.args)) {
        throw new Error('Invalid manifest: server.mcp_config.args must be an array')
      }

      // Use server name as the final extract directory for automatic version management
      const serverDirName = `server-${manifest.name}`
      const finalExtractDir = ensurePathWithin(this.mcpDir, path.join(this.mcpDir, serverDirName))

      // Stage the new package first, then swap directories so a failed install
      // does not destroy the last working version.
      await this.replacePackageDirectory(tempExtractDir, finalExtractDir, serverDirName)
      logger.debug(`${packageLabel} server extracted to: ${finalExtractDir}`)

      // Clean up the uploaded package file if it's in temp directory
      if (filePath.startsWith(this.tempDir)) {
        fs.unlinkSync(filePath)
      }

      // Return success with manifest and extraction path
      return {

View on GitHub (pinned to 726446b54c)

Solutions

  1. Ensure manifest.json has `server.mcp_config.args` as a JSON array of strings
  2. If args was omitted, add an empty array: "args": []
  3. Convert any space-delimited string to an array: "-y foo" → ["-y", "foo"]
  4. Re-package and retry the installation

Example fix

// before (manifest.json)
{
  "server": {
    "mcp_config": {
      "command": "npx",
      "args": "-y @my/mcp-server"
    }
  }
}

// after
{
  "server": {
    "mcp_config": {
      "command": "npx",
      "args": ["-y", "@my/mcp-server"]
    }
  }
}
Defensive patterns

Strategy: validation

Validate before calling

function validateManifestArgs(manifest: unknown): asserts manifest is McpPackageManifest {
  const args = (manifest as any)?.server?.mcp_config?.args
  if (!Array.isArray(args) || !args.every(a => typeof a === 'string')) {
    throw new Error('Manifest server.mcp_config.args must be a string array')
  }
}

Type guard

function hasValidArgs(manifest: unknown): manifest is McpPackageManifest {
  const args = (manifest as any)?.server?.mcp_config?.args
  return Array.isArray(args) && args.every(a => typeof a === 'string')
}

Try / catch

try {
  await mcpPackageService.processUploadedPackage(filePath)
} catch (e) {
  if (e instanceof Error && e.message.includes('args must be an array')) {
    // Prompt user to fix args in manifest
  }
  throw e
}

Prevention

When it happens

Trigger: The manifest.json contains `server.mcp_config.command` but `args` is a string (e.g. "-y foo"), an object, null, or omitted entirely. The validator runs `Array.isArray(manifest.server.mcp_config.args)` which returns false for all non-array values.

Common situations: Author writes args as a single space-delimited string instead of an array; args key is accidentally omitted; args is set to null; a JSON serialization bug converts the array to an object with numeric keys.

Related errors


AI-assisted analysis of CherryHQ/cherry-studio@726446b54c (2026-08-12). Data as JSON: /api/errors/35ae344c307a2d6e. Report an issue: GitHub.