Skip to main content
Glama
sfcc-logs-mcp

sfcc-logs-mcp

by nabhat

๐Ÿš€ Salesforce Commerce Cloud (SFCC) Logs MCP Server

CI Quality Gate Status Coverage License: MIT Node.js Version Model Context Protocol Dependabot Updates

A production-grade Model Context Protocol (MCP) server that enables AI coding assistants (Claude Desktop, Cursor, Gemini, Claude Code, VS Code Copilot, Windsurf, etc.) to query, tail, search, analyze, and clean Salesforce Commerce Cloud (SFCC / Demandware) logs in real-time over standard I/O (stdio).


โœจ Key Features

  • ๐Ÿ”„ Context-Aware Dynamic Workspace Resolution: Automatically detects the active workspace folder sent during the MCP initialization handshake and walks up the directory tree to find dw.json or .env. Switch between client projects or sandbox environments seamlessly without restarting your MCP server or changing settings.

  • โšก Bandwidth-Optimized Range Chunking: Uses HTTP Range headers (bytes=-1MB) over WebDAV to fetch only the trailing chunk of huge log files. Tail multi-gigabyte production logs in milliseconds with minimal bandwidth consumption.

  • ๐Ÿ” Multi-File Search & Filtering: Perform case-insensitive regex/text searches across multiple log files filtered by log level (error, warn, info, debug) or target date (YYYYMMDD or today).

  • โฑ๏ธ SFCC Background Job Analytics: Dedicated toolset to inspect cron job logs (job-*), filter entries by severity, and parse step boundaries to construct visual execution timelines (RUNNING, OK, ERROR).

  • ๐Ÿ“Š Statistical Log Volume Summaries: Generate high-level audits breaking down active log volume, category distributions, file counts, and newest active files for any given date.

  • ๐Ÿงน Log Sanitization: Clean or reset active log files directly from chat to isolate freshly reproduced bugs.


Related MCP server: Local Logs MCP Server

๐Ÿ“ฆ Installation

Install globally to make the sfcc-logs-mcp binary available everywhere in your PATH:

npm install -g sfcc-logs-mcp

Once installed globally, you can run:

sfcc-logs-mcp
# or shorthand alias
sfcc-logs

Run on Demand (npx)

npx sfcc-logs-mcp

๐Ÿ” Authentication & Credential Discovery

The server resolves credentials in the following order of priority:

1. dw.json (Standard SFCC Tooling Config)

Place a dw.json file in your workspace root (or any parent directory):

{
  "hostname": "your-sandbox.demandware.net",
  "username": "your_webdav_username",
  "password": "your_webdav_password",
  "webdav_path": "/on/demandware.servlet/webdav/Sites/Logs"
}

2. .env File

Alternatively, define credentials in a local .env file in your project folder:

SFCC_SERVER=your-sandbox.demandware.net
SFCC_USERNAME=your_webdav_username
SFCC_PASSWORD=your_webdav_password
SFCC_WEBDAV_PATH=/on/demandware.servlet/webdav/Sites/Logs

3. Environment Variables

Set system environment variables for static single-instance configurations:

DW_WEBDAV_USERNAME=your_webdav_username
DW_WEBDAV_PASSWORD=your_webdav_password
SFCC_SERVER=your-sandbox.demandware.net

๐Ÿ› ๏ธ MCP Tools Reference

Tool Name

Description

Arguments

get_sfcc_logfile

List all available log files or return the last count lines from a specific log file.

logFileName (optional), count (default: 10)

clean_sfcc_logfile

Clean/reset an active log file by replacing it with a timestamped cleared marker.

logFileName (required)

get_latest_error

Fetch the newest error logs for today or a specific date string (YYYYMMDD).

limit (default: 10), date (default: 'today')

get_latest_warn

Fetch the newest warning logs for today or a specific date string (YYYYMMDD).

limit (default: 10), date (default: 'today')

get_latest_info

Fetch the newest info logs for today or a specific date string (YYYYMMDD).

limit (default: 10), date (default: 'today')

get_latest_debug

Fetch the newest debug logs for today or a specific date string (YYYYMMDD).

limit (default: 10), date (default: 'today')

summarize_logs

Generate a statistical breakdown of log categories, file counts, and sizes.

date (default: 'today')

search_logs

Search across multiple log files matching level/date for a text pattern.

pattern (required), loglevel (default: 'all'), limit (default: 20), date (default: 'today')

get_latest_job_log_files

List background cron job log files (job-*), sorted newest first.

limit (default: 10)

search_job_logs_by_name

Filter background job logs strictly by Job ID/name (e.g. CatalogImport).

jobName (required), limit (default: 10)

get_job_log_entries

Retrieve trailing log entries inside a job log, optionally filtered by severity.

jobName (optional), level (default: 'all'), limit (default: 10)

search_job_logs

Search for a text pattern strictly within background job logs.

pattern (required), level (optional), limit (default: 20), jobName (optional)

get_job_execution_summary

Parses job step boundaries to return structured execution timeline & status (OK/ERROR/RUNNING).

jobName (optional)


๐Ÿ”Œ Connecting to AI Clients

Claude Desktop

Add to your claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "sfcc-logs": {
      "command": "sfcc-logs-mcp"
    }
  }
}

Cursor IDE

Add to .cursor/mcp.json in your workspace or global Cursor settings:

{
  "mcpServers": {
    "sfcc-logs": {
      "command": "sfcc-logs-mcp"
    }
  }
}

Windsurf / VS Code / Other MCP Clients

Configure the stdio server using the globally installed binary:

{
  "mcpServers": {
    "sfcc-logs": {
      "command": "npx",
      "args": ["-y", "sfcc-logs-mcp"]
    }
  }
}

๐Ÿงช Testing with MCP Inspector

You can test and verify all tools interactively using the official @modelcontextprotocol/inspector:

# 1. Interactive Web UI
npx @modelcontextprotocol/inspector sfcc-logs-mcp

# 2. CLI Mode (List tools)
npx @modelcontextprotocol/inspector --cli sfcc-logs-mcp --method tools/list

# 3. CLI Mode (Call a tool)
npx @modelcontextprotocol/inspector --cli sfcc-logs-mcp --method tools/call --tool-name get_latest_error

# 4. Interactive Terminal UI (TUI)
npx @modelcontextprotocol/inspector --tui sfcc-logs-mcp

๐Ÿ‘จโ€๐Ÿ’ป Development & Contributing

# Clone the repository
git clone https://github.com/nabhat/sfcc-logs-mcp.git
cd sfcc-logs-mcp

# Install dependencies
npm install

# Run unit tests with Vitest & coverage
npm run test

# Lint the codebase
npm run lint

# Compile TypeScript
npm run build

๐Ÿ“’ License

This project is licensed under the MIT License - see the LICENSE.txt file for details.

Available Tools

13 tools
clean_sfcc_logfileA

Clean/reset a specific SFCC log file by overwriting it with a clean message.

Inputs: logFileName (required).

get_job_execution_summaryB

Parses standard SFCC job steps boundries inside the newest job log file, returning a structured steps executioin audit timeline and step statuses (OK/ERROR/RUNNING).

Inputs: jobName.

get_job_log_entriesB

Retrieve trailing log entries inside a specific job log, optionally filtered by severity.

Inputs: level, limit, jobName.

get_latest_debugB

Retrieve the latest Debug logs from the active appserver.Tails the newest debug log file.

Inputs: date, limit.

get_latest_errorB

Retrieve the latest Error logs from the active appserver.Tails the newest error log file.

Inputs: date, limit.

get_latest_infoA

Retrieve the latest Info logs from the active appserver.Tails the newest info log file.

Inputs: date, limit.

get_latest_job_log_filesB

Lists active background cron job log files (starting with job- prefix) newest first.

Inputs: limit.

get_latest_warnB

Retrieve the latest Warning logs from the active appserver.Tails the newest warn log file.

Inputs: date, limit.

get_sfcc_logfileA

Get SFCC last Log file records. If logFileName is not provided list all available log files. If provided, return the last "count" lines from the file.

Inputs: count, logFileName.

search_job_logsC

Searches for a text pattern strictly inside background job logs.

Inputs: pattern (required), level, limit, jobName.

search_job_logs_by_nameB

Filters background job logs strictly by a specific job ID/name (e.g. (CatalogImport).

Inputs: jobName (required), limit.

search_logsC

Searches across multiple log files matching logLevel/date for a specific text pattern.

Inputs: pattern (required), date, limit, loglevel.

summarize_logsB

Retrieve a statistical audit overview of all log files generated on a specific date (clutter categories, active volume, newest active items).

Inputs: date.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    TDQS

    A3.7/5.0

    Scored across 13 tools

    Disambiguation5/5

    Each tool targets a distinct log operation or type (error, warn, info, debug, job, general). Descriptions clearly differentiate overlapping aspects like search_job_logs vs search_logs.

    Naming Consistency5/5

    All tools follow a verb_noun pattern with consistent use of get_, search_, clean_, summarize_. No mixing of conventions.

    Tool Count5/5

    13 tools is well-scoped for a log management server, covering reading by severity, searching, summarizing, clearing, and job-specific operations without excess.

    Completeness5/5

    The toolset covers all major log operations: retrieval by severity, search, summary, file listing, clearing, and job log details. No obvious gaps for the domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      F
      maintenance
      Provides comprehensive access to Salesforce B2C Commerce Cloud development tools including SFCC API documentation, best practices guides, log analysis, and system object definitions. Enables AI assistants to help with SFCC development tasks through both documentation-only mode and full credential-based mode.
      15
      1,007 npm
      28
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables monitoring and analysis of local application log files with real-time tailing, error tracking, and search capabilities. Perfect for debugging Node.js applications, web servers, or any application that writes to log files through natural language commands.
      6
      5
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to automatically inspect and analyze application runtime log files for debugging and troubleshooting. Supports monitoring multiple log directories simultaneously with tools for listing, reading, searching, and paginating through log files.
      8
      MIT