google-labs-jules[bot] commited on
Commit
922d1b8
Β·
1 Parent(s): d4a1440

Update README.md with comprehensive system overview and component details

Browse files
Files changed (1) hide show
  1. README.md +127 -0
README.md ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CredentialWatch: Alert MCP Server
2
+
3
+ ## Overview
4
+
5
+ CredentialWatch is a demo product for the **Hugging Face "MCP 1st Birthday / Gradio Agents Hackathon"**. It is designed to act as a unified, queryable view of provider credentials and a proactive alerting system for expirations (state licenses, board certs, DEA/CDS, etc.) in a US-style healthcare setting.
6
+
7
+ The system leverages:
8
+ - **Model Context Protocol (MCP)** for standardized tool interfaces.
9
+ - **LangGraph** for agentic workflows (sweeps, Q&A).
10
+ - **Gradio** for the user interface.
11
+ - **FastAPI & SQLite** for backend services and data persistence.
12
+
13
+ ### System Architecture
14
+
15
+ The complete CredentialWatch system consists of three separate MCP servers:
16
+ 1. **npi_mcp**: Read-only access to the public NPPES NPI Registry.
17
+ 2. **cred_db_mcp**: Internal provider & credential database operations.
18
+ 3. **alert_mcp** (This Repository): Alert logging, listing, and resolution.
19
+
20
+ These servers interact with a **LangGraph Agent** and **Gradio UI** to provide a seamless experience for managing provider credentials and risks.
21
+
22
+ ---
23
+
24
+ ## This Repository: `alert_mcp` & `alert_mcp_server`
25
+
26
+ This repository specifically houses the **Alert MCP** component, which includes:
27
+
28
+ 1. **`src/alert_mcp`**: A FastAPI backend service that manages the `alerts` table in a SQLite database. It provides endpoints to log alerts, retrieve open alerts, and mark them as resolved.
29
+ 2. **`src/alert_mcp_server`**: A Gradio-based MCP server. It acts as a frontend/wrapper that exposes the alert capabilities as MCP tools (via SSE) and provides a simple web UI for testing and interaction.
30
+
31
+ ### Features
32
+ - **Log Alert**: Create new alerts with severity levels (info, warning, critical).
33
+ - **View Alerts**: Query open alerts, filtered by provider or severity.
34
+ - **Resolve Alert**: Mark alerts as resolved with a note.
35
+ - **Summarize**: Get a breakdown of alerts by severity.
36
+ - **MCP Support**: Exposes these functions as MCP tools for agents to use.
37
+
38
+ ---
39
+
40
+ ## Prerequisites
41
+
42
+ - **Python 3.11**
43
+ - **uv** (recommended for dependency management)
44
+
45
+ ## Installation
46
+
47
+ 1. **Clone the repository**:
48
+ ```bash
49
+ git clone <repo-url>
50
+ cd <repo-dir>
51
+ ```
52
+
53
+ 2. **Install dependencies**:
54
+ ```bash
55
+ uv sync
56
+ ```
57
+ Or using pip:
58
+ ```bash
59
+ pip install .
60
+ ```
61
+
62
+ ## Configuration
63
+
64
+ The system uses environment variables for configuration. Create a `.env` file or set them in your environment:
65
+
66
+ ```bash
67
+ # src/alert_mcp_server/config.py
68
+ ALERT_API_BASE_URL=http://localhost:8000 # URL of the backend alert_mcp service
69
+ DB_FILE_PATH=/data/credentialwatch.db # Path to SQLite DB (used by backend)
70
+ ```
71
+
72
+ ## Usage
73
+
74
+ ### 1. Run the Backend (`alert_mcp`)
75
+
76
+ The backend service manages the database and API.
77
+
78
+ ```bash
79
+ uv run uvicorn src.alert_mcp.main:app --reload --port 8000
80
+ ```
81
+ This will start the FastAPI server at `http://localhost:8000`. It will automatically create the SQLite database at `DB_FILE_PATH` (defaulting to `./credentialwatch.db` or similar if not set).
82
+
83
+ ### 2. Run the Gradio MCP Server (`alert_mcp_server`)
84
+
85
+ The Gradio server connects to the backend and exposes the UI and MCP tools.
86
+
87
+ ```bash
88
+ uv run python -m src.alert_mcp_server.main
89
+ ```
90
+ This will launch the Gradio interface (usually at `http://localhost:7860`).
91
+
92
+ ### Using with an MCP Client
93
+
94
+ The `alert_mcp_server` exposes MCP tools via SSE (Server-Sent Events). An MCP-compatible agent (like the CredentialWatch LangGraph agent) can connect to this server to:
95
+ - `log_alert(...)`
96
+ - `get_open_alerts(...)`
97
+ - `mark_alert_resolved(...)`
98
+
99
+ ## Testing
100
+
101
+ Run the test suite using `pytest`:
102
+
103
+ ```bash
104
+ uv run pytest
105
+ ```
106
+
107
+ ## Project Structure
108
+
109
+ ```
110
+ .
111
+ β”œβ”€β”€ src/
112
+ β”‚ β”œβ”€β”€ alert_mcp/ # FastAPI Backend & DB Models
113
+ β”‚ β”‚ β”œβ”€β”€ main.py # App entrypoint
114
+ β”‚ β”‚ β”œβ”€β”€ models.py # SQLAlchemy models (Alert)
115
+ β”‚ β”‚ β”œβ”€β”€ db.py # DB connection logic
116
+ β”‚ β”‚ └── ...
117
+ β”‚ └── alert_mcp_server/ # Gradio UI & MCP Tool Wrapper
118
+ β”‚ β”œβ”€β”€ main.py # Gradio app entrypoint
119
+ β”‚ β”œβ”€β”€ tools.py # Client logic to talk to backend
120
+ β”‚ └── ...
121
+ β”œβ”€β”€ tests/ # Test suite
122
+ └── pyproject.toml # Dependencies
123
+ ```
124
+
125
+ ## License
126
+
127
+ MIT