Skip to content

FHIR Context With MCP

MCP servers that require patient data access will have FHIR context passed to them via headers.

MCP servers can take advantage of MCP extensions to indicate that they support PromptOpinion's FHIR context.

Extension Declaration

When an initialize request is sent to the MCP server, they should respond with an extension in the capabilities section indicating that they support PromptOpinion's FHIR context. The specific extension name we are looking for is: ai.promptopinion/fhir-context. At this time, the value of this extension is just an empty object, there are no customizations to this extension.

This is a sample response to the initialize call:

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "capabilities": {
      "extensions": {
        "ai.promptopinion/fhir-context": {}
      }
    }
  }
}

PromptOpinion Web App

When you go to add your MCP server in the Configuration -> MCP Servers page, you must first click on the Continue button. This will send an initialize request to your MCP server and will read the response that was returned by your server. If the MCP server supports FHIR context by including the extension declaration, an additional flag will be displayed to you indicating whether you trust the MCP server and would like to enable the extension.

You can opt out of sending the FHIR context to the MCP server if you do not trust the server.

FHIR Context Headers Sent

When you add an MCP server that supports PromptOpinion's FHIR extension and you authorize FHIR context to be sent, Po will send the following headers to the MCP server when a tool on that server is called:

  • X-FHIR-Server-URL - The url to the FHIR server
  • X-FHIR-Access-Token - The token that is used to authorize with the FHIR server
  • X-Patient-ID - The ID of the patient.