Skip to main content
Glama

unifi-mcp

A Model Context Protocol server for the UniFi Local Network Integration API. Query your UniFi network from Claude Desktop, Claude Code, Cursor, or any MCP client.

Status

Phase 1 — read-only, four generic tools, spec-driven interface generated at runtime from the UniFi OpenAPI spec.

Related MCP server: UniFi MCP Server

How it works

The server fetches the OpenAPI spec from your gateway at startup (or uses a bundled fallback) and derives all tool behaviour from it — there is no per-resource code. Adding a new UniFi entity or operation requires no code change; it becomes available as soon as the updated spec is fetched.

The four tools follow a discover-then-query pattern:

Tool

Purpose

unifi_list_entities

List available entities (derived from OpenAPI tags)

unifi_describe_entity

Operations, parameters, and fields for one entity

unifi_get

Invoke a read (GET) operation on an entity

unifi_invoke

Invoke a write operation — disabled until write support ships

The agent calls unifi_list_entities to discover what is available, then unifi_describe_entity on an entity to learn its operations and field names, then unifi_get to retrieve data.

Read-only by default

unifi_invoke is defined and registered but gated: it returns an error unless UNIFI_ALLOW_WRITES=true is set. The default is read-only. Write support will ship in a later phase.

Spec resolution

The server resolves the OpenAPI spec in order:

  1. Fresh local cache (age < UNIFI_SPEC_FRESHNESS_MS, default 24 h)

  2. Live fetch from the gateway (UNIFI_BASE_URL/proxy/network/integration/v1)

  3. Stale local cache (if the live fetch fails)

  4. Bundled spec (shipped with the package as a last-resort fallback)

Run pnpm update-spec to update the bundled spec from a live gateway.

Configuration

Copy .env.example to .env and fill in the required values.

Variable

Required

Default

Description

UNIFI_BASE_URL

yes

Gateway address, e.g. https://192.168.1.1

UNIFI_API_KEY

yes

Integration API key (see below)

UNIFI_CA_CERT

no

Path to the controller's CA certificate (PEM)

UNIFI_INSECURE_TLS

no

false

Disable TLS verification — last resort only

UNIFI_ALLOW_WRITES

no

false

Enable write operations via unifi_invoke

UNIFI_TIMEOUT_MS

no

30000

Per-request timeout in milliseconds

UNIFI_SPEC_URL

no

Override the OpenAPI spec URL fetched from the gateway

UNIFI_SPEC_FILE

no

Use a local spec file as the bundled fallback

UNIFI_CACHE_DIR

no

~/.cache/unifi-mcp

Where the cached spec is written

UNIFI_SPEC_FRESHNESS_MS

no

86400000

Max age of the cached spec in milliseconds

UNIFI_LOG_LEVEL

no

error

Pino log level (error, warn, info, debug)

Getting an API key

In the UniFi Network application: Settings → Integrations → Add Integration. Copy the generated key into UNIFI_API_KEY.

TLS

UniFi gateways use self-signed certificates. The recommended approach is to pin the controller's CA certificate:

UNIFI_CA_CERT=/path/to/controller-ca.pem

Export the certificate from the UniFi console or your browser and provide the path above. This keeps TLS verification enabled.

UNIFI_INSECURE_TLS=true disables certificate verification entirely. Use it only as a last resort — it exposes connections to man-in-the-middle attacks. The server prints a warning to stderr on startup when it is set.

Running

pnpm install
pnpm build
node dist/cli.js      # or: unifi-mcp (after npm install -g @robinbowes/unifi-mcp)

Note: The package is published as @robinbowes/unifi-mcp (scoped), but the CLI command is unifi-mcp — unchanged.

For use with an MCP client, point the client at the binary with stdio transport.

Development

pnpm install
pnpm dev              # run from source with stdio transport
pnpm test             # unit + component tests
pnpm verify           # format + lint + typecheck + test
pnpm update-spec      # refresh the bundled spec from a live gateway
pnpm smoke            # build, then exercise the tools against a live controller (.env)

Smoke test

pnpm smoke builds the server and drives it as a real MCP client over stdio against the controller configured in your .env. It fetches the live spec, lists and describes entities, runs a couple of read queries, and confirms the read-only gate refuses a write. It is read-only: nothing on the network is changed, and the API key is never printed.

Licence

MIT.

Available Tools

4 tools
unifi_describe_entityB

Describe one entity: its operations, path/query parameters, and whether each is read (GET) or write.

ParametersJSON Schema
NameRequiredDescriptionDefault
entityYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must fully disclose behavior. It mentions the output includes read/write classification, but omits specifics like side effects (likely none), auth requirements, error handling, or data boundaries.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single concise sentence with no redundancy. All content is relevant and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, no annotations, and simple input, the description fails to cover expected output format, valid entity values, or usage prerequisites. Agents may need to infer or experiment.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% and the description does not clarify the 'entity' parameter (e.g., if it's a name, ID, or endpoint path). No validation or enumeration is provided, leaving agents guessing.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: describing an entity's operations, parameters, and HTTP method. This distinguishes it from siblings like unifi_list_entities (list all) and unifi_get (general get) by focusing on structural description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use when needing to understand an entity's API structure, but lacks explicit guidance on when not to use it or alternatives. Siblings are provided but not contrasted.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

unifi_getC

Invoke a read (GET) operation for an entity. Provide pathParams/query as needed.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryNo
entityYes
pathParamsNo
operationIdYes

TDQS

C2.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It discloses that the operation is a read (GET), implying non-destructive behavior, but omits details about authentication, error handling, rate limits, or side effects. The minimal description fails to adequately inform the agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise (one sentence), but it lacks structure and front-loads only a generic purpose. Every word is used, but the sentence does not deliver comprehensive information. It is adequate in length but not well-organized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the absence of output schema and annotations, the description is far from complete. It does not describe return values, error states, or parameter constraints. The tool has moderate complexity (4 parameters, including nested objects), but the description provides insufficient context for correct usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, meaning the description adds no meaning beyond the schema. While it mentions 'pathParams/query as needed', it does not explain the required parameters 'entity' and 'operationId', nor provide context for their values. This leaves the agent without sufficient understanding of parameter usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states it invokes a read (GET) operation for an entity, providing a general purpose. However, it does not clearly differentiate from sibling tools like unifi_list_entities or unifi_describe_entity, which might also involve reading. The phrase 'read (GET) operation' is moderately clear but lacks specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives. The description does not mention scenarios, prerequisites, or exclusions. Sibling tools exist but no comparison is provided, leaving the agent to guess the appropriate context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

unifi_invokeA

Invoke any operation by id (including writes). Gated off unless UNIFI_ALLOW_WRITES=true. Post-v1 write path.

ParametersJSON Schema
NameRequiredDescriptionDefault
bodyNo
queryNo
entityYes
pathParamsNo
operationIdYes

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Discloses that the tool can perform writes and is gated by an environment variable, which is useful. However, without annotations, it omits details on side effects, auth requirements beyond the env variable, rate limits, or idempotency, leaving significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences, each adding distinct value: the core functionality and an important constraint. No redundancy or unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 5 parameters, no output schema, and no annotations, the description is too sparse to fully guide the agent. It lacks details on valid entities/operations, request formatting, and what the tool returns, making it incomplete for reliable invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description implies that operationId is the operation identifier from 'by id', but provides no explanation for entity, body, query, or pathParams. With 0% schema description coverage, the description fails to add meaning beyond the schema, making parameter usage unclear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Invoke any operation by id (including writes)' which specifies the action (invoke) and the resource (operation by id). It distinguishes from siblings which are for listing, describing, and getting entities, not invoking operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides context: 'Gated off unless UNIFI_ALLOW_WRITES=true' and 'Post-v1 write path', but lacks explicit guidance on when to use vs siblings (e.g., for creating/updating/deleting) and no when-not-to-use or alternative recommendations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

unifi_list_entitiesA

List UniFi entities (OpenAPI tags) exposed by this controller, with read/write op counts. Call first.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the behavioral burden. It discloses the operation (list) and the data (entities with op counts) but omits details like auth requirements, caching, or pagination. While the behavior is simple, additional transparency would be beneficial.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence of 120 characters, highly concise and front-loaded with the core action. Every word adds value, and there is no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple list tool with no output schema, the description adequately covers purpose and usage hint ('Call first'). It is missing explicit statements about output format, but the simplicity makes it reasonably complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are no parameters, and the schema coverage is trivially 100%. The description correctly adds no parameter information, which is appropriate. Baseline for 0 parameters is 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'List' and the resource 'UniFi entities (OpenAPI tags)', and specifies it includes read/write op counts. It effectively distinguishes itself from sibling tools by implying it is a discovery tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'Call first' provides explicit usage guidance, indicating this tool should be invoked before others. However, it does not explicitly state when not to use or contrast with siblings, leaving some room for ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updatesv0.2.0
    • First observedunifi_describe_entity
    • First observedunifi_get
    • First observedunifi_invoke
    • First observedunifi_list_entities

TDQS

A3.5/5.0
Disambiguation4/5

Each tool has a distinct purpose: list entities, describe one entity, perform read-only GET, and invoke any operation (including writes). There is slight overlap between unifi_get and unifi_invoke for reads, but descriptions clarify safety, making ambiguity low.

Naming Consistency5/5

All tools follow the pattern unifi_<verb>, with verbs list, describe, get, invoke. The naming is predictable and consistent, with no mixing of styles.

Tool Count5/5

Four tools is appropriate for a dynamic API wrapper: discovery (list, describe) and execution (get, invoke). The number is well-scoped and each tool earns its place.

Completeness5/5

The tool set covers full lifecycle of API interaction: list available endpoints, describe details, perform safe reads, and invoke any operation (including writes if enabled). No obvious gaps for its purpose.

Maintenance

ActivityActive
ResponsivenessUnresponsive

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    D
    quality
    D
    maintenance
    Enables comprehensive management of UniFi network infrastructure through the UniFi Cloud API, including device control, client management, camera settings, and access door control through natural language.
    39
    47
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables managing UniFi networks through natural language, allowing users to monitor clients, check network health, and perform device actions like blocking or restarting access points. It securely connects UniFi Controllers to MCP clients with features like Google OAuth authentication.
    47
    Apache 2.0
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server providing Claude Code with full UniFi network management capabilities -- devices, clients, ports, bandwidth auditing, firewall policies, and traffic rules -- all through natural language.
    47
    1
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    MCP server that turns Claude into a UniFi network specialist. Manage devices, optimize WiFi, audit security, and troubleshoot your network through natural language.
    31
    20
    2
    MIT

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/yo61/unifi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server