Xcode MCP 服务器
Xcode MCP 服务器提供了用于构建和测试 Xcode 项目的模型上下文协议 (MCP) 接口。它使 AI 助手能够通过标准化接口直接触发构建、运行测试、监控进度和访问日志。
特征
使用自定义方案和配置构建 Xcode 项目
运行具有精细控制的单元测试(运行特定测试或跳过测试)
生成代码覆盖率报告
实时传输构建和测试日志
访问详细的构建和测试报告
JSON 格式的输出
自动日志持久化
要求
Node.js 16+
Xcode 命令行工具
TypeScript
MCP 兼容客户端(例如 Claude Desktop)
安装
与 Claude Desktop 一起使用
启动服务器:
在 Claude Desktop 设置中:
可用工具
构建项目
使用指定的参数构建 Xcode 项目。
参数:
projectPath
(必需):.xcodeproj 或 .xcworkspace 的路径scheme
(必填):构建方案名称configuration
(可选):构建配置(调试/发布,默认为调试)destination
(可选):构建目标(默认为“platform=iOS Simulator,name=iPhone 15 Pro”)
Claude 中的用法示例:
运行测试
运行带有可选过滤的单元测试。
参数:
projectPath
(必需):.xcodeproj 或 .xcworkspace 的路径scheme
(必填):测试方案名称testIdentifier
(可选):要运行的特定测试(例如,“MyTests/testExample”)skipTests
(可选):要跳过的测试标识符数组configuration
(可选):构建配置(调试/发布,默认为调试)destination
(可选):测试目的地(默认为“platform=iOS Simulator,name=iPhone 15 Pro”)
Claude 中的用法示例:
日志
所有日志都存储在
build-logs/
下的指定基础目录中构建操作创建:
纯文本日志(
build-[timestamp].log
)JSON 格式的日志(
build-[timestamp].log.json
)Xcode 报告(
report-[timestamp].txt
)
测试操作创建:
测试日志(
test-[timestamp].log
)JSON 格式的日志(
test-[timestamp].log.json
)测试报告(
test-report-[timestamp].txt
)代码覆盖率报告(
coverage-[timestamp].txt
)
最新日志(构建或测试)可通过
xcode-build://latest-log
资源访问
local-only server
The server can only run on the client's local machine because it depends on local resources.
Tools
模型上下文协议服务器,使 AI 助手能够直接通过标准化界面构建和测试 Xcode 项目,并具有运行测试、监控进度和实时访问日志的功能。
Related Resources
Related MCP Servers
- -securityFlicense-qualityA comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.Last updated -331
- AsecurityAlicenseAqualityA Model Context Protocol server that provides tools for Xcode-related operations, making it easier to work with iOS project management, building, testing, archiving, and deploying apps to both simulators and physical devices.Last updated -9296MIT License
- -securityAlicense-qualityA Model Context Protocol server that enables AI assistants to interact with iOS simulators, perform accessibility testing, manage apps, and automate complex iOS workflows.Last updated -25Apache 2.0