MCP Hub
Back to servers

xcsift-mcp

mcp server for @ldomaradzki/xcsift

glama
Stars
1
Updated
Jan 25, 2026

xcsift-mcp

An MCP (Model Context Protocol) server that wraps xcsift, enabling AI coding assistants to parse Xcode build output into structured, token-efficient formats.

Python 3.10+ License: MIT MCP

Overview

xcsift-mcp provides AI coding assistants (like Claude, OpenCode, Cursor, etc.) with tools to:

  • Parse raw xcodebuild or swift build/test output into structured JSON or TOON format
  • Execute build commands and get parsed results automatically
  • Extract errors, warnings, test failures, and linker errors with file/line information
  • Analyze code coverage from test runs

The output is optimized for token efficiency, with TOON format providing 30-60% fewer tokens compared to JSON.

Quick Start

# Install
pip install .

# Run the MCP server
xcsift-mcp

Then configure your AI assistant to use the server (see Integration below).

Installation

Prerequisites

  • Python 3.10+
  • macOS (xcsift is macOS-only)

Install from source

git clone https://github.com/johnnyclem/xcsift_mcp.git
cd xcsift_mcp
pip install .

Install with development dependencies

pip install -e ".[dev]"

xcsift Binary

The server will automatically download the xcsift binary from GitHub releases on first run if it's not already installed. The binary is cached in ~/.local/share/xcsift-mcp/bin/.

Alternatively, you can install it manually:

# Via Homebrew (recommended)
brew install xcsift

# Or build from source
git clone https://github.com/ldomaradzki/xcsift.git
cd xcsift
swift build -c release
cp .build/release/xcsift /usr/local/bin/

Usage

Running the Server

# Run with stdio transport (default, for Claude Desktop/OpenCode)
xcsift-mcp

# Or as a Python module
python -m xcsift_mcp

# Run with HTTP transport (for debugging/web clients)
python -m xcsift_mcp --transport http --port 8000

Integration with AI Assistants

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "xcsift": {
      "command": "python",
      "args": ["-m", "xcsift_mcp"]
    }
  }
}

OpenCode

opencode mcp add xcsift -- python -m xcsift_mcp

Cursor

Add to your MCP configuration in Cursor settings, or add to .cursor/mcp.json:

{
  "mcpServers": {
    "xcsift": {
      "command": "python",
      "args": ["-m", "xcsift_mcp"]
    }
  }
}

Available Tools

Parsing Tools

ToolDescription
parse_xcodebuild_outputParse raw xcodebuild/swift output into JSON or TOON format
extract_errorsExtract only errors with file/line information
extract_warningsExtract only warnings with file/line/type
extract_test_failuresExtract failed tests with assertion messages
get_build_summaryGet a quick summary with error/warning counts

Build Execution Tools

ToolDescription
xcodebuildRun xcodebuild and parse output automatically
swift_buildRun swift build for SPM projects
swift_testRun swift test with optional coverage
run_shell_build_commandRun arbitrary build commands and parse output

Tool Parameters

parse_xcodebuild_output

ParameterTypeDefaultDescription
outputstringrequiredRaw xcodebuild/swift output (use 2>&1 to capture stderr)
format"json" | "toon""json"Output format
include_warningsboolfalseInclude detailed warnings list
include_coverageboolfalseInclude coverage data if available

xcodebuild

ParameterTypeDefaultDescription
action"build" | "test" | "clean" | "analyze""build"Build action
schemestringnoneScheme to build
projectstringnonePath to .xcodeproj
workspacestringnonePath to .xcworkspace
destinationstringnoneDestination (e.g., "platform=iOS Simulator,name=iPhone 15")
configuration"Debug" | "Release"noneBuild configuration
enable_code_coverageboolfalseEnable coverage for tests
output_format"json" | "toon""json"Output format
timeoutint600Timeout in seconds

swift_build

ParameterTypeDefaultDescription
configuration"debug" | "release""debug"Build configuration
package_pathstringnonePath to Swift package
targetstringnoneSpecific target to build
output_format"json" | "toon""json"Output format
timeoutint300Timeout in seconds

swift_test

ParameterTypeDefaultDescription
package_pathstringnonePath to Swift package
filter_teststringnoneFilter tests (e.g., "MyTests.testFoo")
enable_code_coverageboolfalseEnable coverage collection
parallelbooltrueRun tests in parallel
output_format"json" | "toon""json"Output format
timeoutint600Timeout in seconds

Example Usage

Parse existing build output

# In your AI assistant
result = parse_xcodebuild_output(
    output="<raw xcodebuild output>",
    format="toon",  # or "json"
    include_warnings=True
)

Run build and get parsed results

result = xcodebuild(
    action="build",
    scheme="MyApp",
    destination="platform=iOS Simulator,name=iPhone 15",
    output_format="json"
)

Run tests with coverage

result = swift_test(
    enable_code_coverage=True,
    output_format="toon"
)

Extract just the errors

errors = extract_errors(output="<raw xcodebuild output>")
# Returns: [{"file": "main.swift", "line": 15, "message": "..."}]

Output Formats

JSON Format

Standard structured JSON output:

{
  "status": "failed",
  "summary": {
    "errors": 1,
    "warnings": 3,
    "failed_tests": 0,
    "linker_errors": 0,
    "build_time": "3.2s"
  },
  "errors": [
    {
      "file": "main.swift",
      "line": 15,
      "message": "use of undeclared identifier 'unknown'"
    }
  ],
  "warnings": [
    {
      "file": "view.swift",
      "line": 20,
      "message": "variable 'temp' was never used",
      "type": "compile"
    }
  ]
}

TOON Format (Token-Optimized)

30-60% fewer tokens than JSON:

status: failed
summary:
  errors: 1
  warnings: 3
  failed_tests: 0
  linker_errors: 0
  build_time: 3.2s
errors[1]{file,line,message}:
  main.swift,15,"use of undeclared identifier 'unknown'"
warnings[1]{file,line,message,type}:
  view.swift,20,"variable 'temp' was never used","compile"

When to use each format:

  • JSON: When you need to parse the output programmatically or integrate with other tools
  • TOON: When sending to an LLM to reduce token usage and API costs

Available Resources

Resource URIDescription
xcsift://versionxcsift version and installation info
xcsift://config-templateExample .xcsift.toml configuration
xcsift://output-formatsDocumentation about output formats
xcsift://helpComprehensive help documentation

Available Prompts

PromptDescriptionArguments
analyze_build_failureTemplate for analyzing build failureserrors, code_context
fix_compiler_errorsTemplate for fixing Swift/ObjC compiler errorserrors, file_content
improve_test_coverageTemplate for improving test coveragecoverage_report, target_coverage
debug_test_failuresTemplate for debugging test failurestest_output, test_code
fix_linker_errorsTemplate for fixing linker errorslinker_errors, project_structure
analyze_build_performanceTemplate for analyzing build performancebuild_info

Development

Running Tests

pytest

Running Tests with Coverage

pytest --cov=xcsift_mcp

Code Formatting

ruff format .
ruff check .

Project Structure

xcsift_mcp/
├── src/xcsift_mcp/
│   ├── __init__.py           # Package init
│   ├── __main__.py           # Entry point
│   ├── server.py             # FastMCP server
│   ├── xcsift_installer.py   # Auto-download xcsift
│   ├── resources.py          # MCP resources
│   ├── prompts.py            # Prompt templates
│   └── tools/
│       ├── parse.py          # Parsing tools
│       └── build.py          # Build execution tools
├── tests/
│   ├── fixtures/             # Sample build outputs
│   └── test_*.py             # Test files
├── pyproject.toml
└── README.md

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                 AI Assistant (Claude, OpenCode, etc.)           │
└─────────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌─────────────────────────────────────────────────────────────────┐
│                     MCP Protocol (stdio/HTTP)                    │
└─────────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌─────────────────────────────────────────────────────────────────┐
│                     xcsift MCP Server (Python)                   │
│  ┌─────────────────┐  ┌──────────────────┐  ┌────────────────┐  │
│  │   Tools (9)     │  │  Resources (4)   │  │  Prompts (6)   │  │
│  │ - parse_output  │  │ - version        │  │ - analyze      │  │
│  │ - xcodebuild    │  │ - config         │  │ - fix_errors   │  │
│  │ - swift_build   │  │ - formats        │  │ - coverage     │  │
│  │ - swift_test    │  │ - help           │  │ - debug        │  │
│  └─────────────────┘  └──────────────────┘  └────────────────┘  │
└─────────────────────────────────────────────────────────────────┘
                                │
                                ▼
┌─────────────────────────────────────────────────────────────────┐
│                     xcsift CLI (subprocess)                      │
└─────────────────────────────────────────────────────────────────┘

Troubleshooting

xcsift not found

If xcsift cannot be downloaded automatically, install it manually:

brew install xcsift

Permission denied

Ensure the xcsift binary has execute permissions:

chmod +x ~/.local/share/xcsift-mcp/bin/xcsift

Build timeout

Increase the timeout parameter for long builds:

xcodebuild(scheme="MyApp", timeout=1200)  # 20 minutes

License

MIT License - see LICENSE for details.

Credits

  • xcsift - The Swift CLI tool that does the actual parsing
  • MCP Python SDK - Model Context Protocol implementation

Reviews

No reviews yet

Sign in to write a review