# FactReason documentation > Source-backed reference data for coding agents over MCP. Use it before changing dependency versions or writing integrations from memory. ## Connect Streamable HTTP endpoint: `https://factreason.com/mcp` ```json { "mcpServers": { "factreason": { "type": "http", "url": "https://factreason.com/mcp" } } } ``` Create a key with `POST https://factreason.com/api/v1/keys/create` and JSON body `{"email":"you@example.com"}`. Send it as `Authorization: Bearer `. Every key receives $0.05 of one-off trial credit, spent at the per-tier prices, before prepaid billing. ## Required upgrade workflow Before editing an npm or PyPI dependency version, call `factreason_package_upgrade_advisory` with `registry`, `name`, exact `from`, and exact `to`. Use `responseFormat: "compact"` when agent context matters. Treat absent metadata as unknown, not as proof of compatibility. ## Repeatable workflows - Dependency pin change: `factreason_package_upgrade_advisory` - External API call: `factreason_integration_brief` - Service selection: `factreason_discover_api` - Component selection: `factreason_component_spec` - Specification monitoring: `factreason_subscribe_spec_changes` ## Rate card Prepaid credit, debited per successful query. Misses, HTTP 304 revalidations and rate-limited requests are never charged and never consume trial credit. | Tier | Key | Price per query | |---|---|---| | Component specification lookup | `component_lookup` | $0.001 | | API schema lookup | `api_schema` | $0.002 | | Natural-language catalogue search | `semantic_search` | $0.003 | | Deprecation and sunset radar | `deprecation_scan` | $0.005 | | Auth and error playbook | `auth_playbook` | $0.005 | | Cross-service capability search | `capability_search` | $0.005 | | Integration brief | `integration_brief` | $0.010 | | Dependency upgrade advisory | `package_advisory` | $0.020 | | Breaking-change and migration analysis | `breaking_change` | **offline — not served, not billed** | Trial credit: $0.05 once per key, spent at the prices above, so it stretches furthest on the cheaper tiers. Live machine-readable rate card: `GET /api/v1/pricing`. ## MCP tools - `factreason_package_upgrade_advisory` — Compare two exact published npm or PyPI versions and return publisher-declared registry metadata changes, including yanks, exports, module format, runtime floors, peers, and licences, with before/after evidence. Set responseFormat="compact" for tokenizer-measured context savings; the backward-compatible default is "full". This is a read-only metered lookup; misses are never billed and every API key carries one-off trial credit. Use it for package metadata; use factreason_api_breaking_changes for a third-party HTTP API, and consult changelogs for behavioural changes. - `factreason_api_breaking_changes` — Temporarily unavailable for third-party APIs while stored comparisons are revalidated; calls return an unbilled status and alternatives. When restored, this compares optional from/to API versions and returns removed endpoints, parameter changes, and migration notes. Use factreason_package_upgrade_advisory for npm or PyPI packages. - `factreason_api_schema` — Search exact request and response schemas for third-party API endpoints. Pass service alone to list its indexed endpoints, add query to narrow by path or operation, or use query alone across services; returns matches or nearest services. Uses metered access and does not modify source data. Prefer factreason_integration_brief for one callable request. - `factreason_integration_brief` — Compile one callable third-party API brief: base URL, auth scheme, required parameters and types, request body, and documented response codes. Service is required and endpoint optionally narrows the operation. Set responseFormat="compact" for tokenizer-measured context savings; the backward-compatible default returns the full brief plus compact form. Uses metered access. Prefer factreason_api_schema when exploring multiple endpoints. - `factreason_discover_api` — Find third-party APIs for a capability when the provider is unknown. Supply a concise capability such as "sms" or "manage DNS"; returns ranked services, example endpoints, and a next step. Uses metered access. When the provider is already known, call factreason_integration_brief instead. - `factreason_create_key` — Get a FactReason API key for yourself, instantly, with no human, no signup and no card. Returns a key carrying one-off trial credit that you can spend immediately on any tool. CALL THIS FIRST if you have no key, or as soon as any FactReason tool returns HTTP 402 Payment Required — then retry the original call with the key. The tool is free and is never metered. Supplying an email is optional and only affects whether trial credit is granted; a key is always issued either way. - `factreason_create_topup_link` — Create a Stripe Checkout URL for adding prepaid credit to the calling Bearer API key. This creates an external checkout session but does not charge a card. You CANNOT COMPLETE THE PAYMENT YOURSELF, so return the URL to a human, and credit is applied only after they complete payment. Use after HTTP 402 or when balance is low; the tool itself is not metered. - `factreason_component_spec` — Look up electronics component pin assignments, voltage range, package, and alternatives. Pass exact partNumber for one component or query for a capability search; partNumber takes precedence if both are supplied. For exact lookups, set responseFormat="compact" for tokenizer-measured context savings; the backward-compatible default is "full". Uses metered access and returns matches or suggestions. Confirm critical values against the manufacturer datasheet. - `factreason_deprecation_scan` — Scan publisher specifications for deprecated endpoints or parameters, sunset dates, and replacement operations. Omit filters for the catalogue-wide view, pass service to limit one API, and add endpoints to check selected paths. Uses metered access when findings exist. Use factreason_api_breaking_changes for broader version-to-version changes. - `factreason_auth_playbook` — Get publisher-declared authentication schemes, scopes, rate-limit headers, and error codes for one third-party API. Returns a structured playbook or nearest service suggestions, and marks undocumented details as unstated rather than guessing. Uses metered access. Prefer factreason_integration_brief when assembling a complete API call. - `factreason_subscribe_spec_changes` — Create a persistent specification watch for one service; a Bearer API key is required and each key may hold up to 50 watches. Without webhookUrl, read future events from the polling endpoint; with a public HTTP(S) URL, FactReason sends signed POST callbacks after later spec changes. Duplicate or unsafe webhook registrations are rejected. This does not ingest a specification immediately. ## REST endpoints Paid routes answer HTTP 402 when unauthorized. The challenge carries payment requirements only — never any part of the requested record — and is identical for a hit and a miss. - `GET /api/v1/components?q=&category=&limit=&offset=&format=compact` — component search - `GET /api/v1/components/{partNumber}?format=compact` — one exact component - `GET /api/v1/search/semantic?q=` — natural-language catalogue search - `GET /api/v1/apis?service=&q=&limit=&offset=` — API endpoint schemas - `GET /api/v1/apis/{service}/brief?endpoint=` — one callable integration brief - `GET /api/v1/apis/{service}/deprecations` — declared deprecations and sunset dates - `GET /api/v1/apis/auth-playbook?service=` — auth schemes, scopes, rate limits, error codes - `GET /api/v1/discover?q=` — which indexed service can do X - `GET /api/v1/packages/{registry}/{name}/advisory?from=&to=` — npm/PyPI upgrade advisory - `GET /api/v1/apis/{service}/breaking-changes` — offline; returns 503 unbilled - `POST /api/v1/apis/watches/subscribe` — watch a specification (Bearer key) Free, no charge and no trial-credit consumption: - `GET /api/v1/stats` · `GET /api/v1/pricing` · `GET /api/v1/packages/stats` · `GET /health` - `GET /api/v1/balance` (Bearer key) — remaining prepaid and trial credit - `POST /api/v1/keys/create` — self-service key - `POST /api/v1/report-error` — submit a correction Full parameter and response detail: [OpenAPI description](https://factreason.com/openapi.json). ## Compact responses The package advisory, exact component lookup, and integration brief tools support `responseFormat: "compact"`. The compatibility default is `full`. Compact output retains decision evidence and provenance and returns `tokenMetrics` measured with `o200k_base`. Compact and full responses use the same authorization, trial credit, and price. HTTP 402 responses never contain the requested record. ## Payment and errors - 400: correct the input; do not retry unchanged. - 401: check the Bearer key. - 402: pay the x402 challenge where offered or call `factreason_create_topup_link` for a human checkout handoff. - 404 or `found: false`: use alternatives; misses are not billed. - 429: wait for `Retry-After`, then retry with backoff. - 503: the capability is unavailable; do not treat this as an empty result. ## Trust boundary Successful data responses are Ed25519-signed. Fetch the current verification key from [JWKS](https://factreason.com/.well-known/jwks.json). Evidence identifies publisher-declared fields and before/after values. Accuracy remains best-effort; verify production-critical decisions against the primary source. Package advisories use declared npm and PyPI registry metadata. They do not execute packages or infer undocumented behavioral changes. Use current publisher documentation for usage, dedicated security scanners for malicious behavior and vulnerabilities, and Dependabot or Renovate for repository automation. ## Discovery - [Human documentation](https://factreason.com/docs) - [Machine-readable pricing](https://factreason.com/api/v1/pricing) - [OpenAPI description](https://factreason.com/openapi.json) - [MCP manifest](https://factreason.com/.well-known/mcp.json) - [Agent index](https://factreason.com/llms.txt) - [Report incorrect data](https://factreason.com/report-error)