Skip to main content
Connect your EHR or another service through REST or MCP. Cortexa can read from connected tools and submit writes for clinician approval.

Setup

  1. Register your endpoint and tool definitions with your application API key.
  2. Arrange review of the connector with Cortexa.
  3. Connect each clinician using a Bearer credential or OAuth.
  4. Call tools with the clinician’s Partner JWT.

1. Register the connector

POST /connectors — use the Cortexa-Api-Key header and this JSON body:
The response includes id, manifest_hash, and approved: false. Save the ID as CONNECTOR_ID and arrange review before making calls. These operations use the API key. Any definition change requires another review and a new clinician connection, including changes to descriptions.

REST requirements

EHR profile

Use profile: "ehr" to require these six tools. Your manifest defines their input and output schemas.

MCP requirements

Use transport: "mcp" and a Streamable HTTP endpoint. Copy each tool’s name, description, schemas, and annotations from tools/list, and set write explicitly. REST method and path fields are ignored. Stdio and legacy HTTP+SSE are unsupported. Cortexa checks the live tool catalog before calls. A change returns 409 CONNECTOR_SCHEMA_CHANGED; update the manifest, arrange review, and reconnect. MCP writes send the stable call ID in _meta.idempotencyKey for server-side deduplication.

2. Connect the clinician

Use the clinician’s Partner JWT. Each connection belongs to that clinician and workspace.

Bearer credential

The response returns connection details without the credential. To disconnect, call DELETE /connectors/{connector_id}/connection. Reconnecting invalidates pending write approvals.

OAuth

Set auth: "oauth2" in the connector manifest and add an oauth object:
Use a pre-registered public OAuth client with authorization code and PKCE S256. Confidential-client secrets and dynamic registration are unsupported.
  1. Call POST /connectors/{connector_id}/oauth/authorize.
  2. Open the returned authorization_url for the clinician.
  3. Send the callback’s code and state to POST /connectors/{connector_id}/oauth/complete using the same grant.
State is single-use and expires after ten minutes. Cortexa stores credentials and refreshes access tokens. Reauthorize if refresh fails or no refresh token is available.

3. Call a tool

GET /connectors/tools lists the tools available to the current clinician.
The connected clinician approves the write in Cortexa’s approval interface. Arrange this interface during onboarding. A Partner JWT cannot approve a write by sending an approved flag. Cortexa Agent can also propose connected-tool writes through its approval UI.

Check a call’s status

GET /connector-calls/{call_id} returns one of: Retry a lost response with the same key and arguments. Changing the arguments or connection under that key returns 409. A stalled executing or unknown call may have reached the EHR; reconcile it by call ID before submitting a new write.