Skip to main content
Glama
dncore

efferent-ble-simulator

by dncore

Efferent는 실제 라디오(Linux BlueZ)를 통해 Bluetooth Low Energy(BLE) 주변기기 장치를 시뮬레이션합니다: FTMS 스마트 트레이너, 사이클링 파워 미터, 속도/케이던스 센서, 심박수 모니터. 또한 MCP 서버(stdio 또는 HTTP)를 노출하여 AI 에이전트 — 그리고 번들로 제공되는 웹 대시보드 — 가 실제 트레이너를 제어하는 것처럼 시뮬레이션을 시작, 구성 및 모니터링할 수 있습니다.


기능

  • 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와 대시보드 간 공유

  • AI 에이전트용 17개 MCP 도구: 제어, 구성, 구성 프리셋, 상호작용 규칙, 세션, 로그, 실시간 장치 상태, 버전

  • 웹 대시보드(React + shadcn/ui): 상태, 폼, 원클릭 라이딩 템플릿, 상호작용 규칙, 세션/구성 관리, 실시간 로그 사이드 패널

  • Docker Compose 원커맨드 배포(MCP + 대시보드 + Skill 파일 over HTTP), 헬스 체크 포함 장기 실행

  • 버전 관리: MCP serverInfo.version + ble_get_version으로 에이전트가 업데이트를 감지할 수 있습니다


Related MCP server: pyBTMCP

런타임 환경

요구 사항

세부 사항

OS

Linux 전용 — 시뮬레이터는 D-Bus를 통해 호스트 BlueZ를 구동합니다

BlueZ

≥ 5.87 (5.86에는 advertisement-registration 버그가 있음)

하드웨어

실제 브로드캐스트를 위해서는 BLE 지원 어댑터(내장 또는 USB 동글)가 필요합니다

D-Bus 정책

/etc/dbus-1/system.d/ble-simulator.conf (npm run setup으로 설치) — 비루트 GATT 등록에 필요

Docker

컨테이너가 호스트 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, Indoor Bike Data(notify), Control Point(write/indicate), Status, Resistance/Power ranges

사이클링 파워

0x1818

Power/Cadence 측정, 휠/크랭크 데이터

속도/케이던스(CSC)

0x1816

휠/크랭크 회전 카운터

심박수

0x180D

HR 측정, 신체 센서 위치, 배터리


빠른 시작

사전 요구 사항

  • BlueZ ≥ 5.87(bluetoothd) 및 BLE 지원 어댑터가 있는 Linux

    BlueZ 5.86에는 advertisement-registration 버그가 있습니다; 엄격한 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를 작성합니다 — 비루트 GATT 등록에 필수(없으면 장치가 광고는 하지만 연결할 수 없습니다).

2. Docker Compose(서버 권장)

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

URL

용도

http://<host>:3300/mcp

MCP 엔드포인트

http://<host>:3330/

웹 대시보드

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

컨트롤러 상태 + 활성 구성 + 실시간 장치 상태(단계/파워/케이던스/HR)

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 write-response 규칙

ble_list_sessions / ble_get_session

세션 기록 / 상세 보기

ble_get_logs

영구 통신 로그(connect/write/notify/error)

ble_get_version

MCP + 스킬 버전, 변경 로그, 스킬 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

분당 파워 감소(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은 파워/케이던스/속도를 0으로 설정. 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

공개 스킬 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