Skip to main content
Glama
ebowwa

Xcode MCP Server

by ebowwa

xcode_create_project

Create a new Xcode project with basic structure by specifying project path, name, bundle identifier, and target platform (iOS/macOS).

Instructions

Create a new Xcode project with basic structure

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYesPath where the project should be created
project_nameYesName of the project
bundle_idYesBundle identifier (e.g., com.company.app)
platformNoTarget platform (ios/macos)ios

Implementation Reference

  • Core handler function that implements the Xcode project creation logic using xcodegen or fallback manual structure creation.
    async createXcodeProject(projectPath: string, projectName: string, bundleId: string, platform: string = 'ios'): Promise<void> {
      // Create project directory
      await this.createDirectory(projectPath);
      
      // Create source directory for xcodegen (must exist before generation)
      const sourcesDir = path.join(projectPath, projectName);
      await this.createDirectory(sourcesDir);
      
      // Generate xcodegen config with automatic team detection
      const xcodegenConfig = await this.generateXcodegenConfig(projectName, bundleId, platform);
      
      // Write xcodegen spec
      const specPath = path.join(projectPath, 'project.yml');
      await this.writeFile(specPath, xcodegenConfig);
    
      // Check if xcodegen is available
      try {
        await execAsync('which xcodegen');
        
        // Create basic Swift files BEFORE running xcodegen
        await this.createBasicSwiftFiles(sourcesDir, projectName, platform);
        
        // Generate project using xcodegen
        const { stdout, stderr } = await execAsync(`cd "${projectPath}" && xcodegen generate 2>&1`);
        console.log('xcodegen output:', stdout);
        if (stderr) console.error('xcodegen stderr:', stderr);
        
        // Check if .xcodeproj was created
        const xcodeprojPath = path.join(projectPath, `${projectName}.xcodeproj`);
        if (!await this.fileExists(xcodeprojPath)) {
          throw new Error('xcodegen did not create .xcodeproj file');
        }
      } catch (error) {
        console.error('xcodegen failed:', error);
        // Fallback: create basic structure manually
        await this.createBasicProjectStructure(projectPath, projectName, bundleId, platform);
      }
    }
  • Internal command handler that invokes the FileManager's createXcodeProject method for the 'create_project' command, which corresponds to the 'xcode_create_project' tool.
    case 'create_project':
      await this.fileManager.createXcodeProject(
        args.project_path,
        args.project_name,
        args.bundle_id,
        args.platform || 'ios'
      );
      output = `Project '${args.project_name}' created successfully at: ${args.project_path}`;
      break;
  • Dynamically generates MCP tool definitions for all loaded commands, creating the 'xcode_create_project' tool name and schema from the 'create_project' command definition.
    generateMCPToolDefinitions(): Array<{
      name: string;
      description: string;
      inputSchema: any;
    }> {
      return Object.entries(this.commands).map(([name, command]) => ({
        name: `xcode_${name}`,
        description: command.description,
        inputSchema: {
          type: 'object',
          properties: command.parameters ? Object.fromEntries(
            Object.entries(command.parameters).map(([paramName, paramDef]) => [
              paramName,
              {
                type: paramDef.type,
                description: paramDef.description,
                ...(paramDef.default !== undefined && { default: paramDef.default })
              }
            ])
          ) : {},
          required: command.parameters ? Object.entries(command.parameters)
            .filter(([_, paramDef]) => paramDef.required)
            .map(([paramName]) => paramName) : []
        }
      }));
    }
  • MCP CallTool request handler that dispatches 'xcode_create_project' calls to CommandExecutor.executeCommand('create_project', args).
      // Handle Xcode commands
      // Remove 'xcode_' prefix if present
      const commandName = name.startsWith('xcode_') ? name.slice(6) : name;
      const result = await this.commandExecutor.executeCommand(commandName, args);
      
      let responseText = result.output;
      if (result.error) {
        responseText += `\n\nWarnings/Errors:\n${result.error}`;
      }
      if (!result.success) {
        responseText = `Command failed: ${result.error}\n\nCommand executed: ${result.command}`;
      }
      
      return {
        content: [
          {
            type: 'text',
            text: responseText,
          },
        ],
      };
    } catch (error) {
  • Registers the ListTools handler which returns the dynamically generated tools list including 'xcode_create_project'.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [...tools, ...webMonitorTools],
    }));
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states it creates a project with 'basic structure' but doesn't specify what that entails (e.g., default files, configurations), whether it overwrites existing projects, requires specific permissions, or handles errors. This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action and resource. There's no wasted wording, and it directly communicates the tool's purpose without unnecessary details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral aspects (e.g., what 'basic structure' means, side effects), and while the schema covers parameters well, the overall context for safe and effective use is insufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters. The description doesn't add any meaning beyond what the schema provides (e.g., it doesn't clarify 'basic structure' in relation to parameters). With high schema coverage, the baseline is 3, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and resource ('new Xcode project with basic structure'), making the purpose immediately understandable. It doesn't specifically differentiate from sibling tools like 'xcode_create_directory' or 'xcode_create_swift_file' beyond mentioning 'project' versus 'directory' or 'file', which provides some distinction but not explicit comparison.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, when not to use it, or compare it to sibling tools like 'xcode_create_directory' for creating project components separately. Usage is implied by the name and description alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ebowwa/xcode-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server