Configuration
Most setups need none of this: the defaults are offline and read-only. Reach for these settings when you want live record facts, several orgs, or more control.
Choosing the vault
Every command that reads or writes a vault, and the MCP server itself, takes --vault <path>: the org-kb folder or the folder that holds it. Precedence is the flag, then SFI_VAULT, then ./org-kb. A named path with no vault is an error, never a silent fallback.
Always pass an absolute path in MCP host config, because hosts start the server from a folder you don’t control. At startup sfi mcp prints the vault it serves and the org it was built from, so a wrong-org session is easy to spot.
npx -y sf-intelligence mcp --vault "/full/path/to/your-project/org-kb"
A vault records its own folder. A vault that was copied or moved refuses writes from commands until you run the one-line fix it prints.
Default tool set
By default the server advertises 16 tools (231 are registered): the basics plus the tools behind the questions the site advertises. Every other analysis gives the same output through sfi.run_analysis. The profile is fixed when the server starts.
| Variable | Default | Effect |
|---|---|---|
SFI_TOOL_PROFILE | core | core: the 16 default tools. full: advertise and call every tool directly. Unknown values warn and fall back to core. |
Live mode
Off by default. Snapshot tools never call Salesforce. When on, only a fixed set of read-only live tools can run; there is no free-form SOQL tool.
| Method | Scope | How |
|---|---|---|
| Standing grant | Per org; lasts 7 days | sfi.live_consent { grant: true }. Binds the org id and user through a read-only sf org display. Default scope is aggregate counts. |
| More scopes | Same grant | Grant again with scopes: ["sample"] and/or ["users"]. |
| Environment | The whole MCP process | SFI_LIVE_PLANE_ENABLED=1 |
Revoke with sfi.live_consent { revoke: true }. A per-call liveEnabled: true is a request, not consent: it never turns live mode on by itself. Grants are stored in ~/.sf-intelligence/live-consent.json (override with SFI_CONSENT_PATH), so they work before a vault exists.
Limits
| Variable | Default | Purpose |
|---|---|---|
SFI_LIVE_QUERY_BUDGET | 50 | Live queries per server session. When it’s spent, live tools stop and say so. Cache hits are free. |
SFI_LIVE_CACHE_TTL_MS | 90000 | In-memory cache for repeated live queries, stamped cached: true with the original read time. |
SFI_BLAST_RADIUS_MAX_LIVE | 25 | Per-call cap on live counts for sfi.blast_radius_live; beyond it the answer is marked partial. |
Some answers combine the snapshot (what depends on what) with a live count (how many records), labelled hybrid with both freshness stamps. If the org is ahead of the snapshot, the answer leads with that warning. Without a grant these tools still answer from the snapshot, with a note.
The 38 live tools
sfi.live_describe· Opt-in live org: describe an sObject via Salesforce CLI. Disabled unless SFI_LIVE_PLANE_ENABLED=1 or liveEnabled=true.sfi.live_stale_check· Opt-in live org: "is the org AHEAD of the vault?".sfi.live_count· Opt-in live org: count records. Pass `objectApiName` to count every row of an object, or `soql` for a custom count query.sfi.live_sample· Opt-in live org: run SOQL with a hard row cap (default + max 200). Read-only sample rows for runtime questions.sfi.live_field_population· Opt-in live org: population rate for one field (total vs null counts).sfi.live_group_count· Opt-in live org: value distribution - COUNT grouped by one field on any object (e.g. Cases by Status, Accounts by Industry). Optional equality filter.sfi.live_stale_records· Opt-in live org: records on any object not touched in N days (default LastModifiedDate). Answers "which X are stale/unused?" without arbitrary SOQL.sfi.live_recent_activity· Opt-in live org: records created or modified in the last N days on any object. Read-only; capped detail with true total.sfi.live_aggregate· Opt-in live org: MIN/MAX/AVG/SUM on one numeric field for any object. Optional equality filter.sfi.live_duplicate_check· Opt-in live org: find duplicate values on one field (GROUP BY + HAVING COUNT > 1). Read-only; capped duplicate groups.sfi.live_owner_breakdown· Opt-in live org: record counts by OwnerId with User/Queue names resolved. Read-only; top owners by volume.sfi.live_record_access· Opt-in live org: a specific user's EFFECTIVE access to ONE record right now - Read / Edit / Delete / Transfer / Full (All) - from the org's live sharing calculation (UserRecordAccess).sfi.live_access_oracle· Opt-in live org: PARITY ORACLE for the offline permission engine.sfi.live_record_shares· Opt-in live org: the explicit sharing rows on ONE record - WHO it is shared with and WHY - from the runtime `{Object}Share` table (each row is a UserOrGroupId + AccessLevel + RowCause: Owner / Manual / a sharing Rule / a Team / Apex managed sharing).sfi.live_scheduled_jobs· Opt-in live org: the RUNTIME schedule registry - what is ACTUALLY scheduled right now - from CronTrigger (+ CronJobDetail.Name / JobType, State, CronExpression, NextFireTime, TimesTriggered), plus an optional recent AsyncApexJob status summary.sfi.live_field_history· Opt-in live org: WHO changed a field on a record and to what - from the `{Object}History` table (Field, OldValue, NewValue, CreatedBy.Name, CreatedDate). Filter by `fieldApiName`, `recordId`, and/or `days`.sfi.live_storage_by_object· Opt-in live org: record counts across objects via the Salesforce recordCount REST API - top N by volume, optional objectApiNames filter. Read-only.sfi.live_org_limits· Opt-in live org: current org governor limits via REST. Read-only.sfi.live_data_skew· Opt-in live org: ownership / data-skew concentration - which `ownerField` value (default `OwnerId`) holds MORE than `threshold` records (default 10,000) of `objectApiName`, via a single `GROUP BY ... HAVING COUNT(Id) > threshold` SOQL aggregate, worst-concentration first.sfi.live_security_exposure· Opt-in live org: the RUNTIME security-exposure snapshot, via resilient SOQL COUNT over PermissionSet / PermissionSetAssignment.sfi.live_inactive_users· Opt-in live org: active users who haven't logged in within N days (default 30) or never have - the license-reclamation / dormant-account question. Standard (human) users by default; reports the true total (`totalInactive`) plus a capped detail page, oldest-dormant first.sfi.live_permset_holders· Opt-in live org: WHO HOLDS a permission set, permission set group, or profile - the name-by-name assignment roster (PermissionSetAssignment / User rows are runtime state, never in the vault; vault sfi.effective_permissions describes what a grantor GRANTS, not who holds it).sfi.live_zombie_accounts· Opt-in live org: ZOMBIE accounts - active users with login access but ZERO permission-set/PSG assignments, via a single SOQL anti-join.sfi.live_group_members· Opt-in live org: WHO IS IN a queue or public group - the runtime GroupMember roster (metadata XML only carries DECLARED members, so the vault's member counts routinely say 0 while Setup-managed membership is live-only; vault sfi.empty_queues_and_groups reads the declared counts).sfi.live_user_permsets· Opt-in live org: WHAT does USER X hold - the reverse of sfi.live_permset_holders (input = a user, output = the grantors they hold: profile + direct permission sets + permission set groups, with expirations).sfi.live_setup_audit_trail· Opt-in live org: WHO CHANGED WHAT in Setup - the SetupAuditTrail roster (profile/permission-set edits, field changes, org-wide-default flips, and every other tracked configuration change), the runtime "who touched this" question the vault's declared metadata cannot answer.sfi.live_license_usage· Opt-in live org: license / cost optimization.sfi.live_consent· Reports, grants or revokes the per-org live-plane grant. The live plane runs read-only queries against the real org for record counts, samples and field population.sfi.live_report_usage· Opt-in live org: stale/unused reports via Report.LastRunDate - total vs not-run-in-N-days. Read-only; resilient when Report is unavailable.sfi.live_folder_access· Opt-in live org: folder inventory and access types (Report/Dashboard/Email/Document). Read-only; flags publicly accessible folders.sfi.live_email_template_usage· Opt-in live org: email template usage, Classic vs Lightning classification, and migration candidates. Read-only.sfi.live_org_health· Opt-in live org: operational health snapshot - failed/pending async jobs, paused flow interviews, governor limits at risk. Read-only.sfi.live_automation_fired· Does this record-triggered automation actually run in production?sfi.live_picklist_usage· Which picklist VALUES are actually used in production.sfi.live_budget· Disclose this session's live-query budget and result-cache state.sfi.blast_radius_live· Fuse the static impact graph with LIVE record magnitude - "what breaks if I change/remove X, and how much is at stake?".sfi.live_drift_check· Offline↔live contradiction detection (requires the opt-in live plane).sfi.live_verify· Confirm ONE claim against the live org now, with the smallest read-only query that can, so a finding never rests on a stale snapshot.
Network and updates
| Variable | Default | Purpose |
|---|---|---|
SFI_NETWORK_MODE | off | No outbound network from the MCP process. updates-only allows the npm update check; salesforce-read allows retrieve and live reads. refresh and live calls step up only for their own duration. |
SFI_UPDATE_CHECK | off | Set to 1 to check npm for a newer version at start-up (one GET, about a 3-second timeout, cached a day, off in CI). SFI_NO_UPDATE_CHECK=1 forces it off. |
SFI_TELEMETRY_OPTIN + SFI_TELEMETRY_ENDPOINT | off | An opt-in daily counter after a fresh update check. Both must be set; the only payload is the event name and the UTC day. |
Separately, with no network at all, sfi.health_check tells you when the vault was built by an older version and should be refreshed.
Response size and routing
| Variable | Default | Purpose |
|---|---|---|
SFI_MAX_RESPONSE_BYTES | 40000 | Byte budget per tool response. Lists are trimmed first and the trim is disclosed; an answer that still can’t fit returns an oversize error naming that tool’s narrowing options. Raise only if your client accepts larger results. |
About 40 analysis tools accept a selector (a component id, an API name, a name fragment or a namespace) and echo back the appliedScope they used. If selectors disagree or none matches, the tool refuses with invalid-query instead of answering org-wide. Leave the selector off and you get the unscoped answer, unchanged.
HTTP serving
sfi serve --http serves the same read-only tools over streamable HTTP for CI or shared use on one machine. It needs a bearer token (--generate-token prints one once), binds 127.0.0.1 by default, and keeps live mode off over HTTP whatever the consent or environment says. For a team server, --tokens-file takes a list of tokens with ids used to attribute annotation writes. stdio serving stays sfi mcp.
Large orgs
refresh --staged- A usable vault in minutes. A skeleton card first, then the families behind most questions (objects, fields, validation rules, flows, Apex, layouts, record types, profiles, permission sets), then the full refresh, swapped in only if it succeeds. Until a family lands, answers about it stay qualified.
- Reports and dashboards
- Every full refresh pulls the most-used
SFI_REPORTS_CAP(default 500) by last run or view. Above the cap, the rest show as not checked.--with-reportspulls all;--no-reportsskips them. - Apex parsing
- On by default: a real parser reads field reads, writes and calls (labelled parsed).
--no-apex-astturns it off at the cost of weaker labels. refresh --no-pull- Rebuilds from the source already on disk without contacting the org.
Several orgs
Cross-org tools (compare_vaults, fleet_drift_ranking and others) read a registry of vault paths. Register each vault with an absolute path:
sfi register-vault prod /full/path/to/prod/org-kb sfi register-vault uat /full/path/to/uat/org-kb sfi list-vaults
SF_INTELLIGENCE_REGISTRY_PATH points at a registry.json or the folder holding it. Freshness is read from each vault’s own manifest, so the registry never goes stale. Several read-only servers can share one vault; only a refresh needs the exclusive lock.
Logs and overlays
| Setting | Default | Purpose |
|---|---|---|
SF_INTELLIGENCE_AUDIT_LOG | off | Append-only JSONL: tool name, argument keys (never values), vault hash, time. |
SFI_METRICS_LOG | off | Per-call JSONL: tool, ok or error, duration, payload size. No arguments or org content. |
~/.sf-intelligence/question-gaps.jsonl | local file | Questions the router couldn’t place, kept locally and never sent anywhere. |
meta/annotations.jsonl | in the vault | Owner, status, synonyms and notes that survive refreshes. People write with sfi annotate; an assistant can only propose. |
sfi vault git enable | off | Turns the vault into its own git repo; refreshes that change the source commit a summary. |
The full reference
This page covers the settings people use. Everything else, including development and release-gate variables, is in docs/configuration.md in the repository.
- Getting started
- Trust · what’s guaranteed and why
- Tools reference