conorluddy

XC-MCP: Intelligent Xcode MCP Server

Community conorluddy
Updated

XCode CLI MCP: Convenience wrapper for Xcode CLI tools, reducing LLM token usage by summarising CLI outputs.

XC-MCP: Intelligent Xcode MCP Server

npm versionnpm downloadsNode.js versioncodecovAsk DeepWikiLicense: MIT

Problem: MCP clients can't effectively use Xcode CLI tools because the build and simulator listing commands return more than 50,000 tokens, exceeding MCP limits. Solution: Progressive disclosure with intelligent caching returns 2,000 tokens instead, achieving 96% reduction. Result: Full Xcode tooling functionality without token overflow, 90% faster workflows.

Quick Start

# Install and run
npm install -g xc-mcp
xc-mcp

# Or use without installation
npx xc-mcp

MCP Configuration (Claude Desktop):

claude mcp add xc-mcp -s user "npx xc-mcp"

Why This Exists

Raw Xcode CLI tools break MCP clients due to massive output:

  • simctl list: 57,000+ tokens (exceeds MCP limits)
  • xcodebuild logs: 135,000+ tokens (unusable)
  • No state memory between operations

XC-MCP solves this with progressive disclosure: return concise summaries first, full data on demand via cache IDs. This maintains complete functionality while respecting MCP token constraints.

Core Features

Progressive Disclosure System

  • Concise summaries by default: 96% token reduction for simulator lists
  • Full details on demand: Use cache IDs to access complete data
  • Smart filtering: Return only relevant information upfront
  • Token-efficient responses: Never exceed MCP client limits

Three-Layer Intelligent Cache

  • Simulator Cache: 1-hour retention with usage tracking and performance metrics
  • Project Cache: Remembers successful build configurations per project
  • Response Cache: 30-minute retention for progressive disclosure access

Smart Defaults & Learning

  • Build configuration memory: Learns successful settings per project
  • Simulator recommendations: Prioritizes recently used and optimal devices
  • Performance tracking: Records boot times, build success rates, optimization metrics
  • Adaptive intelligence: Improves suggestions based on usage patterns

Usage Examples

Progressive Simulator Management

Get instant simulator summary (2k tokens vs 57k):

{
  "tool": "simctl-list",
  "arguments": {"deviceType": "iPhone"}
}

Returns concise summary with cache ID for detailed access:

{
  "cacheId": "sim-abc123",
  "summary": {
    "totalDevices": 47,
    "availableDevices": 31,
    "bootedDevices": 1
  },
  "quickAccess": {
    "bootedDevices": [{"name": "iPhone 16", "udid": "ABC-123"}],
    "recentlyUsed": [...],
    "recommendedForBuild": [...]
  }
}

Access full details when needed:

{
  "tool": "simctl-get-details",
  "arguments": {
    "cacheId": "sim-abc123",
    "detailType": "available-only",
    "maxDevices": 10
  }
}

Smart Building with Configuration Memory

Build with automatic smart defaults:

{
  "tool": "xcodebuild-build",
  "arguments": {
    "projectPath": "./MyApp.xcworkspace",
    "scheme": "MyApp"
  }
}

Returns build summary with cache ID for full logs:

{
  "buildId": "build-xyz789",
  "success": true,
  "summary": {
    "duration": 7075,
    "errorCount": 0,
    "warningCount": 1
  },
  "nextSteps": [
    "Build completed successfully",
    "Smart defaults used: optimal simulator auto-selected",
    "Use 'xcodebuild-get-details' with buildId for full logs"
  ]
}

Cache Management

Monitor cache performance:

{"tool": "cache-get-stats", "arguments": {}}

Configure cache timeouts:

{
  "tool": "cache-set-config",
  "arguments": {"cacheType": "simulator", "maxAgeMinutes": 30}
}

Installation & Configuration

Prerequisites

  • macOS with Xcode command-line tools
  • Node.js 18+
  • Xcode 15+ recommended

Install Xcode CLI tools:

xcode-select --install

Installation Options

# Global install (recommended)
npm install -g xc-mcp

# Local development
git clone https://github.com/conorluddy/xc-mcp.git
cd xc-mcp && npm install && npm run build

MCP Client Configuration

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "xc-mcp": {
      "command": "npx",
      "args": ["xc-mcp"],
      "cwd": "/path/to/your/ios/project"
    }
  }
}

Tool Reference

Category Tool Description Progressive Disclosure
Project Discovery xcodebuild-list List targets, schemes, configurations โœ“
xcodebuild-showsdks Available SDKs -
xcodebuild-version Xcode version info -
Build Operations xcodebuild-build Build with smart defaults โœ“ (via buildId)
xcodebuild-clean Clean build artifacts -
xcodebuild-get-details Access cached build logs -
Simulator Management simctl-list Simulator list with 96% token reduction โœ“ (via cacheId)
simctl-get-details Progressive access to full simulator data -
simctl-boot Boot with performance tracking -
simctl-shutdown Graceful shutdown -
Cache Management cache-get-stats Cache performance metrics -
cache-set-config Configure cache timeouts -
cache-clear Clear cached data -
list-cached-responses View cached build/test results -

Advanced Features

Performance Optimization

  • 90% fewer repeated calls through intelligent caching
  • Boot time tracking for simulator performance optimization
  • Build trend analysis tracks success rates and timing
  • Usage pattern learning improves recommendations over time

Persistent State Management (Optional)

Enable file-based persistence for cache data across server restarts:

{"tool": "persistence-enable", "arguments": {}}

Environment Variables

  • XCODE_CLI_MCP_TIMEOUT: Operation timeout (default: 300s)
  • XCODE_CLI_MCP_LOG_LEVEL: Logging verbosity
  • XCODE_CLI_MCP_CACHE_DIR: Custom cache directory

Development

Build Commands

npm run build      # Compile TypeScript
npm run dev        # Development mode with watch
npm test           # Run test suite (80% coverage required)
npm run lint       # Code linting with auto-fix

Testing

  • Jest with ESM support
  • 80% coverage threshold enforced
  • Pre-commit hooks ensure code quality

License & Support

MIT License. For issues and questions, open a GitHub issue.

XC-MCP solves MCP token overflow for Xcode tooling through progressive disclosure and intelligent caching.

MCP Server ยท Populars

MCP Server ยท New

    ergut

    MCP server for LogSeq

    MCP server to interact with LogSeq via its Local HTTP API - enabling AI assistants like Claude to seamlessly read, write, and manage your LogSeq graph.

    Community ergut
    call518

    MCP PostgreSQL Operations Server

    Professional, read-only MCP server for PostgreSQL ops/monitoring: performance insights using pg_stat_statements & pg_stat_monitor, plus structure/size/config visibility.

    Community call518
    pulsemcp

    Hatchbox MCP Server

    MCP (Model Context Protocol) Servers authored and maintained by the PulseMCP team. We build reliable servers thoughtfully designed specifically for MCP Client-powered workflows.

    Community pulsemcp
    snyk

    Getting started with the Snyk CLI

    Snyk CLI scans and monitors your projects for security vulnerabilities.

    Community snyk
    snyk

    Snyk Language Server (Snyk-LS)

    Language Server used by IDEs as Snyk Backend for Frontends

    Community snyk