ble-mcp-transport 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +65 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 solnera
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# BLE MCP Transport
|
|
2
|
+
|
|
3
|
+
A Node.js BLE transport that enables MCP clients to communicate with MCP devices over BLE GATT. It relies on @abandonware/noble for scanning, connecting, and characteristic I/O, and includes JSON-RPC message framing for MTU-constrained links.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Scan and connect to peripherals by service UUID
|
|
8
|
+
- Bidirectional messaging via RX/TX characteristics
|
|
9
|
+
- Message packetization and reassembly for large payloads
|
|
10
|
+
- Compatible with the @modelcontextprotocol/sdk Transport interface
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
16
|
+
import { BleTransport } from "ble-mcp-transport";
|
|
17
|
+
|
|
18
|
+
const transport = new BleTransport({
|
|
19
|
+
scanTimeout: 10000,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const client = new Client(
|
|
23
|
+
{ name: "ble-mcp-client", version: "1.0.0" },
|
|
24
|
+
{ capabilities: {} }
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
await client.connect(transport);
|
|
28
|
+
const tools = await client.listTools();
|
|
29
|
+
console.log(tools);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Transport Options
|
|
33
|
+
|
|
34
|
+
`BleTransport` supports these optional settings:
|
|
35
|
+
|
|
36
|
+
- `serviceUuid`: Service UUID (defaults to the built-in value)
|
|
37
|
+
- `rxCharUuid`: RX characteristic UUID (defaults to the built-in value)
|
|
38
|
+
- `txCharUuid`: TX characteristic UUID (defaults to the built-in value)
|
|
39
|
+
- `namePrefix`: Peripheral name prefix filter
|
|
40
|
+
- `scanTimeout`: Scan timeout in milliseconds (default 10000)
|
|
41
|
+
|
|
42
|
+
Built-in UUIDs:
|
|
43
|
+
|
|
44
|
+
- Service: `00001999-0000-1000-8000-00805f9b34fb`
|
|
45
|
+
- RX: `4963505f-5258-4000-8000-00805f9b34fb`
|
|
46
|
+
- TX: `4963505f-5458-4000-8000-00805f9b34fb`
|
|
47
|
+
|
|
48
|
+
## Protocol and Framing
|
|
49
|
+
|
|
50
|
+
- Uses BLE GATT for communication
|
|
51
|
+
- RX characteristic: client writes messages
|
|
52
|
+
- TX characteristic: server notifies messages
|
|
53
|
+
- Start packet includes total length; subsequent packets increment sequence
|
|
54
|
+
- JSON-RPC messages are emitted after full reassembly
|
|
55
|
+
|
|
56
|
+
## Development
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm run build
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Requirements
|
|
63
|
+
|
|
64
|
+
- Node.js runtime
|
|
65
|
+
- A BLE adapter and appropriate OS permissions
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ble-mcp-transport",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Bluetooth Low Energy transport for MCP using Web Bluetooth API",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "npm run build",
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"watch": "tsc --watch",
|
|
21
|
+
"clean": "rm -rf dist"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"mcp",
|
|
25
|
+
"bluetooth",
|
|
26
|
+
"ble",
|
|
27
|
+
"web-bluetooth",
|
|
28
|
+
"transport"
|
|
29
|
+
],
|
|
30
|
+
"author": "",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@abandonware/noble": "^1.9.2-21"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^22.0.0",
|
|
37
|
+
"typescript": "^5.6.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
41
|
+
}
|
|
42
|
+
}
|