Sponsored by Deepsite.site

Xcode Monitor MCP Server

Created By
wblair86896 months ago
Swift MCP server for real-time Xcode project diagnostics and monitoring
Content

Xcode Monitor MCP Server

A comprehensive Model Context Protocol (MCP) server for monitoring Swift/Xcode projects, providing real-time diagnostics, build status, and project information to AI assistants like Claude Desktop and Windsurf.

✅ Current Status: WORKING

The MCP server is now fully operational and successfully connects to both Claude Desktop and Windsurf.

Features

  • Real-time Xcode Project Monitoring: Detect workspaces, projects, and schemes
  • Live Diagnostics: Get Swift/Xcode build errors and warnings
  • SourceKit-LSP Integration: Monitor Language Server Protocol status
  • Build Server Support: Configure and monitor Xcode build servers
  • File Change Detection: Monitor Swift, Objective-C, and C/C++ file changes
  • Multi-Platform Support: Works with Claude Desktop and Windsurf
  • Comprehensive Logging: Detailed error reporting and debugging

Installation

Prerequisites

  • macOS (required for Xcode integration)
  • Python 3.10+ (tested with Python 3.13)
  • Xcode and Xcode Command Line Tools
  • Node.js (for some MCP features)

1. Install Dependencies

# Install MCP library
pip3 install --break-system-packages mcp

# Verify installation
python3 -c "import mcp; print('MCP installed successfully')"

2. Clone and Setup

git clone <repository-url> XcodeMonitorMCP
cd XcodeMonitorMCP

3. Configure Claude Desktop

Update ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "xcode_monitor": {
      "command": "/opt/homebrew/bin/python3",
      "args": [
        "/Users/williamblair/Desktop/XcodeMonitorMCP/XcodeMonitor/working_swift_mcp_server.py",
        "--swiftpath=/Users/williamblair/Desktop/XcodeMonitorMCP"
      ],
      "env": {
        "PYTHONPATH": "/Users/williamblair/Desktop/XcodeMonitorMCP/XcodeMonitor",
        "PYTHONUNBUFFERED": "1"
      }
    }
  }
}

4. Configure Windsurf (Optional)

Update ~/Library/Application Support/Windsurf/User/settings.json:

{
  "mcp": {
    "servers": {
      "xcode-monitor": {
        "command": "/opt/homebrew/bin/python3",
        "args": [
          "/Users/williamblair/Desktop/XcodeMonitorMCP/XcodeMonitor/working_swift_mcp_server.py",
          "--swiftpath=/Users/williamblair/Desktop/XcodeMonitorMCP"
        ],
        "env": {}
      }
    }
  }
}

Available MCP Tools

Once connected, the following tools are available to AI assistants:

Core Tools

  • get_project_path() - Get the current monitored project path
  • set_project_path(new_path) - Change the monitored project path
  • get_project_status() - Get comprehensive project information

Diagnostics Tools

  • get_diagnostics() - Get current Swift/Xcode diagnostics and errors
  • get_xcode_live_diagnostics() - Get live diagnostics directly from Xcode
  • clear_diagnostics_queue() - Clear the diagnostics queue

Build Tools

  • get_build_server_status() - Check build server configuration
  • get_recent_updates() - Get recent updates from the monitoring queue

Usage Examples

In Claude Desktop or Windsurf:

"What's the current status of my Xcode project?"
"Are there any build errors in my Swift code?"
"Can you check the SourceKit-LSP status?"
"Monitor my project for file changes"
"Get the latest diagnostics from Xcode"

Project Structure

XcodeMonitorMCP/
├── XcodeMonitor/
│   ├── working_swift_mcp_server.py    # Main MCP server (WORKING)
│   ├── swift_mcp_monitor.py           # Core monitoring logic
│   ├── xcode_monitor_core.py          # Core utilities
│   ├── swift_mcp_monitor_inspector.py # GUI inspector
│   └── XcodeViewer.py                 # Legacy viewer
├── MCPGameTemplate.xcodeproj/         # Example Swift project
├── README_FIXED.md                    # Detailed fix documentation
├── WINDSURF_TROUBLESHOOTING.md        # Windsurf-specific setup
└── venv/                              # Python virtual environment

Monitoring Capabilities

The server can monitor and report on:

  • Workspaces and Projects: .xcworkspace and .xcodeproj files
  • Build Status: Recent builds, success/failure status
  • File Changes: Swift (.swift), Objective-C (.m, .h), C/C++ files
  • Diagnostics Sources:
    • Xcode live diagnostics
    • Build logs via XCLogParser
    • SourceKit-LSP diagnostics
    • SwiftPM build logs
  • Build Server Configuration: buildServer.json status

Troubleshooting

MCP Server Not Connecting

  1. Restart the application: Completely quit and restart Claude Desktop/Windsurf
  2. Check logs:
    tail -f ~/Library/Application\ Support/Claude/logs/mcp-server-xcode_monitor.log
    
  3. Test manually:
    /opt/homebrew/bin/python3 XcodeMonitor/working_swift_mcp_server.py --help
    

Common Issues

  • "Module not found": Ensure MCP is installed with pip3 install --break-system-packages mcp
  • "Permission denied": Check file permissions with ls -la XcodeMonitor/working_swift_mcp_server.py
  • "No such file": Verify all paths in configuration are absolute and correct
  • JSON syntax errors: Validate configuration with python3 -m json.tool config.json

Windsurf-Specific Issues

  • "npx not found": Use full paths to executables in configuration
  • Process conflicts: Restart both applications if they interfere with each other

Development

Testing the Server

# Test server startup
python3 XcodeMonitor/working_swift_mcp_server.py --help

# Test with specific project
python3 XcodeMonitor/working_swift_mcp_server.py --swiftpath="/path/to/your/project"

# Run the GUI inspector
python3 XcodeMonitor/swift_mcp_monitor_inspector.py

Adding New Features

The server is built with a modular architecture:

  • SwiftMCPMonitorCore: Core monitoring logic
  • MCP tools are defined in working_swift_mcp_server.py
  • Diagnostic sources can be extended in the get_diagnostics() method

Log Files

  • Claude Desktop: ~/Library/Application Support/Claude/logs/mcp-server-xcode_monitor.log
  • Windsurf: ~/Library/Application Support/Windsurf/logs/

Version History

  • v0.1.0: Initial implementation with basic monitoring
  • v0.2.0: Added comprehensive diagnostics and build server support
  • v1.0.0: CURRENT - Fixed all import issues, added robust error handling, full Claude Desktop + Windsurf support

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Test with both Claude Desktop and Windsurf
  4. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

For issues and questions:

  1. Check the troubleshooting section above
  2. Review log files for error details
  3. Test the server manually to isolate issues
  4. Create an issue with diagnostic information

Status: ✅ FULLY WORKING - The MCP server successfully connects to Claude Desktop and provides comprehensive Xcode/Swift project monitoring capabilities.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
WindsurfThe new purpose-built IDE to harness magic
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
ChatWiseThe second fastest AI chatbot™
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Serper MCP ServerA Serper MCP Server
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Amap Maps高德地图官方 MCP Server
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
CursorThe AI Code Editor
DeepChatYour AI Partner on Desktop
Tavily Mcp
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Playwright McpPlaywright MCP server
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs