unifi-mcp-server: Command for Claude Code

.claude/commands/unifi-mcp-add-tool.md

unifi-mcp-add-tool is a command for Claude Code from enuno/unifi-mcp-server. It costs 17 tokens per session (722 once invoked), scanned A, original, Apache-2.0.

A scaffolding command for adding a new UniFi MCP tool, meaning a function that lets an AI assistant use a UniFi API operation. It creates the related data models, implementation, registration, tests, and documentation.

In plain words
What is it for?
Use it to add a read-only or modifying tool for areas such as networks, devices, clients, or firewalls. Provide the tool name, API endpoint, category, description, and operation type.
Why use it?
It removes repetitive setup and helps a new tool follow the server's existing structure. It also includes confirmation or dry-run support when the operation changes data.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

This is enuno/unifi-mcp-server's own configuration. It tells Claude Code how to work on unifi-mcp-server itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything unifi-mcp-server configures →

Reuse

Borrowing it

Nothing to install: this file belongs to enuno/unifi-mcp-server. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/enuno/unifi-mcp-server/main/.claude/commands/unifi-mcp-add-tool.md
Clone the repo
git clone --depth 1 https://github.com/enuno/unifi-mcp-server

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for unifi-mcp-add-tool

README.md
[![agentmods](https://agentmods.dev/badge/commands/enuno/unifi-mcp-server/unifi-mcp-add-tool/github.svg)](https://agentmods.dev/commands/enuno/unifi-mcp-server/unifi-mcp-add-tool)
Your own site
<a href="https://agentmods.dev/commands/enuno/unifi-mcp-server/unifi-mcp-add-tool"><img src="https://agentmods.dev/badge/commands/enuno/unifi-mcp-server/unifi-mcp-add-tool/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for unifi-mcp-add-tool

Your own site · 80×15
<a href="https://agentmods.dev/commands/enuno/unifi-mcp-server/unifi-mcp-add-tool"><img src="https://agentmods.dev/badge/commands/enuno/unifi-mcp-server/unifi-mcp-add-tool.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 722 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00017 $0.00722
Opus 5 $0.00009 $0.00361
Sonnet 5 $0.00003 $0.00144
Haiku 4.5 $0.00002 $0.00072

Measured 12d ago against content hash 83cfcd68bd96, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

unifi-mcp-add-tool scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/unifi-mcp-add-tool.md · 95 lines

What it actually says

Scaffold a complete new MCP tool for the UniFi MCP Server.

This command creates all necessary files and code for a new tool following the project's architecture and standards.

Steps to execute:

  1. Ask the user for tool details:

    • Tool name (e.g., "get_port_profile")
    • Tool category (e.g., "networks", "devices", "clients", "firewall")
    • Brief description of what the tool does
    • UniFi API endpoint it will use
    • Whether it's a read-only or mutating operation
  2. Create or update the Pydantic model in src/models/:

    • If the model file for the category doesn't exist, create it
    • Add request/response models based on UniFi API schema
    • Include proper type hints and field descriptions
    • Add validators if needed
  3. Create the tool function in src/tools/:

    • If the tool file for the category doesn't exist, create it
    • Implement async tool function with proper error handling
    • Add confirmation/dry-run support for mutating operations
    • Include comprehensive docstring with:
      • Description
      • Parameters
      • Returns
      • Raises
      • Example usage
  4. Register the tool in src/main.py:

    • Add import statement
    • Register tool with FastMCP
  5. Create comprehensive unit tests in tests/unit/:

    • Test file following naming convention: test_<category>_tools.py
    • Include tests for:
      • Success case with mocked API response
      • Error handling (authentication, network, API errors)
      • Validation of parameters
      • Confirmation/dry-run mode (if applicable)
    • Aim for 80%+ coverage
  6. Update API.md documentation:

    • Add tool to appropriate category section
    • Include description, parameters, returns, example
  7. Run validation:

    • Format code: black src/ tests/
    • Check tests: pytest tests/unit/test_<category>_tools.py -v
    • Verify registration: python -c "from src.main import mcp; print(mcp.list_tools())"

Report back with:

  • Summary of files created/modified
  • Tool registration confirmation
  • Test results
  • Next steps for integration testing
  • Reminder to update TESTING_PLAN.md if needed

Example workflow:

User: "I want to add a tool to get WLAN groups"
Assistant:
1. Creates src/models/wifi.py with WLANGroupResponse model
2. Creates src/tools/wifi.py with get_wlan_groups() function
3. Updates src/main.py to register the tool
4. Creates tests/unit/test_wifi_tools.py
5. Updates API.md with documentation
6. Runs tests and reports results

Safety checks:

  • Never expose sensitive credentials in code
  • Always use async/await for I/O operations
  • Include proper type hints for all parameters
  • Follow the principle of least privilege
  • Validate all user inputs
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 95 lines · 17 tokens per session scan A 83cfcd68bd96

Subscribe to this mod's changes

unifi-mcp-add-tool is a command published in the GitHub repository enuno/unifi-mcp-server (252 stars, last pushed 5d ago), licensed Apache-2.0. It adds 17 tokens to every session and 722 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.