xcsift-mcp
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.
Overview
xcsift-mcp provides AI coding assistants (like Claude, OpenCode, Cursor, etc.) with tools to:
Parse raw
xcodebuildorswift build/testoutput into structured JSON or TOON formatExecute 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.
Installation
Prerequisites
Python 3.10+
macOS (xcsift is macOS-only)
pipx (install via
brew install pipx)
Install from source
git clone https://github.com/johnnyclem/xcsift_mcp.git
cd xcsift_mcp
pipx install -e ".[dev]"Install via Homebrew
brew install johnnyclem/xcsift-mcp/xcsift-mcpxcsift 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/.
You can also install it manually via Homebrew:
brew install xcsiftUsage
Running the Server
# Run with stdio transport (default, for Claude Desktop/OpenCode)
xcsift-mcp
# Run with HTTP transport (for debugging/web clients)
xcsift-mcp --transport http --port 8000Integration with AI Assistants
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"xcsift": {
"command": "xcsift-mcp"
}
}
}OpenCode
Add to your opencode.json (or opencode.jsonc):
{
"mcp": {
"xcsift": {
"type": "local",
"command": ["xcsift-mcp"]
}
}
}Alternatively, run opencode mcp add and follow the interactive prompts.
Cursor
Add to your MCP configuration in Cursor settings, or add to .cursor/mcp.json:
{
"mcpServers": {
"xcsift": {
"command": "xcsift-mcp"
}
}
}Available Tools
Parsing Tools
Tool | Description |
| Parse raw xcodebuild/swift output into JSON or TOON format |
| Extract only errors with file/line information |
| Extract only warnings with file/line/type |
| Extract failed tests with assertion messages |
| Get a quick summary with error/warning counts |
Build Execution Tools
Tool | Description |
| Run xcodebuild and parse output automatically |
| Run swift build for SPM projects |
| Run swift test with optional coverage |
| Run arbitrary build commands and parse output |
Tool Parameters
parse_xcodebuild_output
Parameter | Type | Default | Description |
| string | required | Raw xcodebuild/swift output (use |
|
|
| Output format |
| bool |
| Include detailed warnings list |
| bool |
| Include coverage data if available |
xcodebuild
Parameter | Type | Default | Description |
|
|
| Build action |
| string | none | Scheme to build |
| string | none | Path to .xcodeproj |
| string | none | Path to .xcworkspace |
| string | none | Destination (e.g., |
|
| none | Build configuration |
| bool |
| Enable coverage for tests |
|
|
| Output format |
| int |
| Timeout in seconds |
swift_build
Parameter | Type | Default | Description |
|
|
| Build configuration |
| string | none | Path to Swift package |
| string | none | Specific target to build |
|
|
| Output format |
| int |
| Timeout in seconds |
swift_test
Parameter | Type | Default | Description |
| string | none | Path to Swift package |
| string | none | Filter tests (e.g., |
| bool |
| Enable coverage collection |
| bool |
| Run tests in parallel |
|
|
| Output format |
| int |
| Timeout 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 URI | Description |
| xcsift version and installation info |
| Example .xcsift.toml configuration |
| Documentation about output formats |
| Comprehensive help documentation |
Available Prompts
Prompt | Description | Arguments |
| Template for analyzing build failures |
|
| Template for fixing Swift/ObjC compiler errors |
|
| Template for improving test coverage |
|
| Template for debugging test failures |
|
| Template for fixing linker errors |
|
| Template for analyzing build performance |
|
Development
Running Tests
pytestRunning Tests with Coverage
pytest --cov=xcsift_mcpCode 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.mdArchitecture
┌─────────────────────────────────────────────────────────────────┐
│ 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 xcsiftPermission denied
Ensure the xcsift binary has execute permissions:
chmod +x ~/.local/share/xcsift-mcp/bin/xcsiftBuild timeout
Increase the timeout parameter for long builds:
xcodebuild(scheme="MyApp", timeout=1200) # 20 minutesLicense
MIT License - see LICENSE for details.
Credits
xcsift - The Swift CLI tool that does the actual parsing
MCP Python SDK - Model Context Protocol implementation