# AIエージェント向けMCP · ドキュメント | Lagsmith

> LagsmithのMCPサーバを、コマンド1つでClaude Codeに、またはCursor、Codex、Claude Desktop、Windsurfに追加し、低速・失敗するネットワークでアプリをテストします。

Source: https://lagsmith.com/ja/docs/mcp

# 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_network` | 1つのアプリのネットワークを遅くする、または切断する | 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_endpoint` | 1つのエンドポイントにダミーのレスポンスを返す | 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 s
     Executed 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 ms
     POST https://api.pantryhq.app/v1/payments 503 injected by Lagsmith 1 ms
     POST 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版をダウンロード](https://downloads.lagsmith.com/Lagsmith.dmg)

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