Skip to main content
Glama

Opentrons API MCP Server

Opentrons HTTP API v2 および Python Protocol API を操作・参照するための TypeScript / Node.js ベースの Model Context Protocol (MCP) サーバーです。
Claude Desktop、Cursor などの MCP クライアントから、Opentrons ロボット(OT-2 / Opentrons Flex)の操作、プロトコルの検証・実行、ステータス確認、ドキュメント検索を行うことができます。


主な機能

  • 📚 opentrons_search_docs: Opentrons Python Protocol API および HTTP API のドキュメント・サンプルコードを検索

  • 🔍 opentrons_validate_protocol: Python プロトコルの構文チェックおよび物理ハードウェア(モジュール/ピペット)の要求照合

  • 🚀 opentrons_upload_and_run: ハードウェア検証・プロトコルアップロード・Run 生成・実行開始を安全に一括実行

  • 📊 opentrons_get_robot_status: ロボットの接続状態、モジュール/ピペット構成、Run の進捗ステータスを取得

  • ⏸️ opentrons_control_run: Run に対する操作(play, pause, stop, resume)

  • ⚡ opentrons_execute_command: 個別のハードウェアダイレクトコマンドを発行


Related MCP server: JSON-RPC

前提条件

  • Node.js: v20.0.0 以上 (動作確認済み: v22.22.0)

  • npm: v10.0.0 以上

  • Opentrons ロボット: OT-2 または Opentrons Flex(API ポート 31950 が開放されていること)


インストール & セットアップ

1. 依存関係のインストール

npm install

2. ドキュメント検索インデックスの構築

npm run build:index

3. プロジェクトのビルド

npm run build

環境変数の設定

プロジェクトルートに .env ファイルを作成するか、環境変数を設定して接続先ロボット情報を指定します。

# Opentrons ロボットの IP アドレス (デフォルト: 127.0.0.1)
OPENTRONS_ROBOT_IP=192.168.1.100

# Opentrons HTTP API ポート (デフォルト: 31950)
OPENTRONS_ROBOT_PORT=31950

# API トークン (認証が必要な場合のみ)
OPENTRONS_API_TOKEN=

MCP クライアントへの登録方法

Claude Desktop の場合

claude_desktop_config.json(Windows の場合は %APPDATA%\Claude\claude_desktop_config.json)に以下のように追加します。

{
  "mcpServers": {
    "opentrons": {
      "command": "node",
      "args": [
        "C:/path/to/otie-mcp/dist/index.js"
      ],
      "env": {
        "OPENTRONS_ROBOT_IP": "192.168.1.100",
        "OPENTRONS_ROBOT_PORT": "31950"
      }
    }
  }
}

開発モードでの実行 (tsx)

{
  "mcpServers": {
    "opentrons": {
      "command": "npx",
      "args": [
        "tsx",
        "C:/path/to/otie-mcp/src/index.ts"
      ],
      "env": {
        "OPENTRONS_ROBOT_IP": "192.168.1.100",
        "OPENTRONS_ROBOT_PORT": "31950"
      }
    }
  }
}

ツール一覧と利用方法

1. opentrons_search_docs

Opentrons API ドキュメントをキーワード検索します。

  • パラメータ:

    • query (string, 必須): 検索キーワード(例: "temperature module", "transfer", "load_labware")

    • maxResults (number, 任意): 最大取得件数(デフォルト: 5)

2. opentrons_validate_protocol

Python プロトコルコードの構文チェックと、接続済みモジュール/ピペットとの適合性をチェックします。

  • パラメータ:

    • protocolContent (string, 必須): Python プロトコルコード本文

3. opentrons_upload_and_run

物理ハードウェア検証を行ったうえでプロトコルをアップロードし、Run を生成して実行を開始します。必要なモジュールが不足している場合は安全にブロックされます。

  • パラメータ:

    • protocolContent (string, 必須): Python プロトコルコード本文

    • filename (string, 任意): 保存ファイル名(デフォルト: "protocol.py")

4. opentrons_get_robot_status

ロボットの健康状態、接続中モジュール・ピペット、および特定の Run ステータスを取得します。

  • パラメータ:

    • runId (string, 任意): 確認したい Run の ID

5. opentrons_control_run

実行中または一時停止中の Run を制御します。

  • パラメータ:

    • runId (string, 必須): 対象の Run ID

    • action (string, 必須): 'play' | 'pause' | 'stop' | 'resume'

6. opentrons_execute_command

指定した Run に対し、ダイレクトコマンド(ホーム復帰、ピペット移動など)を発行します。

  • パラメータ:

    • runId (string, 必須): 対象の Run ID

    • commandType (string, 必須): コマンド種別(例: "home", "loadLabware")

    • params (object, 任意): コマンドパラメータ

    • intent (string, 任意): 'setup' | 'protocol'


テストの実行

Jest によるユニットテストを実行します。

npm test

ライセンス

ISC License

Available Tools

6 tools
opentrons_control_runA

実行中の Run に対して play (開始/再開), pause (一時停止), stop (停止), resume (再開) の制御アクションを発行します。

Inputs: runId (required), action (required).

opentrons_execute_commandC

指定された Run に対して個別のハードウェアダイレクトコマンドを発行・実行します。

Inputs: runId (required), commandType (required), intent, params.

opentrons_get_robot_statusA

ロボットの接続状態、モジュール・ピペット構成、および指定された Run の現在ステータスを取得します。

Inputs: runId.

opentrons_search_docsA

Opentrons Python Protocol API & HTTP API ドキュメントをキーワード検索し、関連する仕様やサンプルコードを返却します。

Inputs: query (required), maxResults.

opentrons_upload_and_runA

プロトコル検証・アップロード・Run生成・実行開始を一括で行います。ハードウェア不足時はブロックします。

Inputs: protocolContent (required), filename.

opentrons_validate_protocolB

Opentrons Python プロトコルコードの構文・物理ハードウェア要件(接続モジュール/ピペット)を事前チェックします。

Inputs: protocolContent (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 6 tools

    Disambiguation4/5

    Each tool has a clear primary purpose, and the descriptions make the differences understandable. However, opentrons_upload_and_run includes validation and starting execution, which overlaps with opentrons_validate_protocol and could create ambiguity about when to call both.

    Naming Consistency4/5

    All tool names share the opentrons_ prefix and use snake_case, and most follow a verb_noun pattern (search_docs, validate_protocol, get_robot_status, control_run, execute_command). opentrons_upload_and_run breaks the pattern by combining two verbs without a direct object, which is a minor inconsistency.

    Tool Count5/5

    Six tools is a well-scoped size for an Opentrons automation server. Each tool earns its place: documentation search, validation, upload/run, status, run control, and direct commands cover distinct operational needs without unnecessary redundancy.

    Completeness4/5

    The set covers the core workflow from documentation and validation through upload, execution, status monitoring, and run control. Minor gaps exist, such as a lack of separate upload-only or run-only actions and no way to retrieve run results or history, but agents can still accomplish the main tasks.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      A Python-based MCP server that integrates OpenAPI-described REST APIs into MCP workflows, enabling dynamic exposure of API endpoints as MCP tools.
      157
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol (MCP) server based on OpenRPC, providing JSON-RPC function invocation and method discovery services.
      2
      1
      Apache 2.0
    • F
      license
      Not graded
      quality
      C
      maintenance
      An MCP server that enables AI assistants to control and monitor Klipper 3D printers via the Moonraker API. It supports comprehensive printer management, including G-code execution, toolchanger operations, and real-time status monitoring.
      29
      -
    • A
      license
      A
      quality
      D
      maintenance
      A Model Context Protocol server for PyLabRobot that exposes liquid handler, plate reader, thermocycler, and heater-shaker as MCP tools. It ships in simulation mode by default, allowing end-to-end testing without hardware.
      10
      MIT