sf-docs-mcp
This MCP server lets LLM agents search, read, navigate, and apply Salesforce documentation, knowledge graph data, code examples, limits, and domain-scoped context.
Search across 129 Salesforce documentation domains with
sf_searchRun AI-powered semantic/NLP search with
sf_semantic_searchRead specific documentation topics and sections with
sf_read_topicNavigate the knowledge graph for related docs, namespaces, services, and context with
sf_graph_queryList available documentation domains and filter by service category with
sf_list_domainsLook up Apex classes, methods, and signatures with
sf_apex_lookupFind working code snippets by topic, language, or domain with
sf_code_examplesLook up standard Salesforce objects and fields with
sf_object_referenceExplain Salesforce errors and exceptions with
sf_explain_errorRetrieve exact governor limits and platform constraints with
sf_limitsRestrict all tools to selected domains with
sf_set_active_domainsSuggest relevant domains for a task with
sf_suggest_domainsUse 4 prompt templates and 5 resources for guided agent workflows
Collects and serves Salesforce documentation from developer.salesforce.com, providing tools for search, semantic search, topic reading, graph query, domain listing, Apex class lookup, code examples, object reference, error explanation, limits lookup, domain restriction, and domain suggestion, as well as prompts for exploring APIs, debugging Apex, comparing services, and writing Apex code.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@sf-docs-mcp Find Apex code snippets for batch processing"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 tablesMCP 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.
Related MCP server: mcp-server-salesforce
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-docsCommand:
npx -y -p @sfdxy/sf-documentation-knowledge sf-docs-mcpTransport:
stdioEnvironment:
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-mcpThe 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:startMCP 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:startOr via npx (no clone required):
npx -y -p @sfdxy/sf-documentation-knowledge sf-docs-mcpTools (12)
Tool | Purpose | Example Usage |
| Search across all SF documentation domains | "Find docs about Platform Events" |
| AI-powered semantic search with NLP query understanding | "how to process records in bulk" |
| Read a specific documentation topic's content | Read the SOQL reference page |
| Navigate the knowledge graph — related docs, namespaces, services | "Show all docs in the System namespace" |
| List all available domains, filter by service category | "List analytics domains" |
| Look up an Apex class with full documentation | "Look up the String class" |
| Find working code snippets by topic, language, or domain | "Show batch apex code examples" |
| Look up Salesforce objects and fields (6,500+ ref pages) | "Look up Account.Industry field" |
| Decode error messages with context and resolution steps | "Explain UNABLE_TO_LOCK_ROW" |
| Governor limits lookup — exact numbers for 15 categories | "What are SOQL limits?" |
| Restrict all tools to specific documentation domains | Focus on revenue-cloud only |
| Suggest relevant domains for a task description | "contract lifecycle management" |
Prompt Templates (4)
Prompt | What It Does | Arguments |
| Walk through a Salesforce API — endpoints, auth, best practices |
|
| Debug an Apex issue — class lookup, error patterns, examples |
|
| Compare Salesforce products by documentation coverage |
|
| Write production-ready Apex — gathers limits, patterns, examples first |
|
Resources (5)
Agents can read these without making a tool call:
Resource URI | Content |
| System stats, available tools, quick start guide |
| All documentation domains with descriptions |
| All Apex namespaces with doc counts |
| All service categories with domain counts |
| Current domain restriction state and runtime controls |
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 configAt runtime: Use
sf_set_active_domainsto change the active domains without restartingNot 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
Tool | Domain Restriction Behavior |
| Filters via Orama |
| Filters via Orama |
| Filters via CodeIndex |
| Post-filters |
| Domain-aware search + post-filtered keyword results |
| Warns if |
| Warns if |
| Shows all domains, marks active ones with checkmark |
| Gentle warning (still allows reads outside active set) |
| No filtering (hardcoded data, no graph search) |
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.mdEach 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:
Edge Type | What It Connects |
| Document → Document (52,988 cross-references) |
| Document → Apex Namespace (143 namespaces) |
| Domain → Service Category (16 categories) |
| Document → DocType ( |
| Document → Keyword (22,610 unique keywords) |
| Domain → Document |
Inspect it with:
npm run graph:statsSee 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 discoverLists 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 -- --discoverStep 3: Process HTML to Markdown
# Process a specific domain
npm run process -- --domain cli-commands
# Process ALL collected domains
npm run process -- --discoverAutomatically 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 -- --discoverBuilds 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:statsFull Pipeline (One-liner)
npm run collect -- --discover && npm run process -- --discover && npm run generate -- --discoverCLI Reference
Command | Description |
| List available SF documentation deliverables |
| Download raw HTML documentation |
| Convert HTML → Markdown with tagging |
| Generate knowledge files + graph |
| Analyze the knowledge graph |
| Start the MCP server (stdio) |
| Compile TypeScript |
| Run test suite |
| Run ESLint |
All pipeline commands support --domain <name> for single-domain processing and --discover for all-domain processing.
CI/CD
Workflow | Trigger | What It Does |
Push / PR to master | Build, test, lint, MCP smoke test | |
Push | Build, test, publish to npm, create GitHub release | |
Weekly (Sunday) | Run full pipeline to refresh docs |
Documentation
Document | Description |
System design, data flow, 4-layer architecture | |
Node/edge types, ID conventions, query examples | |
All 129 domains organized by service category | |
Complete domain list with file counts | |
How to develop and extend this repo |
License
MIT © Avinava
Inventory
Domain | Description | Status | Files |
Salesforce Field Reference Guide | Use this concise reference to quickly look up details of the standard fields for | ✅ Available | 4817 |
Apex Reference | Apex class library reference — all system classes and methods | ✅ Available | 4623 |
Connect REST API Developer Guide | Integrate mobile apps, intranet sites, and third-party web applications with Sal | ✅ Available | 2465 |
Object Reference for the Salesforce Platform | Get details on standard objects so that you can interface with your Salesforce d | ✅ Available | 1777 |
Revenue Cloud / Agentforce Revenue Management | Product catalog, pricing, billing, Dynamic Revenue Orchestrator | ✅ Available | 1371 |
OmniStudio | OmniStudio — OmniScripts, FlexCards, DataRaptors, Integration Procedures | ✅ Available | 1297 |
Public Sector Developer Guide | Use Public Sector API and developer resources to unify public service delivery. | ✅ Available | 1003 |
Agentforce Health Developer Guide | Use the Health Cloud API to configure the Health Cloud console, which helps care | ✅ Available | 833 |
Marketing Cloud API | Developer documentation for Marketing Cloud APIs | ✅ Available | 809 |
Agentforce Life Sciences Developer Guide | Use the developer resources of Life Sciences Cloud to automate the operations av | ✅ Available | 714 |
Metadata API | Metadata API — deployment, retrieval, metadata types | ✅ Available | 693 |
Insurance Developer Guide | Learn more about the developer sources of Insurance to automate the backend work | ✅ Available | 616 |
Visualforce Developer Guide | Learn how to develop custom user interfaces and apps with Visualforce, a framewo | ✅ Available | 609 |
Apex Developer Guide | Apex language guide — syntax, triggers, testing, best practices | ✅ Available | 566 |
Agentforce Financial Services Developer Guide | Extend Agentforce Financial Services with other Salesforce products using the AP | ✅ Available | 527 |
Loyalty Management Developer Guide | Use Loyalty Management API and developer resources to create personalized loyalt | ✅ Available | 526 |
Consumer Goods Cloud Developer Guide | Use APIs and developer resources to configure, customize, and extend the capabil | ✅ Available | 524 |
CRM Analytics REST API Developer Guide | Describes how to send queries directly to CRM Analytics, access datasets that ha | ✅ Available | 519 |
Lightning Aura Components Developer Guide | Create Aura components for Salesforce for Android, iOS, and mobile web and Light | ✅ Available | 491 |
Mobile SDK Development Guide | Build standalone native, React Native, and hybrid mobile apps that access Salesf | ✅ Available | 409 |
Data Cloud | Data Cloud developer guide — data models, connectors, identity resolution | ✅ Available | 400 |
Programmatic Marketing Content | Developer documentation for Marketing Cloud Programmatic Content | ✅ Available | 381 |
ISVforce Guide | Plan, build, and sell AppExchange solutions and consulting services. | ✅ Available | 356 |
Service Cloud | Service Cloud — cases, knowledge, omni-channel, entitlements | ✅ Available | 344 |
Tooling API | Tooling API — code coverage, debug logs, custom fields | ✅ Available | 339 |
Einstein Discovery REST API Developer Guide | Describes how to create and access Einstein Discovery predictions, discovery mod | ✅ Available | 312 |
Education Cloud Developer Guide | Education Cloud gives you the tools and developer resources you need to support | ✅ Available | 308 |
REST API | Salesforce REST API — resources, methods, composite, batch | ✅ Available | 308 |
Nonprofit Cloud Developer Guide | Use APIs and developer resources to configure, customize, and extend the capabil | ✅ Available | 304 |
Data Prep Recipe REST API Developer Guide | Describes how to retrieve, update, and schedule Data Prep recipes. | ✅ Available | 296 |
+ 99 more domains | See full inventory | ✅ Available | 6,901 |
129 domains | 35,438 knowledge files
Available Tools
12 toolssf_apex_lookupA
Look up an Apex class or method by name. Searches the apex-reference domain specifically for class documentation, methods, and signatures.
Inputs: className (required), namespace.
sf_code_examplesA
Find working code examples from Salesforce documentation. Returns code snippets with language, source file, and surrounding context. Great for learning patterns and copy-paste solutions.
Inputs: topic (required), limit, domain, language.
sf_explain_errorA
Explain a Salesforce error message or exception. Searches documentation for the error, provides explanation, common causes, and resolution steps.
Inputs: error (required).
sf_graph_queryB
Navigate the Salesforce Knowledge Graph. Find related docs, explore namespaces, discover service categories, or get full context for a document.
Inputs: action (required), nodeId, keyword, service, +1 more.
sf_limitsA
Look up Salesforce governor limits and platform constraints. Returns exact numbers for SOQL, DML, callout, CPU, heap, batch, API limits and more.
Inputs: feature (required).
sf_list_domainsA
List all available Salesforce documentation domains, optionally filtered by service category.
Inputs: service.
sf_object_referenceA
Look up a Salesforce standard object or field. Searches the Field Reference Guide (4,800+ pages) and Object Reference (1,700+ pages) for object details, field types, and relationships.
Inputs: object (required), field.
sf_read_topicA
Read a specific Salesforce documentation topic file. Use sf_search first to find the domain and topic ID. Optionally request a specific section by heading.
Inputs: topic (required), domain (required), section.
sf_searchA
Search across all Salesforce documentation domains for a topic. Returns matching documents with titles, domains, and descriptions. When domain restriction is active, only searches active domains.
Inputs: query (required), limit, domain, docType.
sf_semantic_searchA
AI-powered semantic search with NLP query understanding. Analyzes your query to extract entities, intent, and synonyms for better results. Returns section-level matches with header paths. Use this for natural language questions like 'how to process records in bulk' or 'debug authentication errors'.
Inputs: query (required), limit, domain.
sf_set_active_domainsA
Set the active domain restriction. When set, all tools only return results from the specified domains. Use sf_suggest_domains first to discover relevant domain IDs. Call with clear=true to remove restrictions.
Inputs: clear, domains.
sf_suggest_domainsA
Suggest relevant documentation domains based on a description of what the user is working on. Returns domain IDs that can be passed to sf_set_active_domains. Use this when the user wants to focus their search on specific Salesforce products or features.
Inputs: description (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Most tools target distinct resources (domains, topics, Apex, objects, errors, limits), but sf_search and sf_semantic_search both serve general search and could be confused; sf_apex_lookup also overlaps with sf_search for Apex-specific queries. Overall mostly clear.
All tools share the 'sf_' prefix, but the action placement is inconsistent: some follow verb_noun (list_domains, read_topic, explain_error), others are noun phrases (apex_lookup, object_reference, limits, semantic_search). This mixed convention reduces predictability.
12 tools is well within the ideal 3-15 range for a documentation server, covering various access patterns without being overwhelming.
The tool set covers discovery (domains, search), reading (topics, lookups), and specialized queries (code examples, errors, limits). A minor gap is the lack of an explicit tool to enumerate all topics within a domain, but graph_query and search mitigate this.
Maintenance
Related MCP Connectors
Curated knowledge API for AI agents - skill packs, semantic search, validated patterns.
Shared knowledge base for AI agents. Semantic search across agents, no setup required — just a URL.
SEC filings, Wikipedia, arXiv, US Census and more for AI agents, with every answer source-linked.
Cloud or self-hosted knowledge for AI agents: hybrid search, reranking, GraphRAG, scoped MCP tools.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables LLMs to scrape, index, and search modern and legacy Salesforce documentation by piercing complex Shadow DOM and iframe structures. It supports hierarchical spidering of entire guides and local RAG capabilities using a SQLite database for offline querying.54MIT
- AlicenseBqualityDmaintenanceProvides AI agents with secure access to Salesforce data and operations, enabling natural language interaction with CRM for sales, marketing, and executive teams.65MIT
- AlicenseNot gradedqualityDmaintenanceEnables Salesforce developers to create code and configuration using local documentation, with optional semantic search.7 npm1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI coding agents to query a pre-built semantic knowledge graph of code, reducing token usage and tool calls. Supports 16 tools for code exploration, analysis, and context building.36 npm9MIT