Skip to content

Release: v2.0.0 — cmlapi SDK migration #17

Merged
Khauneesh-AI merged 14 commits into
mainfrom
release/v2.0.0
May 12, 2026
Merged

Release: v2.0.0 — cmlapi SDK migration #17
Khauneesh-AI merged 14 commits into
mainfrom
release/v2.0.0

Conversation

@Khauneesh-AI
Copy link
Copy Markdown
Collaborator

@Khauneesh-AI Khauneesh-AI commented May 12, 2026

Summary

Replace all hand-rolled requests HTTP calls with the official cmlapi Python SDK across all 98 tool
functions. Fixes customer-reported silent failures, registers all tools in both servers.

What's new

cmlapi SDK migration (

  • Every tool function now calls cmlapi.CMLServiceApi methods via a shared setup_client() factory
  • serialize_result() helper handles datetime objects from SDK responses
  • create_registered_model uses typed CreateRegisteredModelRequest and cmlapi.Tag objects (raw
    dicts fail for this endpoint)
  • Lazy try/except ImportError on all cmlapi imports — server starts and CI tests pass without cmlapi
    installed; errors surface at call time with a clear message

Customer bug fixes

  • delete_application — previously returned {"success": true} even when the API rejected the request;
    now surfaces the actual error
  • stop_application / restart_application — previously hit wrong endpoints; SDK uses correct paths
  • update_applicationscript and other fields silently dropped; now all fields passed via SDK
  • get_runtimes — returned wrong field names (image_type, short_description); now returns correct
    SDK fields (editor, kernel, full_version)
  • list_project_filespath passed as positional arg (SDK requires it)
  • get_project_id — pagination metadata (count, pages_fetched) now reported

HTTP server parity (commit 597de41)

  • All 104 tools registered as @mcp.tool() — previously only 58 were discoverable via tools/list
  • Removed TOOL_IMPLEMENTATIONS lambda dict
  • /mcp-api and /debug/call use FastMCP native tool dispatch

Other

  • stdio_server.py — 4 tool wrappers (create_job, list_jobs, delete_job, delete_all_jobs) fixed
    to return json.dumps() instead of raw dicts
  • create_registered_model_tool docstring documents tags JSON format
  • Tool count expanded to 104(stdio) / 104 (http)
  • .gitignore — added .mcp.json
  • README — architecture section, cmlapi prerequisite, updated troubleshooting
  • pyproject.toml — version bumped to 2.0.0

Testing

  • unit tests pass
  • Tools verified end-to-end via MCP against live Cloudera AI Workbench
  • Full application lifecycle: create → update → stop → restart → delete
  • HTTP server: 104 tools load
  • STDIO server: 104 tools load

Khauneesh-AI and others added 14 commits April 6, 2026 18:38
- Add API v2 function modules (registry, projects, runtimes, quotas, etc.)
- Wire tools in stdio_server and http_server
- create_registered_model: parse tags JSON string for API array payload
- README: tool inventory, create_registered_model tags note, inference_test.py
- tests: pytest-asyncio for FastMCP client tests; test_create_registered_model
- Fix clone path in README (CAI_Workbench_MCP_Server)

Made-with: Cursor
Paginate project lookup and send project file paths as URL segments so agents can operate outside the first page and nested directories without unsafe deletes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Expose the internal project pagination page size and fetched page count so MCP users can see that list_projects exhausted paginated results.

Co-authored-by: Cursor <cursoragent@cursor.com>
  - Fix URL paths: use :restart/:stop instead of /restart//stop for
    restart_application, stop_application, stop_job_run
  - Rewrite stop_model_deployment with correct path structure
    (models/{id}/builds/{id}/deployments/{id}:stop) and required params
  - Rewrite log_experiment_run_batch and delete_experiment_run_batch with
    correct :logbatch/:deletebatch paths and run_id parameter
  - Make create_application subdomain optional; auto-generate from name
  - Remove get_runtimes_tool (broken, no pagination); improve
    list_runtimes_tool description to guide agents toward enabled runtimes
  - HTTP server tools/list now dynamically exposes all registered tools
    via FastMCP instead of hardcoded 6; tools/call falls through to
    FastMCP for tools not in legacy dict
  - Update tests for 104 tool count and list_runtimes_tool references
…-54632

fix: resolve customer-reported MCP tool failures (DSE-54632)
  Migrate 6 high-priority functions (delete/stop/restart/update/create_application,
  get_runtimes) from hand-rolled requests to cmlapi.CMLServiceApi. Add shared
  setup_client() to http_helpers.py. Fixes silent failures on delete, wrong URL
  patterns for stop/restart, and incorrect field names in get_runtimes.

  - Reduces ~676 lines of boilerplate to ~246 lines of typed SDK calls
  - Errors now properly surfaced via ApiException instead of silent success
  - upload_folder.py updated to reuse shared setup_client
  - Test assertions updated to accept cmlapi as valid HTTP transport
…m cmlapi

cmlapi SDK returns datetime objects in responses which break JSON
serialization in the MCP transport layer. Add serialize_result() to
http_helpers that round-trips through json.dumps(default=str).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace hand-rolled requests calls with cmlapi.CMLServiceApi methods
across all function files. Adds setup_client() and serialize_result()
to http_helpers.py as shared infrastructure.

Key changes:
- All tools now use typed SDK calls instead of manual URL construction
- serialize_result() handles datetime serialization from SDK responses
- create_registered_model uses CreateRegisteredModelRequest + Tag objects
- list_project_files passes path as required positional arg
- stdio_server.py: fix 4 tools returning dicts instead of JSON strings
- Tests updated to mock cmlapi instead of requests
- README updated with architecture note and cmlapi prerequisite
- .gitignore: add .mcp.json (contains local credentials)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace TOOL_IMPLEMENTATIONS lambda dict with proper @mcp.tool()
decorated functions so all tools appear in FastMCP tools/list.
Previously only 58 of 104 tools were discoverable.

Also fixes:
- create_registered_model: handle both dict and plain string tags
- test assertions updated for CreateRegisteredModelRequest object
- list_project_files test: path is positional arg

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move cmlapi imports behind try/except (ApiException falls back to
Exception) and inside function bodies (setup_client, create_registered_model).
This allows the package to import and tests to collect without cmlapi
installed — required for GitHub Actions CI where cmlapi is unavailable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When cmlapi is unavailable, ApiException = Exception was too broad —
it caught ModuleNotFoundError from setup_client() and then crashed
accessing e.status. Fix: define a placeholder ApiException class that
only matches itself, so real errors fall through to except Exception.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Khauneesh-AI Khauneesh-AI merged commit bf5ac25 into main May 12, 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