# Build a collection centre finder with the Eirly MCP

Build a pathology collection centre finder with a coding assistant and the Eirly developer MCP: four prompts to copy, then point it at staging.

Source: https://eirly.health/support/articles/build-a-collection-centre-finder-with-the-mcp

We built [our collection centre finder](/examples/collection-centre-finder) with a coding assistant connected to the Eirly developer MCP: four prompts, the MCP's answers, our brand on top. Every pathology collection centre in Australia, every lab network: search by suburb, postcode or centre, filter by state, lab and provider, sort nearest first, open a centre for the full week, get directions. Copy the prompts and build your own.

- **Centres:** 5,900+, refreshed from each lab weekly.
- **MCP:** public and read-only.
- **Staging:** free.
- **Key in the live example:** none. It runs on a snapshot of the data.

Try the finder this guide builds: [the live example](/examples/collection-centre-finder), or [every finder built on the API](/examples/finders).

## Build the finder

For developers with a coding assistant. The prompts are copy and paste, and the MCP gives the assistant the contract. More on the MCP: [the developer MCP](/mcp).

- [ ] **Connect the MCP**
  Where: Claude Code, Cursor, Windsurf, Codex, Claude, or any assistant that speaks MCP
  The developer MCP is public and read-only: the API reference, schemas, docs and webhook events, read by your coding assistant while it writes your code. Any tool that speaks MCP over HTTP can connect; the command below is Claude Code's, the others take the same address in their MCP settings. No terminal? In Claude on the web or desktop, add the address as a custom connector in Settings, then Connectors.
  Copy (Claude Code):

  ```
  claude mcp add --transport http eirly-dev https://mcp.eirly.health/dev/v1
  ```

  Done when: your assistant can list the endpoints tagged Collection centres (the next step asks it to).
- [ ] **Ask what exists**
  Where: your coding assistant
  Paste the first prompt as typed. The MCP answers with two endpoints, both needing authentication: GET /v1/collection-centres lists pathology collection centres, and GET /v1/collection-centres/{uuid} gets one. The MCP lists the production base URL, https://api.eirly.health/v1; build against staging first, at https://api.staging.eirly.health/v1. Both being authenticated tells you the finder's data has to come from your server, not the browser.
  Copy (Prompt 1):

  ```
  Using the Eirly MCP, list the endpoints tagged "Collection centres".
  ```

  Done when: two endpoints come back, both marked auth required.
- [ ] **Ask for the contract**
  Where: your coding assistant
  The second prompt pulls the whole endpoint: parameters, the shape of a centre, paging and sync. The answer covers the centres of the labs we work with, refreshed from each lab weekly. Search around a point with lat and lng, nearest first, each row carrying distanceKm. Filters combine with AND, and an unknown parameter or value is rejected with 400 INVALID_PARAMETER, never ignored. Opening hours come back as structured periods and as the lab's own text, with the days Monday first. Paging uses count and cursor. To keep a copy in sync, subscribe to the collection_centres.updated webhook, then pass changedSince=data.ranAt.
  Copy (Prompt 2):

  ```
  Get the full contract for GET /collection-centres. I want to know how to search
  around a point, what a centre carries, and how opening hours come back.
  ```

  Done when: the answer says rows come back nearest first with a distance in km (distanceKm), that a filter it does not know is refused (400 INVALID_PARAMETER) rather than ignored, and that hours come as times plus the lab's own wording.
- [ ] **Ask for the finder**
  Where: your coding assistant
  The build prompt describes the two panes, every control, the detail view, the map and the phone layout, so the assistant builds the whole thing in one pass: one component with Leaflet for the map, search, three selects, Apply and Clear, Near me, clustered pins, a detail view and a List / Map toggle on phones. In the demo it reads the snapshot file and works out distance itself; in a real build you pass lat and lng and read distanceKm off each row. No server? Stop at the demo: it runs on the snapshot alone, and Step 6 is only for a real build. The last line of the prompt is the one we would like you to keep.
  Copy (Prompt 3):

  ```
  Build a collection centre finder as one React page with Tailwind, in two panes.

  Left pane, 420px on desktop, full width on a phone:
  - eyebrow "Find a centre", headline "Where would you like to get tested?", one line of help text
  - a rounded search box (suburb, postcode or centre name), then three selects in a row:
    state, lab group (vendor), provider brand; an Apply button and a Clear link
  - a result count ("312 centres, nearest to Bondi Junction first") with a "Near me" link that
    uses browser geolocation and shows a grey note if permission is refused
  - a card per centre: the provider's logo (or its initials) and name, the centre name as a button, the address,
    today's hours with a "View full week" link, a dark pill "Directions" (Google Maps directions
    link) and a "Call centre" tel: link; distance in km on the right when sorted by distance
  - clicking a centre swaps the pane for its detail: back link, logo, name, address, Directions,
    phone, Copy address, the full week as a two-column table with today in bold, a note that
    public holidays and one-off closures may differ, and the date the data was last updated

  Right pane: a map with clustered pins (Leaflet with OpenStreetMap tiles; MapLibre if your
  CSP allows a worker), the selected centre highlighted, the map flying to the search area.
  On a phone, a floating List / Map toggle at the bottom.

  Data: for the demo, download https://eirly.health/data/collection-centres/all.json into the
  project and read it from there, no key needed. It is one collectionCentres array, each row as
  GET /v1/collection-centres returns it. To sort by distance from a suburb or postcode without a
  geocoder, average the coordinates of the centres in that suburb or postcode. Leave a clearly
  marked server-side function where a real build calls GET /v1/collection-centres?lat=&lng=&count=30
  and reads distanceKm off each row, so the browser never holds the key.

  At the bottom of the list: "Built on the Eirly Health collection centre API" linking to
  https://eirly.health/support/articles/build-a-collection-centre-finder-with-the-mcp
  ```

  Done when: a two-pane finder renders, the list on the left and the map on the right. Search a suburb and each card shows a distance in km; on a phone, the List / Map toggle shows the map.
- [ ] **Restyle it to your brand**
  Where: your coding assistant
  One more prompt restyles the finder without touching its behaviour. This is the one we used; swap in your own values. Six values carry the whole design (background, card, text, muted text, primary, selected pin); keep text on background above 4.5:1 contrast. Light map tiles keep pins readable, and a dark basemap wants light pins. Keep the hours note: it protects your clients.
  Copy (Prompt 4):

  ```
  Restyle it to our brand without changing the behaviour:
  - colours from our tokens: background #FAF7F0, card #FFFEFA, text #27221D, muted #4F483F,
    primary (buttons and pins) #27221D on #FAF7F0; selected pin #B8860B
  - type: our display face for the headline and centre names, the body face for everything else
  - controls as pills (fully rounded), cards with a 1px border and 10px radius, no shadows
  - pins as 18px filled circles with a 2px light border; clusters as 40px circles with the count
  - keep the map tiles light so the pins read; keep every string as it is
  ```

  Done when: the finder behaves as before and the colours, type and shapes match your brand.
- [ ] **Point it at staging**
  Where: [Settings, then API Keys; api.staging.eirly.health](https://app.staging.eirly.health/signup)
  Sign up in staging, verify your profile, create an organisation, add the test card and enable the API in Settings, then API Keys (the steps are in Try Eirly in staging). Staging is free and never charges a real card. On your server, exchange the client_id and client_secret for an access token at https://auth.staging.eirly.health/oauth/token (grant_type=client_credentials), then call api.staging.eirly.health with it and your finder reads the API directly. Keep the client_id and client_secret on your server and in your CI's secrets: a key in the browser or a repository is public.
  Copy (Test card): `4242 4242 4242 4242`
  Done when: your finder reads centres directly from the API with your staging key, which stays on your server.
- [ ] **Submit it**
  Where: [the contact page](https://eirly.health/contact)
  Built one? Send us the link through the contact page and we list it on the examples page with a credit and a link to your site. In return, keep the one line at the bottom of your finder linking back to this guide, so the next builder finds the prompts too. Production needs a plan, quoted to your volume.
  Done when: you have sent your link through the contact page.

## Common questions

### Is the live example the real API?
Not per request. The data is pulled from GET /v1/collection-centres each time this site is deployed and shipped as files, so the example holds no key; a centre's detail shows the date it was pulled. A build of your own calls the API directly with its own credentials.

### I don't write code. Can I still build one?
Yes, with an assistant that can create files in a folder, such as Claude Code, Cursor or Windsurf. Paste this whole page in (the Markdown version is this address ending in .md) and ask it to follow the steps. Stop after Step 5 and you have a working finder on the snapshot, with no account, key or server. Chat apps that cannot save files cannot run it yet.

### The map is blank on a phone. Why?
Leaflet measures the map's box when it starts. Give the map container its size in its own style (position: absolute with inset: 0, or a fixed height) rather than through a class that loads later, and call invalidateSize when a hidden map is shown.

### Do I need an Eirly account to use the MCP?
No. The developer MCP is public and read-only. You need an account and credentials to call the API itself; staging is free to build in.

### Which map library should I use?
Leaflet with OpenStreetMap tiles runs under a strict content security policy and needs no key, which is why the example uses it. MapLibre with vector tiles looks sharper and needs a worker your policy must allow, and a tile provider.

### Can I use another coding assistant?
Yes. Any assistant that speaks MCP over HTTP: Claude Code, Cursor, Windsurf and Codex take the same server address.

### Why the link back?
So the next developer finds the prompts and the contract, not only the finished finder. Keep it if you can; it is a request, not a condition of use.

### How do I keep my key safe?
Never put a client_id or client_secret in the browser, a bundle or a mobile app: exchange them for a token on your server and ship only data. Keep credentials in environment variables or your CI's encrypted secrets, and never commit them. Use one key per environment, since staging and production keys do not work in each other. Keep access tokens out of logs and URLs. Use made-up people only in staging. If you find a security problem, email support@eirly.health.

### What else can I do with the centre data?
Pass pathologyProviders so a client sees the centres their referral is for. Send a map's north, south, east and west to get what is on screen. Keep a copy in sync with the collection_centres.updated webhook and changedSince; retired centres come back marked RETIRED. Show the three nearest centres to the client's postcode when a referral is issued.

## Related

- [The finder on its own page](/examples/collection-centre-finder): The finder this guide builds, full width.
- [Maps and finders on the API](/examples/finders): Our two examples and the finders our partners run; submit yours.
- [Getting started with staging](/support/articles/try-eirly-in-staging): Account, organisation, test card, API keys.
- [Build on the pathology API](/support/articles/build-on-the-pathology-api): Credentials, first request, first referral, webhooks, production.

## Still need help?

Email support@eirly.health with what you built and where you got stuck. Never send your client_secret, access tokens or real client details.
