Provides secure read-only access to a PostgreSQL-based Hospital Management System through defined views, enabling queries for doctors, departments, appointments, room status, and billing summaries while protecting sensitive patient health information.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Hospital MCP Servershow me appointments for Dr. Smith tomorrow"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ฅ Hospital MCP Server
Secure PostgreSQL Access via Model Context Protocol (MCP)
Claude Desktop acts as the MCP client
This project implements a secure Model Context Protocol (MCP) server that connects to a PostgreSQL-based Hospital Management System.
Claude Desktop communicates with this server and can safely query hospital data through defined, read-only MCP tools.
๐ Project Structure
๐๏ธ 1. PostgreSQL Setup
You must create secure read-only views before exposing data to Claude.
Create Views (Safe, non-sensitive)
๐ 2. Create Restricted DB Role
Only the views are exposed โ raw PHI tables are protected.
โ๏ธ 3. Environment Variables (.env)
Your MCP server reads DB credentials from here:
๐ง 4. MCP Server (main.py)
main.py runs your MCP server and exposes tools such as:
get_doctor_by_idlist_doctors_by_departmentget_appointments_for_doctorcheck_room_statusget_patient_billing_summary
All SQL queries are:
โ parameterized โ read-only โ safely constrained
๐ 5. Installing Dependencies
Inside your project folder:
Or if using pip manually:
(Dependencies are defined in pyproject.toml)
๐ค 6. Connecting MCP Server to Claude Desktop
Claude Desktop automatically detects MCP servers placed in its extensions directory.
In your local file system "C:\Users\shesh\AppData\Roaming\Claude\claude_desktop_config.json" edit this file with your configurations
๐ Step 3 โ Restart Claude Desktop
Go to:
Claude Desktop โ Settings โ Developer You should see:
Claude will now:
Launch your
main.pyMCP serverDiscover available tools
Call them automatically during conversation
๐งช 7. Testing Inside Claude
In Claude Desktop you can ask:
Claude will call:
Or:
Claude โ calls your MCP tool โ your DB โ safe output returned.
๐ฏ Summary
You now have:
โ A working Python MCP server โ Secure PostgreSQL integration โ Fully wired Claude Desktop tool access โ Safe read-only hospital data views โ Clean project structure
Claude Desktop communicates with your DB only through your safe MCP tools, never accessing raw tables directly.