MCP not working

48 views
Skip to first unread message

Leonel Peña

unread,
Oct 6, 2025, 12:01:56 PM (11 days ago) Oct 6
to HAPI FHIR
I was testing the MCP server in HAPI using the following configuration, but I’m getting a “not found” error. Is there any additional configuration I need to do?

spring:
  ai:
    mcp:
      server:
        name: FHIR MCP Server
        version: 1.0.0
        instructions: "This server provides access to a FHIR RESTful API. You can use it to query FHIR resources, perform operations, and retrieve data in a structured format."
        enabled: true
        streamable-http:
          mcp-endpoint: /mcp/messages

herb...@gmail.com

unread,
Oct 7, 2025, 11:33:36 AM (10 days ago) Oct 7
to HAPI FHIR
As far as I know, HAPI-FHIR does not support the MCP protocol. The docs (https://hapifhir.io/hapi-fhir/docs/) do not list this feature and if I'am not wrong neither HL7 FHIR (https://hl7.org/fhir/index.html) has any description of it.

Maybe you had to put a additional layer to enable the MCP protocol on a HAPI-FHIR server.

Leonel Peña

unread,
Oct 7, 2025, 11:41:31 AM (10 days ago) Oct 7
to HAPI FHIR
 I took this configuration from the project’s GitHub repository  https://github.com/hapifhir/hapi-fhir-jpaserver-starter?tab=readme-ov-file#enable-mcp, but I’ll take a look at what you sent.  

Rob Ferguson

unread,
Oct 14, 2025, 4:05:34 PM (3 days ago) Oct 14
to HAPI FHIR

Leonel Peña

unread,
Oct 15, 2025, 8:24:09 AM (2 days ago) Oct 15
to HAPI FHIR
Hi, what configuration do you use in the application.yaml in fhir server and what version are you testing on. If you access de url by a browser works?

Rob Ferguson

unread,
Oct 15, 2025, 4:20:19 PM (2 days ago) Oct 15
to HAPI FHIR
I have a fork of the HAPI FHIR JPA Server Starter Project which I have configured to sync with the upstream repository.

See: https://github.com/Robinyo/hapi-fhir-jpaserver-starter

Also see: https://rob-ferguson.me/tag/fhir/

The current HAPI FHIR JPA Server Starter Project version is v8.4.0-2

Note: You can also use the most recent Docker Image: hapiproject/hapi:v8.4.0-2

If you take a look at the project's `application.yml` you will see the following (default) Spring AI MCP Server configuration:

```
spring:
  ai:
    mcp:
      server:
        name: FHIR MCP Server
        version: 1.0.0
        instructions: "This server provides access to a FHIR RESTful API. You can use it to query FHIR resources, perform operations, and retrieve data in a structured format."
        enabled: true
        streamable-http:
          mcp-endpoint: /mcp/messages
```

I also updated the project's `application.yml`, to configure the Web Testpage Overlay:

```
tester:
  home:
    name: Local Tester
    server_address: 'http://localhost:8080/fhir'
    refuse_to_fetch_third_party_urls: false
    fhir_version: R4
```

Then configure your MCP client (e.g., Claude for Desktop):

```
"mcpServers": {
  "hapi": {
    "command": "npx",
      "args": [
        "mcp-remote@latest",
        "http://localhost:8080/mcp/messages"
    ]
  }
}
```

Restart Claude for Desktop and then click on the 'Search and tools' button.

You should see something like:

search-and-tools.png

Also see: https://rob-ferguson.me/hapi-fhir-mcp-server/

Leonel Peña

unread,
Oct 16, 2025, 8:43:22 AM (yesterday) Oct 16
to HAPI FHIR
I think there might be an issue with the Docker image uploaded by the HAPI project. When I change only the image in your Docker Compose file, it stops working. However, if I use your image, everything works perfectly.

  hapi-fhir:
    image: hapiproject/hapi:v8.4.0-2
    #image: robferguson/hapi-fhir-au:v8.4.0-2

2025-10-16T12:36:59.063Z WARN 1 --- [nio-8080-exec-1] o.s.web.servlet.PageNotFound : No mapping for GET /mcp/messages
2025-10-16T12:36:59.092Z WARN 1 --- [nio-8080-exec-1] o.s.web.servlet.PageNotFound : No endpoint GET /mcp/messages.


Rob Ferguson

unread,
Oct 16, 2025, 5:17:27 PM (23 hours ago) Oct 16
to HAPI FHIR
Reply all
Reply to author
Forward
0 new messages