Skip to main content
Glama
andreahaku

Expo iOS Development MCP Server

by andreahaku

simulator.log_stream.start

Begin streaming iOS Simulator system logs to monitor application behavior and debug React Native/Expo development in real-time.

Instructions

Start streaming simulator system logs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core implementation of startLogStream(): starts a log streaming process using 'xcrun simctl spawn booted log stream', handles output via logger, manages process state
    export async function startLogStream(): Promise<LogStreamInfo> {
      logger.info("simulator", "Starting simulator log stream");
    
      if (logStreamProcess) {
        throw createError("SIMCTL_FAILED", "Log stream is already running");
      }
    
      // Check if simulator is booted
      if (!stateManager.isSimulatorReady()) {
        const bootedDevice = await getBootedDevice();
        if (!bootedDevice) {
          throw createError("SIM_NOT_BOOTED", "No simulator is currently booted", {
            details: "Boot a simulator first using simulator.boot",
          });
        }
        stateManager.updateSimulator({
          state: "booted",
          udid: bootedDevice.udid,
          deviceName: bootedDevice.name,
        });
      }
    
      // Start log stream
      logStreamProcess = execa("xcrun", ["simctl", "spawn", "booted", "log", "stream", "--style", "compact"], {
        reject: false,
      });
    
      isStreaming = true;
      const startedAt = new Date().toISOString();
    
      // Process stdout line by line
      logStreamProcess.stdout?.on("data", (chunk: Buffer) => {
        const lines = chunk.toString().split("\n").filter(Boolean);
        for (const line of lines) {
          logger.debug("simulator", line);
        }
      });
    
      logStreamProcess.stderr?.on("data", (chunk: Buffer) => {
        const lines = chunk.toString().split("\n").filter(Boolean);
        for (const line of lines) {
          logger.warn("simulator", `[stderr] ${line}`);
        }
      });
    
      logStreamProcess.on("exit", (code: number | null) => {
        logger.info("simulator", `Log stream ended with code ${code}`);
        isStreaming = false;
        logStreamProcess = null;
      });
    
      logger.info("simulator", "Simulator log stream started");
    
      return {
        isStreaming: true,
        startedAt,
      };
    }
  • MCP server.tool registration for 'simulator.log_stream.start', which invokes startLogStream() and formats the MCP response
    server.tool(
      "simulator.log_stream.start",
      "Start streaming simulator system logs",
      {},
      async () => {
        try {
          const result = await startLogStream();
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({ success: true, ...result }, null, 2),
              },
            ],
          };
        } catch (error) {
          return handleToolError(error);
        }
      }
    );

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/andreahaku/expo_ios_development_mcp'

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