# PharmWare MCP

> PharmWare MCP Server automates cannabis lab operations. Your AI client manages samples, tracks results (potency, pesticides), issues Certificates of Analysis (CoAs), and monitors compliance workflows—all from natural conversation.

## Overview
- **Category:** erp-operations
- **Price:** Free
- **Tags:** lab-testing, compliance, sample-tracking, certificate-of-analysis, seed-to-sale

## Description

When you connect your AI client to this server, it lets you run complex lab operations using plain conversation. You're not navigating a clunky LIMS dashboard; your agent handles quality assurance and compliance tracking through natural dialogue. 

To track sample status, call `list_samples` to see every incoming cannabis sample, showing who submitted it, what type of test is needed, and its current testing priority. From there, you can use `list_batches` to pull up all production batches—whether they're quarantined or ready for release—and check which samples belong to them. You get a full picture by running `list_clients`, which gives you access to every registered client like cultivators, processors, or retailers and their account status.

For generating regulatory reports, the agent pulls data from multiple sources. It uses `list_results` to retrieve detailed findings for specific samples, giving you exact percentages for THC/CBD and a pass/fail status against established limits. You can verify product compliance by checking these analytical results against defined standards using `list_tests`, which provides a list of available test methods and their regulatory limits. When the work is done, your agent pulls up all issued Certificates of Analysis (CoAs) via `list_certificates`, providing potency profiles and the consumer-facing QR code you need.

To maintain rigorous lab oversight, call `list_workflows` to see the standard operating procedures (SOPs) for the whole process—from initial intake right through CoA issuance. You can also run `list_reports` to generate summaries or trend analyses required for state submissions and internal audits across a specific time window.

When it comes to auditing system actions, you're covered. The agent retrieves detailed logs of every single action taken in the lab using `list_audit_logs`, detailing who did what change and when—this is crucial for FDA 21 CFR Part 11 compliance and inspections. You can check user access by calling `list_users` to list all staff accounts, noting their assigned role and current permission level. For physical assets, run `list_instruments` to check the name, model, and most importantly, the calibration status for every lab instrument—like your HPLC or GC-MS.

To ensure connectivity, you can use `list_integrations` to verify if external systems like Metrc or state APIs are connected and syncing data correctly. For a complete picture of who's running what, you'll get the full list of registered users via `list_users`, while `list_clients` keeps track of your partners. The agent manages all this so you don't have to manually check dashboards; just talk to it.

## Tools

### list_audit_logs
Lists every logged action in the lab—who did it, what changed, and when—for compliance investigations.

### list_batches
Retrieves all cannabis production batches, showing their status (quarantined, released) and associated samples for tracking.

### list_certificates
Lists all issued Certificates of Analysis (CoAs), providing details like potency profiles and the consumer-facing QR code.

### list_clients
Gets a list of all registered clients—cultivators, processors, or retailers—and their account status.

### list_instruments
Checks the name, model, and calibration status for every lab instrument (HPLC, GC-MS) on site.

### list_integrations
Verifies if external systems like Metrc or state APIs are connected and syncing data correctly.

### list_reports
Generates summaries, trend analyses, or regulatory submission documents for a specified time period.

### list_results
Retrieves detailed analytical findings for samples, including THC/CBD percentages and pass/fail status against limits.

### list_samples
Lists all incoming cannabis samples, showing the submitting client, sample type, and current testing priority.

### list_tests
Provides a list of available test methods (e.g., potency, pesticides) and their associated regulatory limits.

### list_users
Lists all lab staff accounts, including their assigned role and current permission level.

### list_workflows
Outlines the standard operating procedures (SOPs) for the lab, showing active processes from intake through CoA issuance.

## Prompt Examples

**Prompt:** 
```
Show me all cannabis samples currently in testing and their expected completion dates.
```

**Response:** 
```
Scanning active laboratory queue... I found 23 samples currently in testing across your analytical departments. Breakdown: 8 samples in Potency (HPLC) — average completion 2025-04-11, 6 samples in Terpene Profiling (GC-MS) — expected 2025-04-12, 5 samples in Pesticide Screening (LC-MS/MS) — due 2025-04-13, and 4 samples in Heavy Metals (ICP-MS) — targeting 2025-04-14. Three samples are marked as priority rush orders. Would you like the detailed status for any specific client submissions?
```

**Prompt:** 
```
List all pending Certificates of Analysis awaiting review and signature.
```

**Response:** 
```
Reviewing CoA approval queue... I found 7 Certificates of Analysis pending quality manager review and authorized signatory approval. Notable entries: CoA-2025-0892 (Blue Dream Batch BD-4412 — potency 28.4% THC, passed all contaminant panels), CoA-2025-0893 (OG Kush Batch OG-3387 — full panel clearance), and CoA-2025-0897 (Sour Diesel Concentrate SD-C891 — residual solvents within limits). Average pending time is 18 hours. Should I prioritize the rush orders for immediate release?
```

**Prompt:** 
```
Check the integration status with state regulatory APIs and WeedMaps CoA publishing.
```

**Response:** 
```
Querying integration health dashboard... All external platform connections are operational. Metrc seed-to-sale sync: last successful transmission 2025-04-09 14:32 UTC (147 CoAs published, 0 failures). BioTrack inventory linkage: active, last reconciliation 2025-04-09 12:00 UTC. State regulatory API (Leaf Data Systems): compliant, all mandatory submissions current through Q1 2025. WeedMaps CoA consumer portal: 12 new certificates pushed in last 24 hours, all QR codes verified active. No sync errors detected in past 7 days. Would you like me to generate an integration performance summary?
```

## Capabilities

### Track Sample Status
The agent monitors all submitted cannabis samples, showing their current location in the workflow and when they are expected to finish testing.

### Generate Regulatory Reports
It pulls data from various sources (samples, results, clients) to generate compliance reports needed for state submissions or internal audits.

### Verify Product Compliance
You confirm if specific product batches meet all regulatory requirements by checking analytical test results against defined limits.

### Audit System Actions
The agent retrieves detailed logs of every action taken in the lab, which is crucial for FDA 21 CFR Part 11 compliance and inspections.

## Use Cases

### Client needs an urgent compliance check.
A client calls demanding to know if their recent batch is ready for sale. Instead of making them wait on hold, your agent runs `list_samples` and then checks `list_results`. It reports back: 'Sample ID 503 has passed all required tests (potency > X%). We can issue the CoA now.' The problem is solved in three steps.

### Investigating a deviation during an audit.
An auditor questions how a test result was modified. You tell your agent to run `list_audit_logs` for that specific batch ID. It immediately pulls up the log, showing the timestamp, the user who made the change, and the justification comment. Compliance is maintained.

### Verifying equipment readiness.
The chemist starts a run but suspects an instrument might be out of calibration. They ask the agent to check `list_instruments`. The agent replies: 'HPLC system serial XYZ needs maintenance; its next scheduled service date is overdue.' Testing stops until it's fixed.

### Releasing a large batch for market.
The QC manager needs to prove that 50 separate batches are ready. They run `list_batches` and then follow up with 'List all Certificates of Analysis (CoAs) issued today.' The agent compiles the data, confirming every lot has its documentation.

## Benefits

- **Audit Compliance Effortlessly:** Need to prove who changed a record? Use `list_audit_logs` to reconstruct every event sequence, making FDA 21 CFR Part 11 audits simple.
- **Manage Product Disposition Fast:** Don't wait for reports. Query `list_results` directly to see potency percentages or pesticide levels and instantly confirm if a batch can be released.
- **Ensure System Connectivity:** Stop guessing about data flow. Run `list_integrations` to verify that Metrc, BioTrack, and state APIs are all syncing correctly in real time.
- **Control Staff Access:** Need to know who has approval rights? Use `list_users` to review staff roles and permission levels before approving critical test results.
- **Monitor the Queue:** Know where every sample is. The `list_samples` tool gives you a clear view of incoming material, its type, and current testing status.

## How It Works

The bottom line is your AI client handles the complex API calls and translates them into simple answers for you.

1. Subscribe to this server and enter your PharmWare API keys.
2. Ask your AI agent a question (e.g., 'What's the status of Batch XYZ?').
3. The agent uses the appropriate tool (`list_samples` or `list_batches`) to retrieve structured data, which it then presents as a natural language answer.

## Frequently Asked Questions

**How do I check if a specific batch was correctly tested using list_batches?**
You run `list_batches` and find the Batch ID. The result shows the 'linked samples submitted for testing' status, confirming its compliance journey.

**What information is included in the Certificates of Analysis (CoA) using list_certificates?**
The CoA record includes the certificate number, linked sample/batch, full analytical results, and a QR code for consumer verification. It's everything needed to prove quality.

**Can I see who accessed my data in the past using list_audit_logs?**
Yes, `list_audit_logs` tracks every action taken—who performed it, what record was affected, and even the IP address. This is critical for internal investigations.

**Does PharmWare MCP Server track client details? Use list_clients.**
Yes, `list_clients` gives you a roster of all registered cultivators, processors, or retailers, along with their license and account status.

**What does the tool `list_samples` show about my samples' progress?**
It shows the sample’s current status, priority, and chain of custody. You get the unique ID, client name, type (flower, edible, etc.), received date, and the testing status—whether it's 'in-progress,' 'completed,' or 'failed.' This helps you track workflow time and know if a batch is stalled.

**How can I verify actual compliance data using `list_results`?**
This tool provides the raw analytical findings for specific tests. You see the precise measurements—like THC/CBD percentages or pesticide residue levels—along with a clear pass/fail determination against regulatory limits. This is the core data used to decide if a product can be released.

**Does the tool `list_instruments` help me manage equipment compliance?**
Yes, it provides crucial operational details for your lab hardware. You list every instrument (HPLC, GC-MS) and check its calibration status, last calibration date, and next required maintenance. This is essential for maintaining data integrity during inspections.

**How can I check the health of my external connections using `list_integrations`?**
This tool checks all platform syncs to services like Metrc or state APIs. It reports the connection status, the last successful data synchronization timestamp, and any recorded error logs. This confirms that your lab systems are correctly communicating with outside regulatory bodies.

**Can my AI automatically check if a cannabis sample has passed all required tests and is ready for Certificate of Analysis issuance?**
Yes! Use the `list_results` tool to fetch all completed analytical findings for a specific sample. Your AI agent will respond with comprehensive pass/fail determinations across potency, terpenes, pesticides, heavy metals, and contaminant panels. Once all required tests show passing results, use `list_certificates` to verify CoA generation status. Always confirm regulatory limit compliance before releasing products to distribution or retail channels.

**How do I quickly identify which laboratory instruments are due for calibration or maintenance?**
Simply ask the agent to run the `list_instruments` action. It will compile all analytical equipment with calibration status, last service date, next scheduled maintenance, and qualification records. The AI will highlight any HPLC, GC-MS, ICP-MS, or other systems approaching calibration expiry or overdue for preventive maintenance. This ensures your laboratory maintains ISO/IEC 17025 compliance and analytical data integrity.

**Does PharmWare integration allow modifying test results or deleting sample records?**
No. The current toolset focuses strictly on read-only querying and analytical operations — listing samples, reviewing results, checking certificates, and monitoring workflows. State alteration operations (modifying test data, deleting samples, or revoking certificates) are not currently exposed, assuring your laboratory records remain secure against destructive queries and maintaining complete audit trail integrity for regulatory inspections.