โ ๏ธ Experimental Project: This is an experimental MCP server implementation that leverages LangGraph for intelligent dependency traversal and analysis. We're exploring novel approaches to dependency management and welcome your feedback and contributions!
A powerful MCP (Model Context Protocol) server for analyzing Salesforce OmniStudio dependencies using TypeScript, LangChain, and LangGraph.
# Use with npx (no installation needed!)
npx @sf-explorer/omnistudio-mcp-server
# Or install globally
npm install -g @sf-explorer/omnistudio-mcp-serverThen add to your Claude Desktop or Cursor config - see Configuration.
This project explores the intersection of Model Context Protocol (MCP) and LangGraph's state-based orchestration to solve complex dependency analysis challenges:
- ๐ฏ State-Based Orchestration: LangGraph's state machine pattern naturally models dependency traversal, making the analysis flow explicit and maintainable
- ๐ Recursive Graph Traversal: Complex nested dependencies (OmniScripts calling IPs calling DataRaptors) are handled elegantly through graph nodes
- ๐ก๏ธ Circular Dependency Detection: Built-in state tracking prevents infinite loops in circular references
- ๐จ Multiple Output Formats: The graph structure enables easy transformation to Mermaid, GraphViz, D3.js, or JSON visualizations
- ๐ค AI-Ready Architecture: MCP integration makes it seamless for AI assistants like Claude to analyze and reason about complex OmniStudio architectures
- ๐ Extensible Pipeline: Adding new dependency types or analysis steps is as simple as adding new graph nodes
We're testing whether this architecture can:
- โ Scale to large orgs with thousands of components
- โ Handle edge cases in real-world OmniStudio deployments
- โ Provide actionable insights for migration and refactoring
- โ Integrate smoothly with developer workflows
Your feedback, bug reports, and contributions help shape the future of this approach!
Here's a real example of the dependency analysis output for a customer onboarding flow:
graph TD
OS001["CustomerOnboarding\n[OmniScript]\nType: Service | SubType: New"]:::omniscript
IP001["ValidateCustomer\n[IntegrationProcedure]"]:::integration
IP002["CreateAccount\n[IntegrationProcedure]"]:::integration
DR001["CustomerExtract\n[DataRaptor Extract]"]:::dataraptor
DR002["AccountTransform\n[DataRaptor Transform]"]:::dataraptor
DR003["AccountLoad\n[DataRaptor Load]"]:::dataraptor
APEX001["CustomerValidationService\n[Apex Class]"]:::apex
OBJ001["Contact\n[Standard Object]"]:::object
OBJ002["Account\n[Standard Object]"]:::object
HTTP001["CreditCheck API\n[External Service]"]:::http
OS001 -->|calls| IP001
OS001 -->|calls| IP002
IP001 -->|uses| DR001
IP001 -->|invokes| APEX001
IP001 -->|calls| HTTP001
OBJ001 -->|reads from| DR001
IP002 -->|uses| DR002
IP002 -->|uses| DR003
DR002 -->|uses| DR001
DR003 -->|writes to| OBJ002
classDef omniscript fill:#4CAF50,stroke:#2E7D32,color:#fff,stroke-width:3px
classDef integration fill:#2196F3,stroke:#1565C0,color:#fff,stroke-width:2px
classDef dataraptor fill:#9C27B0,stroke:#6A1B9A,color:#fff,stroke-width:2px
classDef apex fill:#FF9800,stroke:#E65100,color:#fff,stroke-width:2px
classDef object fill:#607D8B,stroke:#37474F,color:#fff,stroke-width:2px
classDef http fill:#F44336,stroke:#C62828,color:#fff,stroke-width:2px
What you see above:
- ๐ข OmniScript initiates the customer onboarding process
- ๐ต Integration Procedures handle validation and account creation logic
- ๐ฃ DataRaptors extract, transform, and load customer data
- ๐ Apex Class performs custom business validation
- โซ Salesforce Objects (Contact, Account) show data flow
- ๐ด External API call for credit check verification
This is generated automatically from your Salesforce org metadata. See the Real-World Example for more complex scenarios!
- ๐ Comprehensive Dependency Analysis: Analyze OmniScripts, Integration Procedures, FlexCards, LWC, and Apex dependencies
- ๐ Type/SubType Search: Search and analyze OmniScripts and Integration Procedures by their Type and SubType fields (e.g.,
Quote_Create) instead of system-generated names - ๐ข Multi-Namespace Support: Automatically works with Core OmniStudio, vlocity_cmt (Communications Cloud), and vlocity_ins (Financial Services Cloud)
- ๐ Visual Dependency Graphs: Generate interactive dependency visualizations in multiple formats
- Mermaid diagrams (for documentation and Markdown)
- GraphViz DOT format (for advanced visualizations)
- D3.js JSON (for interactive web visualizations)
- JSON (for programmatic access)
- ๐ฌ Pre-Built MCP Prompts: 7 ready-to-use prompts for common analysis tasks (analyze, debug, document, explore, etc.) - See PROMPTS.md
- ๐ง Resource Exposure: Access and query OmniStudio components through MCP resources
- ๐ค AI-Powered Analysis: Leverage LangGraph for intelligent dependency resolution
- ๐ MCP Protocol: Standard Model Context Protocol for seamless integration with AI assistants like Claude
- ๐ Namespace Abstraction: Work with a unified Core API regardless of your OmniStudio deployment type
- MCP Server: Built with
@modelcontextprotocol/sdk - Dependency Analysis: LangGraph for state-based dependency graph construction and traversal
- AI Integration: LangChain for extensible AI capabilities
- Salesforce Integration: jsforce for robust Salesforce API interactions
The easiest way to use this MCP server is via npx:
# No installation needed! Just use npx in your MCP config
npx @sf-explorer/omnistudio-mcp-serverAdd to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"omnistudio": {
"command": "npx",
"args": ["-y", "@sf-explorer/omnistudio-mcp-server"],
"env": {
"SF_AUTH_MODE": "sfdx",
"SF_SFDX_ORG_ALIAS": "your-org-alias",
"SF_API_VERSION": "60.0"
}
}
}
}Benefits:
- โ No manual installation or updates needed
- โ Always uses the latest version
- โ No need to clone the repository
- โ Cleaner setup
If you want to contribute or modify the code:
# Clone the repository
git clone https://github.com/sf-explorer/omnistudio-mcp-server.git
cd omnistudio-mcp-server
# Install dependencies
npm install
# Build the project
npm run buildThe server supports three authentication modes: SFDX, Username/Password, and OAuth.
If you have an org already authenticated with the Salesforce CLI, you can use it directly:
# Salesforce Credentials (SFDX Mode)
SF_AUTH_MODE=sfdx
SF_SFDX_ORG_ALIAS=myorg # Your org alias or username
SF_API_VERSION=60.0
# Server Configuration
MCP_SERVER_NAME=omnistudio-analyzer
MCP_SERVER_VERSION=1.0.0Prerequisites:
- Install Salesforce CLI: https://developer.salesforce.com/tools/salesforcecli
- Authenticate your org:
# New CLI (sf) sf org login web --alias myorg # Or legacy CLI (sfdx) sfdx auth:web:login --setalias myorg
Benefits of SFDX Mode:
- โ
No need to store passwords in
.envfile - โ Uses OAuth tokens automatically
- โ Leverages existing CLI authentication
- โ Tokens refresh automatically
- โ Works with both production and sandbox orgs
Create a .env file with your Salesforce credentials:
# Salesforce Credentials (Username/Password Mode)
SF_AUTH_MODE=username_password # Optional, this is the default
SF_USERNAME=your_salesforce_username@example.com
SF_PASSWORD=your_salesforce_password
SF_SECURITY_TOKEN=your_security_token # Optional if using IP filter
SF_DOMAIN=login # Use 'test' for sandbox
SF_API_VERSION=60.0
# Server Configuration
MCP_SERVER_NAME=omnistudio-analyzer
MCP_SERVER_VERSION=1.0.0If you have an OAuth access token, you can use it directly:
# Salesforce Credentials (OAuth Mode)
SF_AUTH_MODE=oauth
SF_ACCESS_TOKEN=your_oauth_access_token
SF_INSTANCE_URL=https://yourinstance.salesforce.com
SF_API_VERSION=60.0
# Server Configuration
MCP_SERVER_NAME=omnistudio-analyzer
MCP_SERVER_VERSION=1.0.0# Development mode (with hot reload)
npm run dev
# Production mode
npm run build
npm start# Build first
npm run build
# Run the example client
npm run client{
"mcpServers": {
"omnistudio": {
"command": "npx",
"args": ["-y", "@sf-explorer/omnistudio-mcp-server"],
"env": {
"SF_AUTH_MODE": "sfdx",
"SF_SFDX_ORG_ALIAS": "your-org-alias",
"SF_API_VERSION": "60.0"
}
}
}
}{
"mcpServers": {
"omnistudio": {
"command": "node",
"args": ["/absolute/path/to/omnistudio/dist/index.js"]
}
}
}Cursor has native MCP support built into the editor. Follow these steps:
Step 1: Authenticate with Salesforce CLI
# Install Salesforce CLI if not already installed
# Visit: https://developer.salesforce.com/tools/salesforcecli
# Authenticate your org
sf org login web --alias myorg
# Verify authentication
sf org display --target-org myorgStep 2: Configure MCP Server
-
Open Cursor Settings:
- macOS:
Cursor > Settings > Features > Model Context Protocol - Windows/Linux:
File > Preferences > Settings > Features > Model Context Protocol
OR edit directly:
~/.cursor/mcp_settings.json(macOS/Linux) or%APPDATA%\Cursor\mcp_settings.json(Windows) - macOS:
-
Add the configuration (Using npx - Recommended):
{
"mcpServers": {
"omnistudio": {
"command": "npx",
"args": ["-y", "@sf-explorer/omnistudio-mcp-server"],
"env": {
"SF_AUTH_MODE": "sfdx",
"SF_SFDX_ORG_ALIAS": "myorg",
"SF_API_VERSION": "60.0"
}
}
}
}- Alternative: Using local installation:
{
"mcpServers": {
"omnistudio": {
"command": "node",
"args": ["/absolute/path/to/omnistudio-mcp-server/dist/index.js"]
}
}
}Step 3: Restart Cursor
Completely quit and restart Cursor to load the MCP server.
Step 4: Test the Integration
Open Cursor's AI chat and ask:
- "What OmniStudio namespaces are detected in my org?"
- "List all my OmniScripts"
- "Analyze dependencies for CustomerOnboarding OmniScript"
VSCode requires an MCP extension to support Model Context Protocol servers.
Step 1: Install MCP Extension
- Open VSCode Extensions (
Cmd+Shift+X/Ctrl+Shift+X) - Search for "Model Context Protocol" or "MCP"
- Install a compatible MCP extension (check VSCode Marketplace for current options)
Step 2: Authenticate with Salesforce CLI
# Install Salesforce CLI if not already installed
# Visit: https://developer.salesforce.com/tools/salesforcecli
# Authenticate your org
sf org login web --alias myorg
# Verify authentication
sf org display --target-org myorgStep 3: Configure MCP Server
The configuration location depends on your installed MCP extension. Common locations:
- Settings.json approach:
- Open VSCode Settings (
Cmd+,/Ctrl+,) - Search for "MCP" or "Model Context Protocol"
- Edit settings.json directly
- Open VSCode Settings (
{
"mcp.servers": {
"omnistudio": {
"command": "npx",
"args": ["-y", "@sf-explorer/omnistudio-mcp-server"],
"env": {
"SF_AUTH_MODE": "sfdx",
"SF_SFDX_ORG_ALIAS": "myorg",
"SF_API_VERSION": "60.0"
}
}
}
}- Workspace settings (.vscode/settings.json):
{
"mcp.servers": {
"omnistudio": {
"command": "npx",
"args": ["-y", "@sf-explorer/omnistudio-mcp-server"],
"env": {
"SF_AUTH_MODE": "sfdx",
"SF_SFDX_ORG_ALIAS": "myorg",
"SF_API_VERSION": "60.0"
}
}
}
}- Alternative: Using local installation:
{
"mcp.servers": {
"omnistudio": {
"command": "node",
"args": ["/absolute/path/to/omnistudio-mcp-server/dist/index.js"]
}
}
}Step 4: Reload VSCode
Run the command: "Reload Window" (Cmd+Shift+P / Ctrl+Shift+P โ type "Reload Window")
Step 5: Test the Integration
Access the MCP server through your installed extension's interface (varies by extension).
# 1. Authenticate with Salesforce CLI (one time)
sf org login web --alias myorg
# 2. Get your org alias
sf org list
# 3. Add MCP configuration (see above for your editor)
# 4. Update SF_SFDX_ORG_ALIAS with your actual org alias
# 5. Restart your IDE
# 6. Test it!
# Ask: "List all OmniScripts in my org"- โ No manual installation or updates needed
- โ Always uses the latest version
- โ No need to clone the repository
- โ Cleaner setup
- โ Works identically across different machines
Cursor:
- Verify MCP is enabled in Cursor settings
- Check Cursor logs:
Help > Toggle Developer Tools > Console - Ensure the
omnistudioserver appears in the MCP servers list
VSCode:
- Verify MCP extension is installed and active
- Check extension logs in Output panel
- Ensure your MCP extension supports the standard MCP protocol
- Try reloading the window if changes don't take effect
Both:
- Verify Salesforce CLI is installed:
sf --version - Verify org is authenticated:
sf org display --target-org myorg - Check org alias is correct:
sf org list - Ensure npx is available:
npx --version
Analyze all dependencies for an OmniScript including Integration Procedures, DataRaptors, and embedded components. Now supports searching by Type/SubType!
// Search by name
{
name: "MyOmniScript",
maxDepth: 5, // Optional: maximum depth for traversal
format: "mermaid" // Options: json, mermaid, graphviz, d3, detailed
}
// OR search by Type/SubType โญ NEW
{
type: "Quote",
subtype: "Create",
language: "English", // Optional, defaults to "English"
maxDepth: 5,
format: "mermaid"
}Analyze Integration Procedure dependencies including DataRaptors, Apex classes, and HTTP actions. Now supports searching by Type/SubType!
// Search by name
{
name: "MyIntegrationProcedure",
maxDepth: 5,
format: "json"
}
// OR search by Type/SubType โญ NEW
{
type: "Account",
subtype: "Retrieve",
maxDepth: 5,
format: "detailed"
}Analyze FlexCard dependencies including Integration Procedures and data sources.
{
name: "MyFlexCard",
maxDepth: 3,
format: "mermaid"
}List all active OmniScripts in your org.
List all active Integration Procedures.
List all active FlexCards.
Get an OmniScript by its Type and SubType (common way to reference OmniScripts).
{
type: "Quote", // Type of the OmniScript
subtype: "Create", // SubType of the OmniScript
language: "English" // Optional, defaults to "English"
}Get an Integration Procedure by its Type and SubType.
{
type: "Account", // Type of the Integration Procedure
subtype: "Retrieve" // SubType of the Integration Procedure
}Get detailed information about a specific component.
{
name: "ComponentName",
type: "omniscript" // Options: omniscript, integration-procedure, flexcard, dataraptor, apex, lwc
}Get information about detected OmniStudio namespaces in your org (Core, vlocity_cmt, vlocity_ins).
This tool shows:
- Which OmniStudio deployment type you have
- Whether you're using Core OmniStudio, Communications Cloud, or Financial Services Cloud
- How the abstraction layer is handling your specific deployment
The server includes 7 ready-to-use prompts that help you interact with OmniStudio components more effectively. Prompts follow the MCP specification and provide structured guidance for common tasks.
analyze-omniscript- Analyze dependencies for a specific OmniScriptanalyze-integration-procedure- Analyze dependencies for an Integration Procedureexplore-omnistudio- Get an overview of all OmniStudio components in your orgdebug-dependencies- Debug and troubleshoot dependency issuesdocument-component- Generate comprehensive documentation for a componentnamespace-check- Check OmniStudio namespace configurationimpact-analysis- Analyze the impact of changing or removing a component
Once configured, you can use prompts by simply asking Claude:
Use the analyze-omniscript prompt with omniscript_name="CustomerOnboarding"
or
Use the explore-omnistudio prompt
Claude will automatically discover and execute the appropriate prompts, providing you with comprehensive analysis and insights.
- โ Consistent: Ensures you're using tools correctly every time
- โ Complete: Remembers to check everything you need
- โ Expert: Encodes best practices for OmniStudio analysis
- โ Time-Saving: No need to remember tool names and parameters
- โ Discoverable: Easy to explore what the server can do
โ See Full Prompt Documentation
The server includes an abstraction layer that automatically handles different OmniStudio deployment types:
-
Core OmniStudio (Spring '24+)
- Objects:
OmniScript__c,OmniProcess__c,OmniUiCard__c,OmniDataTransform__c - Fields:
Type__c,SubType__c,IsActive__c, etc.
- Objects:
-
vlocity_cmt (Communications Cloud / Vlocity CMT)
- Objects:
vlocity_cmt__OmniScript__c,vlocity_cmt__OmniProcess__c, etc. - Fields:
vlocity_cmt__Type__c,vlocity_cmt__SubType__c, etc.
- Objects:
-
vlocity_ins (Financial Services Cloud / Vlocity Insurance)
- Objects:
vlocity_ins__OmniScript__c,vlocity_ins__OmniProcess__c, etc. - Fields:
vlocity_ins__Type__c,vlocity_ins__SubType__c, etc.
- Objects:
User Request โ Detect Namespace โ Build Query โ Execute โ Normalize Response โ Return Core Structure
- On Connection: The client automatically detects which namespace(s) exist in your org
- Query Translation: All queries are automatically translated to use the correct namespace
- Response Normalization: All records are normalized to Core structure for consistent processing
- Transparent Processing: The analyzer and tools work with Core types regardless of actual deployment
Example:
- You request: "Get OmniScript 'CustomerOnboarding'"
- Server detects:
vlocity_cmtnamespace - Query executed:
SELECT ... FROM vlocity_cmt__OmniScript__c WHERE vlocity_cmt__Name = 'CustomerOnboarding' - Response normalized:
{ Type__c: 'Service', SubType__c: 'New', ... }(Core structure) - Processing continues using Core types
Check Your Namespace:
# Use the get_namespace_info tool to see which deployment type you haveAccess OmniStudio components via MCP resources:
omnistudio://omniscripts- All active OmniScriptsomnistudio://integration-procedures- All active Integration Proceduresomnistudio://flexcards- All active FlexCardsomnistudio://dataraptors- All active DataRaptorsomnistudio://lwc- All Lightning Web Componentsomnistudio://apex- All Apex Classesomnistudio://omniscript/{name}- Specific OmniScriptomnistudio://integration-procedure/{name}- Specific Integration Procedureomnistudio://flexcard/{name}- Specific FlexCard
graph TD
OS001["CustomerOnboarding\n[OmniScript]"]:::omniscript
IP001["ValidateCustomer\n[IntegrationProcedure]"]:::integration
DR001["CustomerDataRaptor\n[DataRaptor]"]:::dataraptor
OS001 -->|calls| IP001
IP001 -->|uses| DR001
classDef omniscript fill:#4CAF50,stroke:#2E7D32,color:#fff
classDef integration fill:#2196F3,stroke:#1565C0,color:#fff
classDef dataraptor fill:#9C27B0,stroke:#6A1B9A,color:#fff
See a complete production example with step-by-step instructions:
โ View MultiSite Quote Order Flow Example
This example demonstrates:
- โ Multi-level dependency traversal (5 levels deep)
- โ DataRaptor object dependencies (reads from / writes to)
- โ Standard vs Custom Salesforce objects differentiation
- โ Integration Procedure calls with recursive analysis
- โ Apex class invocations
- โ HTTP Action tracking for external API calls
- โ Correct data flow visualization
New to OmniStudio dependency analysis? Start here:
โ User Guide with Common Use Cases
- Pre-Built Prompts Guide โญ NEW
- Architecture Overview
- Namespace Detection Guide
- Quick Start Guide
- Testing Documentation
- All Examples
The server analyzes these OmniStudio and Salesforce components:
- OmniScripts: Including embedded OmniScripts and Integration Procedure calls
- Integration Procedures: Including DataRaptor actions, Apex calls, and HTTP actions
- FlexCards: Including data source Integration Procedures
- DataRaptors: Extract, Transform, Load, and Turbo Extract types with object dependencies
- Lightning Web Components (LWC): Custom components
- Apex Classes: Including OmniStudio service calls
- Salesforce Objects: Both Standard Objects (Account, Opportunity) and Custom Objects (e.g.,
vlocity_cmt__PriceList__c) - External APIs: HTTP endpoints called by Integration Procedures and OmniScripts
The analyzer tracks these dependency relationships:
calls- Component invokes another (e.g., OmniScript โ Integration Procedure, IP โ External API)embeds- Component embeds another (e.g., OmniScript โ Embedded OmniScript)uses- Component uses a resource (e.g., Integration Procedure โ DataRaptor)references- Component references anotherinvokes- Direct invocation (e.g., Integration Procedure โ Apex Class)reads from- DataRaptor reads from a Salesforce object (arrow: Object โ DataRaptor)writes to- DataRaptor writes to a Salesforce object (arrow: DataRaptor โ Object)
# Watch mode for development
npm run watch
# Lint code
npm run lint
# Format code
npm run format
# Clean build artifacts
npm run cleanOnce integrated with Claude Desktop, you can ask:
"Analyze the dependencies for the CustomerOnboarding OmniScript and show me a visual diagram"
"List all Integration Procedures in my org"
"Show me what DataRaptors are used by the OrderProcessing Integration Procedure"
"Get details about the AccountFlexCard"
The server uses LangGraph to build a state machine that:
- Fetches component data from Salesforce
- Parses component definitions to extract dependencies
- Traverses the dependency tree recursively
- Builds a complete dependency graph
- Generates visualizations in multiple formats
The state-based approach ensures efficient traversal and prevents infinite loops in circular dependencies.
We actively welcome contributions! This is an experimental project and your input is invaluable.
- ๐ Report Bugs: Found an issue? Open a GitHub issue with reproduction steps
- ๐ก Suggest Features: Have ideas for improving dependency analysis? We'd love to hear them
- ๐ Improve Documentation: Help us make this easier to understand and use
- ๐งช Test with Your Org: Try it with your Salesforce org and report what works (or doesn't)
- ๐ง Submit PRs: Code contributions are highly appreciated
- ๐ฌ Share Feedback: Tell us about your experience, pain points, and use cases
- Performance Testing: How does it scale with large orgs (1000+ components)?
- Edge Cases: Unusual OmniStudio patterns or configurations
- Visualization: Better ways to present dependency graphs
- Integration: New use cases for MCP + LangGraph patterns
- Documentation: Real-world examples and tutorials
Open a GitHub issue or discussion. We're here to collaborate and learn together!
MIT
- Built with the Model Context Protocol
- Powered by LangChain and LangGraph
- Salesforce integration via jsforce
For Username/Password Mode:
- Verify your
.envfile has correct Salesforce credentials - Check if your security token is current
- For IP-filtered orgs, remove
SF_SECURITY_TOKENfrom.env - For sandbox, set
SF_DOMAIN=test - Ensure network connectivity to Salesforce
For SFDX Mode:
- Verify org is authenticated:
sf org display --target-org myorg - Check org alias exists:
sf org list - Re-authenticate if needed:
sf org login web --alias myorg - Ensure Salesforce CLI is installed and in PATH
- Verify the org alias in
.envmatches your authenticated org
For OAuth Mode:
- Verify access token is valid and not expired
- Check instance URL format (e.g.,
https://yourinstance.salesforce.com) - Ensure token has required API permissions
- Confirm components exist and are active in your org
- Check if you have proper permissions to access the components
- Verify the component names are correct (case-sensitive)
- Some dependencies may be implicit and not captured in metadata
- Custom implementations may require additional parsing logic
- Check the console for any warnings or errors
For issues, questions, or feature requests, please open an issue on GitHub.