{"_id":"@braynexservices/nigeria-mcp-health-facility","_rev":"2-64b42f55a43606fbb9f0f872f593a619","name":"@braynexservices/nigeria-mcp-health-facility","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@braynexservices/nigeria-mcp-health-facility","version":"0.1.0","keywords":["mcp","model-context-protocol","nigeria","health","health-facilities","hospitals","grid3","geospatial"],"author":{"url":"Braynex Services Ltd — https://www.braynexservices.com","name":"Samuel Orie","email":"braynexservices@gmail.com"},"license":"MIT","_id":"@braynexservices/nigeria-mcp-health-facility@0.1.0","maintainers":[{"name":"braynexservices","email":"braynexservices@gmail.com"}],"homepage":"https://www.braynexservices.com","bugs":{"url":"https://github.com/braynexservices/nigeria-mcp/issues"},"bin":{"nigeria-mcp-health-facility":"dist/stdio.js"},"dist":{"shasum":"69dd35624876e6b574282ba51a43fe36a8182c0f","tarball":"https://registry.npmjs.org/@braynexservices/nigeria-mcp-health-facility/-/nigeria-mcp-health-facility-0.1.0.tgz","fileCount":31,"integrity":"sha512-v2m4AKFIyiKIXA5e4jf7I6LNgoYBRKgDZFbBRD6jtRMzBHUT22PHGiIfX7rZk3toewy0Si8Zn/O0GXG9W2Zgkw==","signatures":[{"sig":"MEUCIFMK7eKi9RUPmNCqOCI357dFJ436Ed9YETUseVLxndG+AiEAoExR/sRf6R5X+KzlwdjjPdFFxhqYglDx3bNlXA7WefU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":37094},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"gitHead":"4ad54144b4f3200028104555dab2c8a7f225b500","mcpName":"io.github.Braynexservices/nigeria-health-facility","private":false,"scripts":{"build":"tsc","smoke":"tsx scripts/smoke.ts","prepack":"tsc","smoke:live":"tsx scripts/live.ts","start:stdio":"tsx src/stdio.ts"},"_npmUser":{"name":"braynexservices","email":"braynexservices@gmail.com"},"repository":{"url":"git+https://github.com/braynexservices/nigeria-mcp.git","type":"git","directory":"lanes/health-facility"},"_npmVersion":"11.6.1","description":"Find Nigerian health facilities (hospitals, clinics, PHCs) near a WGS84 point, sorted by distance, as MCP tools. Backed by GRID3 NGA Health Facilities v2.0 (CC BY 4.0), keyless.","directories":{},"displayName":"Nigeria Health Facility MCP","_nodeVersion":"24.11.0","dependencies":{"zod":"^3.25.76","@braynexservices/nigeria-mcp-core":"^0.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@modelcontextprotocol/sdk":"^1.29.0"},"_npmOperationalInternal":{"tmp":"tmp/nigeria-mcp-health-facility_0.1.0_1784437912203_0.9720000722024666","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@braynexservices/nigeria-mcp-health-facility","displayName":"Nigeria Health Facility MCP","version":"0.1.1","description":"Find Nigerian health facilities (hospitals, clinics, PHCs) near a WGS84 point, sorted by distance, as MCP tools. Backed by GRID3 NGA Health Facilities v2.0 (CC BY 4.0), keyless.","homepage":"https://www.braynexservices.com","repository":{"type":"git","url":"git+https://github.com/braynexservices/nigeria-mcp.git","directory":"lanes/health-facility"},"bugs":{"url":"https://github.com/braynexservices/nigeria-mcp/issues"},"keywords":["mcp","model-context-protocol","nigeria","health","health-facilities","hospitals","grid3","geospatial"],"private":false,"publishConfig":{"access":"public"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"build":"tsc","prepack":"tsc","start:stdio":"tsx src/stdio.ts","smoke":"tsx scripts/smoke.ts","smoke:live":"tsx scripts/live.ts"},"dependencies":{"@braynexservices/nigeria-mcp-core":"^0.3.0","zod":"^3.25.76"},"devDependencies":{"@modelcontextprotocol/sdk":"^1.29.0"},"license":"MIT","author":{"name":"Samuel Orie","email":"braynexservices@gmail.com","url":"Braynex Services Ltd — https://www.braynexservices.com"},"engines":{"node":">=20"},"bin":{"nigeria-mcp-health-facility":"dist/stdio.js"},"mcpName":"io.github.Braynexservices/nigeria-health-facility","gitHead":"d90447b167e5d8821ca45aea6970f958fafae28e","_id":"@braynexservices/nigeria-mcp-health-facility@0.1.1","_nodeVersion":"24.11.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-YnP9Y0FQVE0Ikfeh42q6Cc46HjEADXHrK2zEYNgJt6zQEPE/RrTuVcJgHdAjj18GtevWWGmYzgOnQ07cYDqJ5Q==","shasum":"96b34cd198e3c0442a15c2ef980f9297a4d9a69a","tarball":"https://registry.npmjs.org/@braynexservices/nigeria-mcp-health-facility/-/nigeria-mcp-health-facility-0.1.1.tgz","fileCount":31,"unpackedSize":37135,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCSxGaTjYG2uMpS9E1bD1bM94zY18DraIaJDYMYC7eChAIhAKeEDpa636z173VdNnZhHaSVgVCPkmKn+42uEk/86vXp"}]},"_npmUser":{"name":"braynexservices","email":"braynexservices@gmail.com"},"directories":{},"maintainers":[{"name":"braynexservices","email":"braynexservices@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nigeria-mcp-health-facility_0.1.1_1784464123245_0.16629450901085985"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-19T05:11:52.073Z","modified":"2026-07-19T12:28:43.563Z","0.1.0":"2026-07-19T05:11:52.371Z","0.1.1":"2026-07-19T12:28:43.406Z"},"bugs":{"url":"https://github.com/braynexservices/nigeria-mcp/issues"},"author":{"name":"Samuel Orie","email":"braynexservices@gmail.com","url":"Braynex Services Ltd — https://www.braynexservices.com"},"license":"MIT","homepage":"https://www.braynexservices.com","keywords":["mcp","model-context-protocol","nigeria","health","health-facilities","hospitals","grid3","geospatial"],"repository":{"type":"git","url":"git+https://github.com/braynexservices/nigeria-mcp.git","directory":"lanes/health-facility"},"description":"Find Nigerian health facilities (hospitals, clinics, PHCs) near a WGS84 point, sorted by distance, as MCP tools. Backed by GRID3 NGA Health Facilities v2.0 (CC BY 4.0), keyless.","maintainers":[{"name":"braynexservices","email":"braynexservices@gmail.com"}],"readme":"# Nigeria Health Facility MCP\n\n> Nearest Nigerian health facilities (hospitals, clinics, PHCs) to a map point, exposed to AI agents as MCP tools.\n\n**Status:** 🌐 **LIVE + free (no API key)**\n**Package:** `@braynexservices/nigeria-mcp-health-facility` v0.1.0 · depends on `@braynexservices/nigeria-mcp-core`\n**Author:** Samuel Orie (Founder) · **Owner:** [Braynex Services Ltd](https://www.braynexservices.com) · **License:** [MIT](./LICENSE)\n**© 2026 Braynex Services Ltd** — MIT licensed (copyright retained; see the [`NOTICE`](./NOTICE)).\n\n---\n\n## What it does\nFinds Nigerian health facilities near a WGS84 (lat/lng) point and returns them **sorted by distance**, or fetches one facility by id. Data comes from **GRID3 NGA Health Facilities v2.0** (~51k facilities, incorporating the Nigeria Health Facility Registry) — a free, keyless public ArcGIS feature service, licensed **CC BY 4.0**. Public infrastructure data — no PII, no key.\n\n## Tools\n\n### `find_facilities_near`\n| Param | Required | Notes |\n|---|---|---|\n| `lat` | ✅ | Latitude, WGS84 (4–14 for Nigeria) |\n| `lng` | ✅ | Longitude, WGS84 (2–15 for Nigeria) |\n| `radius_km` | — | Search radius in km (default `10`, max `100`) |\n| `limit` | — | Max results (default `10`, max `50`) |\n\nReturns facilities within the radius, **sorted nearest-first**, each carrying a `distanceKm` (great-circle distance from the query point).\n\n**Example:**\n```jsonc\n// → find_facilities_near({ \"lat\": 6.44, \"lng\": 3.41, \"radius_km\": 10, \"limit\": 10 })   // live GRID3 provider (HEALTH_PROVIDER=grid3)\n\"7 facility(ies) within 10 km — nearest: Runsewe Hospital Specialist (1.83 km)\"\n// structuredContent.facilities: [\n//   { id, name:\"Runsewe Hospital Specialist\", category:\"Primary Health Center\",\n//     ownership:\"Private\", state:\"Lagos\", lga:\"Lagos Island\",\n//     lat, lng, distanceKm:1.83, source:\"grid3 (GRID3 NGA Health Facilities v2.0, CC BY 4.0)\", retrievedAt },\n//   ...\n// ]\n// structuredContent.count: 7\n```\n\n### `get_facility`\n| Param | Required | Notes |\n|---|---|---|\n| `id` | ✅ | Facility id as returned by `find_facilities_near` — a uuid `globalid` or numeric `OBJECTID` under the live provider, or a fixture id like `HF001` under the default mock |\n\n**Example:**\n```jsonc\n// → get_facility({ \"id\": \"HF001\" })   // default mock provider (\"HF001\" is a mock fixture id)\n\"Island Maternity Hospital — hospital in Eti-Osa, Lagos\"\n// structuredContent: { id, name, category, ownership, state, lga, lat, lng, distanceKm:null, source, retrievedAt }\n```\n\n> **`distanceKm` is `null` on `get_facility`** — distance only makes sense relative to a query point, so it is populated **only** on `find_facilities_near` results, never on a direct id lookup.\n\n## Configuration — `HEALTH_PROVIDER`\n\n| Value | Behaviour |\n|---|---|\n| `mock` *(default)* | Offline deterministic fixtures — for dev/eval |\n| `grid3` | **Live** data from the GRID3 NGA Health Facilities ArcGIS service (keyless). Set this for real data. |\n\nNo API key required. Override the ArcGIS layer endpoint via **`GRID3_HEALTH_URL`** (only needed if GRID3 rehosts the service).\n\n## Run it\n\n```bash\nnpm install && npm run build      # from repo root\n\nnpm run smoke      -w @braynexservices/nigeria-mcp-health-facility   # offline (mock)\nnpm run smoke:live -w @braynexservices/nigeria-mcp-health-facility   # live (real API)\n\nHEALTH_PROVIDER=grid3 npm run start:stdio -w @braynexservices/nigeria-mcp-health-facility   # serve over stdio, live\n```\n\n**MCP Inspector** (interactive GUI):\n```bash\nHEALTH_PROVIDER=grid3 npx @modelcontextprotocol/inspector node lanes/health-facility/dist/stdio.js\n```\n\n**Claude Desktop / Code** — add to your MCP config (needs Node.js ≥ 20):\n```json\n{\n  \"mcpServers\": {\n    \"nigeria-health-facility\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@braynexservices/nigeria-mcp-health-facility\"],\n      \"env\": { \"HEALTH_PROVIDER\": \"grid3\" }\n    }\n  }\n}\n```\nRunning from a clone instead: `\"command\": \"node\", \"args\": [\"/path/to/nigeria-mcp/lanes/health-facility/dist/stdio.js\"]`. Then ask, e.g., *\"Find the nearest hospitals to Lagos Island.\"*\n\n## Limits & notes\n- **Nearest is exact, not approximate.** ArcGIS returns in-radius matches in server order (by `OBJECTID`), not by proximity — so `find_facilities_near` over-fetches the in-radius set, computes great-circle (**haversine**) distance client-side, sorts nearest-first, then slices to `limit`. You get the *true* nearest facilities, each with a real `distanceKm`.\n- **Very dense radius:** the over-fetch is bounded by an internal cap, so for a radius dense enough to exceed it, the result is the nearest facilities within that cap (realistic city-scale radii return far fewer, so this is not hit in practice).\n- **`get_facility` distance is `null`** — a direct id lookup has no origin point to measure from.\n- **Nigeria only:** `lat`/`lng` are validated to Nigeria's bounding box (lat 4–14, lng 2–15).\n- **Source:** every record carries `source: \"grid3 (GRID3 NGA Health Facilities v2.0, CC BY 4.0)\"` and a fresh `retrievedAt` per call — attribution travels with the data.\n\n## Verification\n`npm run verify` (repo root) → build + all lane smokes + eval. This lane: offline smoke + `smoke:live` against the live GRID3 ArcGIS service (two live probes verified 2026-07-15), independent code-review of the distance-sort path, cached.\n","readmeFilename":"README.md"}