# Better Vetters integrations: contractor license checks in Claude, ChatGPT, Cursor, LangChain, CrewAI, n8n and Zapier

Copy-paste setup for the Better Vetters contractor-check API and MCP server: Claude and ChatGPT connectors with no headers, Claude Code, Cursor, VS Code, Python, JavaScript, OpenAI function calling, LangChain, CrewAI, n8n, Zapier and Make. 50 free checks a month.

MCP endpoint: https://api.bettervetters.com/mcp (tools: check_contractor, get_coverage, get_free_api_key). REST: POST https://api.bettervetters.com/v1/contractor/check with Authorization: Bearer <key>; free key: POST https://api.bettervetters.com/v1/keys.

## Claude, ChatGPT and other chat apps (no headers needed)

Add https://api.bettervetters.com/mcp as a custom connector (Claude: Settings > Connectors > Add custom connector; ChatGPT: developer-mode connectors). Connecting needs no auth. The agent gets its own free key with the get_free_api_key tool and passes it to check_contractor as api_key.

```
Connector URL: https://api.bettervetters.com/mcp   (no auth needed to connect)

Then just ask:
  "Use Better Vetters to get a free API key, then check whether
   Valentine Roofing LLC in Seattle, WA is licensed."

The agent calls get_free_api_key once, then check_contractor with api_key=<that key>.
```

## Claude Code

One command. Get a key first with the curl below, or let the agent call get_free_api_key.

```
claude mcp add --transport http better-vetters https://api.bettervetters.com/mcp \
  --header "Authorization: Bearer bv_live_YOUR_KEY"
```

## Cursor

Cursor reads remote MCP servers with custom headers from mcp.json.

```
// ~/.cursor/mcp.json  (or .cursor/mcp.json in a project)
{
  "mcpServers": {
    "better-vetters": {
      "url": "https://api.bettervetters.com/mcp",
      "headers": { "Authorization": "Bearer bv_live_YOUR_KEY" }
    }
  }
}
```

## VS Code (Copilot agent mode)

VS Code supports streamable-HTTP MCP servers with headers.

```
// .vscode/mcp.json
{
  "servers": {
    "better-vetters": {
      "type": "http",
      "url": "https://api.bettervetters.com/mcp",
      "headers": { "Authorization": "Bearer bv_live_YOUR_KEY" }
    }
  }
}
```

## MCP from Python (official SDK)

No key in your config: the script gets a free key over MCP, then checks a contractor.

```
import asyncio, json
from mcp import ClientSession
from mcp.client.streamable_http import streamable_http_client  # pip install "mcp>=2"

async def main():
    async with streamable_http_client("https://api.bettervetters.com/mcp") as streams:
        async with ClientSession(streams[0], streams[1]) as s:
            await s.initialize()
            key = json.loads((await s.call_tool("get_free_api_key", {"label": "my-agent"})).content[0].text)["api_key"]
            out = await s.call_tool("check_contractor", {"name": "Valentine Roofing LLC", "state": "WA", "api_key": key})
            print(json.loads(out.content[0].text)["verdict"])

asyncio.run(main())
```

## REST with curl

Two calls: create a free key, then check. Misses (not_found, out_of_coverage) are never charged.

```
# 1. free key (50 checks a month, shown once)
KEY=$(curl -s -X POST https://api.bettervetters.com/v1/keys \
  -H 'content-type: application/json' -d '{"label":"my-agent"}' | jq -r .api_key)

# 2. check a contractor
curl -s -X POST https://api.bettervetters.com/v1/contractor/check \
  -H "Authorization: Bearer $KEY" -H 'content-type: application/json' \
  -d '{"name":"Valentine Roofing LLC","state":"WA","city":"Seattle"}' | jq '{status,verdict,trust_score}'
```

## REST from Python

Plain requests. A 402 means the free checks and credits are used up; the body's top_up lists packs and plans.

```
import os, requests

BASE = "https://api.bettervetters.com"
KEY = os.environ["BETTER_VETTERS_API_KEY"]  # free: POST /v1/keys

def check_contractor(name, state=None, city=None, license_number=None, phone=None, website=None):
    body = {k: v for k, v in dict(name=name, state=state, city=city, license_number=license_number,
                                  phone=phone, website=website).items() if v}
    r = requests.post(f"{BASE}/v1/contractor/check", json=body, timeout=30,
                      headers={"Authorization": f"Bearer {KEY}"})
    r.raise_for_status()  # 402 = out of free checks and credits (see body.top_up)
    return r.json()

res = check_contractor("Valentine Roofing LLC", state="WA", city="Seattle")
print(res["verdict"], res["trust_score"], res["license"]["status"])
```

## REST from JavaScript / TypeScript

Node 18+, Deno, Bun or the browser (server-side only: keep the key secret).

```
const res = await fetch("https://api.bettervetters.com/v1/contractor/check", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.BETTER_VETTERS_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ name: "Valentine Roofing LLC", state: "WA", city: "Seattle" }),
});
const r = await res.json();
console.log(r.verdict, r.trust_score, r.license?.status);
```

## OpenAI function calling / any tool-calling LLM

Give the model this tool schema and forward its arguments to the REST endpoint.

```
{
  "type": "function",
  "function": {
    "name": "check_contractor",
    "description": "Check a US contractor against official licence, permit and discipline records (WA, CA, FL, TX, NYC, OR, CT, Pittsburgh PA). Returns verdict, trust_score 0-100, licence status and permits.",
    "parameters": {
      "type": "object",
      "properties": {
        "name":  { "type": "string", "description": "Business name, e.g. 'Valentine Roofing LLC'" },
        "state": { "type": "string", "description": "2-letter state code, e.g. WA" },
        "city":  { "type": "string" },
        "license_number": { "type": "string" },
        "phone": { "type": "string" },
        "website": { "type": "string" }
      },
      "required": ["name"]
    }
  }
}
// When the model calls it, POST the arguments as JSON to
// https://api.bettervetters.com/v1/contractor/check with Authorization: Bearer <key>.
```

## LangChain / LangGraph

A typed tool that works with bind_tools and create_react_agent.

```
import os, requests
from langchain_core.tools import tool

@tool
def check_contractor(name: str, state: str = "", city: str = "", license_number: str = "") -> dict:
    """Check a US contractor's licence, permits and discipline in official public records.
    Use before hiring or recommending a contractor. state is a 2-letter code (WA, CA, FL, TX, NY, OR, CT, PA)."""
    body = {k: v for k, v in dict(name=name, state=state, city=city, license_number=license_number).items() if v}
    r = requests.post("https://api.bettervetters.com/v1/contractor/check", json=body, timeout=30,
                      headers={"Authorization": f"Bearer {os.environ['BETTER_VETTERS_API_KEY']}"})
    r.raise_for_status()
    d = r.json()
    return {k: d.get(k) for k in ("status", "verdict", "trust_score", "license", "permits", "reasons")}

# llm.bind_tools([check_contractor])  or  create_react_agent(llm, [check_contractor])
```

## CrewAI

Wrap the same call as a CrewAI tool for a vetting agent.

```
import os, requests
from crewai.tools import tool

@tool("Check contractor licence")
def check_contractor(name: str, state: str = "", city: str = "") -> str:
    """Check a US contractor's licence, permits and discipline in official public records."""
    r = requests.post("https://api.bettervetters.com/v1/contractor/check", timeout=30,
                      json={k: v for k, v in dict(name=name, state=state, city=city).items() if v},
                      headers={"Authorization": f"Bearer {os.environ['BETTER_VETTERS_API_KEY']}"})
    return r.text

# Agent(role="Contractor vetter", tools=[check_contractor], ...)
```

## n8n

Vet every new vendor or lead in a workflow with one HTTP Request node.

```
HTTP Request node
  Method:   POST
  URL:      https://api.bettervetters.com/v1/contractor/check
  Authentication: Generic Credential Type > Header Auth
            Name: Authorization   Value: Bearer bv_live_YOUR_KEY
  Send Body: JSON
            {"name": "{{ $json.company }}", "state": "{{ $json.state }}", "city": "{{ $json.city }}"}

Then branch with an IF node on {{ $json.verdict }}  (trusted / likely_ok / caution / high_risk / needs_review / not_found).
```

## Zapier and Make

No code: a webhook step checks the contractor and returns the verdict.

```
Zapier: Webhooks by Zapier > Custom Request   |   Make: HTTP > Make a request
  Method:  POST
  URL:     https://api.bettervetters.com/v1/contractor/check
  Headers: Authorization: Bearer bv_live_YOUR_KEY
           Content-Type: application/json
  Data:    {"name":"<company from your form>","state":"WA","city":"Seattle"}
Use the returned verdict and trust_score to route the lead or flag the vendor.
```
