# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-29T07:09:55+00:00
import argparse
import json
import os
from typing import *
from typing import Optional, Union
from autogen.mcp.mcp_proxy import MCPProxy
from autogen.mcp.mcp_proxy.security import BaseSecurity
from fastapi import Header
from models import (
Certs,
ConsentArtefactResponse,
ConsentFetchRequest,
ConsentRequest,
ConsentRequestInitResponse,
ConsentRequestStatusRequest,
DataNotification,
ErrorResponse,
HealthInformationNotification,
HeartbeatResponse,
HIRequest,
HIUConsentNotificationEvent,
HIUConsentNotificationResponse,
HIUConsentRequestStatus,
HIUHealthInformationRequestResponse,
HIUSubscriptionNotification,
HIUSubscriptionNotificationAcknowledgment,
HIUSubscriptionRequestNotificationAcknowledgement,
HIUSubscriptionRequestReceipt,
OpenIdConfiguration,
PatientAuthConfirmRequest,
PatientAuthConfirmResponse,
PatientAuthInitRequest,
PatientAuthInitResponse,
PatientAuthModeQueryRequest,
PatientAuthModeQueryResponse,
PatientAuthNotification,
PatientAuthNotificationAcknowledgement,
PatientIdentificationRequest,
PatientIdentificationResponse,
SessionRequest,
SessionResponse,
SubscriptionApprovalNotification,
SubscriptionRequest1,
)
app = MCPProxy(
contact={'name': 'National Health Authority', 'url': 'https://ndhm.gov.in/'},
description='The following are the specifications for the APIs to be implemented at the Health Repository end if an entity is only serving the role of a HIU. The specs are essentially duplicates from the Gateway and Bridge, but put together so as to make it clear to *HIUs* which set of APIs they should implement to participate in the network. \n\n 1. The APIs are organized by the flows - **identification**, **consent flow**, **data flow** and **monitoring**. They represent the APIs that are expected to be available at the HIU end by the Gateway. \n 2. For majority of the APIs, if Gateway has initiated a call, there are corresponding callback APIs on the Gateway. e.g for **/consents/hiu/notify** API on HIU end, its expected that a corresponding callback API **/consents/hiu/on-notify** on Gateway is called. Such APIs are organized under the **Gateway** label. \n 3. Gateway relevant APIs for HIUs are grouped under **Gateway** label. These include the APIs that HIPs are required to call on the Gateway. For example, to request a CM for consent, HIU would call **/consent-requests/init** API on gateway. \n 4. **NOTE**, in some of the API documentations below, **X-HIP-ID** is mentioned in header (for example in /auth/on-init). These are the cases, when a particular API is applicable for both HIU and HIP (e.g an entity is playing the role of HRP representing both HIU and HIP). If you are only playing the role of HIP, then only X-HIU-ID header will be sent \n',
title='Health Repository Provider Specifications for HIU',
version='0.5',
servers=[{'description': 'Sandbox', 'url': 'https://dev.ndhm.gov.in/gateway'}],
)
@app.get('/v0.5/.well-known/openid-configuration', tags=['openid_configuration'])
def get_v0_5__well_known_openid_configuration():
"""
Get openid configuration
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get('/v0.5/certs', tags=['openid_configuration', 'user_authentication'])
def get_v0_5_certs():
"""
Get certs for JWT verification
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/consent-requests/init',
description=""" Creates a consent request to get data about a patient by HIU user. """,
tags=['consent_request_handling', 'consent_management'],
)
def post_v0_5_consent_requests_init(
authorization: str = Header(..., alias='Authorization'),
x__c_m__i_d: str = Header(..., alias='X-CM-ID'),
body: ConsentRequest = ...,
):
"""
Create consent request
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/consent-requests/on-init',
description=""" Result of consent request creation for a patient. **id** represents the consentrequest id created by CM. The result must contain either **id** or the **error** caused. <br/>
Reasons for error may be
* Invalid references (e.g patient id, hiu id), purpose, hiTypes, ranges, persmission
""",
tags=['consent_request_handling', 'consent_management'],
)
def post_v0_5_consent_requests_on_init(
authorization: str = Header(..., alias='Authorization'),
x__h_i_u__i_d: str = Header(..., alias='X-HIU-ID'),
body: ConsentRequestInitResponse = ...,
):
"""
Response to consent request
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/consent-requests/on-status',
description=""" Result of consent request done previously. Status of request can be GRANTED, DENIED, EXPIRED. If the request was GRANTED, then
""",
tags=[
'consent_request_handling',
'consent_management',
'health_information_requests',
],
)
def post_v0_5_consent_requests_on_status(
authorization: str = Header(..., alias='Authorization'),
x__h_i_u__i_d: str = Header(..., alias='X-HIU-ID'),
body: HIUConsentRequestStatus = ...,
):
"""
Result of consent request status
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/consent-requests/status',
description=""" Get status of consent request done previously """,
tags=['consent_request_handling', 'consent_management'],
)
def post_v0_5_consent_requests_status(
authorization: str = Header(..., alias='Authorization'),
x__c_m__i_d: str = Header(..., alias='X-CM-ID'),
body: ConsentRequestStatusRequest = ...,
):
"""
Get consent request status
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/consents/fetch', tags=['consent_request_handling', 'consent_management']
)
def post_v0_5_consents_fetch(
authorization: str = Header(..., alias='Authorization'),
x__c_m__i_d: str = Header(..., alias='X-CM-ID'),
body: ConsentFetchRequest = ...,
):
"""
Get consent artefact
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/consents/hiu/notify',
description=""" Health information user will get notified about the consent request granted or denied, consent revoked, consent expired.
1. For consent request grant, status=GRANTED, consentRequestId=<consent-request-id>, and consentArtefacts is an array of generated consent artefact Ids.
2. For consent request expiry, status=EXPIRED, consentRequestId=<consent-request-id>
3. For consent request denied, status=DENIED, consentRequestId=<consent-request-id>
4. For consent revocation, status=REVOKED, consentArtefacts is an array of revoked consent artefact ids
""",
tags=['consent_management', 'health_information_requests'],
)
def post_v0_5_consents_hiu_notify(
authorization: str = Header(..., alias='Authorization'),
x__h_i_u__i_d: str = Header(..., alias='X-HIU-ID'),
body: HIUConsentNotificationEvent = ...,
):
"""
Consent notification
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/consents/hiu/on-notify',
description=""" This API is called by HIU as acknowledgement to consent notifications, specifically for cases when consent is REVOKED or EXPIRED.
""",
tags=[
'consent_request_handling',
'consent_management',
'health_information_requests',
],
)
def post_v0_5_consents_hiu_on_notify(
authorization: str = Header(..., alias='Authorization'),
x__c_m__i_d: str = Header(..., alias='X-CM-ID'),
body: HIUConsentNotificationResponse = ...,
):
"""
Consent notification
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/consents/on-fetch',
description=""" Must contain either consent or error. Possible reason of errors are
1. consentId passed through /fetch is invalid
""",
tags=['consent_management', 'consent_request_handling'],
)
def post_v0_5_consents_on_fetch(
authorization: str = Header(..., alias='Authorization'),
x__h_i_u__i_d: str = Header(..., alias='X-HIU-ID'),
body: ConsentArtefactResponse = ...,
):
"""
Result of fetch request for a consent artefact
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/health-information/cm/request',
description=""" Request for Health information against a consent id. CM would generate a transactionId against each consent and pass it as trnasaction context / correlation id to the HIP and also return the same to HIU via /on-request.
""",
tags=['health_information_requests', 'user_authentication'],
)
def post_v0_5_health_information_cm_request(
authorization: str = Header(..., alias='Authorization'),
x__c_m__i_d: str = Header(..., alias='X-CM-ID'),
body: HIRequest = ...,
):
"""
Health information data request
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/health-information/hiu/on-request',
description=""" Callback API for acknowledgement of Health information request made by HIU. Gateway calls this API when request has validated for the specified consent id. Either the **hiRequest** or **error** would be specified. If the health info request was valid, then the ***hiRequest.transactionId*** specifies the transaction context against which HIP would send over the data. Possible cases of errors are
1. **Invalid consent artefact id**
2. **Consent has expired**
3. **Date ranges are invalid**
""",
tags=['health_information_requests'],
)
def post_v0_5_health_information_hiu_on_request(
authorization: str = Header(..., alias='Authorization'),
x__h_i_u__i_d: str = Header(..., alias='X-HIU-ID'),
body: HIUHealthInformationRequestResponse = ...,
):
"""
Health information data request
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/health-information/notify',
description=""" API called by HIU and HIP during data-transfer.
1. HIP on transfer of data would send **sessionStatus** - one of [TRANSFERRED, FAILED]
2. HIP would also send **hiStatus** for each *careContextReference* - on of [DELIVERED, ERRORED]
3. HIU on receipt of data would send **sessionStatus** - one of [TRANSFERRED, FAILED]. For example, FAILED when if data was not sent or if invalid data was sent
4. HIU would also send **hiStatus** for each *careContextReference* - one of [OK, ERRORED]
""",
tags=['health_information_requests', 'subscription_management'],
)
def post_v0_5_health_information_notify(
authorization: str = Header(..., alias='Authorization'),
x__c_m__i_d: str = Header(..., alias='X-CM-ID'),
body: HealthInformationNotification = ...,
):
"""
Notifications corresponding to events during data flow
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/health-information/transfer',
description=""" **NOTE**: This API is actually the callback URL that is passed as **dataPushUrl** in the data request API - /v0.5/health-information/hip/request. This API is directly called by HIP Data Bridge and is not mediated via CM, and hence not routed through the Gateway.
1. This API should be implemented at HIU side. It maybe implemented by the Data Bridge representing the HIU.
2. Entry elements maybe ***content*** or ***link***, although for version 1, entry ***content*** is preferred.
3. Entry ***content*** (or even link reference content) must be encrypted by means of Elliptic-curve Diffie–Hellman Key Exchange, utilizing the HIU keymaterials that are passed through the data request API - /v0.5/health-information/hip/request.
4. Media contains the mimetype of content, and for v1, it is "application/fhir+json"
5. checksum is Md5 checksum of the data conent, before encryption
6. Please refer to the NDHM Sandbox documentation for the format of FHIR bundle that is passed through content
""",
tags=['health_information_requests', 'user_authentication'],
)
def post_v0_5_health_information_transfer(
authorization: str = Header(..., alias='Authorization'),
body: DataNotification = ...,
):
"""
health information transfer API
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get('/v0.5/heartbeat', tags=['consent_request_handling', 'consent_management'])
def get_v0_5_heartbeat():
"""
Get consent request status
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/patients/find',
description=""" This API is meant for identify to patient given her consent-manager-user-id
""",
tags=['patient_identification', 'consent_management', 'user_authentication'],
)
def post_v0_5_patients_find(
authorization: str = Header(..., alias='Authorization'),
x__c_m__i_d: str = Header(..., alias='X-CM-ID'),
body: PatientIdentificationRequest = ...,
):
"""
Identify a patient by her consent-manager user-id
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/patients/on-find',
description=""" If a patient is found then patient.name contains the patients name.
Otherwise, patient is not provided, and possibly error is raised for invalid requests
Note in addition to the "Authorization" header, one of the following headers must be specified
1. specify **X-HIU-ID** if the requester is HIU (identified from /find requester.id)
2. specify **X-HIP-ID** if the requester is HIP (identified from /find requester.id)
""",
tags=['patient_identification', 'user_authentication'],
)
def post_v0_5_patients_on_find(
authorization: str = Header(..., alias='Authorization'),
body: PatientIdentificationResponse = ...,
):
"""
Identification result for a consent-manager user-id
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post('/v0.5/sessions', tags=['session_management', 'user_authentication'])
def post_v0_5_sessions(body: SessionRequest):
"""
Get access token
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/subscription-requests/cm/init',
description=""" creates a request for subscription. The subscription categories can be for care-contexts linkages or availability of data against existing care-contexts. Note that the requester must have HIU role """,
tags=['subscription_management', 'user_authentication'],
)
def post_v0_5_subscription_requests_cm_init(
authorization: str = Header(..., alias='Authorization'),
x__c_m__i_d: str = Header(..., alias='X-CM-ID'),
body: SubscriptionRequest1 = ...,
):
"""
Request for subscription
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/subscription-requests/hiu/notify',
description=""" This API is used by CM to notify a HIU to grant or deny a request for subscription, and also to notify that in case an existing subscription is revoked or expired. For notifying that a particular subscription request was GRANTED or DENIED, the **subscriptionRequestId** is passed.
""",
tags=['subscription_management', 'user_authentication'],
)
def post_v0_5_subscription_requests_hiu_notify(
authorization: str = Header(..., alias='Authorization'),
x__h_i_u__i_d: str = Header(..., alias='X-HIU-ID'),
body: SubscriptionApprovalNotification = ...,
):
"""
Notification for subscription grant/deny/revoke
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/subscription-requests/hiu/on-init',
description=""" This callback API acknowledges the request for subscription from a HIU, and sends back a "id" that will be used when the patient/user approves or denies the subscription.
""",
tags=['subscription_management', 'health_information_requests'],
)
def post_v0_5_subscription_requests_hiu_on_init(
authorization: str = Header(..., alias='Authorization'),
x__h_i_u__i_d: str = Header(..., alias='X-HIU-ID'),
body: HIUSubscriptionRequestReceipt = ...,
):
"""
callback API for the /subscription-requests/cm/init to notify a HIU on acceptance/acknowledgement of the request for subscription.
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/subscription-requests/hiu/on-notify',
description=""" This API is called by HIU as acknowledgement to subscription request relevant notifications.
""",
tags=['subscription_management', 'user_authentication'],
)
def post_v0_5_subscription_requests_hiu_on_notify(
authorization: str = Header(..., alias='Authorization'),
x__c_m__i_d: str = Header(..., alias='X-CM-ID'),
body: HIUSubscriptionRequestNotificationAcknowledgement = ...,
):
"""
Callback API for /subscription-requests/hiu/notify to acknowledge receipt of notification.
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/subscriptions/hiu/notify',
description=""" This API is used by CM to notify a HIU for notification relevant to subscription. Notifications are sent to subscribed HIUs whenever a new care-context is linked or new data is available on an existing linked care-context.
1. if event.category = LINK, then only care-contexts are passed when new care-contexts are linked for patient.
2. If event.category = DATA, then hiTypes are passed. Care-context is passed only if the subscribed HIU has any valid consent for that care-context
""",
tags=['subscription_management', 'health_information_requests'],
)
def post_v0_5_subscriptions_hiu_notify(
authorization: str = Header(..., alias='Authorization'),
x__h_i_u__i_d: str = Header(..., alias='X-HIU-ID'),
body: HIUSubscriptionNotification = ...,
):
"""
Notification to HIU on basis of a granted subscription
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/subscriptions/hiu/on-notify',
description=""" This API is called by HIU as acknowledgement to consent notifications, specifically for cases when consent is REVOKED or EXPIRED.
""",
tags=['subscription_management', 'user_authentication'],
)
def post_v0_5_subscriptions_hiu_on_notify(
authorization: str = Header(..., alias='Authorization'),
x__c_m__i_d: str = Header(..., alias='X-CM-ID'),
body: HIUSubscriptionNotificationAcknowledgment = ...,
):
"""
Callback API for /subscriptions/hiu/notify to acknowledge receipt of notification.
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/users/auth/confirm',
description=""" This API is called by HIP/HIUs to confirm authentication of users. The transactionId returned by the previous callback API /users/auth/on-init must be sent. If Authentication is successful the callback API will send an "access token" for subsequent purpose specific API calls. Note only **credential.authCode** or **credential.demographic** should be sent
1. demographic details are only required for demographic auth as of now.
2. demographic details are required only in MEDIATED cases and if the **auth.mode** so demands. e.g. if **auth.mode** is DEMOGRAPHICS. Usually for demographic authentication, the name, gender and DOB must be exactly as specified in User Account.
3. demographic.identifier is optional, however maybe required if authentication so mandates.
4. credential.authCode is required for other MEDIATED authentication like MOBILE_OTP, AADHAAR_OTP.
""",
tags=['user_authentication', 'health_information_requests'],
)
def post_v0_5_users_auth_confirm(
authorization: str = Header(..., alias='Authorization'),
x__c_m__i_d: str = Header(..., alias='X-CM-ID'),
body: PatientAuthConfirmRequest = ...,
):
"""
Confirmation request sending token, otp or other authentication details from HIP/HIU for confirmation
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/users/auth/fetch-modes',
description=""" This API is meant for identify supported authentication modes for a patient given a specific purpose
""",
tags=['user_authentication', 'patient_identification'],
)
def post_v0_5_users_auth_fetch_modes(
authorization: str = Header(..., alias='Authorization'),
x__c_m__i_d: str = Header(..., alias='X-CM-ID'),
body: PatientAuthModeQueryRequest = ...,
):
"""
Get a patient's authentication modes relevant to specified purpose
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/users/auth/init',
description=""" This API is called by HIPs to initiate authentication of users. A transactionId is retuned by the corresponding callback API for confirmation of user auth.
1. **NOTE**, only **KYC** purpose is applicable for HIU. Hence HIU should only sent KYC in **query.authMode** in the request
""",
tags=['user_authentication', 'patient_identification'],
)
def post_v0_5_users_auth_init(
authorization: str = Header(..., alias='Authorization'),
x__c_m__i_d: str = Header(..., alias='X-CM-ID'),
body: PatientAuthInitRequest = ...,
):
"""
Initialize authentication from HIP
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/users/auth/notify',
description=""" This API is called by CM to confirm authentication of users. The transactionId returned is same as that passed in /auth/on-init. The "auth.status" conveys whether the request was GRANTED or DENIED.
1. **auth.accessToken** - is specific to the purpose mentioned in the /auth/init. This token needs to be used for initiating the intended action. For example for HIP initiated linking of care-contexts
2. **NOTE**, only one of **X-HIP-ID** or **X-HIU-ID** will be sent as part of header, not both.
3. The payload is conditional to the purpose of auth. If purpose specified in /auth/init is KYC or KYC_AND_LINK, then patient details are passed. **auth.accessToken** is passed only if the purpose is LINK or KYC_AND_LINK.
""",
tags=['user_authentication', 'patient_identification'],
)
def post_v0_5_users_auth_notify(
authorization: str = Header(..., alias='Authorization'),
x__h_i_p__i_d: str = Header(..., alias='X-HIP-ID'),
x__h_i_u__i_d: str = Header(..., alias='X-HIU-ID'),
body: PatientAuthNotification = ...,
):
"""
notification API in case of DIRECT mode of authentication by the CM
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/users/auth/on-confirm',
description=""" This API is called by CM to confirm authentication of users.
1. **auth.accessToken** - is specific to the purpose mentioned in the /auth/init. This token needs to be used for initiating the intended action. For example for HIP initiated linking of care-contexts
2. **NOTE**, only one of **X-HIP-ID** or **X-HIU-ID** will be sent as part of header, not both.
""",
tags=['user_authentication', 'patient_identification'],
)
def post_v0_5_users_auth_on_confirm(
authorization: str = Header(..., alias='Authorization'),
x__h_i_p__i_d: str = Header(..., alias='X-HIP-ID'),
x__h_i_u__i_d: str = Header(..., alias='X-HIU-ID'),
body: PatientAuthConfirmResponse = ...,
):
"""
callback API for /auth/confirm (in case of MEDIATED auth) to confirm user authentication or not
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/users/auth/on-fetch-modes',
description=""" If a patient is found then **auth** attribute contains the supported modes for the specified purpose.
Otherwise, error is raised for invalid requests or for non-existent id.
Note in addition to the "Authorization" header, one of the following headers must be specified
1. **X-HIU-ID** if the requester is HIU (identified from /auth/fetch-modes requester.id)
2. **X-HIP-ID** if the requester is HIP (identified from /auth/fetch-modes requester.id)
""",
tags=['patient_identification', 'user_authentication'],
)
def post_v0_5_users_auth_on_fetch_modes(
authorization: str = Header(..., alias='Authorization'),
x__h_i_p__i_d: str = Header(..., alias='X-HIP-ID'),
x__h_i_u__i_d: str = Header(..., alias='X-HIU-ID'),
body: PatientAuthModeQueryResponse = ...,
):
"""
Identification result for a consent-manager user-id
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/users/auth/on-init',
description=""" If the patient's id is valid, CM will return a transactionId as initialization of user auth. If the request is valid, then 'auth.mode' will convey how the authentication should be done. The authentication can be *mediated* or *direct*. For mediated authentication modes, HIP or HIU is epected to send over relevant code (OTP/token) or demographic info via subsequent API call to /auth/confirm. for direct authentication case, CM will notify requester through/users/auth/notify API.
1. **auth.mode** conveys whats the mode of authentication is, and what is expected from HIP/HIU in the subsequent /auth/confirm API call. Possible values
1. MOBILE_OTP - auth via OTP to registered mobile. Mediated.
2. AADHAAR_OTP - auth initiated with Aadhaar with OTP. Mediated.
3. DEMOGRAPHICS - auth initiated with demographic verification
4. DIRECT - for authentication directly with the patient. e.g. Mobile App, SMS. In this case, the HIP/HIU is not expected to call subsequent /auth/confirm call. CM will do direct authentication with the User (e.g. Mobile App, SMS etc) and will notify requester
2. **meta.expiry** conveys the expiry time of the token and the authentication session
3. **NOTE**, only one of **X-HIP-ID** or **X-HIU-ID** will be sent as part of header, not both.
4. **NOTE**, only KYC purpose is applicable for HIU
The error section in the body, represents the potential errors that may have occurred. Possible reasons:
1. Patient id is invalid
""",
tags=['user_authentication', 'session_management'],
)
def post_v0_5_users_auth_on_init(
authorization: str = Header(..., alias='Authorization'),
x__h_i_p__i_d: str = Header(..., alias='X-HIP-ID'),
x__h_i_u__i_d: str = Header(..., alias='X-HIU-ID'),
body: PatientAuthInitResponse = ...,
):
"""
Response to user authentication initialization from HIP
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v0.5/users/auth/on-notify',
description=""" This API is called by HIU/HIPs to confirm acknowledgement for receipt of auth notification is case of DIRECT authentication.
""",
tags=['health_information_requests', 'user_authentication'],
)
def post_v0_5_users_auth_on_notify(
authorization: str = Header(..., alias='Authorization'),
x__c_m__i_d: str = Header(..., alias='X-CM-ID'),
body: PatientAuthNotificationAcknowledgement = ...,
):
"""
callback API by HIU/HIPs as acknowledgement of auth notification
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="MCP Server")
parser.add_argument(
"transport",
choices=["stdio", "sse", "streamable-http"],
help="Transport mode (stdio, sse or streamable-http)",
)
args = parser.parse_args()
if "CONFIG_PATH" in os.environ:
config_path = os.environ["CONFIG_PATH"]
app.load_configuration(config_path)
if "CONFIG" in os.environ:
config = os.environ["CONFIG"]
app.load_configuration_from_string(config)
if "SECURITY" in os.environ:
security_params = BaseSecurity.parse_security_parameters_from_env(
os.environ,
)
app.set_security_params(security_params)
mcp_settings = json.loads(os.environ.get("MCP_SETTINGS", "{}"))
app.get_mcp(**mcp_settings).run(transport=args.transport)