# Open Payments MCP

> Open Payments (CMS Physician Data) connects your AI client directly to official CMS records, letting you audit financial relationships in healthcare. Use this server to search physicians by NPI or name and query massive payment datasets for compliance checks, market research, or journalism. It gives you deep transparency into how drug companies pay doctors and hospitals.

## Overview
- **Category:** data-analytics
- **Price:** Free
- **Tags:** transparency, financial-disclosure, physician-data, healthcare-compliance, public-records, data-query

## Description

Open Payments connects your AI client straight to official Centers for Medicare & Medicaid Services (CMS) records, letting you audit financial relationships across healthcare. You can use this server to dig into massive payment datasets to check compliance, do market research, or write a deep-dive article on industry funding. It gives you total transparency into how drug and device companies pay doctors and hospitals.

To start your investigation, you've got a couple of ways to locate specific parties involved in the payments. You can use `search_physicians` to find details on healthcare providers; just input their Name, NPI number, or medical specialty, and it locates them for you. If you need to track down institutions instead, run `search_teaching_hospitals`, which finds official teaching hospital records using either the facility's full name or its physical address.

Before you start running queries, you gotta know what data is even available. First, call `list_datasets` to pull up a complete rundown of all reporting cycles and payment category datasets currently housed in the CMS system. Once you see a dataset ID that looks promising, use `get_dataset`. This tool pulls the technical metadata—the column definitions, data types, and schema blueprint—for any specific dataset ID you need to query against.

When you're ready for the deep dive, you run `query_dataset`. This is where the heavy lifting happens. You can execute filtered searches across massive payment datasets using SQL-like syntax, letting you select precise records by applying filters and selections directly through `$where` and `$select` parameters. For example, if you want to know exactly how much Company X paid Doctor Y for Service Z in Q2 2023, `query_dataset` lets you build that query right into your workflow.

When you combine these tools—finding the providers with `search_physicians`, finding the hospitals with `search_teaching_hospitals`, seeing what data exists with `list_datasets`, getting the schema details with `get_dataset`, and finally executing the filtered searches with `query_dataset`—you've got a full auditing capability. You don’t just get raw numbers; you get auditable records showing the specific financial link, the reporting entity, and the covered recipient. It’s all structured data waiting for your agent to pull it out.

You can combine searching by name or specialty with querying payment amounts. You'll find that knowing which dataset ID corresponds to a certain year or category is key; use `list_datasets` first, then get its schema using `get_dataset`, and finally run the specific search criteria you need via `query_dataset`. The entire process centers on building an airtight data trail from discovery to final record extraction. It’s designed for compliance checks, market analysis comparing payment streams across regions, or journalism that requires absolute accuracy in financial reporting.

## Tools

### list_datasets
Lists all currently available reporting cycles and payment category datasets within the system.

### get_dataset
Retrieves the technical metadata and column definitions for a specific Open Payments dataset ID.

### query_dataset
Runs a filtered search against a specified dataset, allowing you to select specific records using SQL-like filters.

### search_physicians
Searches and locates specific healthcare providers using their NPI number, name, or medical specialty.

### search_teaching_hospitals
Finds teaching hospitals by searching using either the hospital’s full name or its physical address.

## Prompt Examples

**Prompt:** 
```
List all available datasets in the Open Payments system.
```

**Response:** 
```
I've retrieved the available datasets. There are several reporting cycles available, including 'General Payments 2023' (ID: pg6p-7v62) and 'Research Payments 2023' (ID: 5930-21xa). Which one would you like to explore?
```

**Prompt:** 
```
Search for physicians with the specialty 'Cardiology' named 'Smith'.
```

**Response:** 
```
Searching the physician database... I found 3 matches for 'Smith' in Cardiology. Would you like to see their NPI numbers or check for payments associated with one of them?
```

**Prompt:** 
```
Query dataset 'pg6p-7v62' for payments where the amount is greater than 5000.
```

**Response:** 
```
Executing query on dataset pg6p-7v62... I found 12 records matching that criteria. The largest payment was $25,000 made to a teaching hospital in Boston. Should I list the top 5 results?
```

## Capabilities

### Search for Specific Physicians
Find details on healthcare providers by inputting their Name, NPI number, or specialty.

### Identify Teaching Hospitals
Look up official teaching hospitals using either the hospital's name or physical address.

### List Available Data Sources
Retrieve a list of all reporting cycles and payment datasets available in the CMS system.

### Get Dataset Schema Details
Pull metadata—column definitions, data types, etc.—for any specific dataset ID you need to query.

### Query Payment Records
Run deep queries against massive payment datasets using filters and selections to extract precise information.

## Use Cases

### Investigating Potential Conflicts of Interest
A journalist suspects a doctor is receiving payments from multiple competing device companies. They ask their agent to run `search_physicians` for the doctor's NPI, then use that ID in `query_dataset`. The agent pulls all payment records and groups them by industry type, solving the problem in minutes.

### Compliance Audit of a New Department
A compliance officer needs to confirm every provider associated with a newly acquired hospital is properly disclosed. They use `search_teaching_hospitals` first to verify the institution's official record, then run targeted searches via `query_dataset` against that location’s payment history.

### Analyzing Market Shifts in Cardiology
A healthcare analyst wants to know how much money was paid to cardiologists from pharmaceutical companies last year. They first call `list_datasets` to find the correct cycle, then use `query_dataset`, filtering by 'Cardiology' specialty and setting a minimum payment threshold.

### Validating Data for Internal Reports
You need to know exactly what fields are available in last year's payments data. You run `get_dataset` on the relevant ID, which hands you the full schema definition so your agent writes a query that won't break.

## Benefits

- Compliance checks are faster. Instead of manually cross-referencing records, you use `search_physicians` to instantly verify a provider's full identity and specialty against official CMS data.
- Deep trend analysis is possible. You run complex filters with `query_dataset`, allowing your agent to pull out only the payments over $10,000 from a specific year, bypassing years of manual spreadsheet work.
- Schema guesswork stops here. If you don't know how a dataset works, use `get_dataset` first. It provides the exact column definitions so you write perfect queries every time.
- Discover available data instantly. Use `list_datasets` to see which reporting cycles (e.g., General Payments 2023) are active before writing your query.
- Hospital lookups are precise. Need to confirm a facility? Running `search_teaching_hospitals` by name or address gives you the official record ID immediately.

## How It Works

The bottom line is that you talk to your AI client, and it handles all the complex API calls needed to pull structured financial data from Medicare sources.

1. First, connect your AI client and provide the Open Payments API Key (App Token).
2. Next, use `list_datasets` or `search_physicians` to narrow down the scope of your investigation.
3. Finally, pass specific criteria to `query_dataset`, which runs the search against the live CMS records, returning actionable data.

## Frequently Asked Questions

**How do I start if I don't know which payment dataset to check using list_datasets?**
First, run `list_datasets` to see all available reporting cycles. Then, review the resulting IDs and use `get_dataset` on a few promising ones. This gives you the schema details you need before running a full query.

**Can I find payment history for a hospital using search_teaching_hospitals?**
No, `search_teaching_hospitals` only finds the official record and metadata. To get payments, you must use that resulting name or ID in conjunction with `query_dataset`.

**What is the difference between search_physicians and query_dataset?**
`search_physicians` is for finding a person's record (NPI, specialty). `query_dataset` is for running complex searches on large tables of transactions *about* people or hospitals.

**Does the Open Payments MCP Server cover all types of payments?**
The server accesses CMS-published data. Always start by using `list_datasets` to verify that the specific payment type you need (e.g., Research vs. General) is available in a current dataset.

**What authentication credentials does `query_dataset` require?**
It requires a valid Open Payments API Key (App Token), which you must provide upon server connection. This token authorizes your agent to access the CMS database records. Without it, all query attempts will fail due to insufficient permissions.

**If I use advanced filtering in `query_dataset`, what format must the $where clause take?**
The $where filter expects a specific SQL-like syntax for effective searching. You need to structure your filters using standard comparison operators (e.g., amount > 5000) and correctly identify the dataset's column names, which you can check first with `get_dataset`.

**Are there rate limits when running multiple calls with `search_physicians` or `list_datasets`?**
Yes, external API services enforce rate limits to maintain system stability. When your agent exceeds the allotted requests per minute, you must implement a pause/retry mechanism in your workflow logic. We recommend batching similar queries.

**Before running a query, how can I verify column names using `get_dataset`?**
`get_dataset` retrieves the full schema and metadata for any specific dataset ID. This output gives you all available field names and their data types, guaranteeing that your subsequent queries will use valid identifiers.

**How can I find payments for a specific doctor by their NPI?**
Use the `search_physicians` tool and provide the `npi` parameter. Your agent will return matching physician records which you can then use to query specific payment datasets.

**Can I filter results to only show payments above a certain dollar amount?**
Yes, use the `query_dataset` tool with the `where` parameter. For example, you can set `where` to `total_amount_of_payment_usdollars > 1000` to filter for high-value transactions.

**How do I see what columns are available in a specific dataset?**
Use the `get_dataset` tool with the specific `dataset_id`. It will return detailed metadata, including column definitions, data types, and update frequency for that specific reporting cycle.