MedRecPro MCP Server

Version: 1.0.3

Runtime: ASP.NET Core 8.0

Production URL: https://www.medrecpro.com/mcp

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.

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\wwwrootMedRecProStaticUI / Static content
/apisite\wwwroot\apiMedRecProWeb API
/mcpsite\wwwroot\mcpMedRecProMCPMCP Server (this project)

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
/mcpPOSTMCP Streamable HTTP transport (JSON-RPC)
/mcp/healthGETHealth check (returns JSON status)
/mcp/docsGETThis documentation page
/mcp/.well-known/oauth-protected-resourceGETProtected Resource Metadata (RFC 9728)
/mcp/.well-known/oauth-authorization-serverGETAuthorization Server Metadata (RFC 8414)
/mcp/oauth/authorizeGETOAuth authorization endpoint
/mcp/oauth/tokenPOSTToken exchange endpoint
/mcp/oauth/registerPOSTDynamic Client Registration (RFC 7591)
/mcp/oauth/callback/googleGETGoogle OAuth callback
/mcp/oauth/callback/microsoftGETMicrosoft 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.

Tool Workflow: 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_drug_labels

Searches for FDA drug labels and returns complete product details with markdown-formatted label sections. This is the primary tool for answering specific drug questions such as side effects, dosage, warnings, indications, and drug interactions.

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", "Tylenol"). 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. Implements a two-step workflow: first search for products, then export the selected document.

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):

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.

Returns a list of matching products with ProductName, ActiveIngredient, UNII, and DocumentGUID. The user selects the correct product from the results.

Step 2 — Export Markdown (call with documentGuid):

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

Returns the complete label as formatted markdown with source links (ViewLabelUrl).

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-9Indications and Usage"What is this drug used for?"
34084-4Adverse Reactions"What are the side effects?"
34070-3Contraindications"When should I NOT use this?"
43685-7Warnings and Precautions"What are the warnings?"
34068-7Dosage and Administration"What is the dosage?"
34073-7Drug Interactions"Does this interact with other drugs?"
34088-5Overdosage"What happens in an overdose?"
34066-1Boxed Warning"Does this have a black box warning?"
34090-1Clinical Pharmacology"How does this drug work?"
34076-0Use 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.

User Tools

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

GetMyProfile

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

No parameters required.

GetMyActivity

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.

GetMyActivityByDateRange

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.

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
"Show me all information about X"export_drug_label_markdown
"What is my profile?"GetMyProfile
"Show my recent activity"GetMyActivity

Support

For questions or issues, visit www.medrecpro.com