@pipeworx/mcp-who-gho 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pipeworx
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # mcp-who-gho
2
+
3
+ WHO GHO MCP — World Health Organization Global Health Observatory (free, no auth)
4
+
5
+ Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 965+ live data sources.
6
+
7
+ ## Tools
8
+
9
+ | Tool | Description |
10
+ |------|-------------|
11
+
12
+ ## Quick Start
13
+
14
+ Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
15
+
16
+ ```json
17
+ {
18
+ "mcpServers": {
19
+ "who-gho": {
20
+ "url": "https://gateway.pipeworx.io/who-gho/mcp"
21
+ }
22
+ }
23
+ }
24
+ ```
25
+
26
+ Or connect to the full Pipeworx gateway for access to all 965+ data sources:
27
+
28
+ ```json
29
+ {
30
+ "mcpServers": {
31
+ "pipeworx": {
32
+ "url": "https://gateway.pipeworx.io/mcp"
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ ## Using with ask_pipeworx
39
+
40
+ Instead of calling tools directly, you can ask questions in plain English:
41
+
42
+ ```
43
+ ask_pipeworx({ question: "your question about Who Gho data" })
44
+ ```
45
+
46
+ The gateway picks the right tool and fills the arguments automatically.
47
+
48
+ ## More
49
+
50
+ - [All tools and guides](https://github.com/pipeworx-io/examples)
51
+ - [pipeworx.io](https://pipeworx.io)
52
+
53
+ ## License
54
+
55
+ MIT
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@pipeworx/mcp-who-gho",
3
+ "version": "0.1.0",
4
+ "description": "WHO GHO MCP — World Health Organization Global Health Observatory (free, no auth)",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "types": "src/index.ts",
8
+ "keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "who-gho"],
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/pipeworx-io/mcp-who-gho"
13
+ },
14
+ "scripts": {
15
+ "typecheck": "tsc --noEmit"
16
+ },
17
+ "devDependencies": {
18
+ "typescript": "^5.7.0"
19
+ }
20
+ }
package/server.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.pipeworx-io/who-gho",
4
+ "title": "Who Gho",
5
+ "description": "WHO GHO MCP — World Health Organization Global Health Observatory (free, no auth)",
6
+ "version": "0.1.0",
7
+ "websiteUrl": "https://pipeworx.io/packs/who-gho",
8
+ "repository": {
9
+ "url": "https://github.com/pipeworx-io/mcp-who-gho",
10
+ "source": "github"
11
+ },
12
+ "remotes": [
13
+ {
14
+ "type": "streamable-http",
15
+ "url": "https://gateway.pipeworx.io/who-gho/mcp"
16
+ }
17
+ ]
18
+ }
package/src/index.ts ADDED
@@ -0,0 +1,218 @@
1
+ interface McpToolDefinition {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: 'object';
6
+ properties: Record<string, unknown>;
7
+ required?: string[];
8
+ };
9
+ }
10
+
11
+ interface McpToolExport {
12
+ tools: McpToolDefinition[];
13
+ callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
14
+ meter?: { credits: number };
15
+ cost?: Record<string, unknown>;
16
+ provider?: string;
17
+ }
18
+
19
+ /**
20
+ * WHO GHO MCP — World Health Organization Global Health Observatory (free, no auth)
21
+ *
22
+ * Tools:
23
+ * - get_indicators: search/list health indicators
24
+ * - get_data: get data values for a specific indicator, optionally by country and year
25
+ * - list_countries: list all countries with ISO codes
26
+ */
27
+
28
+
29
+ const BASE = 'https://ghoapi.azureedge.net/api';
30
+
31
+ // ── Types ─────────────────────────────────────────────────────────────
32
+
33
+ type GHOIndicator = {
34
+ IndicatorCode?: string | null;
35
+ IndicatorName?: string | null;
36
+ Language?: string | null;
37
+ };
38
+
39
+ type GHODataValue = {
40
+ Id?: number | null;
41
+ IndicatorCode?: string | null;
42
+ SpatialDim?: string | null;
43
+ SpatialDimType?: string | null;
44
+ TimeDim?: string | null;
45
+ TimeDimType?: string | null;
46
+ Dim1?: string | null;
47
+ Dim1Type?: string | null;
48
+ Dim2?: string | null;
49
+ Dim2Type?: string | null;
50
+ Dim3?: string | null;
51
+ Dim3Type?: string | null;
52
+ DataSourceDimType?: string | null;
53
+ DataSourceDim?: string | null;
54
+ Value?: string | null;
55
+ NumericValue?: number | null;
56
+ Low?: string | null;
57
+ High?: string | null;
58
+ Comments?: string | null;
59
+ Date?: string | null;
60
+ TimeDimensionValue?: string | null;
61
+ TimeDimensionBegin?: string | null;
62
+ TimeDimensionEnd?: string | null;
63
+ };
64
+
65
+ type GHOCountry = {
66
+ Code?: string | null;
67
+ Title?: string | null;
68
+ Dimension?: string | null;
69
+ ParentDimension?: string | null;
70
+ ParentCode?: string | null;
71
+ ParentTitle?: string | null;
72
+ };
73
+
74
+ type GHOResponse<T> = {
75
+ value: T[];
76
+ };
77
+
78
+ // ── Tool definitions ──────────────────────────────────────────────────
79
+
80
+ const tools: McpToolExport['tools'] = [
81
+ {
82
+ name: 'get_indicators',
83
+ description:
84
+ 'Search or list WHO Global Health Observatory indicators. Returns indicator codes and names. Use the indicator code with get_data to retrieve actual values. Example: get_indicators("life expectancy") or get_indicators("malaria")',
85
+ inputSchema: {
86
+ type: 'object',
87
+ properties: {
88
+ query: { type: 'string', description: 'Optional search keyword to filter indicators (e.g., "mortality", "tuberculosis"). Omit to list all.' },
89
+ },
90
+ },
91
+ },
92
+ {
93
+ name: 'get_data',
94
+ description:
95
+ 'Get health data values for a WHO indicator code. Returns numeric values by country and year. Example: get_data("WHOSIS_000001", country="USA", year="2020"). Use get_indicators first to find the indicator code.',
96
+ inputSchema: {
97
+ type: 'object',
98
+ properties: {
99
+ indicator: { type: 'string', description: 'WHO indicator code (e.g., "WHOSIS_000001" for life expectancy)' },
100
+ country: { type: 'string', description: 'ISO 3-letter country code (e.g., "USA", "GBR", "JPN")' },
101
+ year: { type: 'string', description: 'Year to filter by (e.g., "2020")' },
102
+ },
103
+ required: ['indicator'],
104
+ },
105
+ },
106
+ {
107
+ name: 'list_countries',
108
+ description:
109
+ 'Return all WHO-recognized countries with their 3-letter ISO code, display name, and parent region code. Use the ISO codes returned here as the country parameter in get_data (e.g., "USA", "GBR", "JPN").',
110
+ inputSchema: {
111
+ type: 'object',
112
+ properties: {},
113
+ },
114
+ },
115
+ ];
116
+
117
+ // ── callTool dispatcher ───────────────────────────────────────────────
118
+
119
+ async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
120
+ switch (name) {
121
+ case 'get_indicators':
122
+ return getIndicators(args.query as string | undefined);
123
+ case 'get_data':
124
+ return getData(
125
+ args.indicator as string,
126
+ args.country as string | undefined,
127
+ args.year as string | undefined,
128
+ );
129
+ case 'list_countries':
130
+ return listCountries();
131
+ default:
132
+ throw new Error(`Unknown tool: ${name}`);
133
+ }
134
+ }
135
+
136
+ // ── Tool implementations ─────────────────────────────────────────────
137
+
138
+ async function getIndicators(query?: string) {
139
+ let url = `${BASE}/Indicator`;
140
+ if (query) {
141
+ url += `?$filter=contains(tolower(IndicatorName),tolower('${query.replace(/'/g, "''")}'))`;
142
+ }
143
+
144
+ const res = await fetch(url, { headers: { Accept: 'application/json' } });
145
+ if (!res.ok) throw new Error(`WHO GHO API error: ${res.status}`);
146
+
147
+ const data = (await res.json()) as GHOResponse<GHOIndicator>;
148
+
149
+ const indicators = data.value
150
+ .filter((i) => i.Language === 'EN' || !i.Language)
151
+ .map((i) => ({
152
+ code: i.IndicatorCode ?? null,
153
+ name: i.IndicatorName ?? null,
154
+ }));
155
+
156
+ return {
157
+ total: indicators.length,
158
+ indicators: indicators.slice(0, 50),
159
+ };
160
+ }
161
+
162
+ async function getData(indicator: string, country?: string, year?: string) {
163
+ let url = `${BASE}/${indicator}`;
164
+ const filters: string[] = [];
165
+
166
+ if (country) filters.push(`SpatialDim eq '${country}'`);
167
+ if (year) filters.push(`TimeDim eq '${year}'`);
168
+
169
+ if (filters.length > 0) {
170
+ url += `?$filter=${filters.join(' and ')}`;
171
+ }
172
+
173
+ const res = await fetch(url, { headers: { Accept: 'application/json' } });
174
+ if (!res.ok) throw new Error(`WHO GHO API error (${res.status}): indicator ${indicator} not found`);
175
+
176
+ const data = (await res.json()) as GHOResponse<GHODataValue>;
177
+
178
+ const values = data.value.map((v) => ({
179
+ country: v.SpatialDim ?? null,
180
+ year: v.TimeDim ?? null,
181
+ value: v.NumericValue ?? v.Value ?? null,
182
+ low: v.Low ?? null,
183
+ high: v.High ?? null,
184
+ dimension: v.Dim1 ?? null,
185
+ dimension_type: v.Dim1Type ?? null,
186
+ comments: v.Comments ?? null,
187
+ }));
188
+
189
+ return {
190
+ indicator,
191
+ total: values.length,
192
+ returned: Math.min(values.length, 100),
193
+ data: values.slice(0, 100),
194
+ };
195
+ }
196
+
197
+ async function listCountries() {
198
+ const res = await fetch(`${BASE}/DIMENSION/COUNTRY/DimensionValues`, {
199
+ headers: { Accept: 'application/json' },
200
+ });
201
+ if (!res.ok) throw new Error(`WHO GHO API error: ${res.status}`);
202
+
203
+ const data = (await res.json()) as GHOResponse<GHOCountry>;
204
+
205
+ const countries = data.value.map((c) => ({
206
+ code: c.Code ?? null,
207
+ name: c.Title ?? null,
208
+ parent_code: c.ParentCode ?? null,
209
+ parent_name: c.ParentTitle ?? null,
210
+ }));
211
+
212
+ return {
213
+ total: countries.length,
214
+ countries,
215
+ };
216
+ }
217
+
218
+ export default { tools, callTool, meter: { credits: 1 } } satisfies McpToolExport;
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "outDir": "dist",
10
+ "rootDir": "src",
11
+ "declaration": true
12
+ },
13
+ "include": ["src"]
14
+ }