xcodeproj-mcp-server

A Model Context Protocol Server to manipulate *.xcodeproj

GitHub Stars

95

User Rating

Not Rated

Favorites

0

Views

150

Forks

3

Issues

2

Installation
Difficulty
Intermediate
Estimated Time
10-20 minutes
Requirements
Swift 6.1以上
Xcode 16.4以上

Installation

Installation

Prerequisites

Please specify required software and versions:
Swift: 6.1 or higher
Xcode: 16.4 or higher

Installation Steps

1. Clone Repository

bash
git clone https://github.com/giginet/xcodeproj-mcp-server.git
cd xcodeproj-mcp-server

2. Install Dependencies

bash
swift package resolve

3. Start Server

bash
swift run

Troubleshooting

Common Issues

Issue: Server won't start Solution: Check the version of Swift and reinstall dependencies. Issue: Project files cannot be manipulated correctly Solution: Verify the path to the Xcode project.

Configuration

Configuration

Basic Configuration

Server Setup

No specific server configuration is required, but you can set environment variables as needed.

Environment Variables

Set the following environment variables as needed:
bash
export MCP_SERVER_PORT=3000
export LOG_LEVEL=info

Advanced Configuration

Security Settings

Store API keys and sensitive information in environment variables or secure configuration files.
Set appropriate file access permissions.

Performance Tuning

Configure timeout values.
Limit concurrent executions.

Configuration Example

json
{
  "mcpServers": {
    "xcodeproj-mcp-server": {
      "command": "swift",
      "args": ["run", "xcodeproj-mcp-server"],
      "env": {
        "MCP_SERVER_PORT": "3000"
      }
    }
  }
}

Examples

Examples

Basic Usage

Here are basic usage examples for the MCP server:

Programmatic Usage

swift
import Foundation

let server = MCPServer()
server.start()

// Create a new project
let project = Project(name: "MyNewProject")
server.createProject(project)
print("Project created: \(project.name)")

Advanced Examples

Automation Script

bash
#!/bin/bash

Batch processing example

for file in *.swift; do mcp-tool process "$file" done

Use Cases

Create new Xcode projects from scratch with custom configurations and bundle identifiers.
Set up complex projects with multiple apps, frameworks, tests, and extensions in a single automated workflow.
Automatically add newly created Swift files to the appropriate target's source files.
Include external resource folders or asset directories as synchronized folder references in your project.
Integrate code formatters, linters, or custom build scripts into your targets.

Additional Resources