Use Fonteum from LangChain and LlamaIndex
Give your agent source-provenanced US healthcare-provider data in two lines. The five Fonteum tools — search, resolve-by-NPI, exclusion/compromised-anywhere check, dataset info, and source list — load straight into LangChain or LlamaIndex through the hosted MCP endpoint or the REST API. Every response carries the 14-tuple provenance contract, so the model reasons over the source, snapshot date, and methodology behind each fact.
MCP endpoint: https://mcp.fonteum.com/api/mcp · REST base: https://api.fonteum.com/v1 · Demo key: pk_dx_sample (free, no signup)
Two ways in
1. MCP (zero glue). Point your framework's MCP client at https://mcp.fonteum.com/api/mcp. All five tools register themselves with their schemas — you write no Fonteum-specific code. Anonymous access runs at 30 requests/minute per IP; pass an x-fonteum-mcp-key header to lift the limit.
2. REST (explicit tools). Wrap the public REST API as framework tools when you want per-tool control, custom names, or to mix Fonteum calls with your own. Both paths hit the same data and return the same provenance-wrapped JSON.
The five tools
| Tool | Arguments | Returns |
|---|---|---|
fonteum_search_provider | query, state?, specialty?, limit? | Search US healthcare providers by NPI, name, specialty, or location. |
fonteum_get_provider | npi | Resolve one provider by 10-digit NPI across NPPES, OIG LEIE, CMS PECOS, Care Compare, and Open Payments. |
fonteum_check_exclusion | npi | Unified “compromised anywhere” integrity check: federal OIG LEIE + SAM.gov + state Medicaid lists, plus OIG Corporate Integrity Agreements and CMS Civil Money Penalties. |
fonteum_dataset_info | dataset | Methodology + metadata for a federal source family (refresh cadence, license, coverage window). |
fonteum_list_sources | — | List the federal public-record source families Fonteum reconciles every field against. |
The exclusion check is a screening aid: re-confirm any match against the primary source list before acting, and treat the absence of a match as “not found in the lists Fonteumcurrently holds” rather than a guarantee. Not a legal or credentialing certification.
LangChain (TypeScript)
Path 1 — hosted MCP endpoint
npm i @langchain/mcp-adapters @langchain/langgraph @langchain/anthropic @langchain/coreimport { MultiServerMCPClient } from "@langchain/mcp-adapters";
import { createReactAgent } from "@langchain/langgraph/prebuilt";
import { ChatAnthropic } from "@langchain/anthropic";
// Point the MCP client at the hosted Fonteum endpoint. All five tools load
// automatically — no Fonteum-specific glue code.
const client = new MultiServerMCPClient({
mcpServers: {
fonteum: {
transport: "http", // streamable HTTP
url: "https://mcp.fonteum.com/api/mcp",
// headers: { "x-fonteum-mcp-key": process.env.FONTEUM_MCP_KEY! },
// ^ optional — anonymous access works at 30 req/min/IP
},
},
});
const tools = await client.getTools();
const agent = createReactAgent({
llm: new ChatAnthropic({ model: "claude-sonnet-4-6" }),
tools,
});
const res = await agent.invoke({
messages: [
{ role: "user", content: "Is NPI 1245319599 excluded from any federal or state program? Cite the source." },
],
});
console.log(res.messages.at(-1)?.content);
await client.close();Path 2 — REST tools
Copy-pasteable, dependency-light, free demo key by default. Pass these to createReactAgent as the tools array.
import { tool } from "@langchain/core/tools";
import { z } from "zod";
const FONTEUM_BASE = "https://api.fonteum.com/v1";
const FONTEUM_KEY = process.env.FONTEUM_API_KEY ?? "pk_dx_sample"; // free demo key, 100 req/hour/IP
async function fonteumGet(path: string) {
const res = await fetch(`${FONTEUM_BASE}${path}`, {
headers: { "X-Fonteum-Key": FONTEUM_KEY, Accept: "application/json" },
});
if (!res.ok) throw new Error(`Fonteum ${res.status}: ${await res.text()}`);
return res.json(); // { data, provenance | meta } — provenance carries source + snapshot + methodology
}
export const getProvider = tool(
async ({ npi }) => JSON.stringify(await fonteumGet(`/npi/${npi}`)),
{
name: "fonteum_get_provider",
description:
"Resolve a US healthcare provider by 10-digit NPI across NPPES, OIG LEIE, CMS PECOS, Care Compare, and Open Payments. Each field carries source, snapshot date, and methodology.",
schema: z.object({ npi: z.string().describe("10-digit National Provider Identifier") }),
},
);
export const checkExclusion = tool(
async ({ npi }) => JSON.stringify(await fonteumGet(`/exclusions/${npi}`)),
{
name: "fonteum_check_exclusion",
description:
"Unified 'compromised anywhere' integrity check by NPI: federal OIG LEIE + SAM.gov + state Medicaid exclusion lists, plus OIG Corporate Integrity Agreements and CMS Civil Money Penalties. Screening aid — re-confirm any match against the primary source list; absence of a match is not a guarantee.",
schema: z.object({ npi: z.string().describe("10-digit National Provider Identifier") }),
},
);
export const searchProviders = tool(
async ({ query, state, specialty, limit }) => {
const p = new URLSearchParams({ q: query });
if (state) p.set("state", state);
if (specialty) p.set("specialty", specialty);
p.set("limit", String(limit ?? 10));
return JSON.stringify(await fonteumGet(`/search?${p}`));
},
{
name: "fonteum_search_provider",
description: "Search US healthcare providers by NPI, name, specialty/taxonomy, or location.",
schema: z.object({
query: z.string().describe("NPI, provider name, specialty, or location"),
state: z.string().optional().describe("2-letter US state filter"),
specialty: z.string().optional().describe("Taxonomy / specialty filter"),
limit: z.number().int().min(1).max(25).optional().describe("Max results (1-25, default 10)"),
}),
},
);
export const datasetInfo = tool(
async ({ dataset }) => JSON.stringify(await fonteumGet(`/methodology/${dataset}`)),
{
name: "fonteum_dataset_info",
description:
"Methodology + metadata for a federal source family (e.g. nppes, oig-leie, cms-pecos, cms-open-payments, cms-care-compare).",
schema: z.object({ dataset: z.string().describe("Dataset slug") }),
},
);
export const listSources = tool(
async () => JSON.stringify(await fonteumGet("/sources")),
{
name: "fonteum_list_sources",
description: "List the federal public-record source families Fonteum reconciles every field against.",
schema: z.object({}),
},
);
export const fonteumTools = [searchProviders, getProvider, checkExclusion, datasetInfo, listSources];Prefer not to hand-write the wrappers? The @fonteum/mcp package ships them as createFonteumLangChainTools(tool) from @fonteum/mcp/integrations/langchain.
LlamaIndex (TypeScript)
Path 1 — hosted MCP endpoint
npm i @llamaindex/tools @llamaindex/workflow @llamaindex/anthropic llamaindex zodimport { mcp } from "@llamaindex/tools";
import { agent } from "@llamaindex/workflow";
import { anthropic } from "@llamaindex/anthropic";
// Point mcp() at the hosted Fonteum endpoint — all five tools load automatically.
const fonteum = mcp({
url: "https://mcp.fonteum.com/api/mcp",
verbose: true,
});
const tools = await fonteum.tools();
const providerAgent = agent({
name: "ProviderDiligence",
systemPrompt:
"You answer US healthcare-provider questions using Fonteum's source-provenanced federal data. Cite the source and snapshot date attached to every result.",
llm: anthropic({ model: "claude-sonnet-4-6" }),
tools,
});
const result = await providerAgent.run(
"Is NPI 1245319599 on any exclusion list? Cite the source.",
);
console.log(result.data.result);Path 2 — REST tools
import { tool } from "llamaindex";
import { z } from "zod";
const FONTEUM_BASE = "https://api.fonteum.com/v1";
const FONTEUM_KEY = process.env.FONTEUM_API_KEY ?? "pk_dx_sample"; // free demo key
async function fonteumGet(path: string) {
const res = await fetch(`${FONTEUM_BASE}${path}`, {
headers: { "X-Fonteum-Key": FONTEUM_KEY, Accept: "application/json" },
});
if (!res.ok) throw new Error(`Fonteum ${res.status}: ${await res.text()}`);
return res.json();
}
const getProvider = tool({
name: "fonteum_get_provider",
description:
"Resolve a US healthcare provider by 10-digit NPI across NPPES, OIG LEIE, CMS PECOS, Care Compare, and Open Payments. Each field carries source, snapshot date, and methodology.",
parameters: z.object({ npi: z.string().describe("10-digit National Provider Identifier") }),
execute: async ({ npi }) => JSON.stringify(await fonteumGet(`/npi/${npi}`)),
});
const checkExclusion = tool({
name: "fonteum_check_exclusion",
description:
"Unified 'compromised anywhere' integrity check by NPI: federal OIG LEIE + SAM.gov + state Medicaid lists, plus OIG Corporate Integrity Agreements and CMS Civil Money Penalties. Screening aid — re-confirm any match against the primary source list.",
parameters: z.object({ npi: z.string().describe("10-digit National Provider Identifier") }),
execute: async ({ npi }) => JSON.stringify(await fonteumGet(`/exclusions/${npi}`)),
});
const listSources = tool({
name: "fonteum_list_sources",
description: "List the federal public-record source families Fonteum reconciles every field against.",
parameters: z.object({}),
execute: async () => JSON.stringify(await fonteumGet("/sources")),
});
// ...add fonteum_search_provider and fonteum_dataset_info the same way.
const fonteumTools = [getProvider, checkExclusion, listSources];The @fonteum/mcp package also ships createFonteumLlamaIndexTools(tool) for the same five tools.
Python
Both frameworks read the same hosted MCP endpoint from Python. The Fonteum tools are language-agnostic — the endpoint is the contract.
LangChain (Python)
# pip install langchain-mcp-adapters langchain langchain-anthropic
import os
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain.agents import create_agent
client = MultiServerMCPClient({
"fonteum": {
"transport": "streamable_http",
"url": "https://mcp.fonteum.com/api/mcp",
# "headers": {"x-fonteum-mcp-key": os.environ["FONTEUM_MCP_KEY"]}, # optional
}
})
tools = await client.get_tools()
agent = create_agent("claude-sonnet-4-6", tools)
resp = await agent.ainvoke(
{"messages": "Is NPI 1245319599 excluded from any federal or state program?"}
)
print(resp["messages"][-1].content)LlamaIndex (Python)
# pip install llama-index-tools-mcp llama-index llama-index-llms-anthropic
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.anthropic import Anthropic
mcp_client = BasicMCPClient("https://mcp.fonteum.com/api/mcp")
tools = await McpToolSpec(client=mcp_client).to_tool_list_async()
agent = FunctionAgent(
tools=tools,
llm=Anthropic(model="claude-sonnet-4-6"),
system_prompt="Cite the source and snapshot date on every answer.",
)
resp = await agent.run("Is NPI 1245319599 excluded anywhere? Cite the source.")
print(resp)Auth, rate limits, and provenance
- Free demo key.
pk_dx_sampleneeds no signup and allows 100 REST requests/hour per IP. It is the default in every sample above. - REST auth. Pass your key in the
X-Fonteum-Keyheader. Pilot keys (fnt_…) lift the limit — request one at /pilot-intake. - MCP auth. The hosted endpoint serves anonymous traffic at 30 requests/minute per IP. Send an
x-fonteum-mcp-keyheader to remove the limit. - Provenance. Every tool response is wrapped in the 14-tuple contract —
_source,_source_url,_snapshot,_methodology,_last_checked,_license, coverage window, and more — so a downstream compliance step reads the lineage without a second round-trip. See the provenance contract. - Read-only. All five tools are reads. Nothing the agent calls mutates Fonteum data.