File size: 1,436 Bytes
f8c07f6
87dc528
f8c07f6
87dc528
f8c07f6
87dc528
f8c07f6
 
 
 
87dc528
f8c07f6
 
87dc528
f8c07f6
87dc528
f8c07f6
87dc528
f8c07f6
87dc528
f8c07f6
 
 
 
87dc528
f8c07f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# NPI MCP Server Explanation

## Architecture

This project implements a Model Context Protocol (MCP) server that acts as a bridge between an AI Agent and the NPPES NPI Registry.

1.  **Agent (Client)**: An AI agent (e.g., LangGraph) running in a separate environment connects to this MCP server.
2.  **MCP Server (`npi_mcp_server`)**: This server, running in a Hugging Face Space, exposes tools defined in the MCP specification (`search_npi_providers`, `get_npi_provider`).
3.  **Modal NPI API (`NPI_API`)**: The MCP server does not call the NPPES Registry directly. Instead, it forwards requests to a Modal-hosted FastAPI service (`NPI_API`). This Modal service handles the complex logic of querying the NPPES API and normalizing the data.
4.  **NPPES Registry**: The ultimate source of truth for provider data.

**Flow:**
`Agent` -> `MCP Server (this repo)` -> `Modal NPI API` -> `NPPES Registry`

## Tools

### 1. `search_npi_providers`

Searches for healthcare providers.

**Arguments:**
*   `query` (str): Name or organization name.
*   `state` (str, optional): 2-letter state code.
*   `taxonomy` (str, optional): Taxonomy code.

**Example Invocation (JSON arguments):**
```json
{
  "query": "Mayo Clinic",
  "state": "MN"
}
```

### 2. `get_npi_provider`

Retrieves details for a specific NPI.

**Arguments:**
*   `npi` (str): 10-digit NPI number.

**Example Invocation (JSON arguments):**
```json
{
  "npi": "1234567890"
}
```