Xcode MCP Server

Developmentstdiov26.5
Repository

Official Apple Xcode MCP server (xcrun mcpbridge) that gives external AI agents direct access to Xcode IDE capabilities. Provides 20 native tools for building projects, running tests, reading and writing files in the project navigator, searching code with regex, rendering SwiftUI previews, executing code snippets, browsing Apple Developer documentation, and inspecting build logs and workspace issues. Requires Xcode 26+ with MCP enabled in Intelligence settings.

Connect

Add this configuration to .claude/mcp.json

{
  "mcpServers": {
    "xcode": {
      "command": "xcrun",
      "args": [
        "mcpbridge"
      ]
    }
  }
}

Tools (18)

BuildProject

Builds an Xcode project using the active scheme and waits until the build completes. Returns build result, errors with file paths and line numbers, and full log path.

{
  "type": "object",
  "required": [
    "tabIdentifier"
  ],
  "properties": {
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    }
  }
}

GetBuildLog

Gets the log of the current or most recently finished build. Filter by severity (error, warning, remark), regex pattern, or file glob.

{
  "type": "object",
  "required": [
    "tabIdentifier"
  ],
  "properties": {
    "glob": {
      "type": "string",
      "description": "Glob to filter by file path"
    },
    "pattern": {
      "type": "string",
      "description": "Regex to filter build log entries"
    },
    "severity": {
      "type": "string",
      "description": "Minimum severity to include (error, warning, remark)"
    },
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    }
  }
}

RunAllTests

Runs all tests from the active scheme's active test plan and returns results with pass/fail counts and error messages.

{
  "type": "object",
  "required": [
    "tabIdentifier"
  ],
  "properties": {
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    }
  }
}

RunSomeTests

Runs specific tests by target name and test identifier using the active test plan.

{
  "type": "object",
  "required": [
    "tabIdentifier",
    "tests"
  ],
  "properties": {
    "tests": {
      "type": "array",
      "description": "Array of test specifiers with targetName and testIdentifier"
    },
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    }
  }
}

GetTestList

Gets all available tests from the active scheme's active test plan with identifiers, file paths, and enabled status.

{
  "type": "object",
  "required": [
    "tabIdentifier"
  ],
  "properties": {
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    }
  }
}

XcodeRead

Reads file contents within the Xcode project organization with line numbers. Supports offset and limit for large files.

{
  "type": "object",
  "required": [
    "tabIdentifier",
    "filePath"
  ],
  "properties": {
    "limit": {
      "type": "integer",
      "description": "Number of lines to read"
    },
    "offset": {
      "type": "integer",
      "description": "Line number to start reading from"
    },
    "filePath": {
      "type": "string",
      "description": "Path to file in Xcode project organization"
    },
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    }
  }
}

XcodeWrite

Creates or overwrites files with content in the Xcode project. Automatically adds new files to the project structure.

{
  "type": "object",
  "required": [
    "tabIdentifier",
    "filePath",
    "content"
  ],
  "properties": {
    "content": {
      "type": "string",
      "description": "Content to write to the file"
    },
    "filePath": {
      "type": "string",
      "description": "Path to file in Xcode project organization"
    },
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    }
  }
}

XcodeUpdate

Edits files by replacing text content (find and replace). Supports replacing all occurrences.

{
  "type": "object",
  "required": [
    "tabIdentifier",
    "filePath",
    "oldString",
    "newString"
  ],
  "properties": {
    "filePath": {
      "type": "string",
      "description": "Path to file in Xcode project organization"
    },
    "newString": {
      "type": "string",
      "description": "Replacement text"
    },
    "oldString": {
      "type": "string",
      "description": "Text to replace"
    },
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    }
  }
}

XcodeLS

Lists files and directories in the Xcode project structure at the specified path.

{
  "type": "object",
  "required": [
    "tabIdentifier",
    "path"
  ],
  "properties": {
    "path": {
      "type": "string",
      "description": "Project path to browse"
    },
    "recursive": {
      "type": "boolean",
      "description": "Recursively list all files (truncated to 100 lines)"
    },
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    }
  }
}

XcodeGrep

Searches for text patterns in project files using regex with context lines, glob filtering, and multiple output modes.

{
  "type": "object",
  "required": [
    "tabIdentifier",
    "pattern"
  ],
  "properties": {
    "glob": {
      "type": "string",
      "description": "Only search files matching this pattern"
    },
    "path": {
      "type": "string",
      "description": "Directory to search in"
    },
    "pattern": {
      "type": "string",
      "description": "Regex pattern to search for"
    },
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    }
  }
}

XcodeGlob

Finds files in the project structure matching wildcard patterns (e.g. *.swift, **/*.json).

{
  "type": "object",
  "required": [
    "tabIdentifier"
  ],
  "properties": {
    "pattern": {
      "type": "string",
      "description": "File matching pattern using wildcards"
    },
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    }
  }
}

RenderPreview

Builds and renders a SwiftUI Preview and returns a snapshot image of the resulting UI. Supports preview variant overrides.

{
  "type": "object",
  "required": [
    "tabIdentifier",
    "sourceFilePath"
  ],
  "properties": {
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    },
    "sourceFilePath": {
      "type": "string",
      "description": "Path to the Swift file containing the Preview"
    },
    "previewDefinitionIndexInFile": {
      "type": "integer",
      "description": "Zero-based index of the Preview macro in the file"
    }
  }
}

ExecuteSnippet

Builds and runs a Swift code snippet in the context of a specific file. Returns console output from print statements.

{
  "type": "object",
  "required": [
    "tabIdentifier",
    "codeSnippet",
    "sourceFilePath",
    "purpose"
  ],
  "properties": {
    "purpose": {
      "type": "string",
      "description": "Short description of the purpose"
    },
    "codeSnippet": {
      "type": "string",
      "description": "Swift code snippet to execute"
    },
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    },
    "sourceFilePath": {
      "type": "string",
      "description": "Swift file whose context the snippet has access to"
    }
  }
}

DocumentationSearch

Searches Apple Developer Documentation using semantic matching. Optionally filter by specific frameworks.

{
  "type": "object",
  "required": [
    "query"
  ],
  "properties": {
    "query": {
      "type": "string",
      "description": "The search query"
    },
    "frameworks": {
      "type": "array",
      "description": "Framework(s) to search in"
    }
  }
}

XcodeRefreshCodeIssuesInFile

Retrieves current compiler diagnostics (errors, warnings, notes) for a specific file in the project.

{
  "type": "object",
  "required": [
    "tabIdentifier",
    "filePath"
  ],
  "properties": {
    "filePath": {
      "type": "string",
      "description": "Path to file in Xcode project organization"
    },
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    }
  }
}

XcodeListNavigatorIssues

Lists all current issues shown in Xcode's Issue Navigator including build errors, package resolution problems, and workspace configuration issues.

{
  "type": "object",
  "required": [
    "tabIdentifier"
  ],
  "properties": {
    "severity": {
      "type": "string",
      "description": "Minimum severity (error, warning, remark)"
    },
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    }
  }
}

XcodeGetCurrentFile

Gets information about the currently active file in the Xcode editor including path, content, and selection.

{
  "type": "object",
  "required": [
    "tabIdentifier"
  ],
  "properties": {
    "tabIdentifier": {
      "type": "string",
      "description": "The workspace tab identifier"
    },
    "includeContent": {
      "type": "boolean",
      "description": "Whether to include file content"
    },
    "includeSelection": {
      "type": "boolean",
      "description": "Whether to include selection information"
    }
  }
}

XcodeListWindows

Lists the current Xcode windows and their workspace information.

{
  "type": "object",
  "properties": {}
}

Resources

This server does not expose any resources.

Prompts

This server does not expose any prompts.

Server Information

Author
Apple (@apple)
Repository
https://github.com/apple/swift
License
MIT
Version
26.5
Stars
0
Last Updated
May 27, 2026