Skip to content

refactor: replace py_jama_rest_client with async httpx client#1

Merged
XORwell merged 2 commits into
mainfrom
refactor/replace-py-jama-rest-client
Apr 9, 2026
Merged

refactor: replace py_jama_rest_client with async httpx client#1
XORwell merged 2 commits into
mainfrom
refactor/replace-py-jama-rest-client

Conversation

@XORwell
Copy link
Copy Markdown
Owner

@XORwell XORwell commented Apr 9, 2026

Summary

  • Fix 8 bugs in the stdio MCP server (create_item args, get_item_children method name, get_pick_lists params, get_project missing, get_relationships naming, get_item_relationships wrong scope)
  • Replace py-jama-rest-client dependency with a native async httpx-based client
  • Add test management tools: create_test_plan, create_test_cycle, get_test_cycle, get_test_runs, update_test_run
  • Add create_relationship tool for traceability links

New files

  • jama_cli/core/http_client.py — async HTTP client (auth, pagination at 50/page vs old 20, 429 retry)
  • jama_cli/core/api.py — ~60 typed async API methods
  • jama_cli/core/sync_wrapper.py — background-thread sync facade for CLI
  • jama_cli/core/exceptions.py — clean exception hierarchy

Key improvements

  • Pagination uses page size 50 (API max) instead of library's hardcoded 20 → 2.5x fewer API calls
  • Stdio MCP server is fully async (no more run_in_executor wrapping)
  • create_test_plan works natively (no more _JamaClient__core bypass hack)
  • Typed exceptions with 429 retry + exponential backoff

Note

jama_mcp_server/core/server.py (HTTP MCP) still uses py_jama_rest_client — will be updated in a follow-up PR.

Test plan

  • 378 core tests pass
  • 56 HTTP server tests pass (19 skipped — integration)
  • All 43 stdio server tests updated and passing
  • Manual test against live Jama instance

XORwell added 2 commits April 9, 2026 16:43
Bug fixes:
- create_item: pass all 5 required args to post_item (was missing location + child_item_type_id)
- get_item_children: fix method name from get_items_children to get_item_children
- get_pick_lists: remove incorrect project_id param (API is global)
- get_project: implement via get_projects() filter (method doesn't exist in client)
- get_relationships: rename to get_relationship_types (matched wrong method)
- get_item_relationships: replace with upstream/downstream variants (was passing
  item_id to project-scoped get_relationships)

New features:
- create_test_plan: direct REST call to POST /testplans (not in py_jama_rest_client)
- create_test_cycle, get_test_cycle, get_test_runs, update_test_run
- create_relationship: expose post_relationship for traceability links
- get_item_upstream_relationships, get_item_downstream_relationships
- New jama_cli/core/http_client.py: async HTTP client with auth (basic,
  API key, OAuth), pagination (page size 50 vs old 20), retry on 429,
  typed exceptions
- New jama_cli/core/api.py: ~60 typed async API methods including
  create_test_plan (no longer needs __core bypass)
- New jama_cli/core/sync_wrapper.py: background-thread sync facade for CLI
- New jama_cli/core/exceptions.py: clean exception hierarchy preserving
  class names for backward compatibility

Updated consumers:
- jama_cli/core/client.py: uses SyncJamaApi instead of PyJamaClient,
  eliminates _JamaClient__core hack
- jama_mcp_server/core/stdio_server.py: uses async JamaApi directly,
  removes all run_in_executor boilerplate

Dependency change: py-jama-rest-client -> httpx in pyproject.toml

Note: jama_mcp_server/core/server.py (HTTP MCP) still uses
py_jama_rest_client — will be updated in a follow-up.
@XORwell XORwell merged commit 815a7ca into main Apr 9, 2026
0 of 5 checks passed
@XORwell XORwell deleted the refactor/replace-py-jama-rest-client branch April 9, 2026 14:52
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