MCP server
The API includes a remote Model Context Protocol server. It gives an MCP client (Claude Code, Cursor, or any client that speaks Streamable HTTP) 27 tools over the same data as the REST API: 24 search and lookup tools, a plain-English ask that returns a finished dashboard, and two free tools that describe the data. Each tool calls the same function as the matching REST endpoint and is metered the same way. No tool takes SQL.
POST /mcpThe path is /mcp on your base URL, not under /api/.
- Stateless. There are no sessions. Every request stands alone, and the server never sends an
Mcp-Session-Id. - JSON only. Every response is one
application/jsonbody. The server does not open an event stream. - Tools only. No resources, prompts or sampling. The tool list never changes during a connection.
Authentication
Section titled “Authentication”Send an API key as a bearer token on every request:
Authorization: Bearer oph_your_key_hereOAuth is not supported. The server has no authorization endpoints and no client registration, so a client that can only connect through an OAuth sign-in flow cannot use it. Your client must be able to send a static header.
The key acts in the workspace that created it and spends that workspace’s credits.
Add it to Claude Code
Section titled “Add it to Claude Code”With OPH_API and OPH_KEY set as in the Quickstart:
claude mcp add --transport http openpipe "$OPH_API/mcp" \ --header "Authorization: Bearer $OPH_KEY"Other clients
Section titled “Other clients”Clients that read a { "mcpServers": { ... } } config take a URL and headers. Replace YOUR_HOST with the host of your base URL:
{ "mcpServers": { "openpipe": { "url": "https://YOUR_HOST/mcp", "headers": { "Authorization": "Bearer oph_your_key_here" } } }}Some clients need a transport named as well, for example "type": "http". Check your client’s documentation for the exact key.
| Tool | What it does | Credits |
|---|---|---|
search_providers |
Find clinicians and organizations that billed Medicare Part B. Filter by q, state, city, specialty, entity; pass hcpcs to rank by volume of one procedure. Same as GET /api/providers. |
1 |
get_provider |
Full profile for one provider by 10-digit npi. |
1, free if not found |
search_facilities |
Find hospitals. Filter by q, state, city, min_beds, ownership, private_equity. Same as GET /api/facilities. For EHR, star rating, health system or DRG volume use search_hospital_intel. |
1 |
get_facility |
One hospital by ccn, with its owners. |
1, free if not found |
search_groups |
Find group practices. Filter by q, state, min_members, specialty. Same as GET /api/groups. |
1 |
get_group |
One group practice by id (its group_pac_id), with specialty mix and top 50 members. |
1, free if not found |
search_procedures |
Look up HCPCS/CPT codes by code prefix or description. Same as GET /api/procedures. |
1 |
search_hospital_intel |
Find hospitals by primary EHR vendor (ehr, ehr_changed, uses_product), star rating (min_rating, max_rating), health system (system, system_id), hospital_type, min_beds, or Medicare volume in one MS-DRG (drg, min_discharges). Same as GET /api/hospital-intel. |
1 |
get_hospital_intel |
Account research for one hospital by ccn. section picks the result: summary (default) is GET /api/facilities/:ccn/intel, measures is /api/facilities/:ccn/measures (with domain), drgs is /api/facilities/:ccn/drgs (with limit, offset). |
1 per call, free if not found |
list_hospital_clinicians |
The clinicians affiliated with one hospital by ccn, highest Medicare payment first. Filter by specialty. Same as GET /api/facilities/:ccn/clinicians. |
1, free if not found |
get_clinician_hospitals |
The hospitals and other facilities one clinician works at, by npi. Same as GET /api/providers/:npi/facilities. |
1, free if not found |
search_health_systems |
Find health systems. Filter by q, state (home office), min_hospitals. Same as GET /api/health-systems. |
1 |
get_health_system |
One health system by system_id, with its EHR vendor mix and hospitals. Same as GET /api/health-systems/:id. |
1, free if not found |
search_care_sites |
Find nursing homes, home health agencies, hospices, dialysis facilities, surgery centers, clinics and other non-hospital sites. Filter by types, q, state, city, zip, chain, npi, ownership, min_beds, min_stars, min_patients, private_equity, reit, changed_ownership_since. Same as GET /api/care-sites. |
1 |
get_care_site |
One care site by id. section picks the result: profile (default) is GET /api/care-sites/:id, owners is /api/care-sites/:id/owners (with equity_only, limit, offset). |
1 per call, free if not found |
list_care_site_types |
The facility types search_care_sites accepts, with national counts. Same as GET /api/care-sites/types. |
1 |
get_drug_market |
One drug by state: Medicare Part D next to Medicaid. Optional state and medicaid_year. Same as GET /api/market/drugs. |
1 |
get_drug_spending |
One drug’s national spending per year, 2020 to 2024, in Part D, Part B and Medicaid. Optional program and by_manufacturer. Same as GET /api/market/drugs/spending. |
1 |
get_medicare_payers |
Medicare private-plan enrollment and share by parent company. National by default and GET /api/market/payers with state, category, parent, limit. With county_fips it is GET /api/market/payers/counties/:fips. |
1, free if the county is not found |
search_ma_plans |
Find Medicare Advantage and Part D plans. Filter by q, parent, state, category, plan_type, snp. Same as GET /api/market/plans. |
1 |
search_acos |
Find Medicare Shared Savings Program ACOs. Filter by q, state, track, participating, group_pac_id. Same as GET /api/market/acos. |
1 |
get_aco |
One ACO by id, with its participant organizations. Same as GET /api/market/acos/:id. |
1, free if not found |
search_experts |
Rank clinicians by the trials they lead. At least one of condition, sponsor, state; optional confidence. Same as GET /api/market/experts. |
1 |
get_expert |
One clinician’s trials, NIH grants and industry payments, by npi. Same as GET /api/market/experts/:npi. |
1, free if not found |
ask |
Answer a plain-English question (5 to 500 characters) with a finished dashboard: title, summary, and 2 to 4 tiles with their columns and rows. For aggregates, rankings, comparisons and market sizing that the search tools cannot do. Takes 5 to 30 seconds. Same as POST /api/ask in JSON mode. |
25, nothing if no answer can be planned |
list_datasets |
The loaded datasets with publisher, version, data year, row count and load time. Same as GET /api/meta. |
Free |
describe_data |
What the data means. With no arguments: every dataset with its summary, what one row is and its join keys. With dataset: that dataset’s caveats and its columns (type, description, unit, coded values). Use it to read the columns in a result or to word an ask question. |
Free |
tools/list returns the full JSON Schema for each tool. Things to know:
- Arguments are strict. An unknown argument, or one of the wrong type, is rejected before anything runs or is charged. This holds for every tool, including those whose REST route ignores unknown query parameters.
- Arguments are typed JSON. Send numbers and booleans as such (
"min_rating": 4,"private_equity": true), not as the strings a query string carries. - Three arguments are named or shaped differently from REST.
search_care_sitestakestypesas an array (["nursing_home", "hospice"]) where REST takes a comma-separatedtype.get_drug_spendingtakes a booleanby_manufacturerwhere REST takesmanufacturers=true.get_medicare_payerstakescounty_fipsas an argument where REST has it in the path, and it cannot be combined withstate,parentorlimit. sectionarguments are checked. Onget_hospital_intel,domainis accepted only withsection: "measures", andlimitandoffsetonly withsection: "drgs". Onget_care_site,equity_only,limitandoffsetare accepted only withsection: "owners".limitdefaults to 25. The maximum is 200, except 100 forsearch_procedures,get_medicare_payers,search_ma_plans,search_acosandsearch_experts. Two tools differ:get_acoreturns 200 participants by default and up to 500, andget_care_sitewithsection: "owners"returns 50 by default.offsetpages through results, up to 100,000. On the care site, plan, ACO and expert tools the maximum is 10,000.- The values, ranges and caveats of each argument are those of the matching REST parameter. The linked reference pages describe them.
run_sqlandget_schemawere removed. Calling either is an unknown-tool error (-32602).- Exports are not available over MCP. Use the REST API, with the
idthataskreturns. askshares the workspace’s limit of 10 questions a minute withPOST /api/ask.- Every tool is marked read-only.
Results
Section titled “Results”A successful tool call returns the same object as the REST endpoint, twice: as JSON text in content[0].text, and parsed in structuredContent. It includes sql (a read-only receipt), sources and the usage object.
The ask result
Section titled “The ask result”ask returns the same document as JSON mode: id, question, title, summary, followups, model, tiles, failed, sources, ms and usage. Each tile also has row_count. The charge follows the same rules: once, when a plan exists, and nothing if the model cannot plan.
The answer is stored as a dashboard. id opens it again for free at GET /api/dashboards/:id.
A dashboard can be larger than one tool result. When it is, every tile is kept and its rows are cut to the same smaller number (100, then 50, 25, 10, 5, 1) until the result fits. A cut tile has rows_truncated: true, row_count still gives the full count, and the result says where the rest is:
"response_truncated": { "reason": "Tiles are cut to 25 rows to fit the response size limit. The stored dashboard has every row.", "dashboard": "/api/dashboards/df706628-076f-4fa8-9797-c5f6028915ab"}Calls made over MCP appear in GET /api/usage with meta.via set to mcp and meta.tool set to the tool name.
Raw requests
Section titled “Raw requests”You do not need an MCP library to call the server. It is JSON-RPC 2.0, one message per POST.
Initialize:
curl "$OPH_API/mcp" \ -H "Authorization: Bearer $OPH_KEY" \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}'{ "jsonrpc": "2.0", "id": 1, "result": { "protocolVersion": "2025-06-18", "capabilities": { "tools": { "listChanged": false } }, "serverInfo": { "name": "openpipe-health", "title": "Openpipe Health", "version": "1.0.0" }, "instructions": "US healthcare provider data from public CMS files …" }}Because the server is stateless, initialize is optional when you call it by hand. You can send tools/call straight away:
curl "$OPH_API/mcp" \ -H "Authorization: Bearer $OPH_KEY" \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"search_procedures","arguments":{"q":"knee","limit":2}}}'{ "jsonrpc": "2.0", "id": 2, "result": { "content": [{ "type": "text", "text": "{\"rows\":[{\"code\":\"27447\", … }" }], "structuredContent": { "rows": [ { "code": "27447", "description": "Total knee arthroplasty", "is_drug": false, "providers": 9120, "tot_srvcs": 231400 } ], "sql": "SELECT code, description, is_drug, providers, tot_srvcs FROM hcpcs WHERE …", "params": ["knee%", "%knee%"], "sources": ["hcpcs"], "ms": 1, "usage": { "credits": 1, "creditsUsed": 11, "creditsLimit": 100, "txid": "81249" } } }}Methods
Section titled “Methods”| Method | Result |
|---|---|
initialize |
Protocol version, capabilities, server info and instructions |
ping |
{} |
tools/list |
All 27 tools with their input schemas |
tools/call |
A tool result |
Supported protocol versions are 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05. An initialize that asks for any other version is answered with the newest. On later requests, an MCP-Protocol-Version header that names an unsupported version gets 400.
A message without an id is a notification. It is answered with 202 and an empty body, and it never runs anything: a tools/call without an id is not executed.
Errors
Section titled “Errors”There are two kinds, and they arrive differently.
Tool errors
Section titled “Tool errors”A tool that fails still returns HTTP 200 and a normal JSON-RPC result, with isError set to true and the message as text. This is so the model can read the message and correct itself.
{ "jsonrpc": "2.0", "id": 3, "result": { "content": [{ "type": "text", "text": "NPI must be 10 digits." }], "isError": true }}Tool errors cover:
- Invalid arguments:
Invalid arguments. state: must be a two-letter USPS state code - A record that does not exist:
No provider with NPI 1234567893. - An argument that does not fit the section:
domain applies only to section=measures. - A question that could not be planned:
The model could not plan an answer for that question. Nothing was charged. - Too many questions:
Too many questions. A workspace can ask 10 a minute; try again in 41s. Nothing was charged. - A dataset that does not exist:
No dataset named "accounts". Datasets: … - Out of credits:
Out of credits: 100 of 100 used this month, this call costs 1.Paid tools check the balance for their own price before doing any work, soaskneeds 25 credits left.list_datasetsanddescribe_datakeep working. - A result too large to return even after trimming.
- An unexpected failure:
Internal error.
Protocol and transport errors
Section titled “Protocol and transport errors”These use a JSON-RPC error object, { "jsonrpc": "2.0", "id": null, "error": { "code": -32001, "message": "…" } }, and the HTTP status tells you what went wrong.
| Status | JSON-RPC code | Cause |
|---|---|---|
401 |
-32001 |
No key, or an unknown or revoked key. The response has a WWW-Authenticate: Bearer realm="Openpipe Health" header, with error="invalid_token" added when a key was sent but not accepted. |
405 |
-32000 |
Any method other than POST (or a CORS OPTIONS). GET does not open a stream and DELETE has no session to end. The response has Allow: POST, OPTIONS. |
415 |
-32000 |
Content-Type is not application/json |
406 |
-32000 |
An Accept header that allows neither application/json nor a wildcard |
413 |
-32000 |
Request body larger than 256 KB |
400 |
-32700 |
The body is not valid JSON |
400 |
-32600 |
Not a JSON-RPC 2.0 object, a bad id, or a batch. Batches are not supported: send one message per POST. |
400 |
-32000 |
Unsupported MCP-Protocol-Version header |
200 |
-32601 |
Unknown method |
200 |
-32602 |
Unknown tool name, or params that is not an object |
429 |
none | Rate limited. See below. |
500 |
-32603 |
Internal error. |
The key is checked before the body is read, so a request without a valid key gets 401 whatever it contains.
Limits
Section titled “Limits”| Limit | Value |
|---|---|
| Requests | 120 per minute, counted per API key and client address together |
| Request body | 256 KB |
| Tool result | About 100 KB |
ask |
10 questions per minute per workspace, counted together with POST /api/ask |
ask question |
5 to 500 characters |
Rate limit. Responses carry the RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset headers described under Rate limits. Past the limit the server returns 429 with a Retry-After header. This one response is not JSON-RPC. It has the REST error shape:
{ "error": "Too many requests. Try again in 23s.", "code": "RATE_LIMITED" }The limit is checked before the key is, so requests with a bad key count too.
Result size. When a search or lookup result is too large, the server drops rows from the end of its largest array until it fits, and adds a response_truncated field that says what was cut:
"response_truncated": { "fields": { "rows": { "returned": 212, "of": 1000 } }, "reason": "Result exceeded the response size limit. Narrow the search with a filter, or page with limit/offset."}If the result cannot be made to fit, the tool returns an error instead. Either way the call has already run and is charged, so keep limit modest on wide searches. An ask result is trimmed per tile instead.
/mcp allows any origin, so browser-based clients such as the MCP Inspector can connect. No cookies are involved: the key travels in the Authorization header.