Skip to main content
Glama
yorifuji

MCP iOS Simulator Screenshot

by yorifuji

MCP iOS 模拟器截图

使用模型上下文协议 (MCP) 从 iOS 模拟器捕获屏幕截图的服务器。

概述

本项目实现了一个MCP协议服务器,可以抓取iOS模拟器的当前屏幕,并保存到指定的目录。

Related MCP server: Screeny MCP Server

设置

克莱恩和鲁代码

对于 Cline 和 Roo 代码,基本格式是:

{
  "mcpServers": {
    "mcp-ios-simulator-screenshot": {
      "command": "npx",
      "args": ["-y", "mcp-ios-simulator-screenshot"]
    }
  }
}

如果您克隆存储库,则可以使用以下配置:

{
  "mcpServers": {
    "mcp-ios-simulator-screenshot": {
      "command": "node",
      "args": ["/path/to/mcp-ios-simulator-screenshot/build/index.js"]
    }
  }
}

光标,克劳德桌面

对于 Cursor 和 Claude Desktop,您需要指定--output-dir和输出目录:

{
  "mcpServers": {
    "mcp-ios-simulator-screenshot": {
      "command": "npx",
      "args": [
        "mcp-ios-simulator-screenshot",
        "--output-dir",
        "/path/to/your/output/directory"
      ]
    }
  }
}

MCP 工具参数

获取屏幕截图

从 iOS 模拟器捕获屏幕截图并将其保存到指定目录。

范围

类型

描述

默认值

输出文件名

细绳

输出文件名

时间戳.png

输出目录名称

细绳

屏幕截图的子目录名称

.截图

调整大小

布尔值

是否将图像调整为大约 VGA 尺寸

真的

最大宽度

整数

调整大小的最大宽度(像素)

640

设备 ID

细绳

指定模拟器设备

启动设备

输出格式

成功时:

{
  "success": true,
  "message": "iOS Simulator screenshot saved successfully",
  "filePath": ".screenshots/simulator_2025-04-10T16-51-16-755Z.png",
  "metadata": {
    "width": 1170,
    "height": 2532,
    "format": "png",
    "size": 382946,
    "timestamp": "2025-04-10T16:51:16.755Z"
  },
  "serverConfig": {
    "commandLineArgs": {
      "outputDir": "/Users/username/Desktop" // Only included when --output-dir is specified
    }
  }
}

注意:仅当启动服务器时指定了--output-dir参数时, serverConfig.commandLineArgs.outputDir字段才会包含在响应中。

{
  "success": false,
  "message": "Error capturing iOS Simulator screenshot: [error message]",
  "error": {
    "code": "ENOENT",
    "command": "xcrun simctl io booted screenshot --type=png -",
    "stderr": "No matching devices found."
  }
}

故障排除

  • 如果您无法截取屏幕截图:

    • 检查 iOS 模拟器是否正在运行

    • 检查是否安装了 Xcode 命令行工具

    • 检查是否可以直接执行xcrun simctl io booted screenshot命令

  • 如果发生权限错误:

    • 检查您是否具有输出目录的写入权限

要求

  • Node.js 16.0.0 或更高版本

  • macOS(需要 iOS 模拟器)

  • Xcode 命令行工具

技术堆栈

  • TypeScript

  • Node.js

  • MCP SDK(@modelcontextprotocol/sdk)

执照

麻省理工学院

其他语言

Available Tools

1 tool
get_screenshotC

Capture a screenshot from iOS Simulator

ParametersJSON Schema
NameRequiredDescriptionDefault
output_filenameNoOutput filename (if not specified, timestamp.png will be used)
output_directory_nameNoSubdirectory name for screenshots (if not specified, .screenshots will be used).screenshots
resizeNoWhether to resize the image to approximately VGA size
max_widthNoMaximum width for resizing (pixels)
device_idNoSpecify a simulator device (if not specified, the booted device will be used)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. 'Capture a screenshot' implies a read operation, but it doesn't specify whether this requires specific simulator states, permissions, or has side effects. The description lacks information about error conditions, what happens if no device is booted, or the format/location of output beyond what's in parameter descriptions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core purpose without unnecessary words. It's appropriately sized for a straightforward tool and gets directly to the point. Every word earns its place in conveying the essential function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations and no output schema, the description is insufficiently complete. While the purpose is clear, it lacks important behavioral context about how the tool operates, what it returns, error handling, and dependencies. The description doesn't compensate for the absence of structured metadata that would help an agent understand the tool's behavior and constraints.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, all parameters are well-documented in the schema itself. The description adds no additional parameter information beyond what's already in the schema descriptions. This meets the baseline expectation when schema coverage is complete, but doesn't provide extra semantic context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Capture') and target resource ('screenshot from iOS Simulator'), making the purpose immediately understandable. It lacks sibling differentiation, but since there are no sibling tools, this doesn't reduce clarity. The description is specific enough to distinguish this from other potential screenshot tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, prerequisites, or context. It simply states what the tool does without indicating appropriate scenarios or limitations. While there are no sibling tools to differentiate from, the description offers no usage context whatsoever.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool update
    • First observedget_screenshot

TDQS

B3.1/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is singular and clearly defined, making it impossible for an agent to misselect between non-existent alternatives.

Naming Consistency5/5

A single tool inherently has perfect naming consistency, as there are no other tools to compare against. The tool name 'get_screenshot' follows a clear verb_noun pattern, which would be consistent if more tools existed.

Tool Count2/5

A single tool is too few for most practical server purposes, as it severely limits functionality and flexibility. While the server's name suggests a focused domain (iOS Simulator screenshots), one tool feels thin and incomplete for even basic operations like listing simulators or managing screenshots.

Completeness2/5

The tool surface is severely incomplete for the implied domain of iOS Simulator interactions. It only provides screenshot capture, with obvious gaps such as listing available simulators, starting/stopping simulators, or managing screenshot files, which are essential for a coherent workflow.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers