EddiksonPena/xcode-mcp
If you are the rightful owner of xcode-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Xcode MCP Server is a comprehensive Model Context Protocol server designed for Xcode development automation, offering a wide range of tools for efficient project management, building, testing, and more.
Xcode MCP Server
A comprehensive Model Context Protocol (MCP) server for Xcode development automation, providing 115+ tools for project management, building, testing, simulator control, crash reporting, asset management, localization, and AI-powered workflows.
🚀 Features
- 112 Direct Xcode Tools - Fast, single-step operations for common tasks
- 3 LangGraph Subagentic Tools - Multi-step workflows with reasoning and state management
- 21 New Tools - Crash reporting, asset management, localization, and simulator enhancements
- Unified Server - Single MCP server combining all capabilities
- Token Optimized - 30-40% token reduction through caching and compression
- Hyper-Specific Schemas - Comprehensive JSON schemas with examples and validation
- Persona System - Configurable agent personas for different use cases
📋 Table of Contents
- Quick Start
- Installation
- Configuration
- Usage
- Tools Reference
- Architecture
- Personas
- Troubleshooting
- Development
🏃 Quick Start
Prerequisites
- macOS (for Xcode tools)
- Python 3.11+
- Conda (recommended) or pip
- Xcode Command Line Tools
Installation
# Clone the repository
git clone <repository-url>
cd xcode-mcp
# Create conda environment
conda env create -f environment.yml
conda activate xcode-mcp
# Or use pip
pip install -r requirements.txt
Cursor Configuration
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"xcode-mcp": {
"command": "/path/to/miniconda3/envs/xcode-mcp/bin/python",
"args": [
"/path/to/xcode-mcp/run_unified_mcp.py"
],
"env": {
"DEEPSEEK_API_KEY": "your-api-key-here"
}
}
}
}
Restart Cursor to load the MCP server.
📦 Installation
Method 1: Automated Setup Script
./setup.sh
This script will:
- Create conda environment
- Install dependencies
- Verify installation
- Test the server
Method 2: Manual Installation
# Create conda environment
conda env create -f environment.yml
conda activate xcode-mcp
# Verify installation
python -c "from src.unified_mcp_server import UnifiedMCPServer; print('✅ Installation successful')"
Dependencies
Core dependencies:
fastapi- HTTP server (optional)pydantic- Data validationlanggraph- Subagentic workflows (optional)langchain- LLM integration (optional)
See environment.yml for complete list.
⚙️ Configuration
Environment Variables
# LLM Provider API Keys
export DEEPSEEK_API_KEY="your-deepseek-key"
export OPENAI_API_KEY="your-openai-key" # Optional
# Model Selection
export DEFAULT_MODEL="ollama:qwen3-coder:30b" # or "deepseek:deepseek-coder"
MCP Configuration
The server is configured via ~/.cursor/mcp.json. Use absolute paths for reliability:
{
"mcpServers": {
"xcode-mcp": {
"command": "/Users/username/miniconda3/envs/xcode-mcp/bin/python",
"args": ["/Users/username/Projects/xcode-mcp/run_unified_mcp.py"],
"env": {
"DEEPSEEK_API_KEY": "your-key"
}
}
}
}
💻 Usage
Direct Tools
Use direct tools for simple, single-step operations:
Use the list_projects tool
Use the build_project tool with scheme "MyApp"
Use the run_tests tool
LangGraph Subagentic Tools
Use LangGraph tools for complex, multi-step workflows:
Use langgraph_agent with prompt "Set up my development environment"
Use langgraph_workflow with workflow "Build, test, and generate report"
With Personas
Apply personas for specialized behavior:
{
"name": "langgraph_agent",
"arguments": {
"prompt": "Help me optimize my build",
"persona": {
"id": "build-optimizer",
"role": "optimizer"
}
}
}
🛠️ Tools Reference
Direct Tools (112 tools)
New in v2.1.0
- Crash Reporting (4 tools):
symbolicate_crash_log,analyze_crash_log,get_crash_reports,export_crash_log - Asset Management (5 tools):
optimize_images,generate_app_icons,validate_asset_catalog,check_asset_sizes,manage_color_assets - Simulator Enhancements (5 tools):
set_simulator_location,get_simulator_logs,list_simulator_apps,simulate_network_conditions,clone_simulator - Localization (4 tools):
extract_strings,validate_localizations,check_localization_coverage,list_localizations - Build Enhancements (3 tools):
set_build_number,set_version,analyze_build_time
Original Tools (94 tools)
Project Management
list_projects- List all Xcode projectscreate_project- Create new Xcode projectopen_project- Open project in Xcodelist_schemes- List available build schemesswitch_scheme- Change active scheme
Building
build_project- Build a projectbuild_workspace- Build a workspaceclean_build- Clean build artifactsarchive_project- Create archiveanalyze_build- Analyze build performance
Testing
run_tests- Run unit testsrun_ui_tests- Run UI testsgenerate_test_report- Generate test reportcode_coverage_report- Get coverage report
Simulator & Devices
list_devices- List available simulatorsboot_simulator- Boot a simulatorinstall_app- Install app on devicelaunch_app- Launch app
LLM Integration
get_llm_status- Check LLM service statusconfigure_llm- Configure LLM provider
See schemas/xcode-mcp-tools.json for complete list.
LangGraph Tools (3 tools)
langgraph_agent
Subagentic agent for complex workflows with reasoning and state management.
Parameters:
prompt(required) - Natural language task descriptionmodel(optional) - Model override (e.g., "ollama:qwen3-coder:30b")persona(optional) - Persona configuration
Example:
Use langgraph_agent with prompt "Verify my development environment and list all projects"
langgraph_workflow
Execute multi-step workflows with automatic tool orchestration.
Parameters:
workflow(required) - Workflow descriptioncontext(optional) - Additional contextpersona(optional) - Persona configuration
Example:
Use langgraph_workflow with workflow "1. Clean build 2. Build project 3. Run tests 4. Generate report"
langgraph_status
Get status of LangGraph agent and available capabilities.
🏗️ Architecture
Unified Server
The project uses a unified MCP server (src/unified_mcp_server.py) that combines:
- Direct Tools - 94 tools from
src/xcode_tools/ - LangGraph Tools - 3 subagentic tools using LangGraph
- Optimization Layer - Caching, compression, schema optimization
Project Structure
xcode-mcp/
├── src/
│ ├── unified_mcp_server.py # Main unified server
│ ├── tool_registry.py # Tool registration system
│ ├── langgraph_agent.py # LangGraph agent implementation
│ ├── llm_service.py # LLM provider abstraction
│ └── xcode_tools/ # Tool implementations
│ ├── project.py # Project management
│ ├── build.py # Build operations
│ ├── testing.py # Testing tools
│ ├── simulator.py # Simulator control
│ └── ...
├── schemas/
│ ├── xcode-mcp-tools.json # Tool schema definitions
│ ├── persona_schemas.json # Persona schema
│ └── persona_examples.json # Pre-configured personas
├── tests/
│ └── test_unified_server.py # Comprehensive test suite
├── docs/ # Additional documentation
├── examples/ # Usage examples
├── run_unified_mcp.py # Server entry point
└── environment.yml # Conda dependencies
Tool Registration
Tools are automatically registered from:
- JSON schema (
schemas/xcode-mcp-tools.json) - Python implementations (
src/xcode_tools/) - Dynamic discovery and mapping
LangGraph Integration
LangGraph tools use the direct tools internally:
- Agent receives natural language prompt
- Breaks down into steps
- Calls appropriate direct tools
- Maintains state across steps
- Returns comprehensive result
👤 Personas
Personas provide specialized agent behavior for different use cases.
Available Personas
senior-ios-architect
- Role: Architect
- Expertise: Swift, Xcode, Architecture, iOS, Performance
- Style: Professional, Detailed, Expert-level
- Use for: Architecture decisions, best practices, design patterns
swift-mentor
- Role: Mentor
- Expertise: Swift, Xcode, iOS, SwiftUI
- Style: Friendly, Comprehensive, Intermediate-level
- Use for: Learning, education, step-by-step guidance
build-optimizer
- Role: Optimizer
- Expertise: Xcode, Performance, CI/CD
- Style: Concise, Moderate, Advanced-level
- Use for: Build performance, optimization, CI/CD
test-specialist
- Role: Tester
- Expertise: Testing, Xcode, Swift, CI/CD
- Style: Professional, Detailed, Advanced-level
- Use for: Test strategies, coverage, quality
Using Personas
{
"persona": {
"id": "build-optimizer",
"role": "optimizer",
"expertise": ["xcode", "performance"],
"communication_style": {
"tone": "concise",
"verbosity": "moderate",
"technical_level": "advanced"
}
}
}
See schemas/persona_examples.json for complete examples.
🔧 Troubleshooting
MCP Server Shows RED
-
Verify Configuration
python3 -m json.tool ~/.cursor/mcp.json -
Test Server Manually
python test_mcp_connection.py -
Kill Stale Processes
pkill -f "run_unified_mcp.py" -
Restart Cursor
- Quit completely (Cmd+Q)
- Wait 5 seconds
- Reopen Cursor
-
Use Absolute Python Path Update
~/.cursor/mcp.jsonto use absolute path:"command": "/path/to/miniconda3/envs/xcode-mcp/bin/python"
No Tools Showing
- Check server is GREEN in Cursor
- Verify tools list:
python -c "from src.unified_mcp_server import UnifiedMCPServer; s = UnifiedMCPServer(); print(len(s.registry.tools))" - Restart Cursor
LangGraph Not Working
-
Verify installation:
conda activate xcode-mcp python -c "import langgraph; print('✅ LangGraph installed')" -
Install if missing:
pip install langgraph langchain langchain-core langchain-openai langchain-ollama
Tool Execution Errors
-
Check Xcode CLI tools:
xcodebuild -version -
Verify permissions for Xcode operations
-
Check tool-specific requirements in
schemas/xcode-mcp-tools.json
🧪 Testing
Run Test Suite
# Comprehensive tests
python tests/test_unified_server.py
# Connection test
python test_mcp_connection.py
Expected Results
- ✅ 8/8 tests passing
- ✅ 97 tools available
- ✅ All protocols working
- ✅ Server responds correctly
🚀 Development
Adding New Tools
-
Add to Schema (
schemas/xcode-mcp-tools.json):{ "name": "my_new_tool", "description": "Tool description", "parameters": [...] } -
Implement Function (
src/xcode_tools/):def my_new_tool(param1: str, param2: int) -> dict: # Implementation return {"result": "..."} -
Test:
python -c "from src.tool_registry import get_registry; r = get_registry(); print(r.execute_tool('my_new_tool', param1='test', param2=1))"
Project Organization
- Core Server:
src/unified_mcp_server.py - Tool Registry:
src/tool_registry.py - Tool Implementations:
src/xcode_tools/ - Schemas:
schemas/ - Tests:
tests/ - Documentation:
docs/
Performance Optimizations
- Schema Caching: 5-minute TTL
- Response Caching: Successful responses cached
- Compact JSON: Reduced token usage
- Lazy Loading: LangGraph loaded only when needed
📊 Performance Metrics
- Token Reduction: 30-40% through optimization
- Memory Usage: 50% reduction (unified server)
- Response Time: 50% faster (cached responses)
- Schema Loading: 80% faster (cached)
📚 Additional Resources
- Tool Schema:
schemas/xcode-mcp-tools.json - Persona Schema:
schemas/persona_schemas.json - Persona Examples:
schemas/persona_examples.json - Examples:
examples/
🤝 Contributing
- Follow existing code structure
- Add tests for new features
- Update schemas and documentation
- Run test suite before submitting
📝 License
[Add your license here]
🌐 Network Access
To expose the MCP server to other devices on your network:
# Start network server (default: port 8000)
python run_network_server.py
# With custom settings
MCP_HOST=0.0.0.0 MCP_PORT=8000 python run_network_server.py
# With authentication
MCP_API_KEY=your-secret-key MCP_REQUIRE_AUTH=true python run_network_server.py
Endpoints:
- HTTP:
http://YOUR_IP:8000/mcp - WebSocket:
ws://YOUR_IP:8000/ws - Tools List:
http://YOUR_IP:8000/tools - Health:
http://YOUR_IP:8000/health
See for complete network setup guide, including:
- Configuration options
- Authentication setup
- Client examples (Python, JavaScript, curl)
- Security considerations
- Production deployment
🙏 Acknowledgments
- Model Context Protocol specification
- LangGraph for subagentic workflows
- Xcode Command Line Tools
Version: 2.1.0
Last Updated: 2025-01-XX
Maintainer: Eddikson Peña
🆕 What's New in v2.1.0
21 New Tools Added
Crash Reporting
- Symbolicate and analyze crash logs
- Extract crash information automatically
- Export crash reports
Asset Management
- Optimize images automatically
- Generate app icon sets
- Validate asset catalogs
- Check asset sizes
Simulator Enhancements
- Set GPS location
- Get simulator logs
- List installed apps
- Clone simulators
Localization
- Extract localizable strings
- Validate translations
- Check coverage percentage
- List supported locales
Build Enhancements
- Set specific build/version numbers
- Analyze build times
- Enhanced version management
See for complete details.