efferent-ble-simulator
Efferent 通过真实无线电(Linux BlueZ)模拟蓝牙低功耗(BLE)外设设备:FTMS 智能骑行台、骑行功率计、速度/踏频传感器和心率监测器。它暴露了一个 MCP 服务器(stdio 或 HTTP),使 AI 代理——以及内置的 Web 仪表盘——能够像控制真实骑行台一样启动、配置和监控模拟。
功能特性
4 种设备类型,通过真实 BLE 无线电广播:FTMS 智能骑行台(0x1826)、骑行功率(0x1818)、速度/踏频(0x1816)、心率(0x180D)
完整的 FTMS 控制点支持:请求控制 / 启动 / 停止 / 重置 / 设置目标功率 / 设置阻力 / 设置室内骑行模拟参数
动态模拟:拟人化的功率/踏频漂移 + 基于物理的速度模型(体重、坡度、Crr、CdA),5 种骑行场景,包括脚本化的 ride_script
热参数更新:运行时更改参数——已连接的手机保持链路,并在下一次通知时收到新值(无需重新配对)
命名配置预设:保存 / 加载 / 重命名 / 删除最多 20 个命名配置,MCP 与仪表盘共享
17 个 MCP 工具供代理使用:控制、配置、配置预设、交互规则、会话、日志、实时设备状态、版本
Web 仪表盘(React + shadcn/ui):状态、表单、一键骑行模板、交互规则、会话/配置管理、实时日志侧面板
Docker Compose 一键部署(MCP + 仪表盘 + 通过 HTTP 提供的 Skill 文件),带健康检查的长期运行
版本化:MCP
serverInfo.version+ble_get_version让代理检测更新
Related MCP server: pyBTMCP
运行环境
要求 | 详情 |
操作系统 | 仅限 Linux — 模拟器通过 D-Bus 驱动宿主机的 BlueZ |
BlueZ | ≥ 5.87(5.86 存在广播注册缺陷) |
硬件 | 需要 支持 BLE 的适配器(内置或 USB 适配器)才能实际广播 |
D-Bus 策略 |
|
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 特征、室内骑行数据(通知)、控制点(写入/指示)、状态、阻力/功率范围 |
骑行功率 | 0x1818 | 功率/踏频测量、车轮与曲柄数据 |
速度/踏频(CSC) | 0x1816 | 车轮与曲柄转数计数器 |
心率 | 0x180D | 心率测量、身体传感器位置、电池 |
快速开始
前置条件
装有 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 + startURL | 用途 |
| MCP 端点 |
| Web 仪表盘 |
| 操作技能(供代理使用) |
| 仪表盘帮助页面 |
零编译构建(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 个)
工具 | 用途 |
| 启动 / 停止 / 重启模拟 |
| 控制器状态 + 当前配置 + 实时设备状态(阶段/功率/踏频/心率) |
| 更新配置 — 若正在运行且设备类型相同则原地热更新 |
| 当前/最新配置(JSON 格式,用于表单回填) |
| 将当前参数保存为命名预设(最多 20 个) |
| 列出 / 查看已保存的预设 |
| 重命名 / 删除预设 |
| 自定义 BLE 写入响应规则 |
| 会话历史 / 详情 |
| 持久化通信日志(连接/写入/通知/错误) |
| 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" }
}参数 | 默认值 | 描述 |
|
| 总开关 |
| 75 / 8 | 速度物理模型(骑手+自行车质量) |
| 0.004 / 0.35 | 滚动阻力 / 迎风面积 |
| 0 | 每分钟功率衰减(0 = 无) |
|
|
|
| 0.005 | 每次滴答的滑行暂停概率 |
|
| 无需应用发送 Start 即可开始骑行 |
|
| 骑行场景(见下文) |
场景
steady— 仅自然微波动freeride(默认)— 基础功率每 60–180 秒漂移 ±20%intervals— 高/低功率交替warmup_main_cooldown— 热身 → 主训练 → 放松ride_script— 脚本化骑行:一系列骑行动作序列(start / cruise / climb / sprint / coast / stop),每个动作都有目标功率、坡度以及可选的踏频;自动启动,通过repeat: true循环,stop将功率/踏频/速度归零。省略phases则使用内置默认脚本。
热更新与稳定序列号
热更新:运行中调用
ble_configure且设备类型相同,参数会原地生效——已连接的手机保持链路,并在下一次通知时收到更新值。更改设备类型仍会重启(新序列号强制重新发现)。稳定序列号:
SIM_SERIAL_STABLE=1使同类型会话的序列号保持稳定(SIM001-FTMS),手机在停止/启动后无需忘记设备即可重新连接。
环境变量
变量 | 默认值 | 描述 |
|
|
|
|
| HTTP 监听地址 |
|
| 广播名称前缀 |
| — | 设备名称的实例 ID 模式 |
| 未设置 |
|
|
| 公开的 Skill URL(由 |
源码结构
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 devicesBLE 外设访问通过宿主机 BlueZ D-Bus 进行(容器挂载宿主机 D-Bus 套接字)。设计记录见 docs/design/*.md。
许可证
MIT © BLE Simulator Contributors
This server cannot be installed
Maintenance
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
- AlicenseNot gradedqualityCmaintenanceBluetooth Low Energy (BLE) MCP server that allows AI agents to scan, connect to and communicated with BLE devices, as well as simulate BLE perhipherals.15BSD 2-Clause "Simplified"
- FlicenseNot gradedqualityNot gradedmaintenanceA 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.
- AlicenseAqualityCmaintenanceA stateful Bluetooth Low Energy (BLE) MCP server that enables AI agents to scan, connect, read/write characteristics, and subscribe to notifications on BLE devices.3517MIT
- FlicenseNot gradedqualityBmaintenanceExposes Garmin Connect data and workout management to AI agents, supporting tools, resources, and prompts for health data, workout creation, and coaching workflows.1
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.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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