Skip to main content
Glama
ebowwa

Xcode MCP Server

by ebowwa

xcode_modify_plist

Modify values in plist files to configure Xcode project settings, enabling automated updates to iOS/macOS app properties.

Instructions

Modify a value in a plist file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
plist_pathYesPath to the plist file
keyYesPlist key to modify
valueYesNew value for the key

Implementation Reference

  • The core handler function that executes the plist modification using PlistBuddy to set the specified key to the given value in the plist file.
    async modifyPlist(plistPath: string, key: string, value: string): Promise<void> {
      // Use PlistBuddy to modify plist files
      const command = `/usr/libexec/PlistBuddy -c "Set :${key} ${value}" "${plistPath}"`;
      await execAsync(command);
    }
  • Dispatches the 'modify_plist' internal command to the FileManager's modifyPlist method.
    case 'modify_plist':
      await this.fileManager.modifyPlist(args.plist_path, args.key, args.value);
      output = `Plist modified successfully: ${args.key} = ${args.value}`;
      break;
  • Generates the MCP tool definitions including 'xcode_modify_plist' by prefixing command names with 'xcode_' and deriving inputSchema from command parameters.
    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) : []
        }
      }));
    }
  • Defines the input schema for tools like 'xcode_modify_plist' based on the command's parameter definitions.
        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) : []
        }
      }));
    }
  • Main MCP CallTool request handler that recognizes 'xcode_*' tools, strips the prefix, and delegates execution to CommandExecutor.
    // 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);

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