xcode-mcp

xcode-mcp

Enables control of the iOS Simulator using the xcrun simctl command-line utility. It allows users to manage devices, install and launch apps, send push notifications, and simulate device features like GPS location.

Category
访问服务器

README

xcode-mcp

MCP server for Xcode developer tools.

Installation

npm install
npm run build

Usage

Claude Desktop Configuration

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "xcode": {
      "command": "node",
      "args": ["/Users/YOUR_USERNAME/Projects/xcode-mcp/dist/index.js"]
    }
  }
}

Available Tools

iOS Simulator (simctl)

Control iOS Simulators via xcrun simctl.

Tool Description
simctl_list List available simulators, device types, runtimes, or device pairs
simctl_boot Boot a simulator device
simctl_shutdown Shutdown a simulator device or all simulators
simctl_install Install an app bundle on a simulator
simctl_launch Launch an app on a simulator
simctl_terminate Terminate a running app without shutting down the simulator
simctl_uninstall Uninstall an app from a simulator
simctl_openurl Open a URL or deep link on a simulator
simctl_push Send a push notification to an app
simctl_location Set or clear the simulated GPS location
simctl_privacy Grant, revoke, or reset privacy permissions for an app
simctl_io_screenshot Capture a screenshot from a simulator

Device Identification

All simulator tools that require a device accept:

  • Device UDID (e.g., "3A8C9B5F-1234-5678-9ABC-DEF012345678")
  • Device name (e.g., "iPhone 16 Pro")
  • Special value "booted" for the currently booted simulator

Examples

List all devices:

{"name": "simctl_list", "arguments": {"filter": "devices"}}

Boot a simulator:

{"name": "simctl_boot", "arguments": {"device": "iPhone 16 Pro"}}

Take a screenshot:

{"name": "simctl_io_screenshot", "arguments": {"device": "booted"}}

Send a push notification:

{
  "name": "simctl_push",
  "arguments": {
    "device": "booted",
    "bundle_id": "com.example.app",
    "payload": {
      "aps": {
        "alert": {
          "title": "Test",
          "body": "Hello from MCP!"
        }
      }
    }
  }
}

Set location:

{
  "name": "simctl_location",
  "arguments": {
    "device": "booted",
    "action": "set",
    "latitude": 37.7749,
    "longitude": -122.4194
  }
}

Grant camera permission:

{
  "name": "simctl_privacy",
  "arguments": {
    "device": "booted",
    "action": "grant",
    "service": "camera",
    "bundle_id": "com.example.app"
  }
}

WebDriverAgent (wda)

UI automation for iOS Simulator apps via WebDriverAgent. Enables tapping, swiping, typing, and finding UI elements.

Tool Description
wda_status Check WebDriverAgent server connectivity
wda_tap Tap at coordinates, by accessibility ID, or element ID
wda_type Type text into the currently focused text field
wda_swipe Perform a swipe gesture from start to end coordinates
wda_find Find UI elements by accessibility ID, class name, or predicate
wda_source Get the UI hierarchy (accessibility tree) as XML
wda_home Press the home button
wda_alert Accept or dismiss system alerts

Prerequisites

  1. Clone WebDriverAgent (one-time):

    git clone https://github.com/appium/WebDriverAgent.git
    cd WebDriverAgent
    
  2. Start WDA on a simulator (keep running in a terminal):

    xcodebuild test -project WebDriverAgent.xcodeproj \
      -scheme WebDriverAgentRunner \
      -destination 'platform=iOS Simulator,name=iPhone 16 Pro'
    
  3. Verify WDA is running:

    curl http://localhost:8100/status
    

Coordinate System

All coordinates are in points (logical pixels), not physical pixels. Use wda_source to see element positions in the UI hierarchy XML.

Common Parameters

All WDA tools accept these optional parameters:

  • bundle_id: Activate a specific app before the action
  • port: WDA server port (default: 8100)

Examples

Check WDA status:

{"name": "wda_status", "arguments": {}}

Tap at coordinates:

{"name": "wda_tap", "arguments": {"x": 200, "y": 400}}

Tap by accessibility ID:

{"name": "wda_tap", "arguments": {"accessibility_id": "login_button"}}

Tap with app activation:

{"name": "wda_tap", "arguments": {"accessibility_id": "login", "bundle_id": "com.example.app"}}

Type text:

{"name": "wda_type", "arguments": {"text": "hello@example.com"}}

Swipe down (scroll up):

{
  "name": "wda_swipe",
  "arguments": {
    "start_x": 200,
    "start_y": 400,
    "end_x": 200,
    "end_y": 200,
    "duration": 500
  }
}

Find elements:

{"name": "wda_find", "arguments": {"strategy": "accessibility id", "value": "submit_button"}}

Get UI hierarchy:

{"name": "wda_source", "arguments": {}}

Handle alert:

{"name": "wda_alert", "arguments": {"action": "accept"}}

Xcode Build (xcodebuild)

Build, test, and manage Xcode projects via xcodebuild.

Tool Description
xcodebuild_list List schemes, targets, and configurations for a project or workspace
xcodebuild_build Build a scheme for a destination with structured result parsing
xcodebuild_test Run tests and return structured results with pass/fail counts
xcodebuild_clean Clean build artifacts for a scheme
xcodebuild_show_build_settings Show build configuration settings

Project Auto-Detection

All xcodebuild tools can automatically detect the project or workspace in the current directory. They prefer .xcworkspace over .xcodeproj. You can also specify explicit paths:

  • workspace: Path to a .xcworkspace file
  • project: Path to a .xcodeproj file
  • directory: Directory to search for projects (defaults to cwd)

Destination Handling

The destination parameter accepts:

  • Device names (e.g., "iPhone 16 Pro") - automatically resolved to simulator UDID
  • Full destination strings (e.g., "platform=iOS Simulator,name=iPhone 16 Pro")

Examples

List schemes:

{"name": "xcodebuild_list", "arguments": {}}

Build a scheme:

{
  "name": "xcodebuild_build",
  "arguments": {
    "scheme": "MyApp",
    "destination": "iPhone 16 Pro",
    "configuration": "Debug"
  }
}

Run tests:

{
  "name": "xcodebuild_test",
  "arguments": {
    "scheme": "MyApp",
    "destination": "iPhone 16 Pro",
    "only_testing": ["MyAppTests/testLogin"]
  }
}

Clean build:

{
  "name": "xcodebuild_clean",
  "arguments": {
    "scheme": "MyApp"
  }
}

Show build settings:

{
  "name": "xcodebuild_show_build_settings",
  "arguments": {
    "scheme": "MyApp",
    "configuration": "Release"
  }
}

Development

# Run in development mode
npm run dev

# Build
npm run build

# Test
npm test

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选