AIエージェント向けMCP

LagsmithにはMCPサーバが内蔵されています。Claude Code、Cursor、Codex、Claude Desktop、WindsurfなどMCPに対応するAIコーディングエージェントは、これを使って次のことができます:

  • シミュレータとアプリの一覧を取得する
  • アプリのネットワークを設定・リセットする
  • リクエストモニタリング付きでアプリを再起動する
  • アプリのリクエストを読み取る
  • エンドポイントを失敗させる・モックにする

Lagsmithが遅くするのはテスト対象のアプリだけなので、エージェント自身の接続はフルスピードのままです。

MCPサーバはアプリ内の/Applications/Lagsmith.app/Contents/MacOS/lagsmith-mcpに同梱されているため、Lagsmithを「アプリケーション」フォルダに入れておく必要があります。MCPを含む自動化機能はProの機能で、14日間のトライアルに含まれています。

Claude Code

ターミナルで次を一度実行します:

claude mcp add --scope user lagsmith -- "/Applications/Lagsmith.app/Contents/MacOS/lagsmith-mcp"

--scope userを付けると、すべてのプロジェクトでLagsmithを使えます。Claude Codeの新しいセッションを開始し、/mcpを実行して接続されているか確認してください。

Cursor

~/.cursor/mcp.json(またはプロジェクト内の.cursor/mcp.json)に次を追加します:

~/.cursor/mcp.json
{
  "mcpServers": {
    "lagsmith": {
      "command": "/Applications/Lagsmith.app/Contents/MacOS/lagsmith-mcp"
    }
  }
}

Codex

~/.codex/config.tomlに次を追加します:

~/.codex/config.toml
[mcp_servers.lagsmith]
command = "/Applications/Lagsmith.app/Contents/MacOS/lagsmith-mcp"

Claude Desktop

Claude DesktopでSettings › Developer › Edit Configを開き、次を追加します:

~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "lagsmith": {
      "command": "/Applications/Lagsmith.app/Contents/MacOS/lagsmith-mcp"
    }
  }
}

その後、Claude Desktopを再起動します。

Windsurf

WindsurfのMCP設定に次を追加します:

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "lagsmith": {
      "command": "/Applications/Lagsmith.app/Contents/MacOS/lagsmith-mcp"
    }
  }
}

設定ファイルにすでにほかのサーバがある場合は、ファイルを置き換えるのではなく、既存のmcpServersセクションの中にlagsmithのエントリを追加してください。

ツール

LagsmithのMCPサーバは、エージェントに10個のツールを提供します:

ツール機能主なパラメータ
list_targets実行中のシミュレータとそのアプリ、実行中のMacアプリ、プリセット、現在のルールなし
statusすべてのルールとその動作内容、プロキシが実行中かどうかなし
set_network1つのアプリのネットワークを遅くする、または切断するapp、simulator。preset、またはdown/up(kbps)、latency/jitter(ms)、loss(%)。failure(airplane、refuse、timeout、drop、outages)。hosts、hosts_mode
reset_networkフルスピードに戻す。アプリの監視は続くapp、simulator
stop_watchingアプリのルールを完全にオフにするapp、simulator
relaunch_appリクエストモニタリング付きでシミュレータアプリを再起動するapp、simulator
get_requestsアプリの最近のHTTPリクエスト(新しい順)app、simulator、limit、filter(例: is:failed、status:5xx)、include_bodies
fail_endpointほかは動作させたまま、1つのエンドポイントを失敗させるapp、simulator、pattern、kind(offline、timeout、status、delay)、value
mock_endpoint1つのエンドポイントにダミーのレスポンスを返すapp、simulator、pattern、status、body、content_type、delay
clear_endpointsエンドポイントの失敗とモックを削除するapp、simulator、pattern

セッションの例

> 決済APIが503を返す状態で、3GでチェックアウトのUIテストを実行して、何が壊れるか教えて。
まずシミュレータでアプリを探します。
lagsmith - list_targets (MCP)
simulators: iPhone 17 Pro (booted)apps: com.pantryhq.Pantry, com.apple.mobilesafari, …presets: Edge, 3G, DSL, LTE, WiFi, Very Bad Network, 100% Loss
lagsmith - set_network (MCP)(app: "com.pantryhq.Pantry", simulator: "booted", preset: "3G")
{"ok": true, "rule": "Pantry", "preset": "3G", "conditions": {"down": 780, "up": 330, "latency": 200}}
lagsmith - fail_endpoint (MCP)(app: "com.pantryhq.Pantry", simulator: "booted", pattern: "api.pantryhq.app/v1/payments", kind: "status", value: 503)
{"ok": true, "endpoints": [{"pattern": "api.pantryhq.app/v1/payments", "kind": "status", "value": 503}]}
lagsmith - relaunch_app (MCP)(app: "com.pantryhq.Pantry", simulator: "booted")
{"ok": true, "relaunched": ["Pantry on iPhone 17 Pro"]}
Bash(xcodebuild test -scheme PantryUITests -only-testing:PantryUITests/CheckoutTests -destination 'platform=iOS Simulator,name=iPhone 17 Pro')
Test Suite 'CheckoutTests' started✓ testCartLoads (4.8 s)✓ testApplyCoupon (6.1 s)✗ testPlaceOrder (30.0 s): Failed to find "Order confirmed" within 30 sExecuted 3 tests, with 1 failure
lagsmith - get_requests (MCP)(app: "com.pantryhq.Pantry", simulator: "booted", filter: "host:api.pantryhq.app is:failed", include_bodies: true)
POST https://api.pantryhq.app/v1/payments 503 injected by Lagsmith 2 msPOST https://api.pantryhq.app/v1/payments 503 injected by Lagsmith 1 msPOST https://api.pantryhq.app/v1/payments 503 injected by Lagsmith 1 ms(3 requests, 0.4 s apart)
lagsmith - reset_network (MCP)(app: "com.pantryhq.Pantry", simulator: "booted")
{"ok": true, "preset": "No Throttling"}
見つかりました。3Gではカートとクーポンのフローは問題ありませんが、決済が503を返すと: 1. PaymentServiceがバックオフなしで3回リトライし(0.4秒間隔)、何も表示せずに諦めます。 2. チェックアウト画面のスピナーが回り続けます: 決済失敗時のエラー状態がないため、 testPlaceOrderが"Order confirmed"を待ってタイムアウトします。 CheckoutViewに指数バックオフと「もう一度試す」ボタン付きのエラー状態を追加して、 同じ条件でテストを再実行しましょうか?
LagsmithのMCPサーバを使ったClaude Codeセッションの例。エージェントはフルスピードのままで、Pantryだけが3Gになります。

プロンプトの例

  • 「モニタリング付きでアプリを3Gで再起動してサインインし、2秒より遅かったリクエストを一覧にして」
  • 「アプリを機内モードにして、オフラインのバナーが表示されるか確認して」
  • 「POST /v1/ordersが500を返すようにして、アプリが再試行ボタンを表示するか確認して」
Mac版をダウンロード

無料ダウンロード、14日間のProトライアル付き。アカウントもカードも不要です。macOS 13 Ventura以降。