MedRecPro MCP Server

This MCP (Model Context Protocol) server provides secure access to MedRecPro medical records functionality for AI assistants like Claude. It acts as an OAuth 2.1 gateway between MCP clients and the MedRecPro Web API.

Runtime: ASP.NET Core 8.0 URL: https://www.medrecpro.com/mcp

Architecture

The MCP server runs as an IIS virtual application at /mcp on the same Azure App Service as the main MedRecPro UI and API. IIS handles path-based routing to three separate ASP.NET Core processes:

                         Azure App Service: "MedRecPro" (Windows, IIS)
                        +--------------------------------------------------+
                        |                                                  |
+------------------+    |  /          site\wwwroot       MedRecProStatic   |
|  Claude / MCP    | HTTPS  /api       site\wwwroot\api   MedRecPro API    |
|  Client          |------->  /mcp       site\wwwroot\mcp   MedRecProMCP   |
+------------------+    |                                                  |
        |               +--------------------------------------------------+
        v                                    |
+------------------+                         v
|  Cloudflare      |                +------------------+
|  (CDN/WAF/DNS)   |                |  Azure Key Vault |
+------------------+                |  (medrecprovault)|
                                    +------------------+
Virtual PathPhysical PathProjectPurpose
/ site\wwwroot MedRecProStatic UI / Static content
/api site\wwwroot\api MedRecPro Web API
/mcp site\wwwroot\mcp MedRecProMCP MCP Server

Connecting with Claude Desktop

Add the following to your Claude Desktop configuration file:

{
  "mcpServers": {
    "medrecpro": {
      "url": "https://www.medrecpro.com/mcp"
    }
  }
}

Authentication

This server implements OAuth 2.1 with PKCE. When Claude connects, it automatically handles the authentication flow:

  1. Claude sends POST to /mcp (unauthenticated)
  2. Server returns 401 with WWW-Authenticate header pointing to Protected Resource Metadata
  3. Claude fetches /.well-known/oauth-protected-resource (RFC 9728)
  4. Claude fetches /.well-known/oauth-authorization-server (RFC 8414)
  5. Claude registers via /oauth/register (Dynamic Client Registration, RFC 7591)
  6. Claude redirects user to /oauth/authorize?provider=google
  7. User authenticates with Google or Microsoft
  8. Provider redirects to /oauth/callback/{provider}
  9. MCP server issues authorization code, redirects to Claude
  10. Claude exchanges code for tokens via /oauth/token
  11. Claude sends authenticated POST to /mcp with Bearer token
  12. MCP server forwards token to MedRecPro API for each tool call

Supported OAuth scopes: openid, profile, email, mcp:tools, mcp:read, mcp:write

Available Endpoints

All endpoints are externally prefixed with /mcp by the IIS virtual application.

EndpointMethodDescription
/mcp POST MCP Streamable HTTP transport (JSON-RPC)
/mcp/health GET Health check (returns JSON status)
/docs/mcp GET This documentation page (served by static site)
/mcp/.well-known/oauth-protected-resource GET Protected Resource Metadata (RFC 9728)
/mcp/.well-known/oauth-authorization-server GET Authorization Server Metadata (RFC 8414)
/mcp/oauth/authorize GET OAuth authorization endpoint
/mcp/oauth/token POST Token exchange endpoint
/mcp/oauth/register POST Dynamic Client Registration (RFC 7591)
/mcp/oauth/callback/google GET Google OAuth callback
/mcp/oauth/callback/microsoft GET Microsoft OAuth callback
Note: GET /mcp returns HTTP 405 (Method Not Allowed). This is correct behavior — the MCP Streamable HTTP transport only accepts POST requests.

MCP Tools

Once authenticated, Claude automatically discovers the following tools when connecting to the /mcp endpoint. Tools are organized into two categories:

Drug Label Tools

Search and retrieve FDA drug label information from the MedRecPro database. All drug data is sourced from official FDA Structured Product Labeling (SPL) documents.

search_drug_labels ──► Quick lookups, section queries, comparisons
                       ├── ProductName, ActiveIngredient, UNII
                       ├── Label sections (Indications, Warnings, etc.)
                       └── ViewLabelUrl - link to FDA label

export_drug_label_markdown ──► Complete label export (TWO-STEP)
  Step 1: Search products ─────► User selects DocumentGUID
  Step 2: Export markdown ──────► FullMarkdown + ViewLabelUrl

search_expiring_patents ──► Orange Book patent searches
                            ├── Patent expiration dates
                            └── Generic availability timeline

search_by_pharmacologic_class ──► Drug class discovery
                                  ├── AI-powered class matching
                                  └── Products grouped by class

search_by_indication ──► Condition-based drug discovery
                         ├── AI-powered indication matching
                         └── Products grouped by indication

search_drug_labels

Searches for FDA drug labels and returns complete product details with markdown-formatted label sections.

Use when the user asks specific questions about a drug (e.g., "What are the side effects of Lipitor?" or "Compare aspirin and ibuprofen").

ParameterTypeRequiredDescription
productNameSearch string Optional Brand/product name search (e.g., "Lipitor", "Advil"). Supports partial matching.
activeIngredientSearch string Optional Generic/active ingredient name search (e.g., "atorvastatin", "ibuprofen"). Supports partial matching.
unii string Optional UNII (Unique Ingredient Identifier) code for exact chemical match (e.g., "R16CO5Y76E" for aspirin).
sectionCode string Optional LOINC section code to filter results to a specific label section. See section codes table below.
pageNumber int Optional Page number for pagination (1-based). Default: 1.
pageSize int Optional Results per page (1–50). Default: 10. Recommended: 3 for initial searches since labels are large.

Returns: Array of product objects containing ProductName, ActiveIngredient, UNII, DocumentGUID, markdown-formatted label Sections, and a ViewLabelUrl link to view the FDA label in a browser.

export_drug_label_markdown

Exports a complete FDA drug label as clean, well-formatted markdown.

Use when the user wants a complete label (e.g., "Show me the full label for Lipitor" or "Export the label for atorvastatin").

Step 1 — Product Search: Call without documentGuid to search for products.

ParameterTypeRequiredDescription
productNameSearch string Optional Brand/product name search (e.g., "Lipitor").
activeIngredientSearch string Optional Generic ingredient name search (e.g., "atorvastatin").
unii string Optional UNII code for exact ingredient match.

List of matching products with ProductName, ActiveIngredient, UNII, and DocumentGUID. The user selects the correct product.

Step 2 — Export Markdown: Call with documentGuid from Step 1 selection.

ParameterTypeRequiredDescription
documentGuid string Required DocumentGUID from Step 1 selection (e.g., "052493C7-89A3-452E-8140-04DD95F0D9E2").

Complete label as formatted markdown with source links (ViewLabelUrl).

search_expiring_patents

Searches Orange Book NDA patents by expiration date, brand name, or active ingredient.

Use when the user asks about patent expiration or generic drug availability (e.g., "When will generic Ozempic be available?" or "What patents expire in 6 months?").

ParameterTypeRequiredDescription
tradeName string Optional Brand name search (e.g., "Ozempic", "Lipitor"). Supports partial matching.
ingredient string Optional Generic/active ingredient name search (e.g., "semaglutide", "atorvastatin").
expiringInMonths int Optional Patent expiration window in months (e.g., 6 for next 6 months). Must be > 0.
pageNumber int Optional Page number (1-based). Default: 1.
pageSize int Optional Results per page (1–200). Default: 10.

Returns: Patents with trade name, active ingredient, expiry date, patent number, and dosage form. Includes pre-rendered markdown table and links to FDA labels when available.

search_by_pharmacologic_class

Discovers groups of drugs by therapeutic or pharmacologic class using AI-powered natural language search.

Use when the user asks about drug classes or groups (e.g., "Show me all beta blockers" or "What SSRIs are available?").

ParameterTypeRequiredDescription
query string Optional AI-powered natural language search (e.g., "beta blockers", "SSRIs", "statins"). Maps common terms to pharmacologic classes.
classNameSearch string Optional Direct partial match on exact class names (fallback if AI search returns no results).
maxProductsPerClass int Optional Maximum products per class (1–1000). Default: 500.
pageNumber int Optional Page number (1-based, used with classNameSearch). Default: 1.
pageSize int Optional Results per page (1–200, used with classNameSearch). Default: 25.

Returns: Matched classes, products grouped by class with label links, total product count, and suggested follow-up queries.

search_by_indication

Discovers drugs that treat a specific medical condition or disease using AI-powered matching.

Use when the user asks what drugs treat a condition (e.g., "What drugs treat high blood pressure?" or "What medications are used for diabetes?").

ParameterTypeRequiredDescription
query string Required Natural language condition search (e.g., "high blood pressure", "diabetes", "depression"). AI maps common terms to medical conditions.
maxProductsPerIndication int Optional Maximum products per indication (1–100). Default: 25.

Returns: Matched indications, products grouped by indication with label links, total product count, validation reason, and suggested follow-up queries.

User Tools

Manage user profile and activity information. All operations require authentication.

get_my_profile

Gets the current authenticated user's profile information including name, email, and roles.

No parameters required.

get_my_activity

Gets the current user's recent activity log showing actions performed in the system.

ParameterTypeRequiredDescription
pageNumber int Optional Page number (1-based). Default: 1.
pageSize int Optional Results per page (1–100). Default: 20.

get_my_activity_by_date_range

Gets the current user's activity within a specific date range.

ParameterTypeRequiredDescription
startDate string Required Start date in ISO 8601 format (e.g., 2024-01-01).
endDate string Required End date in ISO 8601 format (e.g., 2024-12-31).
pageNumber int Optional Page number (1-based). Default: 1.
pageSize int Optional Results per page (1–100). Default: 20.

Common LOINC Section Codes

Use these codes with the sectionCode parameter in search_drug_labels to filter results to a specific label section:

CodeSectionTypical User Question
34067-9 Indications and Usage What is this drug used for?
34084-4 Adverse Reactions What are the side effects?
34070-3 Contraindications When should I NOT use this?
43685-7 Warnings and Precautions What are the warnings?
34068-7 Dosage and Administration What is the dosage?
34073-7 Drug Interactions Does this interact with other drugs?
34088-5 Overdosage What happens in an overdose?
34066-1 Boxed Warning Does this have a black box warning?
34090-1 Clinical Pharmacology How does this drug work?
34076-0 Use in Specific Populations Is this safe during pregnancy?
Section Fallback: Not all FDA labels have every LOINC section code. If a query with a specific sectionCode returns empty results, retry without the sectionCode parameter to retrieve all available sections, then search the content for the relevant information.

Tool Selection Guide

User IntentTool
"What are the side effects of X?" search_drug_labels
"What is the dosage for X?" search_drug_labels
"What are the warnings for X?" search_drug_labels
"What is X used for?" search_drug_labels
"Compare X and Y" search_drug_labels
"Show me the full label for X" export_drug_label_markdown
"Export the label" export_drug_label_markdown
"When will generic X be available?" search_expiring_patents
"What patents expire in 6 months?" search_expiring_patents
"Show me all beta blockers" search_by_pharmacologic_class
"What SSRIs are available?" search_by_pharmacologic_class
"What drugs treat high blood pressure?" search_by_indication
"What medications are used for diabetes?" search_by_indication
"What is my profile?" get_my_profile
"Show my recent activity" get_my_activity
"What did I do last week?" get_my_activity_by_date_range

Support

For questions or issues, visit www.medrecpro.com