Skip to main content
Glama
agent-desk-mcp

agent-desk-mcp

README.md
<p align="center"><img src="assets/banner.png" alt="Agent Desk: can I call, autodial or text this lead? Go, wait, check or stop for each channel." width="100%"></p>

<p align="center">
  <a href="LICENSE"><img alt="Code: MIT" src="https://img.shields.io/badge/code-MIT-111F1C"></a>
  <a href="rules/LICENSE"><img alt="Rules data: CC BY 4.0" src="https://img.shields.io/badge/rules%20data-CC%20BY%204.0-111F1C"></a>
  <img alt="Node 20.10 or later" src="https://img.shields.io/badge/node-%E2%89%A520.10-111F1C">
  <img alt="No dependencies" src="https://img.shields.io/badge/dependencies-0-111F1C">
  <a href="https://yellowstake.com/tools/agent-desk"><img alt="Try it in the browser" src="https://img.shields.io/badge/try%20it-yellowstake.com-FFDA38?labelColor=111F1C"></a>
</p>

# Agent Desk

**Can I call, autodial or text this lead, and when?** Open rules and checks for US insurance agents who buy leads.

Give Agent Desk a lead (state or ZIP, the consent wording, your agency name, your Do Not Call scrub) and it answers **go, wait, check or stop** for each channel: a call by hand, an autodialed or prerecorded call, and a text. Every answer names the rule it comes from.

<p align="center"><img src="assets/how-it-works.png" alt="How it works: the lead goes through consent, Do Not Call, calling hours, call cap and insurance checks, and comes out as a verdict for a call by hand, an autodialed call and a text." width="100%"></p>

It checks:

- **Consent:** does it name your agency, and does it cover texts and automated calls? Written consent must name the seller who calls (47 CFR § 64.1200(f)(9)).
- **Do Not Call:** National Registry exceptions, the 31-day scrub window, the 3-month inquiry relationship, and the 12 states with their own lists.
- **Calling hours:** the federal 8 a.m. to 9 p.m. window plus every stricter state, in every time zone the state spans, with the next opening.
- **Call caps:** Florida, Maryland, Oklahoma and Oregon's 3-per-24-hours limits.
- **Insurance-specific rules:** licensed-agent exemptions (narrower than most agents think), the Medicare unsolicited-contact ban, Mississippi's Medicare Advantage ban, and lead-vendor contract windows.
- **Recording consent:** the 12 states where every party must agree to a recorded call.

Also included: a lead data check (fake phones, throwaway emails, test names, out-of-area ZIPs) that writes the return request to the vendor; an outreach message check (TCPA, CAN-SPAM, CMS Medicare marketing); and a lead cost calculator.

There are no dependencies and no network calls (except the optional data download below), and nothing is stored. Anything it can't confirm, such as an undated Do Not Call scrub, an agency name it can't find, or a partner list, comes back as **check**, never **go**. Yes/no fields accept any common spelling (`Yes`, `Y`, `TRUE`, `1`); anything else counts as unknown.

## Use it

**In Claude, ChatGPT, Cursor or any MCP client (hosted):** add `https://yellowstake.com/mcp` as a custom connector. No account.

**As a local MCP server:**

```sh
node bin/agent-desk-mcp.js
```

**In your own code:**

```sh
npm install github:yellowstake/agent-desk
```


```js
import { canContact, canContactMany } from 'agent-desk';

const r = canContact({
  state: 'FL',
  inquiryDate: '2026-11-20',
  agencyName: 'Lakeside Insurance',
  consentText: 'By submitting, I agree to be contacted by Lakeside Insurance by phone and text, including by automated technology...',
  onNationalDnc: false,
  onStateDnc: false,
});
r.summary;                       // "Go: call by hand is allowed now."
r.channels.text.verdict;         // "go" | "wait" | "check" | "stop"
r.channels.text.reasons;         // [{ level, text, cite }]
r.channels.manualCall.nextAllowed; // ISO time when a "wait" opens

canContactMany(leads, { agencyName: 'Lakeside Insurance', licensedStates: ['FL', 'GA'] }); // up to 1,000 leads
```

Every answer looks like this, with the rule behind each reason:

<p align="center"><img src="assets/sample-result.png" alt="Sample result for a Florida lead: call by hand is go; autodialed call and text are stop because the consent does not mention automated calls or texts, citing 47 CFR 64.1200." width="100%"></p>

**On the web:** [yellowstake.com/tools/agent-desk](https://yellowstake.com/tools/agent-desk) has every tool, including a lead-list (CSV) check that runs in your browser.

## Phone lookups: load the NANPA data yourself

The checks work without any phone data, using the area code alone. For carrier, line type (mobile, landline, VoIP, pager, toll-free) and numbers that cannot be in service, build a local copy of the public numbering data:

```sh
npx agent-desk-numbering                  # downloads NANPA and FCC files (about 60 MB), writes ~14 MB to ./data/numbering
npx agent-desk-numbering --out /srv/nanpa # or pick the folder, then set AGENT_DESK_NUMBERING_DIR=/srv/nanpa
npx agent-desk-numbering --from ./files   # offline: npa_report.csv, co.zip, tb.zip (and fcc499.xml) you downloaded
```

It reads four public files: NANPA's [area code report](https://reports.nanpa.com/public/npa_report.csv), the [assigned exchanges](https://reports.nanpa.com/public/CoCodeAssignment_Utilized_AllStates_Public.zip) (about 205,000), the [thousands-blocks](https://reports.nanpa.com/public/ThousandsBlockAssignment_All_Augmented.zip) (about 1.4 million), and the [FCC Form 499 filer list](https://apps.fcc.gov/cgb/form499/499results.cfm?XML=TRUE) for each carrier's type. NANPA updates daily; re-run the command on a schedule (a daily cron is plenty). It refuses to replace your data if a download comes back truncated, and swaps the new files in all at once.

```js
import { lookupPhone } from 'agent-desk/phone';

const info = lookupPhone('(917) 723-1234');
info.lineType;        // "mobile"
info.carrier.brand;   // "T-Mobile"
info.status;          // "assigned", or "unassigned-block" / "unassigned-code" for numbers that cannot be in service

canContact({ ...lead, phoneInfo: info }); // a dead number is a stop; a landline gets a check for texts
```

With the data in place, the local MCP server (`npx agent-desk-mcp`) also offers `lookup_phone` and adds phone details to lead checks automatically. Prefer not to host it? The hosted connector at `https://yellowstake.com/mcp` has the same tool, refreshed daily.

One limit: NANPA records the carrier a number block was assigned to. A ported number (a landline moved to a mobile carrier, say) still shows its original carrier, so treat line type as a strong hint, not proof.

## Lead fields

| Field | Meaning |
|---|---|
| `state`, `zip` | Where the lead is. A ZIP fills in or cross-checks the state; when they disagree, both states' rules apply |
| `phone` | The lead's number. Places the lead by area code when there is no state or ZIP; the area code's calling hours and call limits also apply. Invalid and toll-free numbers are flagged |
| `lineType` / `phoneInfo` | `mobile`, `landline`, `voip`, `pager` or `toll-free`, or a full lookup result (carrier, status, state) from `lookupPhone()` or the hosted `lookup_phone` tool. A number that cannot be in service is a stop; a landline gets a check for texts |
| `consentText` | The exact consent wording the person agreed to |
| `agencyName` / `consentNamesYou` | Your agency name (matched in the consent), or tell it directly |
| `inquiryDate` | When the form was submitted |
| `onNationalDnc`, `onStateDnc`, `lastDncScrub` | Your scrub results and date |
| `onInternalDnc` | Opted out or on your own list |
| `ownLead` | The person contacted your agency directly (creates the 3-month inquiry exception) |
| `lastPurchaseDate` | Existing customers: their last purchase (18-month exception for live calls; Oregon's hours and cap waiver) |
| `requestedContact` | The person asked you to contact them (Medicare; Mississippi's Medicare Advantage ban) |
| `partnerListIncludesYou` | The consent names "partners" and your agency is on that list |
| `callerIsLicensee` | The licensed agent is personally calling (Oklahoma and Indiana exemptions) |
| `optedOut` | The person asked you to stop |
| `line` | `auto`, `home`, `life`, `health`, `medicare`, `commercial` |
| `vendor`, `certificateClaimed` | Lead vendor, and whether you claimed the TrustedForm or Jornaya certificate |
| `licensedStates`, `callsLast24h`, `at` | Your licensed states, contacts in the last 24 hours, and the time to check (default now) |
| `contactLog` | Times of earlier sales contacts (array, or separated by `;`). Gives the exact time a state call limit reopens |

## The rules data

`rules/` is plain JSON, licensed CC BY 4.0. Every rule carries its citation and the date it was checked.

- `states.json`: all 50 states and DC. Calling hours, holidays, call caps, automated-call windows, state Do Not Call list, automated-call law, recording consent and licensed-agent exemptions.
- `federal.json`: TCPA and Telemarketing Sales Rule basics: hours, written consent, Do Not Call, scrub age, established business relationship, opt-outs (including FCC 26-67), identification and damages.
- `insurance.json`: CMS Medicare marketing limits, state Medicare bans, lead-vendor contact windows, and consent-certificate retention.
- `area-codes.json`: US area code to state and the toll-free area codes, from the NANPA NPA report (`node scripts/area-codes.mjs` refreshes it). For full number-level data, see Phone lookups above.

Laws change. Corrections with a citation are welcome as pull requests.

## Not legal advice

Agent Desk is a planning aid. It can't see your consent records, your scrub results or how your dialer works, and it doesn't cover every rule. Telemarketer registration notes come from a secondary source, and holiday checks cover federal holidays plus each state's main holidays. Check with counsel before you rely on it.

## License

Code: MIT. Rules data: CC BY 4.0. Built by [Yellow Stake](https://yellowstake.com).