Skip to main content

Drew's MCP server for Xcode integration

Project description

Xcode MCP Server

An MCP (Model Context Protocol) server that enables AI assistants to control and interact with Xcode for Apple platform development.

What It Does

This server allows AI assistants (like Claude, Cursor, or other MCP clients) to:

  • Discover and navigate your Xcode projects and source files
  • Build and run iOS, macOS, tvOS, and watchOS applications
  • Execute and monitor tests with detailed results
  • Debug build failures by retrieving errors and warnings
  • Capture console output from running applications
  • Take screenshots of Xcode windows and iOS simulators
  • Manage simulators and view their status

The AI can perform complete development workflows - from finding a project, to building it, running tests, debugging failures, and capturing results.

Requirements

  • macOS - This server only works on macOS
  • Xcode - Xcode must be installed
  • Python 3.8+ - For running the server

Security

The server implements path-based security to control which directories are accessible:

  • With restrictions: Set XCODEMCP_ALLOWED_FOLDERS=/path1:/path2:/path3 to limit access to specific directories
  • Default: If not specified, allows access to your home directory ($HOME)

Security requirements:

  • All paths must be absolute (starting with /)
  • No .. path components allowed
  • All paths must exist and be directories

Setup

1. Claude Code (Recommended)

claude mcp add --scope user --transport stdio `which uvx` xcode-mcp-server

That's it! Claude Code handles the rest automatically.

2. Claude Desktop

Install uv via Homebrew (if not already installed):

brew install uv

Edit your Claude Desktop config file (~/Library/Application Support/Claude/claude_desktop_config.json):

{
    "mcpServers": {
        "xcode-mcp-server": {
            "command": "uvx",
            "args": [
                "xcode-mcp-server"
            ]
        }
    }
}

If you'd like to allow only certain projects or folders to be accessible by xcode-mcp-server, add the env option, with a colon-separated list of absolute folder paths, like this:

{
    "mcpServers": {
        "xcode-mcp-server": {
            "command": "uvx",
            "args": [
                "xcode-mcp-server"
            ],
            "env": {
                "XCODEMCP_ALLOWED_FOLDERS": "/Users/andrew/my_project:/Users/andrew/Documents/source"
            }
        }
    }
}

Optional: Restrict access to specific folders by adding an env section:

{
    "mcpServers": {
        "xcode-mcp-server": {
            "command": "uvx",
            "args": ["xcode-mcp-server"],
            "env": {
                "XCODEMCP_ALLOWED_FOLDERS": "/Users/you/Projects:/Users/you/Work"
            }
        }
    }
}

3. Cursor AI

In Cursor: Settings → Tools & Integrations → + New MCP Server

Or edit ~/.cursor/mcp.json directly:

{
    "mcpServers": {
        "xcode-mcp-server": {
            "command": "uvx",
            "args": ["xcode-mcp-server"]
        }
    }
}

Optional: Add folder restrictions with an env section (same format as Claude Desktop above).

Usage

Once configured, simply ask your AI assistant to help with Xcode tasks:

  • "Find all Xcode projects in my home directory"
  • "Build the project at /path/to/MyProject.xcodeproj"
  • "Run tests for this project and show me any failures"
  • "What are the build errors in this project?"
  • "Show me the directory structure of this project"
  • "Take a screenshot of the Xcode window"

Most tools work with paths to .xcodeproj or .xcworkspace files, or with regular directory paths for browsing and navigation.

Advanced Configuration

Command Line Arguments

When running the server directly (for development or custom setups), these options are available:

Build output control:

  • --no-build-warnings - Show only errors, exclude warnings
  • --always-include-build-warnings - Always show warnings (default)

Notifications:

  • --show-notifications - Enable macOS notifications for operations
  • --hide-notifications - Disable notifications (default)

Access control:

  • --allowed /path - Add allowed folder (can be repeated)

Example:

xcode-mcp-server --no-build-warnings --show-notifications --allowed ~/Projects

Note: When using MCP clients (Claude, Cursor), configure these via the env section in your client's config file instead.

Development

The server is built with FastMCP and uses AppleScript to communicate with Xcode.

Local Testing

Test with MCP Inspector:

export XCODEMCP_ALLOWED_FOLDERS=~/Projects
mcp dev xcode_mcp_server/__main__.py

This opens an inspector interface where you can test tools directly. Provide paths as quoted strings: "/Users/you/Projects/MyApp.xcodeproj"

Building and Publishing

./deploy.sh  # Increments version, builds, and uploads to PyPI

Limitations

  • AppleScript syntax may need adjustments for specific Xcode versions
  • Some operations require the project to be open in Xcode first

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xcode_mcp_server-1.2.1.tar.gz (57.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xcode_mcp_server-1.2.1-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

Details for the file xcode_mcp_server-1.2.1.tar.gz.

File metadata

  • Download URL: xcode_mcp_server-1.2.1.tar.gz
  • Upload date:
  • Size: 57.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for xcode_mcp_server-1.2.1.tar.gz
Algorithm Hash digest
SHA256 32e2fb5f9c34367733d28d87d3002452f7938d7f379d08d3afaacbc700ce1e39
MD5 e92be1a091e192c03a0be42c5ac29425
BLAKE2b-256 5aa3af40a54dddbb36c6c2f296f2063cdb37dc7d0d51eba0fb9d01a2ed414a93

See more details on using hashes here.

File details

Details for the file xcode_mcp_server-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for xcode_mcp_server-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c7ff72eefe4d5df2538b79839f197cfdfb3e58ef5efc1d7188bcbe200b7ae7a
MD5 ece175b10c0fe32c4af410220a94755a
BLAKE2b-256 da4e0f40d0d7d519e636dff08d81d21dcd505fdaeb86df7970347893c8d65e06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page