PX

polarvista/xcode-mcp-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

53 stars 4 forks 质量 46 趋势 0

polarvista/xcode-mcp-server 是从 https://github.com/polarvista/xcode-mcp-server. 导入的 MCP 候选服务器

概览

polarvista/xcode-mcp-server 是从 https://github.com/polarvista/xcode-mcp-server. 导入的 MCP 候选服务器

概述(AI 翻译)

一个模型上下文协议服务器,用于直接从 LLM 应用构建 Xcode 项目

Xcode MCP 服务器提供了一个模型上下文协议接口,用于构建和测试 Xcode 项目。它使 AI 助手能够通过标准化接口直接触发构建、运行测试、监控进度并访问日志。

特色

  • 构建带有自定义方案和配置的Xcode项目
  • 运行带有细粒控制的单元测试(运行特定测试或跳过测试)
  • 生成代码覆盖报告
  • 实时流式构建日志和测试日志
  • 访问详细的构建和测试报告
  • JSON格式输出
  • 自动日志持久化

要求

  • Node.js 16+
  • Xcode 命令行工具
  • TypeScript
  • 兼容MCP的客户端(例如,Claude桌面版)

安装

使用 Claude Desktop

  1. 启动服务器:

  2. 在 Claude 桌面设置中:

可用工具

build_project

构建一个指定参数的Xcode项目。

参数:

  • projectPath(必填):指向 .xcodeproj 或 .xcworkspace 的路径
  • scheme(必修):构建方案名称
  • configuration(可选):构建配置(调试/发布,默认为调试)

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Xcode MCP Server

A Model Context Protocol server for building Xcode projects directly from LLM applications

The Xcode MCP Server provides a Model Context Protocol interface for building and testing Xcode projects. It enables AI assistants to directly trigger builds, run tests, monitor progress, and access logs through a standardized interface.

Features

  • Build Xcode projects with custom schemes and configurations
  • Run unit tests with granular control (run specific tests or skip tests)
  • Generate code coverage reports
  • Stream build and test logs in real-time
  • Access detailed build and test reports
  • JSON-formatted output
  • Automatic log persistence

Requirements

  • Node.js 16+
  • Xcode Command Line Tools
  • TypeScript
  • MCP-compatible client (e.g., Claude Desktop)

Installation

# Clone the repository
git clone https://github.com/PolarVista/Xcode-mcp-server.git
cd xcode-mcp-server

# Install dependencies
npm install

# Build the server
npm run build

Usage with Claude Desktop

  1. Start the server:

    npm run start /path/to/build/logs/directory
    
  2. In Claude Desktop settings:

           "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"
       }
    

Available Tools

build_project

Builds an Xcode project with specified parameters.

Parameters:

  • projectPath (required): Path to the .xcodeproj or .xcworkspace
  • scheme (required): Build scheme name
  • configuration (optional): Build configuration (Debug/Release, defaults to Debug)
  • destination (optional): Build destination (defaults to “platform=iOS Simulator,name=iPhone 15 Pro”)

Example usage in Claude:

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

run_tests

Runs unit tests with optional filtering.

Parameters:

  • projectPath (required): Path to the .xcodeproj or .xcworkspace
  • scheme (required): Test scheme name
  • testIdentifier (optional): Specific test to run (e.g., ‘MyTests/testExample’)
  • skipTests (optional): Array of test identifiers to skip
  • configuration (optional): Build configuration (Debug/Release, defaults to Debug)
  • destination (optional): Test destination (defaults to “platform=iOS Simulator,name=iPhone 15 Pro”)

Example usage in Claude:

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

Logs

  • All logs are stored in the specified base directory under build-logs/
  • Build operations create:
    • Plain text log (build-[timestamp].log)
    • JSON-formatted log (build-[timestamp].log.json)
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →