myco:runtime-bootstrap-and-test-isolation

Guides manager registration, test isolation, and tool discovery maintenance in the UniFi MCP monorepo.

777|101|Updated Apr 21, 2025
One-click install
npx skills add https://github.com/sirkirby/unifi-network-mcp --skill myco-runtime-bootstrap-and-test-isolation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: myco:runtime-bootstrap-and-test-isolation
Source: https://github.com/sirkirby/unifi-network-mcp/tree/main/.agents/skills/runtime-bootstrap-and-test-isolation
Command: npx skills add https://github.com/sirkirby/unifi-network-mcp --skill myco-runtime-bootstrap-and-test-isolation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers extending the UniFi MCP servers often make changes in the wrong architectural layer, causing silent failures such as invisible tools, missing singletons, or broken test imports. This Skill maps the four-stage bootstrap architecture so changes land in the correct layer the first time.

Core Features & Use Cases

  • Layer Routing: Identifies whether a change belongs in main.py, runtime.py, tools/, or managers/ before any code is written.
  • Singleton Manager Pattern: Documents the @lru_cache factory convention for adding shared managers and avoiding cross-test state leaks.
  • Test Isolation: Explains the three-stage decorator replacement that lets tool unit tests run without a live UniFi controller.
  • Tool Discovery Maintenance: Covers tools_manifest.json regeneration, the two-tier tool_index schema system, and Worker cloud parity requirements.
  • Use Case: When adding a new tool category, follow the procedures to create the module, run make manifest, and verify visibility in tool_index output.

Quick Start

Ask the agent to walk you through adding a new manager and tool category to the UniFi MCP server using the runtime bootstrap procedures.

Frequently Asked Questions about myco:runtime-bootstrap-and-test-isolation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new tool category to a FastMCP server?

Create the category module under tools/, then run make manifest from the repo root to regenerate tools_manifest.json. Without the manifest update, the category is silently invisible to tool_index with no error or CI failure.

How do I write unit tests for MCP tools without a live controller?

Import tool functions from the fully bootstrapped module path; the stage-2 decorator has already stripped permission kwargs, so no live controller or mock permission system is needed. Never pass permission_category or permission_action at test call sites.

Why is my new tool not showing up in tool_index?

The category is likely missing from tools_manifest.json. Run make manifest, confirm the tool is exported from its module, and restart the server since lazy loading caches modules on first import.

Why does my FastMCP tool handler always receive None for its args dict?

FastMCP maps call arguments to Python parameters by name, so a handler taking args: dict never receives caller input. Register a named-param wrapper that assembles the dict and forwards it to the backend handler.

How do I prevent @lru_cache singletons from leaking state between tests?

Call get_domain_manager.cache_clear() in test teardown for any factory whose manager holds mutable state or connection objects. The cache persists across the entire pytest session otherwise.