@owine/unifi-network-mcp 2.8.3 → 2.9.0
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/README.md +23 -12
- package/dist/index.js +5 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ An MCP (Model Context Protocol) server that exposes the UniFi Network Integratio
|
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
7
|
-
- Node.js
|
|
7
|
+
- Node.js 22.13+ or 24 (see `engines` in `package.json`)
|
|
8
8
|
- A UniFi Network console with the Integration API enabled
|
|
9
9
|
- An API key generated from your UniFi Network console
|
|
10
10
|
|
|
@@ -22,13 +22,14 @@ Use `-s user` for global availability across all projects, or `-s project` for t
|
|
|
22
22
|
|
|
23
23
|
### From source
|
|
24
24
|
|
|
25
|
-
If you prefer to build locally:
|
|
25
|
+
If you prefer to build locally, this project uses pnpm via Corepack — use `pnpm install`, not `npm install`, which ignores `pnpm-lock.yaml` and resolves different dependency versions:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
28
|
git clone https://github.com/owine/unifi-network-mcp.git
|
|
29
29
|
cd unifi-network-mcp
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
corepack enable
|
|
31
|
+
pnpm install
|
|
32
|
+
pnpm run build
|
|
32
33
|
```
|
|
33
34
|
|
|
34
35
|
Then add to Claude Code:
|
|
@@ -73,15 +74,21 @@ This server provides layered safety controls for responsible operation:
|
|
|
73
74
|
- **Tool annotations** — Every tool declares `readOnlyHint`, `destructiveHint`, and `idempotentHint` so MCP clients (like Claude Code) can make informed confirmation decisions
|
|
74
75
|
- **Read-only mode** — Enabled by default. Only read operations (list, get) are registered. Set `UNIFI_NETWORK_READ_ONLY=false` to enable write/mutating tools
|
|
75
76
|
- **Destructive tool warnings** — Tools that delete or irreversibly modify resources have descriptions prefixed with `DESTRUCTIVE:` to clearly signal risk
|
|
76
|
-
- **Confirmation parameter** —
|
|
77
|
-
- **Dry-run support** — All write tools accept an optional `dryRun: true` parameter that returns a preview of the HTTP request (method, path, body) without making any changes
|
|
77
|
+
- **Confirmation parameter** — Every tool marked `DESTRUCTIVE:` (all 10 of them, including `unifi_remove_device` and `unifi_bulk_delete_vouchers`) requires an explicit `confirm: true` parameter for the call to succeed
|
|
78
|
+
- **Dry-run support** — All 33 write tools accept an optional `dryRun: true` parameter that returns a preview of the HTTP request (method, path, body) without making any changes
|
|
79
|
+
|
|
80
|
+
## Structured Output
|
|
81
|
+
|
|
82
|
+
58 of the 74 tools (all 41 read tools, plus the 17 write tools whose API responses return the affected resource) declare an MCP `outputSchema` and return `structuredContent` alongside the usual text content. Clients that understand structured output get typed, machine-readable results instead of parsing JSON out of a text blob.
|
|
83
|
+
|
|
84
|
+
The schemas live in `src/utils/output-schemas.ts` and are verified against UniFi Network API 10.5.43. They deliberately use a **loose strategy**: every non-key field is optional and nested objects use `.passthrough()`, so firmware- and hardware-specific fields flow through unchanged rather than being stripped or triggering a validation error. This keeps the contract stable across console versions and hardware models.
|
|
78
85
|
|
|
79
86
|
## Tools (74 total)
|
|
80
87
|
|
|
81
88
|
### System (1)
|
|
82
89
|
| Tool | Description |
|
|
83
90
|
|---|---|
|
|
84
|
-
| `unifi_get_info` | Get
|
|
91
|
+
| `unifi_get_info` | Get UniFi Network application info — returns `applicationVersion` only |
|
|
85
92
|
|
|
86
93
|
### Sites (1)
|
|
87
94
|
| Tool | Description |
|
|
@@ -207,11 +214,15 @@ This server provides layered safety controls for responsible operation:
|
|
|
207
214
|
## Development
|
|
208
215
|
|
|
209
216
|
```bash
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
217
|
+
pnpm install # Install dependencies
|
|
218
|
+
pnpm run build # Compile TypeScript
|
|
219
|
+
pnpm start # Run the server
|
|
220
|
+
pnpm run typecheck # Type-check without emitting
|
|
221
|
+
pnpm run lint # ESLint
|
|
222
|
+
pnpm run lint:fix # ESLint with auto-fix
|
|
223
|
+
pnpm test # Run all tests (vitest)
|
|
224
|
+
pnpm run test:watch # Run tests in watch mode
|
|
225
|
+
pnpm run test:coverage # Run tests with coverage
|
|
215
226
|
```
|
|
216
227
|
|
|
217
228
|
### Commit conventions
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const node_module_1 = require("node:module");
|
|
4
5
|
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
5
6
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
6
7
|
const config_js_1 = require("./config.js");
|
|
7
8
|
const client_js_1 = require("./client.js");
|
|
8
9
|
const index_js_1 = require("./tools/index.js");
|
|
10
|
+
// Read at runtime rather than importing: package.json sits outside rootDir,
|
|
11
|
+
// so a static import would emit dist/src/ and break the published layout.
|
|
12
|
+
const { version } = (0, node_module_1.createRequire)(__filename)("../package.json");
|
|
9
13
|
async function main() {
|
|
10
14
|
const config = (0, config_js_1.loadConfig)();
|
|
11
15
|
const client = new client_js_1.NetworkClient(config);
|
|
12
16
|
const server = new mcp_js_1.McpServer({
|
|
13
17
|
name: "unifi-network",
|
|
14
|
-
version
|
|
18
|
+
version,
|
|
15
19
|
});
|
|
16
20
|
(0, index_js_1.registerAllTools)(server, client, config.readOnly);
|
|
17
21
|
if (config.readOnly) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owine/unifi-network-mcp",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "MCP server for the UniFi Network API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": "^22.13.0 || ^24.0.0"
|
|
24
24
|
},
|
|
25
|
-
"packageManager": "pnpm@11.
|
|
25
|
+
"packageManager": "pnpm@11.15.1",
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
28
|
"url": "https://github.com/owine/unifi-network-mcp.git"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"eslint": "10.7.0",
|
|
48
48
|
"lefthook": "2.1.10",
|
|
49
49
|
"typescript": "6.0.3",
|
|
50
|
-
"typescript-eslint": "8.
|
|
50
|
+
"typescript-eslint": "8.64.0",
|
|
51
51
|
"vitest": "4.1.10"
|
|
52
52
|
}
|
|
53
53
|
}
|