Skip to main content
Glama
dncore

efferent-ble-simulator

by dncore

Efferent は、実際の無線(Linux BlueZ)上で Bluetooth Low Energy(BLE)ペリフェラルデバイスをシミュレートします:FTMS スマートトレーナーサイクリングパワーメータースピード/ケイデンスセンサー心拍数モニターMCP サーバー(stdio または HTTP)を公開するため、AI エージェント — および同梱の Web ダッシュボード — が実際のトレーナーを操作するかのようにシミュレーションの開始、設定、監視ができます。


機能

  • 4 種類のデバイスタイプを実際の BLE 無線で:FTMS スマートトレーナー(0x1826)、サイクリングパワー(0x1818)、スピード/ケイデンス(0x1816)、心拍数(0x180D)

  • 完全な FTMS コントロールポイント対応:Request Control / Start / Stop / Reset / Set Target Power / Set Resistance / Set Indoor Bike Simulation Params

  • 動的シミュレーション:人間らしいパワー/ケイデンスの変動 + 物理ベースの速度モデル(体重、勾配、Crr、CdA)、スクリプト化された ride_script を含む 5 つのライディングシナリオ

  • ホットパラメータ更新:実行中にパラメータを変更 — 接続中のスマートフォンはリンクを維持し、次の notify で新しい値を受け取ります(再ペアリング不要)

  • 名前付き設定プリセット:最大 20 個の名前付き設定を保存 / 読み込み / リネーム / 削除。MCP とダッシュボードで共有

  • エージェント向け 17 の MCP ツール:制御、設定、設定プリセット、インタラクションルール、セッション、ログ、ライブデバイス状態、バージョン

  • Web ダッシュボード(React + shadcn/ui):ステータス、フォーム、ワンクリックライドテンプレート、インタラクションルール、セッション/設定管理、ライブログサイドパネル

  • Docker Compose ワンコマンドデプロイ(MCP + ダッシュボード + Skill ファイルを HTTP で配信)、ヘルスチェック付きの長時間実行

  • バージョン管理:MCP serverInfo.version + ble_get_version でエージェントがアップデートを検出可能


Related MCP server: pyBTMCP

実行環境

要件

詳細

OS

Linux のみ — シミュレーターはホストの BlueZ を D-Bus 経由で駆動します

BlueZ

≥ 5.87(5.86 にはアドバタイズ登録のバグがあります)

ハードウェア

実際にブロードキャストするには BLE 対応アダプター(内蔵または USB ドングル)が必要です

D-Bus ポリシー

/etc/dbus-1/system.d/ble-simulator.confnpm run setup でインストール)— 非 root での GATT 登録に必要です

Docker

mcp コンテナはホストの D-Bus ソケットをマウントします。BLE 無線は常にホスト側にあります

非対応

macOS / Windows はネイティブ非対応(別の BLE スタックが必要)。BLE アダプターがない場合、MCP サービスは動作しますが送信は行われません

アーキテクチャ

┌──────────────┐   MCP protocol    ┌───────────────────────────┐
│ AI Agent /   │ ◄───────────────► │ MCP Server (HTTP :3300)   │
│ MCP Client   │  stdio / :3300    │ Web Dashboard (:3330)     │
│ (Claude,     │                   └────────────┬──────────────┘
│  Codex, pi)  │                                │ BlueZ D-Bus (system bus)
└──────────────┘                                ▼
                                     ┌───────────────────────────┐
                                     │ Host Linux BlueZ          │
                                     │ bluetoothd + BLE adapter  │
                                     │ (D-Bus policy, ≥ 5.87)    │
                                     └────────────┬──────────────┘
                                                  │ HCI / radio
                                                  ▼
                                     ┌───────────────────────────┐
                                     │ BLE advertisement + GATT  │
                                     │ FTMS / Power / CSC / HR   │
                                     └────────────┬──────────────┘
                                                  │
                                     ┌────────────▼──────────────┐
                                     │ Phone / Cycling App       │
                                     │ (Zwift, Garmin, Strava...)│
                                     └───────────────────────────┘

デバイスタイプ

タイプ

BLE サービス

特性

FTMS スマートトレーナー

0x1826

FM Feature、Indoor Bike Data(notify)、Control Point(write/indicate)、Status、Resistance/Power 範囲

サイクリングパワー

0x1818

パワー/ケイデンス測定、ホイール & クランクデータ

スピード/ケイデンス(CSC)

0x1816

ホイール & クランク回転カウンター

心拍数

0x180D

HR 測定、ボディセンサー位置、バッテリー


クイックスタート

前提条件

  • BlueZ ≥ 5.87(bluetoothd)と BLE 対応アダプターを備えた Linux

    BlueZ 5.86 にはアドバタイズ登録のバグがあります。厳格な MGMT 検証を行うカーネルでは、すべての RegisterAdvertisement が失敗します。先にアップグレードしてください:sudo pacman -S bluez && sudo systemctl restart bluetooth(Arch)/ sudo apt install bluez(Debian)。

  • Node.js ≥ 18

1. ネイティブインストール

npm install
npm run setup     # sudo — installs D-Bus policy, enables bluetoothd, verifies GATT
npm run build
npm run start:http   # HTTP mode on :3300 (or npm start for stdio)

npm run setup/etc/dbus-1/system.d/ble-simulator.conf を書き込みます — 非 root での GATT 登録に必須です(これがないとデバイスはアドバタイズしますが、接続できません)。

2. Docker Compose(サーバー推奨)

bash scripts/docker-up.sh     # host prep (sudo, once) + build + start

URL

用途

http://<host>:3300/mcp

MCP エンドポイント

http://<host>:3330/

Web ダッシュボード

http://<host>:3330/skill/SKILL.md

操作スキル(エージェント用)

http://<host>:3330/help

ダッシュボードヘルプページ

コンパイル不要のビルド(better-sqlite3 プリビルドバイナリ)。制限付きネットワークではミラーを使用:

NPM_REGISTRY=https://registry.npmmirror.com \
BETTER_SQLITE3_BINARY_HOST_MIRROR=https://registry.npmmirror.com/-/binary/better-sqlite3 \
bash scripts/docker-up.sh

管理:bash scripts/docker-up.sh status|logs|down


MCP ツール(17)

ツール

用途

ble_start / ble_stop / ble_restart

シミュレーションの開始 / 停止 / 再起動

ble_status

コントローラー状態 + アクティブ設定 + ライブデバイス状態(フェーズ/パワー/ケイデンス/心拍数)

ble_configure

設定の更新 — 同じデバイスタイプで実行中ならその場でホット更新

ble_get_config

現在/最新の設定を JSON で取得(フォームのバックフィル用)

ble_save_config

現在のパラメータを名前付きプリセットとして保存(最大 20

ble_list_configs / ble_get_config_detail

保存済みプリセットの一覧 / 表示

ble_rename_config / ble_delete_config

プリセットのリネーム / 削除

ble_set_interaction / ble_clear_interactions

カスタム BLE 書き込み応答ルール

ble_list_sessions / ble_get_session

セッション履歴 / 詳細

ble_get_logs

永続的な通信ログ(接続/書き込み/notify/エラー)

ble_get_version

MCP + Skill のバージョン、変更履歴、Skill URL(アップデート検出用)

{
  "method": "tools/call",
  "params": {
    "name": "ble_start",
    "arguments": {
      "deviceType": "ftms",
      "ftms": { "simulation": { "enabled": true, "scenario": { "type": "ride_script" } } }
    }
  }
}

動的シミュレーション

FTMS / CyclingPower / CSC で simulation を有効化:

"simulation": {
  "enabled": true,
  "riderWeightKg": 75, "bikeWeightKg": 8, "crr": 0.004, "cdA": 0.35,
  "fatigueFactor": 0.0005, "cadenceCoupling": "proportional", "microPauseProbability": 0.008,
  "autoStart": true,
  "scenario": { "type": "ride_script" }
}

パラメータ

デフォルト

説明

enabled

false

マスタースイッチ

riderWeightKg / bikeWeightKg

75 / 8

速度物理(ライダー+バイク質量)

crr / cdA

0.004 / 0.35

転がり抵抗 / 空気抵抗面積

fatigueFactor

0

1 分あたりのパワー減衰(0 = なし)

cadenceCoupling

proportional

proportional / inverse / independent

microPauseProbability

0.005

ティックごとの惰性走行ポーズ

autoStart

false(ride_script はデフォルトでオン)

アプリが Start を送らなくても走行開始

scenario

freeride

ライディングシナリオ(下記)

シナリオ

  • steady — 自然な微小変動のみ

  • freeride(デフォルト)— 基本パワーが 60〜180 秒ごとに ±20% 変動

  • intervals — 高/低パワーの交互

  • warmup_main_cooldown — ウォームアップ → メイン → クールダウン

  • ride_script — スクリプト化されたライド:一連のライディングアクション(start / cruise / climb / sprint / coast / stop)。各アクションに目標パワー、勾配、任意のケイデンスを指定。自動開始、repeat: true でループ、stop でパワー/ケイデンス/速度をゼロに。phases を省略すると組み込みのデフォルトスクリプトを使用。


ホット更新と安定シリアル

  • ホット更新:実行中に ble_configure + 同じデバイスタイプでパラメータをその場で適用 — 接続中のスマートフォンはリンクを維持し、次の notify で更新された値を受け取ります。デバイスタイプの変更は再起動が必要です(新しいシリアルにより再検出が強制されます)。

  • 安定シリアルSIM_SERIAL_STABLE=1 で、同じタイプのセッション間でシリアルを安定させます(SIM001-FTMS)。これにより、スマートフォンは停止/開始後もデバイスを忘れることなく再接続できます。


環境変数

変数

デフォルト

説明

MCP_TRANSPORT

stdio

stdio または http

MCP_PORT / MCP_HOST

3300 / 0.0.0.0

HTTP リッスンアドレス

SIM_DEVICE_PREFIX

OPEN_RIDE

アドバタイズ名のプレフィックス

SIM_INSTANCE_ID_MODE

デバイス名のインスタンス ID モード

SIM_SERIAL_STABLE

未設定

1 = 同じタイプのセッションで安定シリアル

SKILL_PUBLIC_URL

/skill/SKILL.md

公開 Skill URL(ble_get_version が返す)


ソース構成

src/
├── index.ts             # entry, lifecycle
├── mcp-server.ts        # 17 MCP tool definitions & handlers
├── ble-controller.ts    # BlueZ D-Bus lifecycle, advertisement, hot-update
├── database.ts          # SQLite layer (sessions / saved_configs / logs)
├── config.ts            # config merge & defaults
├── version.ts           # version single-source
├── simulator.ts         # HeartRate / Battery simulators
├── cycling-simulator.ts # power/cadence simulators + physics + ride_script engine
└── devices/             # heart-rate / cycling-power / csc / ftms GATT devices

BLE ペリフェラルアクセスはホストの BlueZ D-Bus 経由で実行されます(コンテナはホストの D-Bus ソケットをマウント)。設計記録は docs/design/*.md を参照してください。


ライセンス

MIT © BLE Simulator Contributors

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Bluetooth Low Energy (BLE) MCP server that allows AI agents to scan, connect to and communicated with BLE devices, as well as simulate BLE perhipherals.
    15
    BSD 2-Clause "Simplified"
  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    A BLE fitness device simulator that enables AI agents to control simulated heart rate monitors, treadmills, and cycling trainers via the Model Context Protocol. It integrates ESP32 firmware, an MQTT broker, and a FastAPI backend for comprehensive device management and real-time interaction.
  • A
    license
    A
    quality
    C
    maintenance
    A stateful Bluetooth Low Energy (BLE) MCP server that enables AI agents to scan, connect, read/write characteristics, and subscribe to notifications on BLE devices.
    35
    17
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Exposes Garmin Connect data and workout management to AI agents, supporting tools, resources, and prompts for health data, workout creation, and coaching workflows.
    1

View all related MCP servers

Related MCP Connectors

  • Multi-tenant Telegram gateway for AI agents — HTTP+stdio, 8 tools, MTProto User API

  • Run, build, and validate firmware on virtual hardware from your AI agent. Hardware knowledge corpus.

  • Build, validate, and deploy multi-agent AI solutions from any AI environment.

View all MCP Connectors

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/dncore/efferent-ble-simulator'

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