@omophub/omophub-mcp 1.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.
Files changed (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +301 -0
  3. package/dist/client/api.d.ts +10 -0
  4. package/dist/client/api.d.ts.map +1 -0
  5. package/dist/client/api.js +168 -0
  6. package/dist/client/api.js.map +1 -0
  7. package/dist/client/types.d.ts +86 -0
  8. package/dist/client/types.d.ts.map +1 -0
  9. package/dist/client/types.js +2 -0
  10. package/dist/client/types.js.map +1 -0
  11. package/dist/formatters/index.d.ts +26 -0
  12. package/dist/formatters/index.d.ts.map +1 -0
  13. package/dist/formatters/index.js +197 -0
  14. package/dist/formatters/index.js.map +1 -0
  15. package/dist/health.d.ts +4 -0
  16. package/dist/health.d.ts.map +1 -0
  17. package/dist/health.js +39 -0
  18. package/dist/health.js.map +1 -0
  19. package/dist/index.d.ts +14 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +118 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/prompts/index.d.ts +3 -0
  24. package/dist/prompts/index.d.ts.map +1 -0
  25. package/dist/prompts/index.js +56 -0
  26. package/dist/prompts/index.js.map +1 -0
  27. package/dist/resources/index.d.ts +4 -0
  28. package/dist/resources/index.d.ts.map +1 -0
  29. package/dist/resources/index.js +86 -0
  30. package/dist/resources/index.js.map +1 -0
  31. package/dist/server.d.ts +3 -0
  32. package/dist/server.d.ts.map +1 -0
  33. package/dist/server.js +31 -0
  34. package/dist/server.js.map +1 -0
  35. package/dist/tools/concepts.d.ts +4 -0
  36. package/dist/tools/concepts.d.ts.map +1 -0
  37. package/dist/tools/concepts.js +89 -0
  38. package/dist/tools/concepts.js.map +1 -0
  39. package/dist/tools/hierarchy.d.ts +4 -0
  40. package/dist/tools/hierarchy.d.ts.map +1 -0
  41. package/dist/tools/hierarchy.js +98 -0
  42. package/dist/tools/hierarchy.js.map +1 -0
  43. package/dist/tools/index.d.ts +6 -0
  44. package/dist/tools/index.d.ts.map +1 -0
  45. package/dist/tools/index.js +6 -0
  46. package/dist/tools/index.js.map +1 -0
  47. package/dist/tools/mappings.d.ts +4 -0
  48. package/dist/tools/mappings.d.ts.map +1 -0
  49. package/dist/tools/mappings.js +39 -0
  50. package/dist/tools/mappings.js.map +1 -0
  51. package/dist/tools/search.d.ts +4 -0
  52. package/dist/tools/search.d.ts.map +1 -0
  53. package/dist/tools/search.js +68 -0
  54. package/dist/tools/search.js.map +1 -0
  55. package/dist/tools/vocabularies.d.ts +4 -0
  56. package/dist/tools/vocabularies.d.ts.map +1 -0
  57. package/dist/tools/vocabularies.js +45 -0
  58. package/dist/tools/vocabularies.js.map +1 -0
  59. package/dist/transports/http.d.ts +8 -0
  60. package/dist/transports/http.d.ts.map +1 -0
  61. package/dist/transports/http.js +66 -0
  62. package/dist/transports/http.js.map +1 -0
  63. package/dist/utils/auth.d.ts +2 -0
  64. package/dist/utils/auth.d.ts.map +1 -0
  65. package/dist/utils/auth.js +9 -0
  66. package/dist/utils/auth.js.map +1 -0
  67. package/dist/utils/cache.d.ts +15 -0
  68. package/dist/utils/cache.d.ts.map +1 -0
  69. package/dist/utils/cache.js +52 -0
  70. package/dist/utils/cache.js.map +1 -0
  71. package/dist/utils/errors.d.ts +10 -0
  72. package/dist/utils/errors.d.ts.map +1 -0
  73. package/dist/utils/errors.js +95 -0
  74. package/dist/utils/errors.js.map +1 -0
  75. package/dist/utils/logger.d.ts +18 -0
  76. package/dist/utils/logger.d.ts.map +1 -0
  77. package/dist/utils/logger.js +24 -0
  78. package/dist/utils/logger.js.map +1 -0
  79. package/dist/version.d.ts +2 -0
  80. package/dist/version.d.ts.map +1 -0
  81. package/dist/version.js +5 -0
  82. package/dist/version.js.map +1 -0
  83. package/package.json +72 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 OMOPHub
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,301 @@
1
+ <h1>OMOPHub MCP Server</h1>
2
+
3
+ <p>
4
+ <strong>Medical vocabularies for AI agents.</strong><br/>
5
+ Search, map, and navigate 5M+ OMOP concepts: SNOMED CT, ICD-10, RxNorm, LOINC, and more. Directly from Claude, Cursor, VS Code, or any MCP-compatible client.
6
+ </p>
7
+
8
+ <p>
9
+ <a href="https://www.npmjs.com/package/@omophub/omophub-mcp"><img src="https://img.shields.io/npm/v/@omophub/omophub-mcp?style=flat-square&color=cb3837&label=npm" alt="npm version" /></a>
10
+ <a href="https://www.npmjs.com/package/@omophub/omophub-mcp"><img src="https://img.shields.io/npm/dm/@omophub/omophub-mcp?style=flat-square&color=blue" alt="npm downloads" /></a>
11
+ <a href="https://github.com/OMOPHub/omophub-mcp/blob/main/LICENSE"><img src="https://img.shields.io/github/license/OMOPHub/omophub-mcp?style=flat-square" alt="License" /></a>
12
+ <a href="https://github.com/OMOPHub/omophub-mcp"><img src="https://img.shields.io/badge/TypeScript-5.x-3178c6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript" /></a>
13
+ <a href="https://modelcontextprotocol.io"><img src="https://img.shields.io/badge/MCP-compatible-green?style=flat-square" alt="MCP Compatible" /></a>
14
+ </p>
15
+
16
+ <p>
17
+ <a href="#quick-start">Quick Start</a> ·
18
+ <a href="#available-tools">Tools</a> ·
19
+ <a href="#example-prompts">Examples</a> ·
20
+ <a href="https://docs.omophub.com">Docs</a> ·
21
+ <a href="https://omophub.com">Website</a>
22
+ </p>
23
+
24
+ ---
25
+
26
+ ## Why OMOPHub MCP?
27
+
28
+ Working with medical vocabularies today means downloading multi-gigabyte CSV files, loading them into a local database, and writing SQL to find what you need. Every time.
29
+
30
+ **OMOPHub MCP Server gives your AI assistant instant access to the entire OHDSI ATHENA vocabulary**. No database setup, no CSV wrangling, no context switching. Just ask.
31
+
32
+ ```
33
+ You: "Map ICD-10 code E11.9 to SNOMED"
34
+
35
+ Claude: Found it - E11.9 (Type 2 diabetes mellitus without complications)
36
+ maps to SNOMED concept 201826 (Type 2 diabetes mellitus)
37
+ via standard 'Maps to' relationship.
38
+ ```
39
+
40
+ **Use cases:**
41
+ - **Concept lookup** - Find OMOP concept IDs for clinical terms in seconds
42
+ - **Cross-vocabulary mapping** - Map between ICD-10, SNOMED, RxNorm, LOINC, and 100+ vocabularies
43
+ - **Hierarchy navigation** - Explore ancestors and descendants for phenotype definitions
44
+ - **Concept set building** - Let your AI agent assemble complete concept sets for cohort definitions
45
+ - **Code validation** - Verify medical codes and check their standard mappings
46
+
47
+ ---
48
+
49
+ ## Quick Start
50
+
51
+ ### 1. Get an API Key
52
+
53
+ Sign up at [omophub.com](https://omophub.com) → create an API key in your [dashboard](https://omophub.com/dashboard/api-keys).
54
+
55
+ ### 2. Add to Your AI Client
56
+
57
+ <details open>
58
+ <summary><strong>Claude Desktop</strong></summary>
59
+
60
+ Open Claude Desktop settings > "Developer" tab > "Edit Config". Add to `claude_desktop_config.json`:
61
+
62
+ ```json
63
+ {
64
+ "mcpServers": {
65
+ "omophub": {
66
+ "command": "npx",
67
+ "args": ["-y", "@omophub/omophub-mcp"],
68
+ "env": {
69
+ "OMOPHUB_API_KEY": "oh_your_key_here"
70
+ }
71
+ }
72
+ }
73
+ }
74
+ ```
75
+
76
+ </details>
77
+
78
+ <details>
79
+ <summary><strong>Claude Code</strong></summary>
80
+
81
+ ```bash
82
+ claude mcp add omophub -- npx -y @omophub/omophub-mcp
83
+ # Then set OMOPHUB_API_KEY in your environment
84
+ ```
85
+
86
+ </details>
87
+
88
+ <details>
89
+ <summary><strong>Cursor</strong></summary>
90
+
91
+ Open the command palette and choose "Cursor Settings" > "MCP" > "Add new global MCP server". Add to `.cursor/mcp.json`:
92
+
93
+ ```json
94
+ {
95
+ "mcpServers": {
96
+ "omophub": {
97
+ "command": "npx",
98
+ "args": ["-y", "@omophub/omophub-mcp"],
99
+ "env": {
100
+ "OMOPHUB_API_KEY": "oh_your_key_here"
101
+ }
102
+ }
103
+ }
104
+ }
105
+ ```
106
+
107
+ </details>
108
+
109
+ <details>
110
+ <summary><strong>VS Code</strong></summary>
111
+
112
+ Add to `.vscode/mcp.json`:
113
+
114
+ ```json
115
+ {
116
+ "servers": {
117
+ "omophub": {
118
+ "command": "npx",
119
+ "args": ["-y", "@omophub/omophub-mcp"],
120
+ "env": {
121
+ "OMOPHUB_API_KEY": "oh_your_key_here"
122
+ }
123
+ }
124
+ }
125
+ }
126
+ ```
127
+
128
+ </details>
129
+
130
+ <details>
131
+ <summary><strong>Streamable HTTP (Remote / Hosted)</strong></summary>
132
+
133
+ Run the MCP server as an HTTP service that clients connect to via URL:
134
+
135
+ ```bash
136
+ # Start HTTP server on port 3100
137
+ npx -y @omophub/omophub-mcp --transport=http --port=3100 --api-key=oh_your_key_here
138
+
139
+ # MCP endpoint: http://localhost:3100/mcp
140
+ # Health check: http://localhost:3100/health
141
+ ```
142
+
143
+ Connect MCP clients to the `/mcp` endpoint. Useful for centralized deployments where multiple AI agents share one server instance.
144
+
145
+ </details>
146
+
147
+ <details>
148
+ <summary><strong>Docker</strong></summary>
149
+
150
+ ```bash
151
+ # HTTP mode (default in Docker) — serves MCP on port 3100
152
+ docker run -e OMOPHUB_API_KEY=oh_your_key_here -p 3100:3100 omophub/omophub-mcp
153
+
154
+ # Stdio mode (for piping)
155
+ docker run -i -e OMOPHUB_API_KEY=oh_your_key_here omophub/omophub-mcp --transport=stdio
156
+ ```
157
+
158
+ </details>
159
+
160
+ ### 3. Start Asking
161
+
162
+ > "What's the OMOP concept ID for type 2 diabetes?"
163
+
164
+ > "Map ICD-10 code E11.9 to SNOMED"
165
+
166
+ > "Show me all descendants of Diabetes mellitus in SNOMED"
167
+
168
+ ---
169
+
170
+ ## Available Tools
171
+
172
+ | Tool | What it does |
173
+ | :--- | :--- |
174
+ | `search_concepts` | Search for medical concepts by name or clinical term across all vocabularies |
175
+ | `get_concept` | Get detailed info about a specific OMOP concept by `concept_id` |
176
+ | `get_concept_by_code` | Look up a concept using a vocabulary-specific code (e.g., ICD-10 `E11.9`) |
177
+ | `map_concept` | Map a concept to equivalent concepts in other vocabularies |
178
+ | `get_hierarchy` | Navigate concept hierarchy - ancestors, descendants, or both |
179
+ | `list_vocabularies` | List available medical vocabularies with statistics |
180
+
181
+ ### Resources
182
+
183
+ | URI | Description |
184
+ | :--- | :--- |
185
+ | `omophub://vocabularies` | Full vocabulary catalog with statistics |
186
+ | `omophub://vocabularies/{vocabulary_id}` | Details for a specific vocabulary |
187
+
188
+ ### Prompts
189
+
190
+ | Prompt | Description |
191
+ | :--- | :--- |
192
+ | `phenotype-concept-set` | Guided workflow to build a concept set for a clinical phenotype |
193
+ | `code-lookup` | Look up and validate a medical code with mappings and hierarchy |
194
+
195
+ ---
196
+
197
+ ## Example Prompts
198
+
199
+ **Find a concept →** `search_concepts`
200
+ > "Search for metformin in RxNorm"
201
+
202
+ **Cross-vocabulary mapping →** `map_concept`
203
+ > "I have SNOMED concept 201826 - what's the ICD-10 code?"
204
+
205
+ **Build a concept set →** `search_concepts` → `get_hierarchy` → `map_concept`
206
+ > "Help me build a concept set for Type 2 diabetes including all descendants"
207
+
208
+ **Validate a code →** `get_concept_by_code` → `map_concept`
209
+ > "Is ICD-10 code E11.9 valid? What does it map to in SNOMED?"
210
+
211
+ ---
212
+
213
+ ## Configuration
214
+
215
+ ### Environment Variables
216
+
217
+ | Variable | Required | Description |
218
+ | :--- | :---: | :--- |
219
+ | `OMOPHUB_API_KEY` | ✅ | Your OMOPHub API key |
220
+ | `OMOPHUB_BASE_URL` | | Custom API base URL (default: `https://api.omophub.com/v1`) |
221
+ | `OMOPHUB_LOG_LEVEL` | | `debug` · `info` · `warn` · `error` (default: `info`) |
222
+ | `OMOPHUB_ANALYTICS_OPTOUT` | | Set to `true` to disable analytics headers |
223
+ | `MCP_TRANSPORT` | | `stdio` (default) or `http` |
224
+ | `MCP_PORT` | | HTTP server port (default: `3100`, only used with `http` transport) |
225
+ | `HEALTH_PORT` | | Port for standalone health endpoint in stdio mode (default: disabled) |
226
+
227
+ ### CLI Arguments
228
+
229
+ ```bash
230
+ # Stdio mode (default)
231
+ npx @omophub/omophub-mcp --api-key=oh_your_key --base-url=https://custom.api.com/v1
232
+
233
+ # HTTP mode
234
+ npx @omophub/omophub-mcp --transport=http --port=3100 --api-key=oh_your_key
235
+
236
+ # Stdio mode with standalone health endpoint
237
+ npx @omophub/omophub-mcp --api-key=oh_your_key --health-port=8080
238
+ ```
239
+
240
+ ### Health Endpoint (Docker / Kubernetes)
241
+
242
+ In **HTTP mode**, the health endpoint is available at `/health` on the same port as the MCP endpoint:
243
+
244
+ ```bash
245
+ npx @omophub/omophub-mcp --transport=http --port=3100 --api-key=oh_your_key
246
+ curl http://localhost:3100/health
247
+ # → {"status":"ok","version":"1.1.0","uptime_seconds":42}
248
+ ```
249
+
250
+ In **stdio mode**, use `--health-port` for a standalone health endpoint:
251
+
252
+ ```bash
253
+ HEALTH_PORT=8080 OMOPHUB_API_KEY=oh_your_key npx @omophub/omophub-mcp
254
+ curl http://localhost:8080/health
255
+ ```
256
+
257
+ The Docker image defaults to HTTP mode on port 3100 with health checks built in.
258
+
259
+ ---
260
+
261
+ ## Development
262
+
263
+ ```bash
264
+ git clone https://github.com/OMOPHub/omophub-mcp.git
265
+ cd omophub-mcp
266
+ npm install
267
+ npm run build
268
+ npm test
269
+ ```
270
+
271
+ Run locally:
272
+
273
+ ```bash
274
+ OMOPHUB_API_KEY=oh_your_key npx tsx src/index.ts
275
+ ```
276
+
277
+ ---
278
+
279
+ ## Troubleshooting
280
+
281
+ | Error | Solution |
282
+ | :--- | :--- |
283
+ | `API key required` | Set `OMOPHUB_API_KEY` in your environment or MCP config |
284
+ | `Authentication failed` | API key may be invalid or expired - [generate a new one](https://omophub.com/dashboard/api-keys) |
285
+ | `Rate limit exceeded` | Automatic retries are built in. For higher limits, [upgrade your plan](https://omophub.com/dashboard/billing) |
286
+ | Tools not appearing | Restart your AI client, verify `npx @omophub/omophub-mcp` runs without errors, check config path |
287
+
288
+ ---
289
+
290
+ ## Links
291
+
292
+ - [Documentation](https://docs.omophub.com)
293
+ - [Get an API Key](https://omophub.com/dashboard/api-keys)
294
+ - [Python SDK](https://github.com/OMOPHub/omophub-python)
295
+ - [Community & Support](https://github.com/OMOPHub/omophub-mcp/issues)
296
+
297
+ ---
298
+
299
+ ## License
300
+
301
+ MIT - see [LICENSE](LICENSE)
@@ -0,0 +1,10 @@
1
+ import type { ApiResponse } from './types.js';
2
+ export declare class OmopHubClient {
3
+ private readonly baseUrl;
4
+ private readonly apiKey;
5
+ private readonly analyticsOptout;
6
+ constructor(apiKey: string, baseUrl?: string);
7
+ request<T>(path: string, params?: Record<string, string | number | boolean | undefined>, toolName?: string): Promise<ApiResponse<T>>;
8
+ post<T>(path: string, body: Record<string, unknown>, toolName?: string): Promise<ApiResponse<T>>;
9
+ }
10
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/client/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAkB9C,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAU;gBAE9B,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAUtC,OAAO,CAAC,CAAC,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,EAC9D,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAqFpB,IAAI,CAAC,CAAC,EACV,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CA0E3B"}
@@ -0,0 +1,168 @@
1
+ import { OmopHubApiError } from '../utils/errors.js';
2
+ import { logger } from '../utils/logger.js';
3
+ import { VERSION } from '../version.js';
4
+ const MAX_RETRIES = 2;
5
+ /** Parse Retry-After header (seconds or HTTP-date), returning wait time in ms. */
6
+ function parseRetryAfter(header, fallbackMs) {
7
+ const seconds = parseInt(header, 10);
8
+ if (!Number.isNaN(seconds) && seconds >= 0)
9
+ return seconds * 1000;
10
+ const date = Date.parse(header);
11
+ if (!Number.isNaN(date)) {
12
+ const delayMs = date - Date.now();
13
+ return delayMs > 0 ? delayMs : fallbackMs;
14
+ }
15
+ return fallbackMs;
16
+ }
17
+ export class OmopHubClient {
18
+ baseUrl;
19
+ apiKey;
20
+ analyticsOptout;
21
+ constructor(apiKey, baseUrl) {
22
+ this.apiKey = apiKey;
23
+ this.baseUrl = (baseUrl ||
24
+ process.env.OMOPHUB_BASE_URL ||
25
+ 'https://api.omophub.com/v1').replace(/\/$/, '');
26
+ this.analyticsOptout = process.env.OMOPHUB_ANALYTICS_OPTOUT === 'true';
27
+ }
28
+ async request(path, params, toolName) {
29
+ const url = new URL(`${this.baseUrl}${path}`);
30
+ if (params) {
31
+ for (const [key, value] of Object.entries(params)) {
32
+ if (value !== undefined && value !== '') {
33
+ url.searchParams.set(key, String(value));
34
+ }
35
+ }
36
+ }
37
+ const headers = {
38
+ Authorization: `Bearer ${this.apiKey}`,
39
+ 'User-Agent': `omophub-mcp/${VERSION}`,
40
+ Accept: 'application/json',
41
+ };
42
+ if (!this.analyticsOptout) {
43
+ headers['X-MCP-Client'] = 'true';
44
+ if (toolName) {
45
+ headers['X-MCP-Tool'] = toolName;
46
+ }
47
+ }
48
+ let lastError = null;
49
+ for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
50
+ const start = Date.now();
51
+ try {
52
+ const response = await fetch(url.toString(), {
53
+ headers,
54
+ signal: AbortSignal.timeout(30_000),
55
+ });
56
+ const duration = Date.now() - start;
57
+ logger.debug('API request', {
58
+ tool_name: toolName,
59
+ api_path: path,
60
+ duration_ms: duration,
61
+ status: response.status,
62
+ });
63
+ if (response.status === 429 && attempt < MAX_RETRIES) {
64
+ const retryAfter = response.headers.get('Retry-After');
65
+ const fallbackMs = 1000 * (attempt + 1);
66
+ const waitMs = retryAfter ? parseRetryAfter(retryAfter, fallbackMs) : fallbackMs;
67
+ logger.warn(`Rate limited, retrying in ${waitMs}ms`, {
68
+ tool_name: toolName,
69
+ api_path: path,
70
+ });
71
+ await new Promise((resolve) => setTimeout(resolve, waitMs));
72
+ continue;
73
+ }
74
+ if (!response.ok) {
75
+ const body = await response.text();
76
+ let message;
77
+ try {
78
+ const parsed = JSON.parse(body);
79
+ message = parsed.error?.message || parsed.message || body;
80
+ }
81
+ catch {
82
+ message = body || response.statusText;
83
+ }
84
+ throw new OmopHubApiError(response.status, message, path);
85
+ }
86
+ return (await response.json());
87
+ }
88
+ catch (error) {
89
+ if (error instanceof OmopHubApiError)
90
+ throw error;
91
+ lastError = error instanceof Error ? error : new Error(String(error));
92
+ if (attempt < MAX_RETRIES) {
93
+ logger.warn(`Request failed, retrying (attempt ${attempt + 1})`, {
94
+ tool_name: toolName,
95
+ api_path: path,
96
+ });
97
+ await new Promise((resolve) => setTimeout(resolve, 1000 * (attempt + 1)));
98
+ }
99
+ }
100
+ }
101
+ throw lastError || new Error('Request failed after retries');
102
+ }
103
+ async post(path, body, toolName) {
104
+ const url = `${this.baseUrl}${path}`;
105
+ const headers = {
106
+ Authorization: `Bearer ${this.apiKey}`,
107
+ 'User-Agent': `omophub-mcp/${VERSION}`,
108
+ 'Content-Type': 'application/json',
109
+ Accept: 'application/json',
110
+ };
111
+ if (!this.analyticsOptout) {
112
+ headers['X-MCP-Client'] = 'true';
113
+ if (toolName) {
114
+ headers['X-MCP-Tool'] = toolName;
115
+ }
116
+ }
117
+ const lastError = null;
118
+ for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
119
+ const start = Date.now();
120
+ try {
121
+ const response = await fetch(url, {
122
+ method: 'POST',
123
+ headers,
124
+ body: JSON.stringify(body),
125
+ signal: AbortSignal.timeout(30_000),
126
+ });
127
+ logger.debug('API POST request', {
128
+ tool_name: toolName,
129
+ api_path: path,
130
+ duration_ms: Date.now() - start,
131
+ status: response.status,
132
+ });
133
+ if (response.status === 429 && attempt < MAX_RETRIES) {
134
+ const retryAfter = response.headers.get('Retry-After');
135
+ const fallbackMs = 1000 * (attempt + 1);
136
+ const waitMs = retryAfter ? parseRetryAfter(retryAfter, fallbackMs) : fallbackMs;
137
+ logger.warn(`Rate limited, retrying in ${waitMs}ms`, {
138
+ tool_name: toolName,
139
+ api_path: path,
140
+ });
141
+ await new Promise((resolve) => setTimeout(resolve, waitMs));
142
+ continue;
143
+ }
144
+ if (!response.ok) {
145
+ const text = await response.text();
146
+ let message;
147
+ try {
148
+ const parsed = JSON.parse(text);
149
+ message = parsed.error?.message || parsed.message || text;
150
+ }
151
+ catch {
152
+ message = text || response.statusText;
153
+ }
154
+ throw new OmopHubApiError(response.status, message, path);
155
+ }
156
+ return (await response.json());
157
+ }
158
+ catch (error) {
159
+ if (error instanceof OmopHubApiError)
160
+ throw error;
161
+ // Do not retry POST on network errors — could cause duplicate mutations
162
+ throw error instanceof Error ? error : new Error(String(error));
163
+ }
164
+ }
165
+ throw lastError || new Error('POST request failed after retries');
166
+ }
167
+ }
168
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/client/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,kFAAkF;AAClF,SAAS,eAAe,CAAC,MAAc,EAAE,UAAkB;IACzD,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,OAAO,IAAI,CAAC;QAAE,OAAO,OAAO,GAAG,IAAI,CAAC;IAElE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAClC,OAAO,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;IAC5C,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,OA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AAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAClE,CAAC;QACH,CAAC;QAED,MAAM,SAAS,IAAI,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACpE,CAAC;CACF"}
@@ -0,0 +1,86 @@
1
+ export interface PaginationMeta {
2
+ page: number;
3
+ page_size: number;
4
+ total_items: number;
5
+ total_pages: number;
6
+ has_next: boolean;
7
+ has_previous: boolean;
8
+ }
9
+ export interface ApiResponse<T> {
10
+ success: boolean;
11
+ data: T;
12
+ meta?: {
13
+ pagination?: PaginationMeta;
14
+ execution_time_ms?: number;
15
+ version?: string;
16
+ };
17
+ }
18
+ export interface Concept {
19
+ concept_id: number;
20
+ concept_name: string;
21
+ domain_id: string;
22
+ vocabulary_id: string;
23
+ concept_class_id: string;
24
+ standard_concept: string | null;
25
+ concept_code: string;
26
+ valid_start_date?: string;
27
+ valid_end_date?: string;
28
+ invalid_reason?: string | null;
29
+ synonyms?: string[];
30
+ }
31
+ export interface SearchResult extends Concept {
32
+ score?: number;
33
+ }
34
+ export interface Mapping {
35
+ concept_id: number;
36
+ concept_name: string;
37
+ vocabulary_id: string;
38
+ concept_code: string;
39
+ domain_id: string;
40
+ standard_concept: string | null;
41
+ concept_class_id: string;
42
+ relationship_id: string;
43
+ relationship_name?: string;
44
+ }
45
+ export interface HierarchyNode extends Concept {
46
+ level?: number;
47
+ min_levels_of_separation?: number;
48
+ max_levels_of_separation?: number;
49
+ }
50
+ export interface HierarchyResponse {
51
+ concept: Concept;
52
+ ancestors?: HierarchyNode[];
53
+ descendants?: HierarchyNode[];
54
+ total_ancestors?: number;
55
+ total_descendants?: number;
56
+ }
57
+ /** Raw hierarchy shape from the API (flat concept fields, no nested `concept` object) */
58
+ export interface RawHierarchyResponse {
59
+ concept_id: number;
60
+ concept_name?: string;
61
+ vocabulary_id?: string;
62
+ ancestors?: HierarchyNode[];
63
+ descendants?: HierarchyNode[];
64
+ total_ancestors?: number;
65
+ total_descendants?: number;
66
+ hierarchy_summary?: {
67
+ total_ancestors?: number;
68
+ total_descendants?: number;
69
+ };
70
+ }
71
+ export interface Vocabulary {
72
+ vocabulary_id: string;
73
+ vocabulary_name: string;
74
+ vocabulary_reference?: string;
75
+ vocabulary_version?: string;
76
+ vocabulary_concept_id?: number;
77
+ concept_count?: number;
78
+ standard_concept_count?: number;
79
+ domain_coverage?: Record<string, number>;
80
+ }
81
+ export interface MappingsResponse {
82
+ source_concept: Concept;
83
+ mappings: Mapping[];
84
+ total_mappings: number;
85
+ }
86
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,CAAC,EAAE;QACL,UAAU,CAAC,EAAE,cAAc,CAAC;QAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,OAAO;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB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AAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE;QAClB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;CACH;AAED,MAAM,WAAW,UAAU;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CACxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import type { ApiResponse, Concept, HierarchyResponse, MappingsResponse, SearchResult, Vocabulary } from '../client/types.js';
2
+ export declare function formatConceptList(response: ApiResponse<SearchResult[]>, query: string): {
3
+ text: string;
4
+ json: string;
5
+ };
6
+ export declare function formatConcept(concept: Concept): {
7
+ text: string;
8
+ json: string;
9
+ };
10
+ export declare function formatMappings(response: ApiResponse<MappingsResponse>, conceptId: number): {
11
+ text: string;
12
+ json: string;
13
+ };
14
+ export declare function formatHierarchy(response: ApiResponse<HierarchyResponse>, direction: 'up' | 'down' | 'both'): {
15
+ text: string;
16
+ json: string;
17
+ };
18
+ export declare function formatVocabularyList(response: ApiResponse<Vocabulary[]>, search?: string): {
19
+ text: string;
20
+ json: string;
21
+ };
22
+ export declare function formatError(error: string): {
23
+ text: string;
24
+ json: string;
25
+ };
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/formatters/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,OAAO,EAEP,iBAAiB,EAEjB,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACX,MAAM,oBAAoB,CAAC;AAa5B,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,WAAW,CAAC,YAAY,EAAE,CAAC,EACrC,KAAK,EAAE,MAAM,GACZ;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAyChC;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAgC9E;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,WAAW,CAAC,gBAAgB,CAAC,EACvC,SAAS,EAAE,MAAM,GAChB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAyChC;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,WAAW,CAAC,iBAAiB,CAAC,EACxC,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAChC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAsDhC;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,WAAW,CAAC,UAAU,EAAE,CAAC,EACnC,MAAM,CAAC,EAAE,MAAM,GACd;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAwChC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAKzE"}