JX

jamesrochabrun/xcodetracemcp

开发工具

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

44 stars 0 forks 质量 75 趋势 16MIT

https://github.com/user-attachments/assets/e92cbd43-cd6c-4ec9-9392-d0d2408a648d

概览

https://github.com/user-attachments/assets/e92cbd43-cd6c-4ec9-9392-d0d2408a648d Xcode Instruments 跟踪的智能性能分析,由 AI 通过模型上下文协议驱动。 请Claude记录和分析Xcode Instruments的跟踪,检测时间分析器回归,并通过本地MCP服务器获得可操作的优化建议。 该项目是一个,但不是完全替代 Instruments.app。它自动化了苹果通过 xcrun xctrace 公开的部分:记录、TOC/XML/HAR 导出、符号化、解析、报告、回归检查和安全跟踪清理。录制工具默认会在 Instruments.app 中打开已保存的 .trace,以便在图形界面中验证不存在或不可导出的区域。当模板或工具视图不可导出时,服务器会报告该限制,而不是发明数据。 把这个添加到 ~/Library/Application Support/Claude/claude_desktop_config。

概述(AI 翻译)

https://github.com/user-attachments/assets/e92cbd43-cd6c-4ec9-9392-d0d2408a648d

Xcode Instruments 跟踪的智能性能分析,由 AI 通过模型上下文协议驱动。

请Claude记录和分析Xcode Instruments的跟踪,检测时间分析器回归,并通过本地MCP服务器获得可操作的优化建议。

本项目是Instruments配套项目,不是 Instruments.app 的完整替代品。它自动化了苹果通过xcrun xctrace公开的部分:记录、TOC/XML/HAR 导出、符号化、解析、报告、回归检查和安全追踪清理。录制工具默认会在 Instruments.app 中打开保存的.trace,以便追踪中不存在或不可导出的区域可以在图形界面中验证。当模板或工具视图不可导出时,服务器会报告该限制,而不是发明数据。


安装

克劳德·科德

验证本地xcrun xctrace设置:

克劳德桌面

将此添加到 ~/Library/Application Support/Claude/claude_desktop_config.json,然后重启 Claude Desktop:

Codex CLI

检查Codex是否注册了服务器:

可选环境设置

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

README

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

Xcode Instruments Trace Analyzer (MCP)

https://github.com/user-attachments/assets/e92cbd43-cd6c-4ec9-9392-d0d2408a648d

Intelligent performance analysis for Xcode Instruments traces, powered by AI via Model Context Protocol.

Ask Claude to record and analyze Xcode Instruments traces, detect Time Profiler regressions, and get actionable optimization recommendations through a local MCP server.

This project is an Instruments companion, not a full replacement for Instruments.app. It automates the parts Apple exposes through xcrun xctrace: recording, TOC/XML/HAR export, symbolication, parsing, reports, regression checks, and safe trace cleanup. Recording tools open the saved .trace in Instruments.app by default so areas that are not present in the trace or not exportable can be verified in the GUI. When a template or Instruments view is not exportable, the server reports that limitation instead of inventing data.


Installation

Claude Code

claude mcp add --transport stdio --scope user xctrace-analyzer -- npx -y @xctrace-analyzer/mcp-server@latest

Verify the local xcrun xctrace setup:

npx -y @xctrace-analyzer/mcp-server@latest --check

Claude Desktop

Add this to ~/Library/Application Support/Claude/claude_desktop_config.json, then restart Claude Desktop:

{
  "mcpServers": {
    "xctrace-analyzer": {
      "command": "npx",
      "args": ["-y", "@xctrace-analyzer/mcp-server@latest"]
    }
  }
}

Codex CLI

codex mcp add xctrace-analyzer -- npx -y @xctrace-analyzer/mcp-server@latest

Check that Codex registered the server:

codex mcp list

Optional Environment Settings

Claude Desktop-style MCP configs can pass security settings through env:

{
  "mcpServers": {
    "xctrace-analyzer": {
      "command": "npx",
      "args": ["-y", "@xctrace-analyzer/mcp-server@latest"],
      "env": {
        "XCTRACE_ANALYZER_TRACE_ROOT": "/Users/you/Library/Application Support/xctrace-analyzer/traces",
        "XCTRACE_ANALYZER_ALLOW_LAUNCH": "1"
      }
    }
  }
}

Codex can pass the same settings with --env:

codex mcp add xctrace-analyzer \
  --env XCTRACE_ANALYZER_TRACE_ROOT="/Users/you/Library/Application Support/xctrace-analyzer/traces" \
  --env XCTRACE_ANALYZER_ALLOW_LAUNCH=1 \
  -- npx -y @xctrace-analyzer/mcp-server@latest

Build From Source

git clone https://github.com/jamesrochabrun/XcodeTraceMCP.git
cd XcodeTraceMCP
pnpm install --frozen-lockfile
pnpm verify

For local source installs, point your MCP client at packages/mcp-server/dist/index.js.


Avoiding Recording Interruptions

Trace recording runs as a single uninterrupted xcrun xctrace session. If your assistant pauses mid-recording to ask for tool approval, the capture window can drift or the run may need to be restarted. To keep recordings clean, before starting a profile:

在 GitHub 查看完整 README

安装

npx -y @xctrace-analyzer/mcp-server@latest
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "xctrace-analyzer": { "command": "npx", "args": ["-y", "@xctrace-analyzer/mcp-server@latest"] } } }