awslabs.healthlake-mcp-server 0.0.1__py3-none-any.whl
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.
- awslabs/__init__.py +16 -0
- awslabs/healthlake_mcp_server/__init__.py +17 -0
- awslabs/healthlake_mcp_server/fhir_operations.py +701 -0
- awslabs/healthlake_mcp_server/main.py +77 -0
- awslabs/healthlake_mcp_server/models.py +120 -0
- awslabs/healthlake_mcp_server/server.py +665 -0
- awslabs_healthlake_mcp_server-0.0.1.dist-info/METADATA +631 -0
- awslabs_healthlake_mcp_server-0.0.1.dist-info/RECORD +12 -0
- awslabs_healthlake_mcp_server-0.0.1.dist-info/WHEEL +4 -0
- awslabs_healthlake_mcp_server-0.0.1.dist-info/entry_points.txt +2 -0
- awslabs_healthlake_mcp_server-0.0.1.dist-info/licenses/LICENSE +175 -0
- awslabs_healthlake_mcp_server-0.0.1.dist-info/licenses/NOTICE +2 -0
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: awslabs.healthlake-mcp-server
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: An AWS Labs Model Context Protocol (MCP) server for healthlake
|
|
5
|
+
Project-URL: homepage, https://awslabs.github.io/mcp/
|
|
6
|
+
Project-URL: docs, https://awslabs.github.io/mcp/servers/healthlake-mcp-server/
|
|
7
|
+
Project-URL: documentation, https://awslabs.github.io/mcp/servers/healthlake-mcp-server/
|
|
8
|
+
Project-URL: repository, https://github.com/awslabs/mcp.git
|
|
9
|
+
Project-URL: changelog, https://github.com/awslabs/mcp/blob/main/src/healthlake-mcp-server/CHANGELOG.md
|
|
10
|
+
Author: Amazon Web Services
|
|
11
|
+
Author-email: AWSLabs MCP <203918161+awslabs-mcp@users.noreply.github.com>, Steven Johnston <stevehj@amazon.com>
|
|
12
|
+
License: Apache-2.0
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
License-File: NOTICE
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: boto3>=1.34.0
|
|
25
|
+
Requires-Dist: botocore>=1.34.0
|
|
26
|
+
Requires-Dist: httpx>=0.25.0
|
|
27
|
+
Requires-Dist: loguru>=0.7.0
|
|
28
|
+
Requires-Dist: mcp>=1.11.0
|
|
29
|
+
Requires-Dist: pydantic>=2.10.6
|
|
30
|
+
Requires-Dist: python-dateutil>=2.8.0
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pre-commit>=4.1.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pyright>=1.1.398; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest-asyncio>=0.26.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest-mock>=3.12.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: ruff>=0.9.7; extra == 'dev'
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
|
|
41
|
+
# HealthLake MCP Server
|
|
42
|
+
|
|
43
|
+
A Model Context Protocol (MCP) server for AWS HealthLake FHIR operations. Provides 11 tools for comprehensive FHIR resource management with automatic datastore discovery.
|
|
44
|
+
|
|
45
|
+
## Table of Contents
|
|
46
|
+
|
|
47
|
+
- [Features](#features)
|
|
48
|
+
- [Prerequisites](#prerequisites)
|
|
49
|
+
- [Quick Start](#quick-start)
|
|
50
|
+
- [Option 1: uvx (Recommended)](#option-1-uvx-recommended)
|
|
51
|
+
- [Option 2: uv install](#option-2-uv-install)
|
|
52
|
+
- [Option 3: Docker](#option-3-docker)
|
|
53
|
+
- [MCP Client Configuration](#mcp-client-configuration)
|
|
54
|
+
- [Amazon Q Developer CLI](#amazon-q-developer-cli)
|
|
55
|
+
- [Docker Configuration](#docker-configuration)
|
|
56
|
+
- [Other MCP Clients](#other-mcp-clients)
|
|
57
|
+
- [Read-Only Mode](#read-only-mode)
|
|
58
|
+
- [Available Tools](#available-tools)
|
|
59
|
+
- [Datastore Management](#datastore-management)
|
|
60
|
+
- [FHIR Resource Operations (CRUD)](#fhir-resource-operations-crud)
|
|
61
|
+
- [Advanced Search](#advanced-search)
|
|
62
|
+
- [Job Management](#job-management)
|
|
63
|
+
- [MCP Resources](#mcp-resources)
|
|
64
|
+
- [Usage Examples](#usage-examples)
|
|
65
|
+
- [Basic Resource Operations](#basic-resource-operations)
|
|
66
|
+
- [Advanced Search](#advanced-search-1)
|
|
67
|
+
- [Patient Everything](#patient-everything)
|
|
68
|
+
- [Authentication](#authentication)
|
|
69
|
+
- [Required Permissions](#required-permissions)
|
|
70
|
+
- [Error Handling](#error-handling)
|
|
71
|
+
- [Troubleshooting](#troubleshooting)
|
|
72
|
+
- [Common Issues](#common-issues)
|
|
73
|
+
- [Debug Mode](#debug-mode)
|
|
74
|
+
- [Development](#development)
|
|
75
|
+
- [Local Development Setup](#local-development-setup)
|
|
76
|
+
- [Running the Server Locally](#running-the-server-locally)
|
|
77
|
+
- [Development Workflow](#development-workflow)
|
|
78
|
+
- [IDE Setup](#ide-setup)
|
|
79
|
+
- [Testing](#testing)
|
|
80
|
+
- [Project Structure](#project-structure)
|
|
81
|
+
- [Contributing](#contributing)
|
|
82
|
+
- [License](#license)
|
|
83
|
+
- [Support](#support)
|
|
84
|
+
|
|
85
|
+
## Features
|
|
86
|
+
|
|
87
|
+
- **11 FHIR Tools**: Complete CRUD operations (6 read-only, 5 write), advanced search, patient-everything, job management
|
|
88
|
+
- **Read-Only Mode**: Security-focused mode that blocks all mutating operations while preserving read access
|
|
89
|
+
- **MCP Resources**: Automatic datastore discovery - no manual datastore IDs needed
|
|
90
|
+
- **Advanced Search**: Chained parameters, includes, revIncludes, modifiers, and date/number prefixes with pagination
|
|
91
|
+
- **AWS Integration**: SigV4 authentication with automatic credential handling and region support
|
|
92
|
+
- **Comprehensive Testing**: 235 tests with 96% coverage ensuring reliability
|
|
93
|
+
- **Task Automation**: Poethepoet integration for streamlined development workflow
|
|
94
|
+
- **Error Handling**: Structured error responses with specific error types and helpful messages
|
|
95
|
+
- **Docker Support**: Containerized deployment with flexible authentication options
|
|
96
|
+
|
|
97
|
+
## Prerequisites
|
|
98
|
+
|
|
99
|
+
- **Python 3.10+** (required by MCP framework)
|
|
100
|
+
- **AWS credentials** configured
|
|
101
|
+
- **AWS HealthLake access** with appropriate permissions
|
|
102
|
+
|
|
103
|
+
[↑ Back to Table of Contents](#table-of-contents)
|
|
104
|
+
|
|
105
|
+
## Quick Start
|
|
106
|
+
|
|
107
|
+
Choose your preferred installation method:
|
|
108
|
+
|
|
109
|
+
| Cursor | VS Code |
|
|
110
|
+
|:------:|:-------:|
|
|
111
|
+
| [](https://cursor.com/en/install-mcp?name=awslabs.healthlake-mcp-server&config=eyJjb21tYW5kIjoidXZ4IGF3c2xhYnMuaGVhbHRobGFrZS1tY3Atc2VydmVyQGxhdGVzdCIsImVudiI6eyJBV1NfUkVHSU9OIjoidXMtZWFzdC0xIiwiQVdTX1BST0ZJTEUiOiJ5b3VyLXByb2ZpbGUiLCJNQ1BfTE9HX0xFVkVMIjoiV0FSTklORyJ9fQ%3D%3D) | [](https://insiders.vscode.dev/redirect/mcp/install?name=AWS%20HealthLake%20MCP%20Server&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22awslabs.healthlake-mcp-server%40latest%22%5D%2C%22env%22%3A%7B%22AWS_REGION%22%3A%22us-east-1%22%2C%22AWS_PROFILE%22%3A%22your-profile%22%2C%22MCP_LOG_LEVEL%22%3A%22WARNING%22%7D%7D) |
|
|
112
|
+
|
|
113
|
+
### Option 1: uvx (Recommended)
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Install and run latest version automatically
|
|
117
|
+
uvx awslabs.healthlake-mcp-server@latest
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Option 2: uv install
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
uv tool install awslabs.healthlake-mcp-server
|
|
124
|
+
awslabs.healthlake-mcp-server
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Option 3: Docker
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Build and run with Docker
|
|
131
|
+
docker build -t healthlake-mcp-server .
|
|
132
|
+
docker run -e AWS_ACCESS_KEY_ID=xxx -e AWS_SECRET_ACCESS_KEY=yyy healthlake-mcp-server
|
|
133
|
+
|
|
134
|
+
# Or use pre-built image with environment variables
|
|
135
|
+
docker run -e AWS_ACCESS_KEY_ID=your_key -e AWS_SECRET_ACCESS_KEY=your_secret -e AWS_REGION=us-east-1 awslabs/healthlake-mcp-server
|
|
136
|
+
|
|
137
|
+
# With AWS profile (mount credentials)
|
|
138
|
+
docker run -v ~/.aws:/root/.aws -e AWS_PROFILE=your-profile awslabs/healthlake-mcp-server
|
|
139
|
+
|
|
140
|
+
# Read-only mode
|
|
141
|
+
docker run -e AWS_ACCESS_KEY_ID=your_key -e AWS_SECRET_ACCESS_KEY=your_secret -e AWS_REGION=us-east-1 awslabs/healthlake-mcp-server --readonly
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
[↑ Back to Table of Contents](#table-of-contents)
|
|
145
|
+
|
|
146
|
+
## MCP Client Configuration
|
|
147
|
+
|
|
148
|
+
### Amazon Q Developer CLI
|
|
149
|
+
|
|
150
|
+
Add to your MCP configuration file:
|
|
151
|
+
|
|
152
|
+
**Location:**
|
|
153
|
+
- macOS: `~/.aws/amazonq/mcp.json`
|
|
154
|
+
- Linux: `~/.config/amazon-q/mcp.json`
|
|
155
|
+
- Windows: `%APPDATA%\Amazon Q\mcp.json`
|
|
156
|
+
|
|
157
|
+
**Configuration:**
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"mcpServers": {
|
|
161
|
+
"healthlake": {
|
|
162
|
+
"command": "uvx",
|
|
163
|
+
"args": ["awslabs.healthlake-mcp-server@latest"],
|
|
164
|
+
"env": {
|
|
165
|
+
"AWS_REGION": "us-east-1",
|
|
166
|
+
"AWS_PROFILE": "your-profile-name",
|
|
167
|
+
"MCP_LOG_LEVEL": "INFO"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Read-Only Configuration:**
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"mcpServers": {
|
|
178
|
+
"healthlake-readonly": {
|
|
179
|
+
"command": "uvx",
|
|
180
|
+
"args": ["awslabs.healthlake-mcp-server@latest", "--readonly"],
|
|
181
|
+
"env": {
|
|
182
|
+
"AWS_REGION": "us-east-1",
|
|
183
|
+
"AWS_PROFILE": "your-profile-name",
|
|
184
|
+
"MCP_LOG_LEVEL": "INFO"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Docker Configuration
|
|
192
|
+
|
|
193
|
+
**With environment variables:**
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"mcpServers": {
|
|
197
|
+
"healthlake": {
|
|
198
|
+
"command": "docker",
|
|
199
|
+
"args": [
|
|
200
|
+
"run", "--rm",
|
|
201
|
+
"-e", "AWS_ACCESS_KEY_ID=your_key",
|
|
202
|
+
"-e", "AWS_SECRET_ACCESS_KEY=your_secret",
|
|
203
|
+
"-e", "AWS_REGION=us-east-1",
|
|
204
|
+
"-e", "MCP_LOG_LEVEL=INFO",
|
|
205
|
+
"awslabs/healthlake-mcp-server"
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**With AWS credentials mounted:**
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"mcpServers": {
|
|
216
|
+
"healthlake": {
|
|
217
|
+
"command": "docker",
|
|
218
|
+
"args": [
|
|
219
|
+
"run", "--rm",
|
|
220
|
+
"-v", "~/.aws:/root/.aws",
|
|
221
|
+
"-e", "AWS_PROFILE=your-profile",
|
|
222
|
+
"-e", "MCP_LOG_LEVEL=INFO",
|
|
223
|
+
"awslabs/healthlake-mcp-server"
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Read-Only Mode with Docker:**
|
|
231
|
+
```json
|
|
232
|
+
{
|
|
233
|
+
"mcpServers": {
|
|
234
|
+
"healthlake-readonly": {
|
|
235
|
+
"command": "docker",
|
|
236
|
+
"args": [
|
|
237
|
+
"run", "--rm",
|
|
238
|
+
"-e", "AWS_ACCESS_KEY_ID=your_key",
|
|
239
|
+
"-e", "AWS_SECRET_ACCESS_KEY=your_secret",
|
|
240
|
+
"-e", "AWS_REGION=us-east-1",
|
|
241
|
+
"-e", "MCP_LOG_LEVEL=INFO",
|
|
242
|
+
"awslabs/healthlake-mcp-server",
|
|
243
|
+
"--readonly"
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Other MCP Clients
|
|
251
|
+
|
|
252
|
+
See `examples/mcp_config.json` for additional configuration examples.
|
|
253
|
+
|
|
254
|
+
[↑ Back to Table of Contents](#table-of-contents)
|
|
255
|
+
|
|
256
|
+
## Read-Only Mode
|
|
257
|
+
|
|
258
|
+
The server supports a read-only mode that prevents all mutating operations while still allowing read operations. This is useful for:
|
|
259
|
+
|
|
260
|
+
- **Safety**: Preventing accidental modifications in production environments
|
|
261
|
+
- **Testing**: Allowing safe exploration of FHIR resources without risk of changes
|
|
262
|
+
- **Auditing**: Running the server in environments where only read access should be allowed
|
|
263
|
+
- **Compliance**: Meeting security requirements for read-only access to healthcare data
|
|
264
|
+
|
|
265
|
+
### Enabling Read-Only Mode
|
|
266
|
+
|
|
267
|
+
Add the `--readonly` flag when starting the server:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
# Using uvx
|
|
271
|
+
uvx awslabs.healthlake-mcp-server@latest --readonly
|
|
272
|
+
|
|
273
|
+
# Or if installed locally
|
|
274
|
+
python -m awslabs.healthlake_mcp_server.main --readonly
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Operations Available in Read-Only Mode
|
|
278
|
+
|
|
279
|
+
| Operation | Available | Description |
|
|
280
|
+
|-----------|-----------|-------------|
|
|
281
|
+
| `list_datastores` | ✅ | List all HealthLake datastores |
|
|
282
|
+
| `get_datastore_details` | ✅ | Get detailed datastore information |
|
|
283
|
+
| `read_fhir_resource` | ✅ | Retrieve specific FHIR resources |
|
|
284
|
+
| `search_fhir_resources` | ✅ | Advanced FHIR search operations |
|
|
285
|
+
| `patient_everything` | ✅ | Comprehensive patient record retrieval |
|
|
286
|
+
| `list_fhir_jobs` | ✅ | Monitor import/export job status |
|
|
287
|
+
|
|
288
|
+
### Operations Blocked in Read-Only Mode
|
|
289
|
+
|
|
290
|
+
| Operation | Blocked | Description |
|
|
291
|
+
|-----------|---------|-------------|
|
|
292
|
+
| `create_fhir_resource` | ❌ | Create new FHIR resources |
|
|
293
|
+
| `update_fhir_resource` | ❌ | Update existing FHIR resources |
|
|
294
|
+
| `delete_fhir_resource` | ❌ | Delete FHIR resources |
|
|
295
|
+
| `start_fhir_import_job` | ❌ | Start FHIR data import jobs |
|
|
296
|
+
| `start_fhir_export_job` | ❌ | Start FHIR data export jobs |
|
|
297
|
+
|
|
298
|
+
[↑ Back to Table of Contents](#table-of-contents)
|
|
299
|
+
|
|
300
|
+
## Available Tools
|
|
301
|
+
|
|
302
|
+
The server provides **11 comprehensive FHIR tools** organized into four categories:
|
|
303
|
+
|
|
304
|
+
### Datastore Management
|
|
305
|
+
- **`list_datastores`** - List all HealthLake datastores with optional status filtering
|
|
306
|
+
- **`get_datastore_details`** - Get detailed datastore information including endpoints and metadata
|
|
307
|
+
|
|
308
|
+
### FHIR Resource Operations (CRUD)
|
|
309
|
+
- **`create_fhir_resource`** - Create new FHIR resources with validation
|
|
310
|
+
- **`read_fhir_resource`** - Retrieve specific FHIR resources by ID
|
|
311
|
+
- **`update_fhir_resource`** - Update existing FHIR resources with versioning
|
|
312
|
+
- **`delete_fhir_resource`** - Delete FHIR resources from datastores
|
|
313
|
+
|
|
314
|
+
### Advanced Search
|
|
315
|
+
- **`search_fhir_resources`** - Advanced FHIR search with modifiers, chaining, includes, and pagination
|
|
316
|
+
- **`patient_everything`** - Comprehensive patient record retrieval using FHIR $patient-everything operation
|
|
317
|
+
|
|
318
|
+
### Job Management
|
|
319
|
+
- **`start_fhir_import_job`** - Start FHIR data import jobs from S3
|
|
320
|
+
- **`start_fhir_export_job`** - Start FHIR data export jobs to S3
|
|
321
|
+
- **`list_fhir_jobs`** - List and monitor import/export jobs with status filtering
|
|
322
|
+
|
|
323
|
+
### MCP Resources
|
|
324
|
+
|
|
325
|
+
The server automatically exposes HealthLake datastores as MCP resources, enabling:
|
|
326
|
+
- **Automatic discovery** of available datastores
|
|
327
|
+
- **No manual datastore ID entry** required
|
|
328
|
+
- **Status visibility** (ACTIVE, CREATING, etc.)
|
|
329
|
+
- **Metadata access** (creation date, endpoints, etc.)
|
|
330
|
+
|
|
331
|
+
[↑ Back to Table of Contents](#table-of-contents)
|
|
332
|
+
|
|
333
|
+
## Usage Examples
|
|
334
|
+
|
|
335
|
+
### Basic Resource Operations
|
|
336
|
+
|
|
337
|
+
```json
|
|
338
|
+
// Create a patient (datastore discovered automatically)
|
|
339
|
+
{
|
|
340
|
+
"datastore_id": "discovered-from-resources",
|
|
341
|
+
"resource_type": "Patient",
|
|
342
|
+
"resource_data": {
|
|
343
|
+
"resourceType": "Patient",
|
|
344
|
+
"name": [{"family": "Smith", "given": ["John"]}],
|
|
345
|
+
"gender": "male"
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### Advanced Search
|
|
351
|
+
|
|
352
|
+
```json
|
|
353
|
+
// Search with modifiers and includes
|
|
354
|
+
{
|
|
355
|
+
"datastore_id": "discovered-from-resources",
|
|
356
|
+
"resource_type": "Patient",
|
|
357
|
+
"search_params": {
|
|
358
|
+
"name:contains": "smith",
|
|
359
|
+
"birthdate": "ge1990-01-01"
|
|
360
|
+
},
|
|
361
|
+
"include_params": ["Patient:general-practitioner"],
|
|
362
|
+
"revinclude_params": ["Observation:subject"]
|
|
363
|
+
}
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Patient Everything
|
|
367
|
+
|
|
368
|
+
```json
|
|
369
|
+
// Get all resources for a patient
|
|
370
|
+
{
|
|
371
|
+
"datastore_id": "discovered-from-resources",
|
|
372
|
+
"patient_id": "patient-123",
|
|
373
|
+
"start": "2023-01-01",
|
|
374
|
+
"end": "2023-12-31"
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
[↑ Back to Table of Contents](#table-of-contents)
|
|
379
|
+
|
|
380
|
+
## Authentication
|
|
381
|
+
|
|
382
|
+
Configure AWS credentials using any of these methods:
|
|
383
|
+
|
|
384
|
+
1. **AWS CLI**: `aws configure`
|
|
385
|
+
2. **Environment variables**: `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`
|
|
386
|
+
3. **IAM roles** (for EC2/Lambda)
|
|
387
|
+
4. **AWS profiles**: Set `AWS_PROFILE` environment variable
|
|
388
|
+
|
|
389
|
+
### Required Permissions
|
|
390
|
+
|
|
391
|
+
```json
|
|
392
|
+
{
|
|
393
|
+
"Version": "2012-10-17",
|
|
394
|
+
"Statement": [
|
|
395
|
+
{
|
|
396
|
+
"Effect": "Allow",
|
|
397
|
+
"Action": [
|
|
398
|
+
"healthlake:ListFHIRDatastores",
|
|
399
|
+
"healthlake:DescribeFHIRDatastore",
|
|
400
|
+
"healthlake:CreateResource",
|
|
401
|
+
"healthlake:ReadResource",
|
|
402
|
+
"healthlake:UpdateResource",
|
|
403
|
+
"healthlake:DeleteResource",
|
|
404
|
+
"healthlake:SearchWithGet",
|
|
405
|
+
"healthlake:SearchWithPost",
|
|
406
|
+
"healthlake:StartFHIRImportJob",
|
|
407
|
+
"healthlake:StartFHIRExportJob",
|
|
408
|
+
"healthlake:ListFHIRImportJobs",
|
|
409
|
+
"healthlake:ListFHIRExportJobs"
|
|
410
|
+
],
|
|
411
|
+
"Resource": "*"
|
|
412
|
+
}
|
|
413
|
+
]
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
[↑ Back to Table of Contents](#table-of-contents)
|
|
418
|
+
|
|
419
|
+
## Error Handling
|
|
420
|
+
|
|
421
|
+
All tools return structured error responses:
|
|
422
|
+
|
|
423
|
+
```json
|
|
424
|
+
{
|
|
425
|
+
"error": true,
|
|
426
|
+
"type": "validation_error",
|
|
427
|
+
"message": "Datastore ID must be 32 characters"
|
|
428
|
+
}
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
**Error Types:**
|
|
432
|
+
- `validation_error` - Invalid input parameters
|
|
433
|
+
- `not_found` - Resource or datastore not found
|
|
434
|
+
- `auth_error` - AWS credentials not configured
|
|
435
|
+
- `service_error` - AWS HealthLake service error
|
|
436
|
+
- `server_error` - Internal server error
|
|
437
|
+
|
|
438
|
+
[↑ Back to Table of Contents](#table-of-contents)
|
|
439
|
+
|
|
440
|
+
## Troubleshooting
|
|
441
|
+
|
|
442
|
+
### Common Issues
|
|
443
|
+
|
|
444
|
+
**"AWS credentials not configured"**
|
|
445
|
+
- Run `aws configure` or set environment variables
|
|
446
|
+
- Verify `AWS_REGION` is set correctly
|
|
447
|
+
|
|
448
|
+
**"Resource not found"**
|
|
449
|
+
- Ensure datastore exists and is ACTIVE
|
|
450
|
+
- Check datastore ID is correct (32 characters)
|
|
451
|
+
- Verify you have access to the datastore
|
|
452
|
+
|
|
453
|
+
**"Validation error"**
|
|
454
|
+
- Check required parameters are provided
|
|
455
|
+
- Ensure datastore ID format is correct
|
|
456
|
+
- Verify count parameters are within 1-100 range
|
|
457
|
+
|
|
458
|
+
### Debug Mode
|
|
459
|
+
|
|
460
|
+
Set environment variable for detailed logging:
|
|
461
|
+
```bash
|
|
462
|
+
export PYTHONPATH=.
|
|
463
|
+
export MCP_LOG_LEVEL=DEBUG
|
|
464
|
+
awslabs.healthlake-mcp-server
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
[↑ Back to Table of Contents](#table-of-contents)
|
|
468
|
+
|
|
469
|
+
## Development
|
|
470
|
+
|
|
471
|
+
### Local Development Setup
|
|
472
|
+
|
|
473
|
+
#### Option 1: Using uv (Recommended)
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
git clone <repository-url>
|
|
477
|
+
cd healthlake-mcp-server
|
|
478
|
+
uv sync --dev
|
|
479
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
#### Option 2: Using pip/venv
|
|
483
|
+
|
|
484
|
+
```bash
|
|
485
|
+
git clone <repository-url>
|
|
486
|
+
cd healthlake-mcp-server
|
|
487
|
+
|
|
488
|
+
# Create virtual environment
|
|
489
|
+
python -m venv .venv
|
|
490
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
491
|
+
|
|
492
|
+
# Install dependencies
|
|
493
|
+
pip install -e ".[dev]"
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
#### Option 3: Using conda
|
|
497
|
+
|
|
498
|
+
```bash
|
|
499
|
+
git clone <repository-url>
|
|
500
|
+
cd healthlake-mcp-server
|
|
501
|
+
|
|
502
|
+
# Create conda environment
|
|
503
|
+
conda create -n healthlake-mcp python=3.10
|
|
504
|
+
conda activate healthlake-mcp
|
|
505
|
+
|
|
506
|
+
# Install dependencies
|
|
507
|
+
pip install -e ".[dev]"
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
### Running the Server Locally
|
|
511
|
+
|
|
512
|
+
```bash
|
|
513
|
+
# After activating your virtual environment
|
|
514
|
+
python -m awslabs.healthlake_mcp_server.main
|
|
515
|
+
|
|
516
|
+
# Or using the installed script
|
|
517
|
+
awslabs.healthlake-mcp-server
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
### Development Workflow
|
|
521
|
+
|
|
522
|
+
```bash
|
|
523
|
+
# Run tests
|
|
524
|
+
poe test
|
|
525
|
+
|
|
526
|
+
# Run tests with coverage
|
|
527
|
+
poe test-cov
|
|
528
|
+
|
|
529
|
+
# Format code
|
|
530
|
+
poe format
|
|
531
|
+
|
|
532
|
+
# Lint code
|
|
533
|
+
poe lint
|
|
534
|
+
|
|
535
|
+
# Run all quality checks
|
|
536
|
+
poe check
|
|
537
|
+
|
|
538
|
+
# Clean build artifacts
|
|
539
|
+
poe clean
|
|
540
|
+
|
|
541
|
+
# Build package
|
|
542
|
+
poe build
|
|
543
|
+
|
|
544
|
+
# Run server
|
|
545
|
+
poe run
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
### Available Tasks
|
|
549
|
+
|
|
550
|
+
The project uses [Poethepoet](https://poethepoet.natn.io/) for task automation. Run `poe --help` to see all available tasks:
|
|
551
|
+
|
|
552
|
+
- **Testing**: `test`, `test-cov`
|
|
553
|
+
- **Code Quality**: `lint`, `format`, `check`, `security`
|
|
554
|
+
- **Build & Run**: `build`, `run`
|
|
555
|
+
- **Cleanup**: `clean`
|
|
556
|
+
|
|
557
|
+
### Development Workflow
|
|
558
|
+
|
|
559
|
+
```bash
|
|
560
|
+
# Run all checks
|
|
561
|
+
poe check
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
### IDE Setup
|
|
565
|
+
|
|
566
|
+
#### VS Code
|
|
567
|
+
1. Install Python extension
|
|
568
|
+
2. Select the virtual environment: `Ctrl+Shift+P` → "Python: Select Interpreter"
|
|
569
|
+
3. Choose `.venv/bin/python`
|
|
570
|
+
|
|
571
|
+
#### PyCharm
|
|
572
|
+
1. File → Settings → Project → Python Interpreter
|
|
573
|
+
2. Add Interpreter → Existing Environment
|
|
574
|
+
3. Select `.venv/bin/python`
|
|
575
|
+
|
|
576
|
+
### Testing
|
|
577
|
+
|
|
578
|
+
```bash
|
|
579
|
+
# Run unit tests (fast, no AWS dependencies)
|
|
580
|
+
poe test
|
|
581
|
+
|
|
582
|
+
# Run with coverage
|
|
583
|
+
poe test-cov
|
|
584
|
+
|
|
585
|
+
# Format code
|
|
586
|
+
poe format
|
|
587
|
+
|
|
588
|
+
# Lint code
|
|
589
|
+
poe lint
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
**Test Results**: 235 tests pass, 96% coverage
|
|
593
|
+
|
|
594
|
+
### Project Structure
|
|
595
|
+
|
|
596
|
+
```
|
|
597
|
+
awslabs/healthlake_mcp_server/
|
|
598
|
+
├── server.py # MCP server with tool handlers
|
|
599
|
+
├── fhir_operations.py # AWS HealthLake client operations
|
|
600
|
+
├── models.py # Pydantic validation models
|
|
601
|
+
├── main.py # Entry point
|
|
602
|
+
└── __init__.py # Package initialization
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
[↑ Back to Table of Contents](#table-of-contents)
|
|
606
|
+
|
|
607
|
+
## Contributing
|
|
608
|
+
|
|
609
|
+
1. Fork the repository
|
|
610
|
+
2. Create a feature branch: `git checkout -b feature-name`
|
|
611
|
+
3. Make changes and add tests
|
|
612
|
+
4. Run tests: `poe test`
|
|
613
|
+
5. Format code: `poe format`
|
|
614
|
+
6. Submit a pull request
|
|
615
|
+
|
|
616
|
+
[↑ Back to Table of Contents](#table-of-contents)
|
|
617
|
+
|
|
618
|
+
## License
|
|
619
|
+
|
|
620
|
+
Licensed under the Apache License, Version 2.0. See LICENSE file for details.
|
|
621
|
+
|
|
622
|
+
[↑ Back to Table of Contents](#table-of-contents)
|
|
623
|
+
|
|
624
|
+
## Support
|
|
625
|
+
|
|
626
|
+
For issues and questions:
|
|
627
|
+
- Check the troubleshooting section above
|
|
628
|
+
- Review AWS HealthLake documentation
|
|
629
|
+
- Open an issue in the repository
|
|
630
|
+
|
|
631
|
+
[↑ Back to Table of Contents](#table-of-contents)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
awslabs/__init__.py,sha256=WuqxdDgUZylWNmVoPKiK7qGsTB_G4UmuXIrJ-VBwDew,731
|
|
2
|
+
awslabs/healthlake_mcp_server/__init__.py,sha256=d2SzLDN1Js86XAKP_AkHWD02KRsak21Pp7kXcYt2iSk,672
|
|
3
|
+
awslabs/healthlake_mcp_server/fhir_operations.py,sha256=fpvivrHwLguXYZ7wNgrKmIURh3KQzQg1OihyqRTad-g,27115
|
|
4
|
+
awslabs/healthlake_mcp_server/main.py,sha256=EcWmg341r8qUUGCe_B7rh1D05fblfJi3ABoTLaTqEp4,2308
|
|
5
|
+
awslabs/healthlake_mcp_server/models.py,sha256=tLPzjNwNd5u0vskt_50m_adgtt7BFItK2eUtmBXnTJo,3769
|
|
6
|
+
awslabs/healthlake_mcp_server/server.py,sha256=qHcmF4CbXwFL9eZ-krSMe5cN0XqtgD5Er6lzluMosPU,29233
|
|
7
|
+
awslabs_healthlake_mcp_server-0.0.1.dist-info/METADATA,sha256=8Efb77Y3CEqzwkyIIj80DSe62jEh-2t6_ALOzhmH6FA,18027
|
|
8
|
+
awslabs_healthlake_mcp_server-0.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
9
|
+
awslabs_healthlake_mcp_server-0.0.1.dist-info/entry_points.txt,sha256=qwtCseEwKAzaTx8KpML78_Df8B6YjfYrQOArOroYdJw,95
|
|
10
|
+
awslabs_healthlake_mcp_server-0.0.1.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
|
|
11
|
+
awslabs_healthlake_mcp_server-0.0.1.dist-info/licenses/NOTICE,sha256=jF_z93O10guFgHFIu7Sl4eHG1BWEK-xa_AlQktlLdn4,97
|
|
12
|
+
awslabs_healthlake_mcp_server-0.0.1.dist-info/RECORD,,
|