The Xcode Diagnostics MCP plugin connects to Xcode's build system to extract, parse, and display errors and warnings from your Swift projects. It helps AI assistants identify issues in your code without manually searching through build logs. The plugin works at the log level, so Xcode must have already attempted a build before you use this tool.
The simplest installation method:
pip install mcp-xcode-diagnostics
Install directly from the GitHub repository:
pip install git+https://github.com/leftspin/mcp-xcode-diagnostics.git
To install from source code:
cd mcp-xcode-diagnostics
pip install .
The plugin provides two main tools that can be used with any MCP-compatible client:
Use the get_xcode_projects
tool to list all Xcode projects that have build logs in the DerivedData directory.
This tool takes no parameters and returns a list of projects.
Use the get_project_diagnostics
tool to extract diagnostic information from a specific project's latest build log.
Parameters:
project_dir_name
: Directory name of the project in DerivedData (e.g., 'ProjectName-hash')include_warnings
: Whether to include warnings in addition to errors (default: True)The plugin can detect and display various types of Xcode diagnostics:
{
"success": true,
"log_file": "/path/to/build.xcactivitylog",
"timestamp": "2025-03-11T12:34:56.789",
"errors": [
{
"type": "error",
"message": "use of unresolved identifier 'NonExistentType'",
"file_path": "/path/to/MyFile.swift",
"line_number": 42,
"column": 15,
"code": " let x: NonExistentType = value",
"notes": []
}
],
"warnings": [
{
"type": "warning",
"message": "static property 'sharedInstance' is not concurrency-safe because it is nonisolated global shared mutable state",
"file_path": "/path/to/SharedManager.swift",
"line_number": 10,
"column": 16,
"code": " static var sharedInstance: SharedManager?",
"notes": [
{
"type": "note",
"message": "convert 'sharedInstance' to a 'let' constant to make 'Sendable' shared state immutable",
"file_path": "/path/to/SharedManager.swift",
"line_number": 10,
"column": 16
}
]
}
],
"error_count": 1,
"warning_count": 1
}
For troubleshooting purposes, the plugin logs information to:
/tmp/xcode-mcp-debug.log
- Application logs/tmp/xcode-diagnostic-raw.log
- Raw output from Xcode activity logsThere are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.