Unified Salesforce Documentation MCP Server
A powerful Model Context Protocol (MCP) server that empowers LLMs to scrape, digest, and search through modern and legacy Salesforce documentation. It elegantly handles deeply nested Shadow DOMs, typical of Lightning Web Components (LWC), and legacy iframe-based documentation structures.
Features
- Deep Shadow DOM Piercing: Bypasses 400KB+ of SPA boilerplate on
help.salesforce.comanddeveloper.salesforce.comto extract only the pure article Markdown. - Hierarchical Spidering: Automatically queues and scrapes all related pages linked from a central guide using
mass_extract_guide. - Offline RAG Capabilities: Chunks and indexes scraped Markdown into a local SQLite database (
docs.db) allowing for instantaneous local search usingsearch_local_docs.
Available Tools
scrape_single_page: Provide a Salesforce documentation URL. The server will use a headless browser (Puppeteer) to load the page, wait for dynamic content, pierce all shadow DOMs, and return clean Markdown.mass_extract_guide: Provide a "Table of Contents" or central guide URL. The server will extract the parent page, find all hierarchical child links, scrape them concurrently, chunk their content, and save them to a local SQLite database for offline querying.search_local_docs: Provide a natural language query (e.g.,LWC lifecycle hooks). The server queries the SQLite database using fuzzy SQL search to instantly return the best matching pre-scraped chunks of documentation.
Quick Start Installation
For anyone downloading this project for the first time:
- Clone the Repository:
git clone https://github.com/ttrevisan-ilmn/unified-sf-docs-mcp.git cd unified-sf-docs-mcp - Install Dependencies:
npm install - Build the Project:
(Note: The server runs from the compilednpm run build/distdirectory, so building is required). (Note: To use the tools interactively, integrate this MCP server with an MCP client like Claude Desktop or Cursor.)
Testing
You can use the provided test scripts to verify the core functionality or the scraper against different Salesforce URL layouts:
# Test the database, chunking, and search functionality
npx tsx tests/test-core.js
# Test the robust Shadow DOM scraper against 4 different URL permutations
npx tsx tests/test-all.js
Integrating with AI Assistants
MCP servers act as a bridge between an LLM and local tools. To actually use this server, you need to plug it into an AI coding assistant like Cursor or Claude Desktop.
1. Claude Desktop
- Open the Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
- Add the following entry to your
mcpServersobject, replacing/PATH/TOwith the absolute path to where you cloned this repository:
{
"mcpServers": {
"unified-sf-docs": {
"command": "node",
"args": [
"/PATH/TO/unified-sf-docs-mcp/dist/index.js"
]
}
}
}
- Restart Claude Desktop. The tools will now be available when talking to Claude!
2. Cursor
- Open Cursor Settings -> Features -> MCP
- Click + Add new MCP server
- Configure the settings:
- Type:
command - Name:
unified-sf-docs - Command:
node /PATH/TO/unified-sf-docs-mcp/dist/index.js(Be sure to use the absolute path)
- Type:
- Click Save. Cursor will connect to the server and surface the 3 new tools to Cursor Agent.