Overview
This system programmatically collects all Salesforce documentation from developer.salesforce.com (129 domains, 35,000+ pages), processes it into structured, curated knowledge files, and serves them to LLM agents via:
- Context Engineering — Pre-compiled Markdown files with
_index.mdrouting tables - MCP Server — 12 tools + 4 prompts + 5 resources via Model Context Protocol
- Knowledge Graph — 53,000+ nodes and 450,000+ edges connecting SF concepts, namespaces, services, and cross-references
No embeddings. No vector stores. No blind chunking.
Quick Start
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"sf-docs": {
"command": "npx",
"args": ["-y", "-p", "@sfdxy/sf-documentation-knowledge", "sf-docs-mcp"],
"env": {
"SF_ACTIVE_DOMAINS": "apex-guide,apex-reference,lwc"
}
}
}
}
Remove the
envblock to search all 129 domains. See Domain Restriction for details.
Restart Claude Desktop.
VS Code (GitHub Copilot)
Add to .vscode/mcp.json in your workspace (or globally in VS Code settings):
{
"servers": {
"sf-docs": {
"command": "npx",
"args": ["-y", "-p", "@sfdxy/sf-documentation-knowledge", "sf-docs-mcp"],
"env": {
"SF_ACTIVE_DOMAINS": "apex-guide,apex-reference,lwc"
}
}
}
}
Then use @sf-docs in Copilot Chat to query Salesforce documentation.
Gemini Code Assist / Gemini CLI
Add to your MCP config (~/.gemini/settings.json or project .gemini/settings.json):
{
"mcpServers": {
"sf-docs": {
"command": "npx",
"args": ["-y", "-p", "@sfdxy/sf-documentation-knowledge", "sf-docs-mcp"],
"env": {
"SF_ACTIVE_DOMAINS": "apex-guide,apex-reference,lwc"
}
}
}
}
Cursor
Add in Settings -> MCP Servers -> Add Server:
- Name:
sf-docs - Command:
npx -y -p @sfdxy/sf-documentation-knowledge sf-docs-mcp - Transport:
stdio - Environment:
SF_ACTIVE_DOMAINS=apex-guide,apex-reference,lwc
Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"sf-docs": {
"command": "npx",
"args": ["-y", "-p", "@sfdxy/sf-documentation-knowledge", "sf-docs-mcp"],
"env": {
"SF_ACTIVE_DOMAINS": "apex-guide,apex-reference,lwc"
}
}
}
}
OpenCode
Add to your OpenCode config (~/.config/opencode/config.json or project .opencode/config.json):
{
"mcpServers": {
"sf-docs": {
"command": "npx",
"args": ["-y", "-p", "@sfdxy/sf-documentation-knowledge", "sf-docs-mcp"],
"env": {
"SF_ACTIVE_DOMAINS": "apex-guide,apex-reference,lwc"
}
}
}
}
Any MCP Client (Generic)
Point your MCP client to:
npx -y -p @sfdxy/sf-documentation-knowledge sf-docs-mcp
The server uses stdio transport and is compatible with any MCP client.
Why
-p+sf-docs-mcp?
The package ships two binaries:sf-knowledge(the data pipeline CLI) andsf-docs-mcp(the MCP server). Using-pinstalls the package and then explicitly calls thesf-docs-mcpbinary, ensuring you get the MCP server and not the CLI.
Use from Source
git clone https://github.com/Avinava/sf-documentation-knowledge.git
cd sf-documentation-knowledge
npm install
npm run build
npm run mcp:start
MCP Server
The MCP server loads the full 53k-node knowledge graph and 18,000+ code snippets into memory on startup (~5s) and serves all queries instantly.
Run directly from source:
npm run mcp:start
Or via npx (no clone required):
npx -y -p @sfdxy/sf-documentation-knowledge sf-docs-mcp
Tools (12)
Prompt Templates (4)
Resources (5)
Agents can read these without making a tool call:
Domain Restriction
When working on a specific Salesforce product area (e.g., Revenue Cloud, Apex development), you can restrict all tools to only search within relevant domains. This reduces noise and improves result quality.
How It Works
- At startup: Set
SF_ACTIVE_DOMAINSas a comma-separated list of domain IDs in your MCP client config - At runtime: Use
sf_set_active_domainsto change the active domains without restarting - Not set: All 129 domains are searched (default, no breaking change)
- Per-call domain filter outside active set: Returns empty results with a warning (not an error)
- sf_read_topic outside active set: Shows a gentle note but still allows reading
Discovering Domains
# Let the AI suggest domains for your task
sf_suggest_domains("building LWC components with Apex backend")
→ Suggests: lwc, apex-guide, apex-reference, lightning
# Set the suggested domains
sf_set_active_domains(domains: ["lwc", "apex-guide", "apex-reference", "lightning"])
# Check current state
sf_set_active_domains()
# Clear restrictions
sf_set_active_domains(clear: true)
Behavior by Tool
All 129 Domain IDs
See docs/domains.md for the full list organized by service category, or use sf_list_domains at runtime.
Knowledge Base
The repository comes pre-loaded with 35,000+ curated markdown files and a Knowledge Graph (53,000+ nodes, 450,000+ edges) covering 129 domains of Salesforce documentation.
Option A: Context Engineering (File-based)
Point your AI agent to the _index.md file in any domain folder. The index acts as a routing table telling the AI which files contain which topics:
knowledge/current/<domain-name>/_index.md
Each domain folder also has a SKILL.md in skills/<domain-name>/SKILL.md that teaches AI agents how to navigate the knowledge.
Option B: Knowledge Graph
The graph at knowledge/current/graph.json connects all documentation with semantic relationships:
Inspect it with:
npm run graph:stats
See Graph Schema Documentation for the full schema with node/edge types, ID conventions, and a visual diagram.
Data Pipeline
To update the knowledge base with the latest Salesforce releases, run the pipeline in order:
Step 1: Discover Available Deliverables
npm run discover
Lists all documentation deliverables available from the Salesforce Index API (~127 deliverables).
Step 2: Collect Raw Data
# Collect a specific domain
npm run collect -- --domain cli-commands
# Collect all configured (P0) domains
npm run collect
# Collect ALL deliverables from the SF index API (121 domains, ~31k pages)
npm run collect -- --discover
Step 3: Process HTML to Markdown
# Process a specific domain
npm run process -- --domain cli-commands
# Process ALL collected domains
npm run process -- --discover
Automatically cleans HTML, strips noise, parses tables, formats code blocks, creates clean Markdown, and redacts any Salesforce tokens or secrets.
Step 4: Generate Knowledge Files & Graph
# Generate ALL collected domains and rebuild the full Knowledge Graph
npm run generate -- --discover
Builds the knowledge graph (cross-references, namespaces, service categories, doctype clustering), generates context files, and updates inventory docs.
Step 5: Inspect the Graph
npm run graph:stats
Full Pipeline (One-liner)
npm run collect -- --discover && npm run process -- --discover && npm run generate -- --discover
CLI Reference
All pipeline commands support --domain <name> for single-domain processing and --discover for all-domain processing.
CI/CD
Documentation
License
MIT © Avinava
Inventory
129 domains | 35,438 knowledge files