Xcode MCP Server

Xcode MCP Server

未知

Xcode MCP 服务器 - 快速开始指南

概述

Xcode MCP 服务器允许 AI 助手直接构建和测试 Xcode 项目,通过标准化接口触发构建、运行测试并获取结果。

要求

  • Node.js 16+
  • Xcode 命令行工具
  • 兼容 MCP 的客户端(如 Claude Desktop)

安装

git clone https://github.com/PolarVista/Xcode-mcp-server.git
cd xcode-mcp-server
npm install
npm run build

配置 Claude Desktop

  1. 启动服务器:

    npm run start /path/to/build/logs/directory
    
  2. 在 Claude Desktop 设置中添加:

    {
      "command": "node",
      "args": ["/path/to/the/xcode-mcp-server/build/index.js",
               "/path/to/your/project/folder"],
      "env": {
        "PATH": "/usr/bin:/bin:/usr/local/bin:/usr/sbin:/sbin"
      }
    }
    

核心功能

构建项目

build_project({
  projectPath: "/path/to/Project.xcodeproj",
  scheme: "MyApp",
  configuration: "Debug"
})

运行测试

run_tests({
  projectPath: "/path/to/Project.xcodeproj",
  scheme: "MyAppTests",
  testIdentifier: "LoginTests/testSuccessfulLogin",
  skipTests: ["PerformanceTests/testLargeDataLoad"]
})

日志访问

所有日志存储在指定目录的 build-logs/ 文件夹中,最新日志可通过 xcode-build://latest-log 访问。


更多详细信息请参阅完整文档。