Skip to main content
Glama
xcode-analyzer-mcp

xcode-analyzer-mcp

by sunny-maeng

xcode-analyzer-mcp

MCP server for analyzing Xcode project dependencies, build times, and code health.

An AI-powered static analysis tool for iOS/macOS projects that works with Claude Code and other MCP-compatible clients.

Features

  • Circular Dependency Detection — Tarjan's SCC algorithm on module/file-level dependency graphs

  • Build Time Analysis — Parse DerivedData build logs or estimate complexity heuristically

  • Import Dependency Graph — Visualize module dependencies as Mermaid diagrams, DOT, or adjacency lists

  • Unused Import Detection — Heuristic analysis with built-in symbol database for 20+ popular iOS frameworks

  • Dependency Tree — SPM (Package.resolved) and CocoaPods (Podfile.lock) tree analysis

  • Large File Detection — Find images, videos, fonts, and other resources impacting app size

Related MCP server: Xcode MCP Server

Quick Start

With Claude Code

claude mcp add xcode-analyzer -- npx -y xcode-analyzer-mcp

With Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "xcode-analyzer": {
      "command": "npx",
      "args": ["-y", "xcode-analyzer-mcp"]
    }
  }
}

Manual Installation

npm install -g xcode-analyzer-mcp

Available Tools

analyze_circular_dependencies

Detect circular dependencies between modules or files.

Parameter

Type

Description

projectPath

string (required)

Path to Xcode project root

level

"module" | "file"

Analysis granularity (default: module)

excludePatterns

string[]

Glob patterns to exclude

analyze_build_time

Analyze build times from DerivedData logs or estimate via static analysis.

Parameter

Type

Description

projectPath

string (required)

Path to Xcode project root

derivedDataPath

string

Custom DerivedData path

scheme

string

Xcode scheme name

topN

number

Top N slowest files (default: 20)

thresholdMs

number

Minimum duration filter

analyze_import_graph

Build and visualize module dependency graph from Swift imports.

Parameter

Type

Description

projectPath

string (required)

Path to Xcode project root

outputFormat

"adjacency_list" | "matrix" | "mermaid" | "dot"

Output format

includeSystemFrameworks

boolean

Include UIKit, Foundation, etc.

excludePatterns

string[]

Glob patterns to exclude

detect_unused_imports

Find potentially unused Swift import statements.

Parameter

Type

Description

projectPath

string (required)

Path to Xcode project root

targetPaths

string[]

Specific paths to analyze

confidence

"high" | "medium" | "low"

Detection confidence filter

excludePatterns

string[]

Glob patterns to exclude

analyze_dependency_tree

Analyze SPM and CocoaPods dependency trees.

Parameter

Type

Description

projectPath

string (required)

Path to Xcode project root

packageManager

"spm" | "cocoapods" | "auto"

Package manager (default: auto)

showTransitive

boolean

Show transitive deps (default: true)

detect_large_files

Find large files impacting app bundle size.

Parameter

Type

Description

projectPath

string (required)

Path to Xcode project root

thresholdKB

number

Minimum size in KB (default: 500)

categories

string[]

File types: images, videos, fonts, json, plists, xcassets, storyboards, all

checkXcassets

boolean

Analyze .xcassets individually

Usage Examples

Once connected, ask Claude:

  • "프로젝트에 순환 참조 있는지 확인해줘"

  • "빌드 시간 가장 오래 걸리는 파일 top 10 보여줘"

  • "의존성 그래프를 Mermaid 다이어그램으로 보여줘"

  • "사용 안 하는 import 찾아줘"

  • "SPM 의존성 트리 보여줘"

  • "500KB 넘는 파일들 찾아줘"

How It Works

This tool performs static analysis only — no compilation or Xcode required. It parses:

  • .swift files for import statements

  • Package.swift for SPM target dependencies

  • Package.resolved for resolved SPM versions

  • Podfile.lock for CocoaPods dependency tree

  • .pbxproj for Xcode target/framework dependencies

  • .xcactivitylog for build timing data (from DerivedData)

Tech Stack

  • TypeScript + Node.js 18+

  • @modelcontextprotocol/sdk — MCP server framework

  • fast-glob — File system scanning

  • zod — Input validation

  • Zero runtime dependencies beyond these 3 packages

Development

git clone https://github.com/user/xcode-analyzer-mcp
cd xcode-analyzer-mcp
npm install
npm run dev    # Watch mode
npm run build  # Production build
npm test       # Run tests

License

MIT

Available Tools

8 tools
analyze_build_timeA

Analyze Xcode build times from DerivedData build logs. Shows slowest files and modules. Falls back to static complexity analysis if no build logs are found.

Inputs: projectPath (required), topN, scheme, thresholdMs, +1 more.

analyze_circular_dependenciesB

Detect circular dependencies between modules/files in an Xcode project using Tarjan's SCC algorithm. Analyzes Package.swift targets and Swift import statements.

Inputs: projectPath (required), level, excludePatterns.

analyze_dependency_treeA

Analyze SPM (Package.resolved) and CocoaPods (Podfile.lock) dependency trees. Shows direct and transitive dependencies, version info, and tree structure.

Inputs: projectPath (required), packageManager, showTransitive.

analyze_import_graphB

Build a module dependency graph from Swift import statements. Shows fan-in/fan-out statistics and can output as adjacency list, matrix, Mermaid diagram, or DOT/Graphviz format.

Inputs: projectPath (required), outputFormat, excludePatterns, includeSystemFrameworks.

detect_large_filesA

Find large files and resources in the project that impact app size. Scans images, videos, fonts, JSON, xcassets, and other file types.

Inputs: projectPath (required), categories, thresholdKB, checkXcassets.

detect_retain_cyclesA

Detect potential memory leaks and retain cycles in Swift code. Finds: missing [weak self] in closures, strong delegates, Timer retain cycles, NotificationCenter leaks, ViewModel↔ViewController strong references, and stored closure properties.

Inputs: projectPath (required), targetPaths, excludePatterns.

detect_unused_importsB

Detect potentially unused Swift import statements using heuristic analysis. Checks against a built-in symbol database for popular iOS frameworks (UIKit, RxSwift, SnapKit, etc.).

Inputs: projectPath (required), confidence, targetPaths, excludePatterns.

fix_retain_cyclesA

Automatically fix common retain cycle patterns: add weak to delegates, add [weak self] + guard let self to closures, add removeObserver in deinit. Defaults to dry-run mode (preview only). Set dryRun to false to apply changes.

Inputs: projectPath (required), dryRun, categories, targetPaths, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 8 tools

    Disambiguation4/5

    Most tools are clearly distinct by resource and action, with the detect/fix retain-cycle pair being obviously related. There is some conceptual overlap among analyze_circular_dependencies, analyze_import_graph, and analyze_dependency_tree, though the descriptions distinguish module cycles, import graphs, and external package trees.

    Naming Consistency5/5

    All tool names use consistent snake_case verb_noun phrasing with clear action verbs such as analyze_, detect_, and fix_. The pattern is predictable throughout the set.

    Tool Count5/5

    Eight tools is well-scoped for an Xcode project analyzer, covering distinct analysis areas without obvious filler. Each tool appears to earn its place.

    Completeness4/5

    The surface covers major project-health areas: dependencies, imports, build performance, file size, and memory/retain cycles. Remediation is limited to retain cycles, so other detected issues remain report-only, but core workflows are covered.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Provides programmatic access to Xcode functionality, enabling AI assistants to create, build, test, and manage iOS/macOS projects directly.
      33
      6
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to manage Xcode projects by listing targets, reading configurations, and triggering builds via the Model Context Protocol. It facilitates natural language interaction with macOS developer tools to streamline iOS app development processes.
      6
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables AI coding agents to perform zero-execution, AST-based static analysis of JavaScript/TypeScript codebases, including symbol lookup, dependency tracing, change-impact analysis, dead-code detection, and risk assessment.
      8
      MIT