Skip to content

fix: resolve GraphQL schema mismatches for Unraid 7.2.x API#12

Open
udhaya10 wants to merge 3 commits intojmagar:mainfrom
udhaya10:main
Open

fix: resolve GraphQL schema mismatches for Unraid 7.2.x API#12
udhaya10 wants to merge 3 commits intojmagar:mainfrom
udhaya10:main

Conversation

@udhaya10
Copy link
Copy Markdown

@udhaya10 udhaya10 commented Feb 20, 2026

Summary

Fixes all GraphQL schema mismatches introduced in Unraid 7.2.x that caused multiple MCP tools to fail with field validation errors. Verified and tested against a live Unraid 7.2.3 installation.

Closes #9


Changes

unraid_mcp/tools/info.py

Query Before (broken) After (fixed)
GetSystemInfo (overview) os { ... codepage ... } removed codepage (field removed in 7.2 API)
GetSystemInfo (overview) versions { kernel openssl ... unraid } versions { id core { unraid api kernel } packages { openssl node npm pm2 git nginx php docker } }
GetSystemInfo (overview) apps { installed started } removed (field removed in 7.2 API)
GetNetworkConfig (network) network { id accessUrls { ... } } vars { id useSsl port portssl localTld }
GetConnectSettings (connect) connect { status sandbox flashGuid } vars { id flashGuid flashProduct flashVendor }
GetMetrics (metrics) cpu { used } cpu { percentTotal }
GetServices (services) services { name state } services { name } (state removed)
GetServer (server) versions { unraid } versions { core { unraid } }
GetServers (servers) servers { id name status description ip port } servers { id name status }
GetFlash (flash) flash { id guid product vendor size } flash { id product vendor }
Response handler "network": "network" "network": "vars"
Response handler "connect": "connect" "connect": "vars"

unraid_mcp/tools/health.py

Section Before (broken) After (fixed)
ComprehensiveHealthCheck query versions { unraid } versions { core { unraid } }
Version extraction .get("versions", {}).get("unraid") .get("versions", {}).get("core", {}).get("unraid")

unraid_mcp/tools/docker.py

  • Removed logs GraphQL query — docker.logs field does not exist in the current API
  • Replaced with a helpful ToolError directing users to the Unraid web UI or SSH (docker logs <id>)

Test Environment

Property Value
Unraid OS 7.2.3 x86_64
Kernel 6.12.54-Unraid
API version 4.28.2+d13a1f61
CPU Intel Core i3-10105 (4c/8t)
RAM 64 GiB DDR4 3600MHz (Corsair)
Motherboard MSI B560M PRO-E (MS-7D22)
MCP transport streamable-http (http://<unraid-host>:6970/mcp)
MCP server version 0.1.0 (Docker)

Tool-by-Tool Test Results

unraid_info — 16 actions tested against Unraid 7.2.3

Action Before PR After PR
overview ❌ GraphQL error: Cannot query field "codepage", "apps", flat versions fields ✅ Full system info returned
array ✅ Working ✅ Working
network ❌ GraphQL error: Cannot query field "network" ✅ Network vars returned
registration ✅ Working ✅ Working
connect ❌ GraphQL error: Cannot query field "connect" ✅ Connect settings returned
variables ✅ Working ✅ Working
metrics ❌ GraphQL error: Cannot query field "used" on CpuMetrics percentTotal returned
services ❌ GraphQL error: Cannot query field "state" on Service ✅ Services listed by name
display ✅ Working ✅ Working
config ✅ Working ✅ Working
online ✅ Working ✅ Working
owner ✅ Working ✅ Working
server ❌ GraphQL error: Cannot query field "unraid" on InfoVersions ✅ Server summary with OS version
servers ❌ GraphQL error: extra fields on servers type ✅ Servers listed
flash ❌ GraphQL error: guid, size fields removed ✅ Flash info returned
settings ✅ Working ✅ Working

unraid_health — all 3 actions

Action Before PR After PR
check ❌ GraphQL error: Cannot query field "unraid" on InfoVersions → returned unhealthy ✅ Returns healthy, includes version, uptime, array state, docker containers
test_connection ✅ Working ✅ Working
diagnose ✅ Working ✅ Working

unraid_array — all 5 actions

Action Before PR After PR
parity_status ✅ Working ✅ Working
All others ✅ Working ✅ Working

unraid_docker — 14 actions (logs removed)

Action Before PR After PR
list ✅ Working ✅ Working
details ✅ Working ✅ Working
start/stop/restart ✅ Working ✅ Working
logs ❌ GraphQL error: docker.logs field does not exist ℹ️ Returns helpful error with web UI / SSH alternative
All others ✅ Working ✅ Working

unraid_storage, unraid_vm, unraid_notifications, unraid_rclone, unraid_users, unraid_keys

All actions verified working before and after (no schema changes needed).


Root Cause

The Unraid 7.2.x API removed or restructured several GraphQL fields:

  • info.os.codepage removed
  • info.apps removed
  • info.versions changed from a flat scalar map to a nested object (core, packages)
  • network top-level field removed (replaced by vars)
  • connect top-level field removed (replaced by vars)
  • metrics.cpu.used renamed to metrics.cpu.percentTotal
  • services.state removed
  • servers.description/ip/port removed
  • flash.guid/size removed
  • docker.logs removed entirely

🤖 Tested with Claude Code against a live Unraid 7.2.3 instance


Summary by cubic

Fixes GraphQL schema mismatches for Unraid 7.2.x to restore all MCP tools and stop field validation errors. Verified against Unraid 7.2.3.

  • Bug Fixes
    • Info queries: remove os.codepage and apps; update versions to core/packages; cpu.used -> cpu.percentTotal; services.state removed; adjust server, servers, flash fields; move network/connect to vars and update handlers.
    • Health: query versions.core.unraid and update version extraction path.
    • Docker: remove unsupported logs query; return a clear error directing to the web UI or SSH.
    • Build: include LICENSE in Docker image.

Written for commit 8f38815. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes

    • Logs are no longer available via GraphQL. Use the Unraid UI or docker CLI to view container logs.
  • Chores

    • Updated Docker image to include LICENSE file.
    • Restructured system information queries for improved data organization.

udhaya10 and others added 3 commits February 20, 2026 14:44
- info: fix versions query from flat fields to nested core/packages structure
- info: remove deprecated apps field from Info type
- info: fix os.codepage -> os.codename
- info: fix metrics cpu.used -> cpu.percentTotal
- info: fix server query versions.unraid -> versions.core.unraid
- health: fix comprehensive check versions.unraid -> versions.core.unraid
- health: fix result processing to use nested versions.core.unraid path
- docker: remove logs query (field does not exist on Docker type in current API)
- docker: replace logs action with helpful error directing to web UI or SSH

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- network: query uses vars fields (network top-level field removed in API)
- connect: query uses vars fields (connect top-level field removed in API)
- services: remove state field (only name exists on Service type)
- servers: remove description/ip/port fields (only id/name/status valid)
- flash: remove guid/size fields (only id/product/vendor valid)
- result handler: update network and connect to read from vars response key

All 16 info queries now verified working against Unraid 7.2.3 API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 20, 2026

📝 Walkthrough

Walkthrough

Updates GraphQL queries and tool behaviors to align with Unraid 7.2 schema changes, including deprecating GraphQL logs access, restructuring version query paths, simplifying query fields, and adding LICENSE file to Docker image.

Changes

Cohort / File(s) Summary
Build Configuration
Dockerfile
Added COPY instruction to include LICENSE file in container image.
Docker Container Management
unraid_mcp/tools/docker.py
Removed GraphQL logs query from QUERIES mapping; logs action now raises ToolError directing users to Unraid UI or docker CLI instead of fetching via GraphQL.
System Health Monitoring
unraid_mcp/tools/health.py
Updated ComprehensiveHealthCheck query to use nested versions { core { unraid } } path instead of versions { unraid } for schema alignment.
System Information Queries
unraid_mcp/tools/info.py
Restructured multiple GraphQL queries: removed OS fields (codepage, logofile); simplified versions to nested core structure; refactored network and connect queries to use vars object; adjusted CPU metrics and removed fields from services, servers, and flash queries.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 The schema shifted in the Unraid sky,
So we pruned and nested fields way up high,
Logs now whisper "use the CLI, dear friend,"
While LICENSE hops into the container blend!
Schema compatibility: quest complete! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: resolve GraphQL schema mismatches for Unraid 7.2.x API' accurately describes the main change: addressing GraphQL schema incompatibilities introduced in Unraid 7.2.x.
Linked Issues check ✅ Passed All objectives from issue #9 are met: Unraid 7.2.x GraphQL schema mismatches are resolved through query updates in info.py, health.py, and docker.py; affected tools now work correctly.
Out of Scope Changes check ✅ Passed The Dockerfile LICENSE file copy addition is a minor packaging fix unrelated to the primary GraphQL schema fixes but is reasonable as supporting infrastructure change.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
unraid_mcp/tools/info.py (1)

416-417: 🧹 Nitpick | 🔵 Trivial

server action returns the entire raw GraphQL response without processing.

All other actions either extract a specific key or apply processing. Returning raw data here exposes the GraphQL response structure directly (with top-level keys info, array, online), which is inconsistent with the pattern of the other actions. This also means any future GraphQL response shape changes will leak directly to callers.

Consider extracting and assembling a processed summary similar to other actions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@unraid_mcp/tools/info.py` around lines 416 - 417, The branch that handles
action == "server" currently returns the raw GraphQL response variable data;
change it to assemble and return a processed summary (matching the pattern used
by other actions) by extracting the top-level keys from data (e.g.,
data.get("info"), data.get("array"), data.get("online")) and build a normalized
dict with only the needed fields (such as summary/info, items/array,
status/online) instead of returning data directly; update the code in the action
== "server" block to validate/normalize those keys and return that processed
dict.
unraid_mcp/tools/docker.py (1)

108-108: ⚠️ Potential issue | 🔴 Critical

Bug: logs action is unreachable — blocked by ALL_ACTIONS validation.

"logs" was removed from QUERIES but ALL_ACTIONS is derived from set(QUERIES) | set(MUTATIONS) | {"restart"}, so "logs" is no longer in ALL_ACTIONS. The guard at Line 250 (if action not in ALL_ACTIONS) will reject "logs" with a generic "Invalid action" error before the informative ToolError at Lines 284-288 is ever reached.

🐛 Proposed fix
-ALL_ACTIONS = set(QUERIES) | set(MUTATIONS) | {"restart"}
+ALL_ACTIONS = set(QUERIES) | set(MUTATIONS) | {"restart", "logs"}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@unraid_mcp/tools/docker.py` at line 108, The constant ALL_ACTIONS currently
omits "logs" (ALL_ACTIONS = set(QUERIES) | set(MUTATIONS) | {"restart"}), which
causes the generic guard that checks if action not in ALL_ACTIONS to reject
"logs" before the more specific ToolError handling runs; fix by including "logs"
in ALL_ACTIONS (or explicitly allowing action == "logs" in the initial guard) so
the "logs" action passes validation and reaches the intended ToolError path;
update the ALL_ACTIONS definition (or the guard that references ALL_ACTIONS) to
include "logs" so the behavior around action validation and ToolError (lines
around the current guard and the ToolError at lines ~284-288) is preserved.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@unraid_mcp/tools/info.py`:
- Around line 50-55: The three GraphQL query strings network, connect, and
variables all query the same root field vars which can be confusing when they
share the same response key in dict_actions; add short inline comments above
each query string (e.g., "# Network-related vars", "# Connect-related vars", "#
General variables") to clarify which subset of vars each query is intended to
return and why they share the same response key, and update the dict_actions
entries (dict_actions keys for network, connect, variables) if necessary to
reference those commented queries for maintainability.

---

Outside diff comments:
In `@unraid_mcp/tools/docker.py`:
- Line 108: The constant ALL_ACTIONS currently omits "logs" (ALL_ACTIONS =
set(QUERIES) | set(MUTATIONS) | {"restart"}), which causes the generic guard
that checks if action not in ALL_ACTIONS to reject "logs" before the more
specific ToolError handling runs; fix by including "logs" in ALL_ACTIONS (or
explicitly allowing action == "logs" in the initial guard) so the "logs" action
passes validation and reaches the intended ToolError path; update the
ALL_ACTIONS definition (or the guard that references ALL_ACTIONS) to include
"logs" so the behavior around action validation and ToolError (lines around the
current guard and the ToolError at lines ~284-288) is preserved.

In `@unraid_mcp/tools/info.py`:
- Around line 416-417: The branch that handles action == "server" currently
returns the raw GraphQL response variable data; change it to assemble and return
a processed summary (matching the pattern used by other actions) by extracting
the top-level keys from data (e.g., data.get("info"), data.get("array"),
data.get("online")) and build a normalized dict with only the needed fields
(such as summary/info, items/array, status/online) instead of returning data
directly; update the code in the action == "server" block to validate/normalize
those keys and return that processed dict.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="unraid_mcp/tools/docker.py">

<violation number="1" location="unraid_mcp/tools/docker.py:284">
P2: `logs` is no longer included in `ALL_ACTIONS`, so the early validation rejects `action="logs"` and the new ToolError guidance in the logs branch is unreachable. This effectively disables the `logs` action while it remains in `DOCKER_ACTIONS`.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@udhaya10
Copy link
Copy Markdown
Author

Related PRs & Conflict Heads-up

Just did a sweep of the other open PRs to flag any overlap:

PR #3 (partial overlap)

fix: update GraphQL queries for Unraid API v4.21.0+ by @abra5umente fixes the same 3 fields (codepage, apps, flat versions { unraid }) but was written against Unraid 7.1.4 / API v4.21.0 and leaves 7 queries still broken on 7.2.x:

Query PR #3 This PR
overview — remove codepage, apps, fix versions
health_check — fix versions { unraid }
networkvars
connectvars
metrics.cpu.usedpercentTotal
services — remove state field
servers — remove extra fields
flash — remove guid/size fields
docker.logs — remove (field gone from API)

This PR is a superset of PR #3 for 7.2.x. If PR #3 is merged first, this PR will still apply cleanly on top (different fields/lines), though a rebase would tidy things up.

PR #11 (potential merge conflict)

refactor: comprehensive code review fixes by @jmagar touches nearly every file in the repo (+2093/-719). If #11 merges before this PR, there will likely be conflicts in info.py, health.py, and docker.py. Happy to rebase on top of #11 once it lands — just let me know.

PRs #5, #6, #7, #8 — no overlap

Focus on error handling, tests, infra, and new tooling — no schema query changes.

TheTechChild pushed a commit to TheTechChild/unraid-mcp that referenced this pull request Feb 28, 2026
Introspected the live Unraid GraphQL API and fixed all queries that
referenced nonexistent fields or types. Removed Docker mutations and
queries that the API does not expose (pause, unpause, remove, update,
logs, network_details, port_conflicts, check_updates). Unavailable
actions now return clear error messages instead of crashing.

Based on community PR jmagar#12 findings, verified against actual schema.
@jmagar
Copy link
Copy Markdown
Owner

jmagar commented Apr 4, 2026

Thanks for the PR and the thorough testing against 7.2.3! Both review comments addressed:

cubic-dev-ai (P2 bug): Fixed — added "logs" to ALL_ACTIONS so the early validation guard no longer rejects it before reaching the ToolError that explains the web UI / SSH alternative.

coderabbitai (clarity): Fixed — added inline comments to dict_actions explaining that network, connect, and variables all share the vars root field, and why that's safe (each query requests its own subfields).

Changes pushed to fix/pr12-review-comments for review before merge.

jmagar added a commit that referenced this pull request Apr 6, 2026
- Add 'logs' to _DOCKER_SUBACTIONS so the validation guard passes through
  to the informative ToolError rather than a generic 'Invalid action' (P1)
- Add inline comments to _SYSTEM_QUERIES explaining that 'network' and
  'variables' share the vars root field but fetch different subfields (P3)
- Process system/server response into a structured summary dict instead
  of returning raw GraphQL data directly (P3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unraid 7.2 GraphQL Schema Compatibility Issue

2 participants