healthcloud-cli 3.8.0__tar.gz → 3.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. healthcloud_cli-3.8.0/README.md → healthcloud_cli-3.9.0/PKG-INFO +48 -0
  2. healthcloud_cli-3.8.0/PKG-INFO → healthcloud_cli-3.9.0/README.md +30 -18
  3. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/auth.py +8 -3
  4. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/compatibility.py +3 -2
  5. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/context.py +8 -2
  6. healthcloud_cli-3.9.0/healthcloud_cli/ams/endpoint.py +69 -0
  7. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/group.py +11 -2
  8. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/session.py +4 -2
  9. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/target.py +9 -4
  10. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/ui.py +5 -0
  11. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/contracts/mcp-tools.manifest.json +129 -4
  12. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/pyproject.toml +1 -1
  13. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/.gitignore +0 -0
  14. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/hatch_build.py +0 -0
  15. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/__init__.py +0 -0
  16. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/admins/__init__.py +0 -0
  17. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/admins/commands.py +0 -0
  18. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/admins/group.py +0 -0
  19. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/admins/operations.py +0 -0
  20. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/__init__.py +0 -0
  21. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/agents/__init__.py +0 -0
  22. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/agents/commands.py +0 -0
  23. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/agents/group.py +0 -0
  24. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/agents/operations.py +0 -0
  25. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/agents/projections.py +0 -0
  26. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/commands.py +0 -0
  27. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/data_sources/__init__.py +0 -0
  28. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/data_sources/commands.py +0 -0
  29. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/data_sources/group.py +0 -0
  30. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/data_sources/operations.py +0 -0
  31. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/data_sources/projections.py +0 -0
  32. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/departments/__init__.py +0 -0
  33. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/departments/commands.py +0 -0
  34. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/departments/group.py +0 -0
  35. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/departments/operations.py +0 -0
  36. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/departments/projections.py +0 -0
  37. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/domain_errors.py +0 -0
  38. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/errors.py +0 -0
  39. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/guardrails/__init__.py +0 -0
  40. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/guardrails/commands.py +0 -0
  41. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/guardrails/group.py +0 -0
  42. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/guardrails/operations.py +0 -0
  43. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/guardrails/projections.py +0 -0
  44. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/health_services/__init__.py +0 -0
  45. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/health_services/commands.py +0 -0
  46. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/health_services/group.py +0 -0
  47. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/health_services/operations.py +0 -0
  48. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/health_services/projections.py +0 -0
  49. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/organization/__init__.py +0 -0
  50. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/organization/commands.py +0 -0
  51. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/organization/group.py +0 -0
  52. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/organization/operations.py +0 -0
  53. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/organization/projections.py +0 -0
  54. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/output.py +0 -0
  55. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/policies/__init__.py +0 -0
  56. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/policies/commands.py +0 -0
  57. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/policies/group.py +0 -0
  58. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/policies/operations.py +0 -0
  59. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/policies/projections.py +0 -0
  60. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/pretty.py +0 -0
  61. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/registry.py +0 -0
  62. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/results.py +0 -0
  63. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/sessions/__init__.py +0 -0
  64. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/sessions/commands.py +0 -0
  65. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/sessions/group.py +0 -0
  66. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/sessions/operations.py +0 -0
  67. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/sessions/projections.py +0 -0
  68. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/skills/__init__.py +0 -0
  69. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/skills/commands.py +0 -0
  70. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/skills/group.py +0 -0
  71. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/skills/operations.py +0 -0
  72. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/skills/projections.py +0 -0
  73. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/teams/__init__.py +0 -0
  74. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/teams/commands.py +0 -0
  75. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/teams/group.py +0 -0
  76. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/teams/operations.py +0 -0
  77. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/teams/projections.py +0 -0
  78. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/tools/__init__.py +0 -0
  79. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/tools/commands.py +0 -0
  80. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/tools/group.py +0 -0
  81. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/tools/operations.py +0 -0
  82. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/tools/projections.py +0 -0
  83. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/tuning.py +0 -0
  84. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/ams/windows_files.py +0 -0
  85. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/cli.py +0 -0
  86. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/context.py +0 -0
  87. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/contracts/__init__.py +0 -0
  88. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/main.py +0 -0
  89. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/manifest.py +0 -0
  90. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/output.py +0 -0
  91. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/params.py +0 -0
  92. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/tenants/__init__.py +0 -0
  93. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/tenants/commands.py +0 -0
  94. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/tenants/group.py +0 -0
  95. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/tenants/operations.py +0 -0
  96. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/healthcloud_cli/util.py +0 -0
  97. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/scripts/__init__.py +0 -0
  98. {healthcloud_cli-3.8.0 → healthcloud_cli-3.9.0}/scripts/bundle_manifest.py +0 -0
@@ -1,3 +1,21 @@
1
+ Metadata-Version: 2.5
2
+ Name: healthcloud-cli
3
+ Version: 3.9.0
4
+ Summary: Command-line interface for the HealthCloud MCP gateway, generated from the shared MCP tool manifest.
5
+ Project-URL: Issues, https://github.com/healthcloudservices/healthcloud-services/issues
6
+ Project-URL: Repository, https://github.com/healthcloudservices/healthcloud-services
7
+ Author: Healthcheck Systems Inc
8
+ License-Expression: MIT
9
+ Keywords: cli,health-cloud,healthcare,healthcloud,mcp
10
+ Requires-Python: >=3.14
11
+ Requires-Dist: click>=8.1
12
+ Requires-Dist: healthcloud-sdk>=3.14.0
13
+ Requires-Dist: healthcloud-tenantadmin>=1.1.1
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest>=9.0.3; extra == 'dev'
16
+ Requires-Dist: respx>=0.21; extra == 'dev'
17
+ Description-Content-Type: text/markdown
18
+
1
19
  # healthcloud-cli
2
20
 
3
21
  Requires **Python 3.14 or newer**.
@@ -73,6 +91,36 @@ This also runs automatically as a hatchling build hook whenever you `python
73
91
  -m build`, so a built wheel/sdist is always self-contained and never depends
74
92
  on a relative path outside the installed package.
75
93
 
94
+ ## Selecting an AMS API URL
95
+
96
+ Pass `--api-url` after `ams` to select a different AMS deployment without changing
97
+ SDK defaults or DNS:
98
+
99
+ ```bash
100
+ uv run --frozen hc ams --api-url https://dev-ams-services.health.cloud/api/ams \
101
+ agents list --environment dev --tenant-id careco
102
+ ```
103
+
104
+ The value is the full HTTPS service base URL, including `/api/ams` when that is
105
+ the service path. A trailing slash is normalized. Without this option, the
106
+ existing environment-derived URL is used. The option applies to AMS discovery,
107
+ reads and writes; it does not change the tenant-admin login/refresh endpoint or
108
+ the saved session's environment and tenant. Root `--base-url` is for MCP and
109
+ remains separate. Use root `--verbose` to show the selected override on stderr;
110
+ JSON results remain on stdout.
111
+
112
+ For tuning commands, the target file's `api_origin` must match the selected URL's
113
+ origin. New override-based receipts bind the full URL, including its path: repeat
114
+ the same option for `show`, `apply` and `restore`. Changing the endpoint or dropping
115
+ the option requires a new reviewed plan; existing default receipts remain bound
116
+ to their original default configuration. Embedded credentials, query strings,
117
+ fragments and ambiguous paths are refused. TLS verification stays enabled and
118
+ redirects are not followed.
119
+
120
+ The local `ui` launcher supports only the `/api/ams` service path because the
121
+ existing frontend appends that path itself; it refuses custom API paths before
122
+ launching. This option does not update deployed web clients.
123
+
76
124
  ## Authentication & configuration
77
125
 
78
126
  Every command accepts these global options (place them before the `mcp`
@@ -1,21 +1,3 @@
1
- Metadata-Version: 2.5
2
- Name: healthcloud-cli
3
- Version: 3.8.0
4
- Summary: Command-line interface for the HealthCloud MCP gateway, generated from the shared MCP tool manifest.
5
- Project-URL: Issues, https://github.com/healthcloudservices/healthcloud-services/issues
6
- Project-URL: Repository, https://github.com/healthcloudservices/healthcloud-services
7
- Author: Healthcheck Systems Inc
8
- License-Expression: MIT
9
- Keywords: cli,health-cloud,healthcare,healthcloud,mcp
10
- Requires-Python: >=3.14
11
- Requires-Dist: click>=8.1
12
- Requires-Dist: healthcloud-sdk>=3.14.0
13
- Requires-Dist: healthcloud-tenantadmin>=1.1.1
14
- Provides-Extra: dev
15
- Requires-Dist: pytest>=9.0.3; extra == 'dev'
16
- Requires-Dist: respx>=0.21; extra == 'dev'
17
- Description-Content-Type: text/markdown
18
-
19
1
  # healthcloud-cli
20
2
 
21
3
  Requires **Python 3.14 or newer**.
@@ -91,6 +73,36 @@ This also runs automatically as a hatchling build hook whenever you `python
91
73
  -m build`, so a built wheel/sdist is always self-contained and never depends
92
74
  on a relative path outside the installed package.
93
75
 
76
+ ## Selecting an AMS API URL
77
+
78
+ Pass `--api-url` after `ams` to select a different AMS deployment without changing
79
+ SDK defaults or DNS:
80
+
81
+ ```bash
82
+ uv run --frozen hc ams --api-url https://dev-ams-services.health.cloud/api/ams \
83
+ agents list --environment dev --tenant-id careco
84
+ ```
85
+
86
+ The value is the full HTTPS service base URL, including `/api/ams` when that is
87
+ the service path. A trailing slash is normalized. Without this option, the
88
+ existing environment-derived URL is used. The option applies to AMS discovery,
89
+ reads and writes; it does not change the tenant-admin login/refresh endpoint or
90
+ the saved session's environment and tenant. Root `--base-url` is for MCP and
91
+ remains separate. Use root `--verbose` to show the selected override on stderr;
92
+ JSON results remain on stdout.
93
+
94
+ For tuning commands, the target file's `api_origin` must match the selected URL's
95
+ origin. New override-based receipts bind the full URL, including its path: repeat
96
+ the same option for `show`, `apply` and `restore`. Changing the endpoint or dropping
97
+ the option requires a new reviewed plan; existing default receipts remain bound
98
+ to their original default configuration. Embedded credentials, query strings,
99
+ fragments and ambiguous paths are refused. TLS verification stays enabled and
100
+ redirects are not followed.
101
+
102
+ The local `ui` launcher supports only the `/api/ams` service path because the
103
+ existing frontend appends that path itself; it refuses custom API paths before
104
+ launching. This option does not update deployed web clients.
105
+
94
106
  ## Authentication & configuration
95
107
 
96
108
  Every command accepts these global options (place them before the `mcp`
@@ -6,6 +6,7 @@ from datetime import UTC, datetime
6
6
 
7
7
  import click
8
8
 
9
+ from .endpoint import sdk_url_options
9
10
  from .session import load_session, refreshed_session, save_session, session_lock
10
11
  from .target import AmsTarget, TenantTarget
11
12
 
@@ -28,18 +29,22 @@ def _tenant_admin_sdk(environment, tenant_id):
28
29
  return HCTenantAdminSDK(environment=environment, tenant_id=tenant_id)
29
30
 
30
31
 
31
- def _public_sdk(environment, tenant_id):
32
+ def _public_sdk(environment, tenant_id, api_url=None):
32
33
  global HCSDK
33
34
  if HCSDK is None:
34
35
  from healthcloud import HCSDK as sdk_factory
35
36
 
36
37
  HCSDK = sdk_factory
37
- return HCSDK(environment=environment, tenant_id=tenant_id)
38
+ return HCSDK(environment=environment, tenant_id=tenant_id, **sdk_url_options(api_url))
38
39
 
39
40
 
40
41
  @contextmanager
41
42
  def authenticated_sdk(target: AmsTarget | TenantTarget):
42
- sdk = _public_sdk(target.environment, target.tenant_id)
43
+ sdk = (
44
+ _public_sdk(target.environment, target.tenant_id, api_url=target.api_url)
45
+ if target.api_url is not None
46
+ else _public_sdk(target.environment, target.tenant_id)
47
+ )
43
48
  try:
44
49
  if not hasattr(sdk, "ams_admin"):
45
50
  raise click.ClickException(
@@ -12,6 +12,7 @@ import click
12
12
 
13
13
  from .auth import authenticated_sdk, selected_agent
14
14
  from .context import AmsDependencies, pass_ams, preflight_discovery, require_target
15
+ from .endpoint import sdk_url_options
15
16
  from .output import digest, metadata, private_output, read_json
16
17
  from .tuning import (
17
18
  apply_receipt,
@@ -88,7 +89,7 @@ def create_discover_command(dependencies: AmsDependencies) -> click.Command:
88
89
 
89
90
  target = resolve_tenant_target(environment, tenant_id)
90
91
  environment, tenant_id = target.environment, target.tenant_id
91
- with dependencies.public_sdk_factory(environment=environment) as sdk:
92
+ with dependencies.public_sdk_factory(environment=environment, **sdk_url_options(target.api_url)) as sdk:
92
93
  agents = sdk.ams.get_agents_for_tenant(tenant_id)
93
94
  if not isinstance(agents, dict) or any(
94
95
  not isinstance(v, list) or any(not isinstance(i, str) or not i for i in v) for v in agents.values()
@@ -96,7 +97,7 @@ def create_discover_command(dependencies: AmsDependencies) -> click.Command:
96
97
  raise click.ClickException("Unexpected public discovery response; no candidate selected.")
97
98
  from healthcloud.config import resolve_base_url # deferred with the SDK
98
99
 
99
- origin = urlsplit(resolve_base_url(environment, "ams"))
100
+ origin = urlsplit(target.api_url or resolve_base_url(environment, "ams"))
100
101
  metadata(
101
102
  dict(
102
103
  environment=environment,
@@ -11,6 +11,7 @@ from typing import Any
11
11
  import click
12
12
 
13
13
  from ..context import CliConfig, resolve_config
14
+ from .endpoint import current_api_url, sdk_url_options
14
15
  from .target import AmsTarget, TenantTarget, load_target
15
16
 
16
17
  # Injection point for tests (``monkeypatch.setattr(context, "HCSDK", ...)`);
@@ -26,7 +27,7 @@ def _public_sdk(environment: str, tenant_id: str):
26
27
  from healthcloud import HCSDK as sdk_factory
27
28
 
28
29
  HCSDK = sdk_factory
29
- return HCSDK(environment=environment, tenant_id=tenant_id)
30
+ return HCSDK(environment=environment, tenant_id=tenant_id, **sdk_url_options(current_api_url()))
30
31
 
31
32
 
32
33
  @dataclass(frozen=True)
@@ -45,6 +46,7 @@ class AmsContext:
45
46
  root_config: CliConfig
46
47
  target_file: Path | None
47
48
  dependencies: AmsDependencies
49
+ api_url: str | None = None
48
50
 
49
51
 
50
52
  pass_ams = click.make_pass_decorator(AmsContext, ensure=False)
@@ -525,7 +527,11 @@ def require_target(invocation: AmsContext) -> AmsTarget:
525
527
  _check_root(invocation)
526
528
  if invocation.target_file is None:
527
529
  raise click.ClickException("AMS requires an explicit --target-file.")
528
- target = load_target(invocation.target_file)
530
+ target = (
531
+ load_target(invocation.target_file, api_url=invocation.api_url)
532
+ if invocation.api_url is not None
533
+ else load_target(invocation.target_file)
534
+ )
529
535
  from .session import load_session
530
536
 
531
537
  session = load_session()
@@ -0,0 +1,69 @@
1
+ """Explicit AMS service URLs; validation never reads credentials or constructs clients."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import ipaddress
6
+ import re
7
+ from urllib.parse import unquote, urlsplit, urlunsplit
8
+
9
+ import click
10
+
11
+
12
+ def normalize_api_url(value: str) -> str:
13
+ """Validate an absolute HTTPS base URL without reflecting hostile input."""
14
+ try:
15
+ if not value or any(ord(c) <= 32 or ord(c) >= 127 for c in value) or any(c in value for c in "\\?#"):
16
+ raise ValueError
17
+ parsed = urlsplit(value)
18
+ host = parsed.hostname
19
+ if parsed.scheme != "https" or not host or parsed.username is not None or parsed.password is not None:
20
+ raise ValueError
21
+ if parsed.port is not None and not 1 <= parsed.port <= 65535:
22
+ raise ValueError
23
+ authority = f"[{host}]" if ":" in host else host
24
+ if parsed.port is not None:
25
+ authority += f":{parsed.port}"
26
+ if parsed.netloc.lower() != authority:
27
+ raise ValueError
28
+ try:
29
+ ipaddress.ip_address(host)
30
+ except ValueError:
31
+ if any(not re.fullmatch(r"[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?", label) for label in host.split(".")):
32
+ raise ValueError from None
33
+ path = parsed.path.rstrip("/")
34
+ decoded = path
35
+ for _ in range(3):
36
+ if re.search(r"%(?![0-9a-fA-F]{2})", decoded):
37
+ raise ValueError
38
+ updated = unquote(decoded)
39
+ if updated == decoded:
40
+ break
41
+ if updated.count("/") != decoded.count("/"):
42
+ raise ValueError
43
+ decoded = updated
44
+ if "%" in decoded or "\\" in decoded or any(ord(c) <= 32 for c in decoded):
45
+ raise ValueError
46
+ if "//" in path or any(part in {".", ".."} for part in decoded.split("/")):
47
+ raise ValueError
48
+ return urlunsplit(("https", parsed.netloc.lower(), path, "", ""))
49
+ except ValueError, TypeError:
50
+ raise click.ClickException(
51
+ "Invalid AMS API URL; require an absolute HTTPS service URL without credentials, query, fragment or ambiguous path."
52
+ ) from None
53
+
54
+
55
+ def api_url_option(_ctx, _param, value: str | None) -> str | None:
56
+ return normalize_api_url(value) if value is not None else None
57
+
58
+
59
+ def current_api_url() -> str | None:
60
+ """Read only the current typed invocation; no process-global endpoint state."""
61
+ from .context import AmsContext
62
+
63
+ ctx = click.get_current_context(silent=True)
64
+ invocation = ctx.find_object(AmsContext) if ctx is not None else None
65
+ return invocation.api_url if invocation is not None else None
66
+
67
+
68
+ def sdk_url_options(api_url: str | None) -> dict[str, str]:
69
+ return {"ams_base_url_override": api_url} if api_url is not None else {}
@@ -9,6 +9,7 @@ import click
9
9
  from ..context import CliConfig
10
10
  from .compatibility import default_dependencies, safe_errors
11
11
  from .context import AmsContext, AmsDependencies
12
+ from .endpoint import api_url_option
12
13
  from .registry import IMPLEMENTED_CHILDREN, register_children
13
14
 
14
15
 
@@ -16,15 +17,23 @@ def create_ams_group(dependencies: AmsDependencies | None = None) -> click.Group
16
17
  dependencies = dependencies or default_dependencies()
17
18
 
18
19
  @click.group("ams")
20
+ @click.option(
21
+ "--api-url",
22
+ callback=api_url_option,
23
+ help="Override the AMS HTTPS service base URL (for example https://host/api/ams); separate from MCP --base-url.",
24
+ )
19
25
  @click.option("--target-file", type=click.Path(path_type=Path, dir_okay=False), default=None)
20
26
  @click.pass_context
21
27
  @safe_errors
22
- def group(ctx: click.Context, target_file: Path | None) -> None:
28
+ def group(ctx: click.Context, target_file: Path | None, api_url: str | None) -> None:
23
29
  """Read and tune one explicitly selected AMS tenant: catalog domains (skills, policies, guardrails, teams, departments, organization, data-sources, health-services, tools), governed authoring sessions with their messages and attachments, and read-only agent operations."""
24
30
  cfg = ctx.find_object(CliConfig)
25
31
  if cfg is None:
26
32
  raise click.ClickException("AMS requires root CLI configuration.")
27
- ctx.obj = AmsContext(root_config=cfg, target_file=target_file, dependencies=dependencies)
33
+ selected_url = api_url
34
+ ctx.obj = AmsContext(root_config=cfg, target_file=target_file, dependencies=dependencies, api_url=selected_url)
35
+ if cfg.verbose and selected_url is not None:
36
+ click.echo(f"AMS API URL: {selected_url}", err=True)
28
37
 
29
38
  register_children(group, dependencies, IMPLEMENTED_CHILDREN)
30
39
  return group
@@ -331,17 +331,19 @@ def delete_session() -> bool:
331
331
 
332
332
 
333
333
  def resolve_tenant_target(environment: str | None, tenant_id: str | None):
334
+ from .endpoint import current_api_url
334
335
  from .target import TenantTarget
335
336
 
337
+ api_url = current_api_url()
336
338
  session = load_session()
337
339
  if session is None:
338
340
  if environment is None and tenant_id is None:
339
341
  raise click.ClickException("Not logged in; run `hc login --environment <env> --tenant-id <tenant>`.")
340
- return TenantTarget(environment, tenant_id)
342
+ return TenantTarget(environment, tenant_id, api_url=api_url)
341
343
  if (environment is not None and environment != session.environment) or (
342
344
  tenant_id is not None and tenant_id != session.tenant_id
343
345
  ):
344
346
  raise click.ClickException("AMS target does not match the saved session; stopped before authentication.")
345
347
  if session.environment == "prod" and environment is None:
346
348
  raise click.ClickException("The saved session targets prod; pass --environment prod explicitly.")
347
- return TenantTarget(session.environment, session.tenant_id)
349
+ return TenantTarget(session.environment, session.tenant_id, api_url=api_url)
@@ -37,6 +37,7 @@ class TenantTarget:
37
37
 
38
38
  environment: str
39
39
  tenant_id: str
40
+ api_url: str | None = None
40
41
 
41
42
  def __post_init__(self) -> None:
42
43
  if self.environment not in ("dev", "uat", "prod"):
@@ -53,11 +54,15 @@ class AmsTarget:
53
54
  agent_id: str
54
55
  api_origin: str
55
56
  qualification: dict
57
+ api_url: str | None = None
56
58
 
57
59
  def binding(self) -> dict:
58
- return dict(
60
+ result = dict(
59
61
  environment=self.environment, tenant_id=self.tenant_id, agent_id=self.agent_id, api_origin=self.api_origin
60
62
  )
63
+ if self.api_url is not None:
64
+ result["api_url"] = self.api_url
65
+ return result
61
66
 
62
67
  def require_qualified(self, fields, version: int) -> None:
63
68
  """The operator asserts the current build; no current-build API exists."""
@@ -90,7 +95,7 @@ class AmsTarget:
90
95
  )
91
96
 
92
97
 
93
- def load_target(path: Path) -> AmsTarget:
98
+ def load_target(path: Path, *, api_url: str | None = None) -> AmsTarget:
94
99
  data = read_json(path)
95
100
  keys = {"schema_version", "environment", "tenant_id", "agent_id", "api_origin", "qualification"}
96
101
  if not _keys(data, keys, keys) or type(data.get("schema_version")) is not int or data["schema_version"] != 1:
@@ -101,7 +106,7 @@ def load_target(path: Path) -> AmsTarget:
101
106
  raise click.ClickException("Explicit environment, tenant, agent and origin are required.")
102
107
  try:
103
108
  parsed = urlsplit(data["api_origin"])
104
- canonical = urlsplit(_resolve_base_url(data["environment"], "ams"))
109
+ canonical = urlsplit(api_url or _resolve_base_url(data["environment"], "ams"))
105
110
  if (
106
111
  parsed.scheme != "https"
107
112
  or parsed.username is not None
@@ -134,4 +139,4 @@ def load_target(path: Path) -> AmsTarget:
134
139
  }
135
140
  if "backend_model_context" in q and not _keys(q["backend_model_context"], context_keys):
136
141
  raise click.ClickException("Unknown backend model-context qualification keys.")
137
- return AmsTarget(**data)
142
+ return AmsTarget(**data, api_url=api_url)
@@ -2,6 +2,7 @@
2
2
 
3
3
  import os
4
4
  from pathlib import Path
5
+ from urllib.parse import urlsplit
5
6
 
6
7
  import click
7
8
 
@@ -28,6 +29,10 @@ def ui_directory(ui_repo: Path) -> Path:
28
29
 
29
30
 
30
31
  def build_ui_launch(target: AmsTarget, ui_repo: Path) -> tuple[list[str], dict[str, str]]:
32
+ if target.api_url is not None and urlsplit(target.api_url).path != "/api/ams":
33
+ raise click.ClickException(
34
+ "The local UI requires the AMS API base path /api/ams; custom API paths are unsupported."
35
+ )
31
36
  ui_directory(ui_repo)
32
37
  essentials = {
33
38
  "PATH",
@@ -30336,7 +30336,7 @@
30336
30336
  "defaultBaseUrl": "patient",
30337
30337
  "name": "patient",
30338
30338
  "path": "/patient",
30339
- "toolCount": 118,
30339
+ "toolCount": 120,
30340
30340
  "tools": [
30341
30341
  {
30342
30342
  "cliCommand": "add-insurance",
@@ -32333,6 +32333,41 @@
32333
32333
  "requiredRoles": [],
32334
32334
  "timeoutSeconds": 25
32335
32335
  },
32336
+ {
32337
+ "cliCommand": "get-patient-intake-operation",
32338
+ "description": "Read only the authenticated patient's original keyed intake journal state. Never writes; missing state does not prove failure or permit retry.",
32339
+ "descriptionSource": "mcp-authored",
32340
+ "destructive": false,
32341
+ "fixedArguments": null,
32342
+ "httpMethod": "GET",
32343
+ "httpPath": "/patients/intake/operations/{idempotency_key}",
32344
+ "inputSchema": {
32345
+ "additionalProperties": false,
32346
+ "properties": {
32347
+ "idempotency_key": {
32348
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
32349
+ "title": "Idempotency Key",
32350
+ "type": "string"
32351
+ }
32352
+ },
32353
+ "required": [
32354
+ "idempotency_key"
32355
+ ],
32356
+ "title": "IntakeOperationKey",
32357
+ "type": "object"
32358
+ },
32359
+ "name": "get_patient_intake_operation",
32360
+ "operationId": "patient.getPatientIntakeOperation",
32361
+ "parameters": {
32362
+ "body": [],
32363
+ "path": [
32364
+ "idempotency_key"
32365
+ ],
32366
+ "query": []
32367
+ },
32368
+ "requiredRoles": [],
32369
+ "timeoutSeconds": 25
32370
+ },
32336
32371
  {
32337
32372
  "cliCommand": "get-patient-photo",
32338
32373
  "description": "Read the authenticated patient's FHIR Binary photo; binary_id is optional when it is stored on the patient.",
@@ -37000,6 +37035,74 @@
37000
37035
  "requiredRoles": [],
37001
37036
  "timeoutSeconds": 25
37002
37037
  },
37038
+ {
37039
+ "cliCommand": "submit-patient-intake-operation",
37040
+ "description": "Execute or replay exact patient-confirmed intake terms under one canonical UUID key. Tenant/patient come only from patient login. Pending/unknown keys never redispatch. Recorded HTTP is not independent clinical success or failure evidence; look up the original key after uncertainty and never evade the barrier with a new key.",
37041
+ "descriptionSource": "mcp-authored",
37042
+ "destructive": false,
37043
+ "fixedArguments": null,
37044
+ "httpMethod": "POST",
37045
+ "httpPath": "/patients/intake/operations",
37046
+ "inputSchema": {
37047
+ "additionalProperties": false,
37048
+ "properties": {
37049
+ "idempotency_key": {
37050
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
37051
+ "title": "Idempotency Key",
37052
+ "type": "string"
37053
+ },
37054
+ "section": {
37055
+ "enum": [
37056
+ "allergies",
37057
+ "cancer_cases",
37058
+ "family_history",
37059
+ "gyn_history",
37060
+ "perinatal_history",
37061
+ "medications",
37062
+ "problems",
37063
+ "social_history",
37064
+ "surgical_history",
37065
+ "vaccines"
37066
+ ],
37067
+ "title": "Section",
37068
+ "type": "string"
37069
+ },
37070
+ "summary": {
37071
+ "anyOf": [
37072
+ {
37073
+ "additionalProperties": true,
37074
+ "type": "object"
37075
+ },
37076
+ {
37077
+ "type": "string"
37078
+ }
37079
+ ],
37080
+ "description": "Exact reviewed raw text or matching single-section object. Bounded to 65536 canonical JSON UTF-8 bytes and 16 levels before storage; existing clinical input validation still applies.",
37081
+ "title": "Summary"
37082
+ }
37083
+ },
37084
+ "required": [
37085
+ "idempotency_key",
37086
+ "section",
37087
+ "summary"
37088
+ ],
37089
+ "title": "SubmitIntakeOperationRequest",
37090
+ "type": "object"
37091
+ },
37092
+ "name": "submit_patient_intake_operation",
37093
+ "operationId": "patient.submitPatientIntakeOperation",
37094
+ "parameters": {
37095
+ "body": [
37096
+ "idempotency_key",
37097
+ "section",
37098
+ "summary"
37099
+ ],
37100
+ "path": [],
37101
+ "query": []
37102
+ },
37103
+ "requiredRoles": [],
37104
+ "timeoutSeconds": 25
37105
+ },
37003
37106
  {
37004
37107
  "cliCommand": "submit-patient-raw-x12-eligibility",
37005
37108
  "description": "Submit a raw X12 270 eligibility request for the authenticated patient.",
@@ -38699,7 +38802,7 @@
38699
38802
  "defaultBaseUrl": "provider",
38700
38803
  "name": "provider",
38701
38804
  "path": "/provider",
38702
- "toolCount": 30,
38805
+ "toolCount": 31,
38703
38806
  "tools": [
38704
38807
  {
38705
38808
  "cliCommand": "complete-practitioner-onboarding",
@@ -39410,6 +39513,28 @@
39410
39513
  "requiredRoles": [],
39411
39514
  "timeoutSeconds": 25
39412
39515
  },
39516
+ {
39517
+ "cliCommand": "logout-practitioner",
39518
+ "description": "Sign the authenticated practitioner out: Cognito revokes the access token and the session's refresh tokens.",
39519
+ "descriptionSource": "mcp-authored",
39520
+ "destructive": false,
39521
+ "fixedArguments": null,
39522
+ "httpMethod": "POST",
39523
+ "httpPath": "/auth/logout",
39524
+ "inputSchema": {
39525
+ "properties": {},
39526
+ "type": "object"
39527
+ },
39528
+ "name": "logout_practitioner",
39529
+ "operationId": "provider.logout",
39530
+ "parameters": {
39531
+ "body": [],
39532
+ "path": [],
39533
+ "query": []
39534
+ },
39535
+ "requiredRoles": [],
39536
+ "timeoutSeconds": 25
39537
+ },
39413
39538
  {
39414
39539
  "cliCommand": "refresh-practitioner-token",
39415
39540
  "description": "Renew a practitioner's access token through Cognito's refresh-token flow.",
@@ -41986,7 +42111,7 @@
41986
42111
  "protocolVersion": "2024-11-05",
41987
42112
  "schemaVersion": 1,
41988
42113
  "source": {
41989
- "catalogSha256": "88c1ba4a2af33ae00f81f5fc996ac01816d581b96815152099ea3c9d69461144"
42114
+ "catalogSha256": "97aa31dedf028e4fd7202beb03ddd34833485860ec1c399cad9c501944bacfc4"
41990
42115
  },
41991
- "toolCount": 1088
42116
+ "toolCount": 1091
41992
42117
  }
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "healthcloud-cli"
7
- version = "3.8.0"
7
+ version = "3.9.0"
8
8
  description = "Command-line interface for the HealthCloud MCP gateway, generated from the shared MCP tool manifest."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.14"