Skip to content

fix(mcp): auto-discover project_id + fix cluster_versions_list crash#5

Merged
vks-team merged 1 commit into
developfrom
fix/mcp-project-autodiscovery-and-versions
Jun 20, 2026
Merged

fix(mcp): auto-discover project_id + fix cluster_versions_list crash#5
vks-team merged 1 commit into
developfrom
fix/mcp-project-autodiscovery-and-versions

Conversation

@vks-team

Copy link
Copy Markdown

Summary

Two MCP server fixes:

  1. Auto-discover project_id from vServer. _require_project_id is now async: when project_id is not configured (no GRN_PROJECT_ID, no credentials-file value — e.g. running in Docker / Agent Runtime), it fetches GET /v1/projects and uses the single project for the account (each user has exactly one), caching it on the config so later tool calls don't refetch. A configured value still takes precedence. No portal-user-id required. All discovery call sites updated to await.

  2. Fix cluster_versions_list crash 'list' object has no attribute 'get'. The shape-normalisation ternary was inverted — it called data.get(...) exactly when data was a top-level array (which /v1/cluster-versions returns). Replaced with robust dict/list/empty normalisation.

Test Plan

  • pytest tests/test_version_tools.py tests/test_discovery_tools.py — new tests: bare-array version response; project_id configured / auto-discover+cache / empty→error
  • Full suite: 137 passed
  • ruff check clean

🤖 Generated with Claude Code

- discovery: _require_project_id now async; when project_id is unset it fetches
  GET /v1/projects from vServer, uses the single project, and caches it on the
  config (no portal-user-id needed). Configured GRN_PROJECT_ID/credentials still
  take precedence. All discovery call sites updated to await.
- version: fix cluster_versions_list crashing with "'list' object has no
  attribute 'get'" on a top-level array response; normalise dict/list/empty
  shapes robustly.
- tests: bare-array version response; project_id configured/auto-discover+cache/
  empty-error. Full suite 137 passed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vks-team vks-team merged commit a6dc34a into develop Jun 20, 2026
1 check passed
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.

1 participant