关于 Bluetooth MCP Server
Bluetooth MCP Server 是一个 MCP 服务,让 Claude 等 AI 助手扫描周围的 Bluetooth 设备。项目采用测试驱动开发方式构建,支持 BLE 与经典 Bluetooth 设备的检测。
主要功能
- 01BLE 与经典 Bluetooth 设备扫描
- 02按名称、类型等属性过滤设备
- 03识别常见设备并获取制造商与类型信息
- 04支持 Windows、macOS 和 Linux
适用场景
- 01让 Claude 查询附近可用的 Bluetooth 设备
- 02排查设备是否可被发现或适配器是否正常
- 03在 AI 助手中查看设备特征信息
MCP 相关
该项目是一个 MCP 服务,向 MCP 客户端(如 Claude)暴露 Bluetooth 设备扫描与查询功能。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
暂未收录安装方式
我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。
工具
还没有获取到工具列表
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
Bluetooth MCP 服务
🔍 概述
本项目实现了一个 Model Context Protocol(MCP)服务,让 Claude 和其他 AI 助手能够扫描并与附近的 Bluetooth 设备交互。本项目采用测试驱动开发方法构建,为跨多个平台的 Bluetooth 操作提供了稳健且经过测试的接口。
✨ 功能
- 📡 多协议扫描:检测 BLE 和 Classic Bluetooth 设备
- 🔎 灵活筛选:按名称、类型或其他属性筛选设备
- 🔄 自动识别设备:识别并分类常见设备(如 Freebox、电视等)
- 📱 增强的设备信息:获取制造商信息、设备类型和详细特征
- 🖥️ 跨平台支持:适用于 Windows、macOS 和 Linux
- ⚡ 平台专属优化:增强 Windows 上的检测能力
- 🤖 MCP 集成:与 Claude 和兼容的 AI 助手无缝集成
📋 要求
- Python 3.7+
- Bluetooth 适配器(内置或外置)
- 管理员/sudo 权限(部分 Bluetooth 操作需要)
- 互联网连接(用于安装软件包)
🚀 快速开始
安装
# Clone the repository
git clone https://github.com/yourusername/bluetooth-mcp-server.git
cd bluetooth-mcp-server
# Create and activate virtual environment
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Configure environment variables
cp .env.example .env
# Edit the .env file as needed
运行服务
# Start the Bluetooth API server
python run.py
# In another terminal, start the MCP server
python bluetooth_mcp_server.py
与 Claude 配合使用
-
使用 ngrok 将服务公开到互联网,或将其部署到服务器:
ngrok http 8000 -
配置 Claude 使用你的 MCP 服务:
npx @anthropic-ai/sdk install-model-context-protocol <YOUR_SERVER_URL> -
让 Claude 扫描 Bluetooth 设备:
Could you scan for nearby Bluetooth devices?
🧪 测试
本项目遵循测试驱动开发(TDD)方法,并提供全面的测试覆盖:
# Run all tests
pytest
# Run specific test categories
pytest tests/api/ # API tests
pytest tests/models/ # Data model tests
pytest tests/services/ # Service logic tests
pytest tests/utils/ # Utility function tests
🏗️ 架构
本项目采用模块化架构,各部分职责划分清晰:
bluetooth-mcp-server/
├── app/ # Main application package
│ ├── api/ # FastAPI endpoints
│ ├── core/ # Core configuration
│ ├── data/ # Static data (Bluetooth identifiers, etc.)
│ ├── models/ # Data models
│ ├── services/ # Business logic
│ └── utils/ # Utility functions
├── mcp_sdk/ # MCP integration SDK
└── tests/ # Test suites
如需了解详细的架构信息,请参阅 architecture.md。
🔧 故障排除
Bluetooth 问题
- “访问被拒绝”错误:以管理员/sudo 权限运行服务
- 未检测到适配器:确保已在系统设置中启用 Bluetooth
- 未找到设备:确保附近有可被发现的 Bluetooth 设备
- Windows 特定问题:检查 Bluetooth 服务是否正在运行(
services.msc)
MCP 问题
- Claude 未检测到工具:确认 MCP 服务 URL 正确且可访问
- 执行错误:查看服务日志以获取详细错误信息
👥 贡献
欢迎贡献!请按以下步骤操作:
- Fork 此代码库
- 创建功能分支(
git checkout -b feature/amazing-feature) - 为你的功能编写测试
- 实现你的功能
- 确保所有测试通过
- 提交你的更改(
git commit -m 'Add amazing feature') - 将分支推送到远程代码库(
git push origin feature/amazing-feature) - 发起 Pull Request
📄 许可证
本项目采用 MIT 许可证授权,详情请参阅 LICENSE 文件。
🙏 致谢
- FastAPI 提供 API 框架
- Bleak 提供跨平台 Bluetooth 功能
- Anthropic Claude 提供 MCP 集成支持
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。