nithin varghese commited on
Commit
a71343d
·
unverified ·
2 Parent(s): 99769b9 89389bc

Merge pull request #4 from humandotlearning/hf-spaces-config

Browse files
Files changed (1) hide show
  1. README.md +106 -36
README.md CHANGED
@@ -1,20 +1,66 @@
1
- # CredentialWatch: NPI MCP Server
2
-
3
- This repository contains the **NPI (NPPES) Model Context Protocol (MCP) Server** for **CredentialWatch**, a demo product for the **Hugging Face MCP 1st Birthday / Gradio Agents Hackathon**.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  ## 🩺 About CredentialWatch
6
 
7
  **CredentialWatch** is an agentic system designed to manage healthcare provider credentials. It serves as a central radar to track expiries, license statuses, and compliance risks across multiple providers.
8
 
9
- The system is composed of multiple independent MCP servers and a central agent:
10
- 1. **`npi_mcp` (This Repo):** Read-only access to public provider data via the NPPES NPI Registry.
11
- 2. `cred_db_mcp`: Internal provider & credential database operations (SQLite).
12
- 3. `alert_mcp`: Alert logging and management.
13
- 4. **Agent UI:** A Gradio-based interface powered by LangGraph.
14
-
15
  ### Role of `npi_mcp`
16
  This MCP server exposes tools to search for and retrieve healthcare provider information from the public [NPPES NPI Registry](https://npiregistry.cms.hhs.gov/api). It acts as a proxy, forwarding requests to a backend **Modal** FastAPI service (`NPI_API`) which handles the actual external API communication and normalization.
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  ## ✨ Tools
19
 
20
  This server exposes the following MCP tools:
@@ -25,46 +71,50 @@ This server exposes the following MCP tools:
25
  - **`get_provider_by_npi(npi)`**:
26
  - Retrieve detailed information for a specific provider using their 10-digit NPI number.
27
 
28
- ## 🚀 Setup & Installation
29
-
30
- ### Prerequisites
31
- - Python 3.11+
32
- - [`uv`](https://github.com/astral-sh/uv) package manager
33
-
34
- ### Installation
35
 
36
- 1. Clone the repository:
37
- ```bash
38
- git clone <repo-url>
39
- cd npi-mcp-server
40
- ```
41
 
42
- 2. Install dependencies:
43
- ```bash
44
- uv sync
45
- ```
46
 
47
- ### Configuration
48
 
49
- The server requires the URL of the backend Modal service. Set the following environment variable:
50
 
51
- ```bash
52
- export NPI_API_BASE_URL="https://your-modal-app-url.modal.run"
 
 
 
 
 
 
 
 
 
 
53
  ```
54
 
55
- *Defaults to `http://localhost:8000` if not set.*
56
 
57
- ## 🏃 Usage
58
-
59
- To run the MCP server:
60
 
61
  ```bash
62
- uv run python -m npi_mcp_server.main
 
 
 
 
 
 
63
  ```
64
 
65
- The server uses `FastMCP` and communicates over stdio (by default) or SSE depending on how it's invoked by the client.
66
 
67
- ## 🧪 Development
68
 
69
  Run tests using `pytest`:
70
 
@@ -72,6 +122,26 @@ Run tests using `pytest`:
72
  uv run pytest
73
  ```
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  ## 🏗️ Architecture
76
 
77
  - **Stack:** Python 3.11, `mcp`, `httpx`, `pydantic`.
 
1
+ ---
2
+ title: CredentialWatch MCP Server
3
+ emoji: 🩺
4
+ colorFrom: blue
5
+ colorTo: purple
6
+ sdk: gradio
7
+ python_version: 3.11
8
+ sdk_version: 6.0.0
9
+ app_file: app.py
10
+ fullWidth: true
11
+ short_description: "Gradio MCP server exposing healthcare credential tools."
12
+ tags:
13
+ - mcp
14
+ - gradio
15
+ - tools
16
+ - healthcare
17
+ pinned: false
18
+ ---
19
+
20
+ # CredentialWatch MCP Server
21
+
22
+ Agent-ready Gradio Space that exposes healthcare credential tools (lookups, expiry checks, risk scoring) over **Model Context Protocol (MCP)**.
23
+
24
+ ## Hugging Face Space
25
+
26
+ This repository is designed to run as a **Gradio Space**.
27
+
28
+ - SDK: Gradio (`sdk: gradio` in the README header)
29
+ - Entry file: `app.py` (set via `app_file` in the YAML header)
30
+ - Python: 3.11 (pinned with `python_version`)
31
+
32
+ When you push this repo to a Space with SDK = **Gradio**, the UI and the MCP server will be started automatically.
33
 
34
  ## 🩺 About CredentialWatch
35
 
36
  **CredentialWatch** is an agentic system designed to manage healthcare provider credentials. It serves as a central radar to track expiries, license statuses, and compliance risks across multiple providers.
37
 
 
 
 
 
 
 
38
  ### Role of `npi_mcp`
39
  This MCP server exposes tools to search for and retrieve healthcare provider information from the public [NPPES NPI Registry](https://npiregistry.cms.hhs.gov/api). It acts as a proxy, forwarding requests to a backend **Modal** FastAPI service (`NPI_API`) which handles the actual external API communication and normalization.
40
 
41
+ ## MCP Server
42
+
43
+ This Space exposes its tools via **Model Context Protocol (MCP)** using Gradio.
44
+
45
+ ### How MCP is enabled
46
+
47
+ In `app.py` we:
48
+
49
+ - install Gradio with MCP support: `pip install "gradio[mcp]"`
50
+ - define typed Python functions with docstrings
51
+ - launch the app with MCP support:
52
+
53
+ ```python
54
+ demo.launch(mcp_server=True)
55
+ ```
56
+
57
+ ### MCP endpoints
58
+
59
+ When the Space is running, Gradio exposes:
60
+
61
+ - MCP SSE endpoint: `https://<space-host>/gradio_api/mcp/sse`
62
+ - MCP schema: `https://<space-host>/gradio_api/mcp/schema`
63
+
64
  ## ✨ Tools
65
 
66
  This server exposes the following MCP tools:
 
71
  - **`get_provider_by_npi(npi)`**:
72
  - Retrieve detailed information for a specific provider using their 10-digit NPI number.
73
 
74
+ ## Using this Space from an MCP client
 
 
 
 
 
 
75
 
76
+ ### Easiest: Hugging Face MCP Server (no manual config)
 
 
 
 
77
 
78
+ 1. Go to your HF **MCP settings**: https://huggingface.co/settings/mcp
79
+ 2. Add this Space under **Spaces Tools** (look for the MCP badge on the Space).
80
+ 3. Restart your MCP client (VS Code, Cursor, Claude Code, etc.).
81
+ 4. The tools from this Space will appear as MCP tools and can be called directly.
82
 
83
+ ### Manual config (generic MCP client using mcp-remote)
84
 
85
+ If your MCP client uses a JSON config, you can point it to the SSE endpoint via `mcp-remote`:
86
 
87
+ ```jsonc
88
+ {
89
+ "mcpServers": {
90
+ "credentialwatch": {
91
+ "command": "npx",
92
+ "args": [
93
+ "mcp-remote",
94
+ "https://<space-host>/gradio_api/mcp/sse"
95
+ ]
96
+ }
97
+ }
98
+ }
99
  ```
100
 
101
+ Replace `<space-host>` with the full URL of your Space.
102
 
103
+ ## Local development
 
 
104
 
105
  ```bash
106
+ # 1. Install deps
107
+ uv pip install "gradio[mcp]" -r requirements.txt
108
+
109
+ # 2. Run locally
110
+ uv run python app.py
111
+ # or
112
+ GRADIO_MCP_SERVER=True uv run python app.py
113
  ```
114
 
115
+ The local server will be available at `http://127.0.0.1:7860`, and MCP at `http://127.0.0.1:7860/gradio_api/mcp/sse`.
116
 
117
+ ### Testing
118
 
119
  Run tests using `pytest`:
120
 
 
122
  uv run pytest
123
  ```
124
 
125
+ **Note:** The server requires the URL of the backend Modal service. Set the following environment variable:
126
+
127
+ ```bash
128
+ export NPI_API_BASE_URL="https://your-modal-app-url.modal.run"
129
+ ```
130
+
131
+ ## Deploying to Hugging Face Spaces
132
+
133
+ 1. Create a new Space with SDK = **Gradio**.
134
+ 2. Push this repo to the Space (Git or `huggingface_hub`).
135
+ 3. Ensure the YAML header in `README.md` is present and correct.
136
+ 4. Go to **Settings** in your Space and add `NPI_API_BASE_URL` as a secret or variable if you have a private backend, or ensure the default works.
137
+ 5. Wait for the Space to build and start — it should show an **MCP badge** automatically.
138
+
139
+ ## Troubleshooting
140
+
141
+ - **Configuration error**: Verify `sdk`, `app_file`, and `python_version` in the YAML header.
142
+ - **MCP badge missing**: Check that `app.py` calls `demo.launch(mcp_server=True)` or `GRADIO_MCP_SERVER=True` is set. Confirm the Space is public.
143
+ - **Tools not working**: Ensure `NPI_API_BASE_URL` is correctly set in the environment.
144
+
145
  ## 🏗️ Architecture
146
 
147
  - **Stack:** Python 3.11, `mcp`, `httpx`, `pydantic`.