@ncodeuy/medplum-mcp 0.1.0 → 0.1.2
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/README.md +105 -0
- package/dist/config.js +1 -16
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# @ncodeuy/medplum-mcp
|
|
2
|
+
|
|
3
|
+
A [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server that provides access to [Medplum](https://www.medplum.com/) FHIR healthcare data. It enables Claude and other MCP clients to read, search, and query FHIR resources from one or more Medplum environments.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Multi-environment support** — connect to multiple Medplum projects (e.g. dev, staging, production) and switch between them per request
|
|
8
|
+
- **30 FHIR resource types** — Patient, Practitioner, Observation, Condition, MedicationRequest, and more
|
|
9
|
+
- **Search with parameters** — query resources using standard FHIR search parameters
|
|
10
|
+
- **Resource history** — view version history of any resource with pagination
|
|
11
|
+
|
|
12
|
+
## Tools
|
|
13
|
+
|
|
14
|
+
The server exposes 5 MCP tools:
|
|
15
|
+
|
|
16
|
+
| Tool | Description |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `fhir_get_environments` | List available Medplum environments and the default |
|
|
19
|
+
| `fhir_get_resource_types` | List supported FHIR resource types and their search parameters |
|
|
20
|
+
| `fhir_read` | Read a single FHIR resource by type and ID |
|
|
21
|
+
| `fhir_search` | Search for FHIR resources with query parameters |
|
|
22
|
+
| `fhir_read_history` | Get version history of a resource |
|
|
23
|
+
|
|
24
|
+
## Setup
|
|
25
|
+
|
|
26
|
+
### Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install @ncodeuy/medplum-mcp
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Configure
|
|
33
|
+
|
|
34
|
+
The server reads configuration from the `MEDPLUM_PROJECTS` environment variable — a JSON object mapping environment names to their connection details:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
MEDPLUM_PROJECTS='{
|
|
38
|
+
"staging": {
|
|
39
|
+
"baseUrl": "https://staging.example.com/",
|
|
40
|
+
"clientId": "staging-client-id",
|
|
41
|
+
"clientSecret": "staging-secret",
|
|
42
|
+
"projectId": "proj-staging"
|
|
43
|
+
},
|
|
44
|
+
"production": {
|
|
45
|
+
"baseUrl": "https://api.medplum.com/",
|
|
46
|
+
"clientId": "prod-client-id",
|
|
47
|
+
"clientSecret": "prod-secret",
|
|
48
|
+
"projectId": "proj-prod"
|
|
49
|
+
}
|
|
50
|
+
}'
|
|
51
|
+
MEDPLUM_DEFAULT_PROJECT=staging
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`MEDPLUM_DEFAULT_PROJECT` is optional and defaults to the first entry.
|
|
55
|
+
|
|
56
|
+
### Use with Claude Desktop
|
|
57
|
+
|
|
58
|
+
Add the server to your Claude Desktop configuration (`claude_desktop_config.json`):
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"mcpServers": {
|
|
63
|
+
"medplum": {
|
|
64
|
+
"command": "npx",
|
|
65
|
+
"args": ["@ncodeuy/medplum-mcp"],
|
|
66
|
+
"env": {
|
|
67
|
+
"MEDPLUM_PROJECTS": "{\"default\":{\"clientId\":\"your-client-id\",\"clientSecret\":\"your-client-secret\"}}"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Use with Claude Code
|
|
75
|
+
|
|
76
|
+
Add the server to your Claude Code MCP settings:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
claude mcp add medplum -- npx @ncodeuy/medplum-mcp
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Then set the required environment variables in your shell before launching Claude Code.
|
|
83
|
+
|
|
84
|
+
## Development
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Install dependencies
|
|
88
|
+
npm install
|
|
89
|
+
|
|
90
|
+
# Type check
|
|
91
|
+
npm run typecheck
|
|
92
|
+
|
|
93
|
+
# Run tests
|
|
94
|
+
npm test
|
|
95
|
+
|
|
96
|
+
# Build
|
|
97
|
+
npm run build
|
|
98
|
+
|
|
99
|
+
# Run the server locally
|
|
100
|
+
node ./dist/index.js
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
ISC
|
package/dist/config.js
CHANGED
|
@@ -34,20 +34,5 @@ export function loadConfig() {
|
|
|
34
34
|
}
|
|
35
35
|
return { projects, defaultProject };
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
const clientId = process.env.MEDPLUM_CLIENT_ID;
|
|
39
|
-
const clientSecret = process.env.MEDPLUM_CLIENT_SECRET;
|
|
40
|
-
if (!clientId || !clientSecret) {
|
|
41
|
-
throw new Error("Missing MEDPLUM_PROJECTS or MEDPLUM_CLIENT_ID/MEDPLUM_CLIENT_SECRET environment variables.");
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
projects: {
|
|
45
|
-
default: {
|
|
46
|
-
baseUrl: process.env.MEDPLUM_BASE_URL || "https://api.medplum.com/",
|
|
47
|
-
clientId,
|
|
48
|
-
clientSecret,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
defaultProject: "default",
|
|
52
|
-
};
|
|
37
|
+
throw new Error("Missing MEDPLUM_PROJECTS environment variable. Set it to a JSON object mapping environment names to project configs.");
|
|
53
38
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ncodeuy/medplum-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"bin": {
|
|
8
|
-
"medplum-mcp": "
|
|
8
|
+
"medplum-mcp": "dist/index.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist"
|