Skip to main content
Glama
devyhan

Xcode MCP Server

by devyhan

xcode-test

Run Xcode project tests on simulators or devices by specifying project path, scheme, and destination, with options for test plans, specific tests, and result bundles.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesXcode 프로젝트 또는 워크스페이스 경로
schemeYes테스트할 스킴
destinationYes테스트 대상 (예: 'platform=iOS Simulator,name=iPhone 14')
testPlanNo사용할 테스트 플랜 이름
onlyTestingNo실행할 특정 테스트 식별자들 (예: ['ModuleTests/ClassTests/testMethod'])
skipTestingNo건너뛸 테스트 식별자들
resultBundlePathNo테스트 결과 번들 저장 경로
buildForTestingNo테스트용 빌드만 수행할지 여부
testWithoutBuildingNo빌드 없이 테스트만 수행할지 여부

Implementation Reference

  • The async handler function that implements the core logic of the 'xcode-test' tool. It builds an xcodebuild test command using the provided parameters (project path, scheme, destination, etc.) and executes it via the executeCommand helper.
    async ({ projectPath, scheme, destination, testPlan, onlyTesting = [], skipTesting = [], resultBundlePath, buildForTesting = false, testWithoutBuilding = false }) => {
      try {
        console.error(`Xcode 테스트 실행: ${projectPath}, Scheme: ${scheme}`);
        
        let command = `xcodebuild`;
        
        // 워크스페이스인지 프로젝트인지 확인
        if (projectPath.endsWith(".xcworkspace")) {
          command += ` -workspace "${projectPath}"`;
        } else {
          command += ` -project "${projectPath}"`;
        }
        
        command += ` -scheme "${scheme}"`;
        command += ` -destination "${destination}"`;
        
        // 테스트 모드 설정
        if (buildForTesting) {
          command += ` build-for-testing`;
        } else if (testWithoutBuilding) {
          command += ` test-without-building`;
        } else {
          command += ` test`; // 기본 모드: 빌드 후 테스트
        }
        
        // 테스트 플랜 설정
        if (testPlan) {
          command += ` -testPlan "${testPlan}"`;
        }
        
        // 특정 테스트만 실행
        if (onlyTesting.length > 0) {
          for (const test of onlyTesting) {
            command += ` -only-testing:"${test}"`;
          }
        }
        
        // 특정 테스트 건너뛰기
        if (skipTesting.length > 0) {
          for (const test of skipTesting) {
            command += ` -skip-testing:"${test}"`;
          }
        }
        
        // 결과 번들 경로 설정
        if (resultBundlePath) {
          command += ` -resultBundlePath "${resultBundlePath}"`;
        }
        
        console.error(`실행할 테스트 명령어: ${command}`);
        
        // 테스트 명령어 실행
        try {
          const { stdout, stderr } = await executeCommand(command);
          
          let resultText = "테스트 결과:\n";
          if (stdout) resultText += `${stdout}\n`;
          if (stderr) resultText += `STDERR:\n${stderr}\n`;
    
          return {
            content: [{ type: "text", text: resultText }]
          };
        } catch (error: any) {
          throw error;
        }
      } catch (error: any) {
        console.error(`Xcode 테스트 오류: ${error.message}`);
        
        return {
          content: [{ 
            type: "text", 
            text: `Xcode 테스트 중 오류가 발생했습니다:\n${error.message}\n${error.stderr || ''}`
          }],
          isError: true
        };
      }
  • The Zod schema defining the input parameters for the 'xcode-test' tool, including projectPath, scheme, destination, and optional test filtering and configuration options.
    {
      projectPath: z.string().describe("Xcode 프로젝트 또는 워크스페이스 경로"),
      scheme: z.string().describe("테스트할 스킴"),
      destination: z.string().describe("테스트 대상 (예: 'platform=iOS Simulator,name=iPhone 14')"),
      testPlan: z.string().optional().describe("사용할 테스트 플랜 이름"),
      onlyTesting: z.array(z.string()).optional().describe("실행할 특정 테스트 식별자들 (예: ['ModuleTests/ClassTests/testMethod'])"),
      skipTesting: z.array(z.string()).optional().describe("건너뛸 테스트 식별자들"),
      resultBundlePath: z.string().optional().describe("테스트 결과 번들 저장 경로"),
      buildForTesting: z.boolean().optional().describe("테스트용 빌드만 수행할지 여부"),
      testWithoutBuilding: z.boolean().optional().describe("빌드 없이 테스트만 수행할지 여부")
    },
  • src/index.ts:206-296 (registration)
    The server.tool registration call that defines and registers the 'xcode-test' tool with its schema and handler function.
    server.tool(
      "xcode-test",
      {
        projectPath: z.string().describe("Xcode 프로젝트 또는 워크스페이스 경로"),
        scheme: z.string().describe("테스트할 스킴"),
        destination: z.string().describe("테스트 대상 (예: 'platform=iOS Simulator,name=iPhone 14')"),
        testPlan: z.string().optional().describe("사용할 테스트 플랜 이름"),
        onlyTesting: z.array(z.string()).optional().describe("실행할 특정 테스트 식별자들 (예: ['ModuleTests/ClassTests/testMethod'])"),
        skipTesting: z.array(z.string()).optional().describe("건너뛸 테스트 식별자들"),
        resultBundlePath: z.string().optional().describe("테스트 결과 번들 저장 경로"),
        buildForTesting: z.boolean().optional().describe("테스트용 빌드만 수행할지 여부"),
        testWithoutBuilding: z.boolean().optional().describe("빌드 없이 테스트만 수행할지 여부")
      },
      async ({ projectPath, scheme, destination, testPlan, onlyTesting = [], skipTesting = [], resultBundlePath, buildForTesting = false, testWithoutBuilding = false }) => {
        try {
          console.error(`Xcode 테스트 실행: ${projectPath}, Scheme: ${scheme}`);
          
          let command = `xcodebuild`;
          
          // 워크스페이스인지 프로젝트인지 확인
          if (projectPath.endsWith(".xcworkspace")) {
            command += ` -workspace "${projectPath}"`;
          } else {
            command += ` -project "${projectPath}"`;
          }
          
          command += ` -scheme "${scheme}"`;
          command += ` -destination "${destination}"`;
          
          // 테스트 모드 설정
          if (buildForTesting) {
            command += ` build-for-testing`;
          } else if (testWithoutBuilding) {
            command += ` test-without-building`;
          } else {
            command += ` test`; // 기본 모드: 빌드 후 테스트
          }
          
          // 테스트 플랜 설정
          if (testPlan) {
            command += ` -testPlan "${testPlan}"`;
          }
          
          // 특정 테스트만 실행
          if (onlyTesting.length > 0) {
            for (const test of onlyTesting) {
              command += ` -only-testing:"${test}"`;
            }
          }
          
          // 특정 테스트 건너뛰기
          if (skipTesting.length > 0) {
            for (const test of skipTesting) {
              command += ` -skip-testing:"${test}"`;
            }
          }
          
          // 결과 번들 경로 설정
          if (resultBundlePath) {
            command += ` -resultBundlePath "${resultBundlePath}"`;
          }
          
          console.error(`실행할 테스트 명령어: ${command}`);
          
          // 테스트 명령어 실행
          try {
            const { stdout, stderr } = await executeCommand(command);
            
            let resultText = "테스트 결과:\n";
            if (stdout) resultText += `${stdout}\n`;
            if (stderr) resultText += `STDERR:\n${stderr}\n`;
    
            return {
              content: [{ type: "text", text: resultText }]
            };
          } catch (error: any) {
            throw error;
          }
        } catch (error: any) {
          console.error(`Xcode 테스트 오류: ${error.message}`);
          
          return {
            content: [{ 
              type: "text", 
              text: `Xcode 테스트 중 오류가 발생했습니다:\n${error.message}\n${error.stderr || ''}`
            }],
            isError: true
          };
        }
      }
    );
Behavior1/5

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

Tool has no description.

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

Conciseness1/5

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

Tool has no description.

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

Completeness1/5

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

Tool has no description.

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

Parameters1/5

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

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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/devyhan/xcode-mcp'

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