Commit graph

24 commits

Author SHA1 Message Date
Jacob Magar
454f346036 chore: sync working tree updates 2026-04-15 19:13:31 -04:00
Jacob Magar
bfdd117b9f chore: fix gitignore dedup, ensure data/ is ignored 2026-04-05 12:35:44 -04:00
Jacob Magar
d9b17cdbf9 chore: gitignore logs/, backups/, data/ runtime artifacts 2026-04-05 12:31:36 -04:00
Jacob Magar
78644cc674 fix(ci): remove backups/ and logs/ directory tracking; keep simple gitignore entries 2026-04-05 08:59:15 -04:00
Jacob Magar
4b8eebd11c fix(ci): remove conflicting bare logs/ and backups/ gitignore patterns 2026-04-05 08:48:12 -04:00
Jacob Magar
60427d6400 fix(ci): correct .gitignore/.dockerignore entries 2026-04-05 08:46:46 -04:00
Jacob Magar
4a1a2b0519 chore: align .gitignore, remove logs/backups dirs, untrack ignored files
Standardize .gitignore across all repos with canonical sections.
Remove logs/ and backups/ directories (runtime artifacts, not tracked).
Untrack files now covered by .gitignore (.beads/, .lavra/, .omc/, etc).
2026-04-02 22:29:13 -04:00
Jacob Magar
80d1fc02c6 chore(gitignore): add .lavra/ pattern, trim .env.example to spec vars, fix .dockerignore
- .gitignore: replace .lavra/memory/session-state.md with .lavra/ (full dir), add *.db-shm and *.db-wal
- .env.example: replace non-spec vars with canonical set (UNRAID_URL, UNRAID_API_KEY, UNRAID_MCP_TOKEN, UNRAID_MCP_PORT, UNRAID_MCP_TRANSPORT, NO_AUTH, ALLOW_DESTRUCTIVE, ALLOW_YOLO)
- .dockerignore: add .codex-plugin entry required by ensure-ignore-files check

Closes claude-homelab-8b8
2026-03-31 17:25:49 -04:00
Jacob Magar
c393092b4f fix(docker): healthcheck 401 loop, credential persistence, startup log clarity
- Add HealthMiddleware (outside BearerAuth) so GET /health bypasses auth;
  Docker healthcheck no longer 401s and triggers restart loop
- Pre-create /home/mcp/.unraid-mcp in Dockerfile with mcp:mcp ownership
  so named volume mounts inherit correct permissions; bearer token now
  persists across container restarts
- Remove custom SIGTERM/SIGINT handlers that silently swallowed signals;
  Uvicorn manages its own shutdown
- Distinguish stdio vs HTTP startup log (was always showing host:port for stdio)
- Move _chmod_safe to module level; convert f-strings to %-format in logger calls
- Expand .dockerignore to exclude test/doc/tooling files from image
2026-03-30 23:52:04 -04:00
Jacob Magar
edece9e205 fix(unraid-mcp-78s,92j,37t,696,6cr,4yz): P1/P2/P3 sweep — fix HealthMiddleware + signal handlers
- P1 (78s): _HEADERS is now an immutable tuple; content-length derived from
  len(_BODY) rather than a hardcoded magic number
- P1 (92j): Remove no-op SIGTERM/SIGINT handlers that swallowed signals without
  stopping the server; delegate shutdown to Uvicorn's built-in handlers
- P2 (37t): HealthMiddleware now only responds 200 to GET /health; all other
  methods fall through to the auth layer (returns 401)
- P2 (696): Extract _chmod_safe() helper; remove redundant second chmod block
  in ensure_token_exists()
- P3 (6cr): Reorder middleware — HealthMiddleware is now outermost so it
  intercepts /health before BearerAuth; removes the need for a bypass condition
  in BearerAuthMiddleware.__call__
- P3 (4yz): Add Scope/Receive/Send type hints to HealthMiddleware.__call__
2026-03-30 23:39:52 -04:00
Jacob Magar
b60bbc0a17 chore: add .worktrees to .gitignore 2026-03-27 21:57:10 -04:00
Jacob Magar
207b68cd8c chore: initialize beads + lavra project config (v1.1.5)
- bd init: Dolt-backed issue tracker, prefix unraid-mcp-<hash>
- .lavra/config/project-setup.md: python stack, 4 review agents
- .lavra/config/codebase-profile.md: stack/arch/conventions profile
- .gitignore: add lavra session-state and beads entries
- CLAUDE.md: beads workflow integration block

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-27 21:30:12 -04:00
Jacob Magar
1c8a81786c bd init: initialize beads issue tracking 2026-03-27 20:49:51 -04:00
Jacob Magar
c37d4b1c5a fix(subscriptions): use x-api-key connectionParams format for WebSocket auth
The Unraid graphql-ws server expects the API key directly in connectionParams
as `x-api-key`, not nested under `headers`. The old format caused the server
to fall through to cookie auth and crash on `undefined.csrf_token`.

Fixed in snapshot.py (×2), manager.py, diagnostics.py, and updated the
integration test assertion to match the correct payload shape.
2026-03-15 22:56:58 -04:00
Jacob Magar
7ef21b8051 chore: gitignore .claude/worktrees to prevent agent dirs being staged 2026-03-13 11:23:39 -04:00
Jacob Magar
3ae85e1df7 fix: resolve 21 pre-existing schema field drift failures
- info.py: fix InfoVersions queries (core/packages nesting), Connect fields,
  CpuUtilization.percentTotal, Service fields, Server fields, Flash, UPS
- health.py: align versions.core.unraid path in health check query/handler
- docker.py: logs subfield selection, networks nesting, port_conflicts fields,
  check_updates fields, network_details client-side filtering
- storage.py: replace non-existent unassignedDevices with disks query
- keys.py: add permissions subfields, remove lastUsed (not on ApiKey)
- test_query_validation.py: update docker mutations coverage to include 11
  organizer mutations; fix comprehensive check query shape
- test_docker.py: update networks mock to match new docker.networks nesting
2026-03-13 11:23:24 -04:00
Jacob Magar
06f18f32fc chore: update gitignore, bump to 0.2.1, apply CodeRabbit fixes
- Add .windsurf/, *.bak*, .1code/, .emdash.json to .gitignore
- Sync standard gitignore entries per project conventions
- Apply final test/tool fixes from CodeRabbit review threads
- Update GraphQL schema to latest introspection snapshot
- Bump version 0.2.0 → 0.2.1

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-13 00:53:51 -04:00
Jacob Magar
abb7915672 feat: harden API safety and expand command docs with full test coverage 2026-02-15 22:15:51 -05:00
Jacob Magar
37e9424a5c fix: address 54 MEDIUM/LOW priority PR review issues
Comprehensive fixes across Python code, shell scripts, and documentation
addressing all remaining MEDIUM and LOW priority review comments.

Python Code Fixes (27 fixes):
- tools/info.py: Simplified dispatch with lookup tables, defensive guards,
  CPU fallback formatting, !s conversion flags, module-level sync assertion
- tools/docker.py: Case-insensitive container ID regex, keyword-only confirm,
  module-level ALL_ACTIONS constant
- tools/virtualization.py: Normalized single-VM dict responses, unified
  list/details queries
- core/client.py: Fixed HTTP client singleton race condition, compound key
  substring matching for sensitive data redaction
- subscriptions/: Extracted SSL context creation to shared helper in utils.py,
  replaced deprecated ssl._create_unverified_context API
- tools/array.py: Renamed parity_history to parity_status, hoisted ALL_ACTIONS
- tools/storage.py: Fixed dict(None) risks, temperature 0 falsiness bug
- tools/notifications.py, keys.py, rclone.py: Fixed dict(None) TypeError risks
- tests/: Fixed generator type annotations, added coverage for compound keys

Shell Script Fixes (13 fixes):
- dashboard.sh: Dynamic server discovery, conditional debug output, null-safe
  jq, notification count guard order, removed unused variables
- unraid-query.sh: Proper JSON escaping via jq, --ignore-errors and --insecure
  CLI flags, TLS verification now on by default
- validate-marketplace.sh: Removed unused YELLOW variable, defensive jq,
  simplified repository URL output

Documentation Fixes (24+ fixes):
- Version consistency: Updated all references to v0.2.0 across pyproject.toml,
  plugin.json, marketplace.json, MARKETPLACE.md, __init__.py, README files
- Tool count updates: Changed all "26 tools" references to "10 tools, 90 actions"
- Markdown lint: Fixed MD022, MD031, MD047 issues across multiple files
- Research docs: Fixed auth headers, removed web artifacts, corrected stale info
- Skills docs: Fixed query examples, endpoint counts, env var references

All 227 tests pass, ruff and ty checks clean.
2026-02-15 17:09:31 -05:00
Jacob Magar
184b8aca1c fix: address 18 CRITICAL+HIGH PR review comments
**Critical Fixes (7 issues):**
- Fix GraphQL schema field names in users tool (role→roles, remove email)
- Fix GraphQL mutation signatures (addUserInput, deleteUser input)
- Fix dict(None) TypeError guards in users tool (use `or {}` pattern)
- Fix FastAPI version constraint (0.116.1→0.115.0)
- Fix WebSocket SSL context handling (support CA bundles, bool, and None)
- Fix critical disk threshold treated as warning (split counters)

**High Priority Fixes (11 issues):**
- Fix Docker update/remove action response field mapping
- Fix path traversal vulnerability in log validation (normalize paths)
- Fix deleteApiKeys validation (check response before success)
- Fix rclone create_remote validation (check response)
- Fix keys input_data type annotation (dict[str, Any])
- Fix VM domain/domains fallback restoration

**Changes by file:**
- unraid_mcp/tools/docker.py: Response field mapping
- unraid_mcp/tools/info.py: Split critical/warning counters
- unraid_mcp/tools/storage.py: Path normalization for traversal protection
- unraid_mcp/tools/users.py: GraphQL schema + null handling
- unraid_mcp/tools/keys.py: Validation + type annotations
- unraid_mcp/tools/rclone.py: Response validation
- unraid_mcp/tools/virtualization.py: Domain fallback
- unraid_mcp/subscriptions/manager.py: SSL context creation
- pyproject.toml: FastAPI version fix
- tests/*: New tests for all fixes

**Review threads resolved:**
PRRT_kwDOO6Hdxs5uu70L, PRRT_kwDOO6Hdxs5uu70O, PRRT_kwDOO6Hdxs5uu70V,
PRRT_kwDOO6Hdxs5uu70e, PRRT_kwDOO6Hdxs5uu70i, PRRT_kwDOO6Hdxs5uu7zn,
PRRT_kwDOO6Hdxs5uu7z_, PRRT_kwDOO6Hdxs5uu7sI, PRRT_kwDOO6Hdxs5uu7sJ,
PRRT_kwDOO6Hdxs5uu7sK, PRRT_kwDOO6Hdxs5uu7Tk, PRRT_kwDOO6Hdxs5uu7Tn,
PRRT_kwDOO6Hdxs5uu7Tr, PRRT_kwDOO6Hdxs5uu7Ts, PRRT_kwDOO6Hdxs5uu7Tu,
PRRT_kwDOO6Hdxs5uu7Tv, PRRT_kwDOO6Hdxs5uu7Tw, PRRT_kwDOO6Hdxs5uu7Tx

All tests passing.

Co-authored-by: docker-fixer <agent@pr-fixes>
Co-authored-by: info-fixer <agent@pr-fixes>
Co-authored-by: storage-fixer <agent@pr-fixes>
Co-authored-by: users-fixer <agent@pr-fixes>
Co-authored-by: config-fixer <agent@pr-fixes>
Co-authored-by: websocket-fixer <agent@pr-fixes>
Co-authored-by: keys-rclone-fixer <agent@pr-fixes>
Co-authored-by: vm-fixer <agent@pr-fixes>
2026-02-15 16:42:58 -05:00
Jacob Magar
2697c269a3 chore: enhance project metadata, tooling, and documentation
**Project Configuration:**
- Enhance pyproject.toml with comprehensive metadata, keywords, and classifiers
- Add LICENSE file (MIT) for proper open-source distribution
- Add PUBLISHING.md with comprehensive publishing guidelines
- Update .gitignore to exclude tool artifacts (.cache, .pytest_cache, .ruff_cache, .ty_cache)
- Ignore documentation working directories (.docs, .full-review, docs/plans, docs/sessions)

**Documentation:**
- Add extensive Unraid API research documentation
  - API source code analysis and resolver mapping
  - Competitive analysis and feature gap assessment
  - Release notes analysis (7.0.0, 7.1.0, 7.2.0)
  - Connect platform overview and remote access documentation
- Document known API patterns, limitations, and edge cases

**Testing & Code Quality:**
- Expand test coverage across all tool modules
- Add destructive action confirmation tests
- Improve test assertions and error case validation
- Refine type annotations for better static analysis

**Tool Improvements:**
- Enhance error handling consistency across all tools
- Improve type safety with explicit type annotations
- Refine GraphQL query construction patterns
- Better handling of optional parameters and edge cases

This commit prepares the project for v0.2.0 release with improved
metadata, comprehensive documentation, and enhanced code quality.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-15 15:32:09 -05:00
Jacob Magar
67b775a9bc chore: update .gitignore 2025-09-28 22:09:26 -04:00
Jacob Magar
b00d78f408 Remove unused MCP resources and update documentation
- Remove array_status, system_info, notifications_overview, and parity_status resources
- Keep only logs_stream resource (unraid://logs/stream) which is working properly
- Update README.md with current resource documentation and modern docker compose syntax
- Fix import path issues that were causing subscription errors
- Update environment configuration examples
- Clean up subscription manager to only include working log streaming

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 14:19:27 -04:00
Jacob Magar
00e07fad38 Update docker-compose.yml 2025-06-11 16:35:24 -04:00