Salesforce开发服务器工具包

MCP Server Toolkit是一个用于Salesforce开发的自动化工具包,提供安装脚本、更新管理和预配置工作流,简化开发环境设置和维护。

  • by franturino
  • PowerShell
  • 本地部署
  • 更新于
在 GitHub 查看 franturino/mcp-server-setup

使用说明

🚀 MCP服务器工具包-安装和使用指南

本指南解释了如何安装和设置 MCP服务器工具包 Salesforce开发。为您的操作系统选择自动安装,以获得最简单的安装体验。

📋 目录

  1. 先决条件 -系统要求
  2. 快速开始 -2分钟后开始
  3. 安装脚本 -自动设置(推荐)
  4. 更新脚本 -保持安装最新
  5. 手动安装 -逐步替代方案
  6. 文件权限管理 -安全和更新
  7. JSON配置 -服务器设置说明
  8. 故障排除 -常见问题和解决方案
  9. 可用工作流 -包括自动化工具

先决条件

在开始之前,请确保您已经:

  • ✅ Node.js 和 npm 已安装(下载)
  • ✅ Git 已安装(下载)
  • ✅ Visual Studio Code 或 Salesforce代码生成器
  • ✅ Windows(PowerShell) 或 Linux/Unix(Bash) 终端接入
  • ✅ 在用户目录中写入权限

快速开始

⚡ Windows(PowerShell)

# 1. Clone the setup repository
git clone https://github.com/franturino/mcp-server-setup.git
cd mcp-server-setup

# 2. Edit setup.ps1 - Update these variables:
#    - $BaseStoragePath: Your VS Code Server storage path
#    - $DxProjectPath: Your Salesforce dx-project path

# 3. Open PowerShell as Administrator and run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
.\setup.ps1

# 4. Wait for completion and check the log file
# Success! The MCP server is now installed and configured.

⚡ Unix/Linux(Bash)

# 1. Clone the setup repository
git clone https://github.com/franturino/mcp-server-setup.git
cd mcp-server-setup

# 2. Edit setup.sh - Update these variables:
#    - BASE_STORAGE_PATH: Your Code Server storage path
#    - DX_PROJECT_PATH (if needed): Your Salesforce dx-project path

# 3. Make scripts executable
chmod +x setup.sh update.sh

# 4. Run setup
./setup.sh

# 5. Wait for completion and check the log file
# Success! The MCP server is now installed and configured.

初始设置

  1. 打开终端(Windows上的PowerShell,Unix/Linux上的Bash)
  2. 克隆安装存储库:
git clone https://github.com/franturino/mcp-server-setup.git
  1. 导航到安装目录:
cd mcp-server-setup

⚠️ 重要:在运行安装脚本之前,请确保:

  • Git已安装,可从您的终端访问
  • 安装了Node.js和npm
  • 您具有在存储路径中创建目录的写入权限
  • (仅限Windows)PowerShell正在以管理员权限运行(计划任务需要)

安装脚本

Windows安装(PowerShell)

这 setup.ps1 该脚本自动化了Windows环境的整个安装过程。

📋 脚本的作用是什么

步骤 行动
1️⃣ 预检查 确认 mcp_server_toolkit 尚未安装
2️⃣ 工作流复制 将工作流文件复制到dx项目 .a4drules/workflows/ 目录
3️⃣ 存储库克隆 从GitHub克隆MCP服务器工具包
4️⃣ 依赖项 安装npm包(npm install)
5️⃣ 构建 将TypeScript编译为JavaScript(npm run build)
6️⃣ 只读保护 套装 build/ 和 src/ 为了安全起见,将目录设置为只读
7️⃣ 配置 更新 a4d_mcp_settings.json 使用服务器设置
8️⃣ 日志记录 创建详细的日志文件以进行故障排除

⚙️ 安装前配置

编辑 setup.ps1 并修改这些变量:

$BaseStoragePath = "C:\Users\codebuilder\.vscode-server\data\User\globalStorage\salesforce.salesforcedx-einstein-gpt"
$DxProjectPath = "C:\Users\codebuilder\dx-project"

替换为实际路径:

  • $BaseStoragePath:VS代码服务器存储路径(检查VS代码设置)
  • $DxProjectPath:Salesforce dx项目目录的路径

🚀 运行PowerShell脚本

# 1. Open PowerShell as Administrator (required for scheduler permissions)
#    Right-click PowerShell → Run as Administrator

# 2. Enable script execution (if not already enabled)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

# 3. Navigate to the setup directory
cd C:\path\to\mcp-server-setup

# 4. Run the installation
.\setup.ps1

# 5. Monitor the output - wait for "INSTALLATION SCRIPT COMPLETED"

📊 创造什么

成功安装后:

$BaseStoragePath/
├── MCP/
│   └── mcp_server_toolkit/          ← Cloned repository
│       ├── build/                   ← Compiled JavaScript (read-only)
│       ├── src/                     ← TypeScript source (read-only)
│       ├── package.json
│       └── ...other files
└── settings/
    └── a4d_mcp_settings.json        ← Updated with server config

✅ 验证安装成功

  1. 检查 日志文件 在脚本目录中(install_YYYYMMDD_HHMMSS.log)
  2. 验证 a4d_mcp_settings.json 包含 mcp_server_toolkit 配置
  3. 重新启动VS代码或代码生成器
  4. MCP服务器现在应该处于活动状态

Unix/Linux安装(Bash)

这 setup.sh 该脚本自动化了Unix/Linux环境的整个安装过程。

📋 脚本的作用是什么

步骤 行动
1️⃣ 预检查 确认 mcp_server_toolkit 尚未安装
2️⃣ 工作流复制 将工作流文件复制到dx项目 .a4drules/workflows/ 目录
3️⃣ 存储库克隆 从GitHub克隆MCP服务器工具包
4️⃣ 依赖项 安装npm包(npm install)
5️⃣ 构建 将TypeScript编译为JavaScript(npm run build)
6️⃣ 配置 更新 a4d_mcp_settings.json 使用服务器设置
7️⃣ 日志记录 创建详细的日志文件以进行故障排除

⚙️ 安装前配置

编辑 setup.sh 并验证这些变量是否与您的环境匹配:

BASE_STORAGE_PATH="/home/codebuilder/.local/share/code-server/User/globalStorage/salesforce.salesforcedx-einstein-gpt"

如果您的代码服务器存储在其他位置,请相应地更新路径。

🚀 运行Bash脚本

# 1. Navigate to the setup directory
cd /path/to/mcp-server-setup

# 2. Make scripts executable
chmod +x setup.sh update.sh

# 3. Run the installation
./setup.sh

# 4. Monitor the output - wait for "INSTALLATION SCRIPT COMPLETED"

📊 创造什么

成功安装后:

$BASE_STORAGE_PATH/
├── MCP/
│   └── mcp_server_toolkit/          ← Cloned repository
│       ├── build/                   ← Compiled JavaScript
│       ├── src/                     ← TypeScript source
│       ├── package.json
│       └── ...other files
└── settings/
    └── a4d_mcp_settings.json        ← Updated with server config

✅ 验证安装成功

  1. 检查 日志文件 在脚本目录中(install_YYYYMMDD_HHmmss.log)
  2. 验证 a4d_mcp_settings.json 包含 mcp_server_toolkit 配置
  3. 重新启动VS代码或代码生成器
  4. MCP服务器现在应该处于活动状态

更新脚本

🔄 目的

初始安装后,使用 update.ps1 (Windows)或 update.sh (Unix/Linux)脚本用于:

  • ✅ 从GitHub中提取最新更改
  • ✅ 重新安装/更新npm依赖项
  • ✅ 使用新代码重建项目
  • ✅ 自动维护文件权限

📋 更新脚本工作流

更新前检查

1. Verifies installation exists at $REPO_PATH
2. Checks if mcp_server_toolkit is configured in a4d_mcp_settings.json
3. Exits with error if installation not found (must run setup.ps1/sh first)

更新过程

1. Restores write permissions to build/ and src/ directories
2. Pulls latest changes from GitHub (git pull)
3. Installs/updates npm dependencies (npm install)
4. Rebuilds the project (npm run build)
5. Resets directories to read-only for protection
6. Creates timestamped log file with all details

🚀 运行更新脚本

Windows(PowerShell)

# Open PowerShell and run:
cd C:\path\to\mcp-server-setup
.\update.ps1

# Check the log file for completion:
# update_YYYYMMDD_HHMMSS.log

Unix/Linux(Bash)

# Navigate and run:
cd /path/to/mcp-server-setup
./update.sh

# Check the log file for completion:
# update_YYYYMMDD_HHmmss.log

📅 自动更新

脚本确实如此 非 自动配置计划任务或cron作业。需要手动更新:

为什么是这个设计?

  • 对更新发生的时间有更多的控制
  • 避免与积极发展的冲突
  • 无需后台任务即可预测行为
  • 更简单的故障排除

推荐:使用系统的任务调度程序手动安排更新,或设置提醒以定期运行更新脚本。

手动安装

如果您更喜欢在没有脚本的情况下手动安装,或者需要进行故障排除,请按照以下分步说明进行操作:

Windows(手动步骤)

步骤1:克隆存储库

# Navigate to your MCP directory
$McpPath = "C:\Users\codebuilder\.vscode-server\data\User\globalStorage\salesforce.salesforcedx-einstein-gpt\MCP"
New-Item -Path $McpPath -ItemType Directory -Force | Out-Null
Set-Location $McpPath

# Clone the repository
git clone https://github.com/franturino/mcp_server_toolkit.git
cd mcp_server_toolkit

步骤2:安装依赖项

npm install

步骤3:构建项目

npm run build

步骤4:复制工作流(可选)

# Copy workflow files to your dx-project
Copy-Item -Path "workflows\*" -Destination "C:\Users\codebuilder\dx-project\.a4drules\workflows\" -Recurse -Force

步骤5:配置MCP设置

编辑或创建 a4d_mcp_settings.json 在:

C:\Users\codebuilder\.vscode-server\data\User\globalStorage\salesforce.salesforcedx-einstein-gpt\settings\a4d_mcp_settings.json

添加或更新:

{
    "mcpServers": {
        "mcp_server_toolkit": {
            "disabled": false,
            "timeout": 600,
            "type": "stdio",
            "command": "node",
            "args": [
                "C:\\Users\\codebuilder\\.vscode-server\\data\\User\\globalStorage\\salesforce.salesforcedx-einstein-gpt\\MCP\\mcp_server_toolkit\\build\\index.js"
            ]
        }
    }
}

Unix/Linux(手动步骤)

步骤1:克隆存储库

# Navigate to your MCP directory
export MCP_PATH="/home/codebuilder/.local/share/code-server/User/globalStorage/salesforce.salesforcedx-einstein-gpt/MCP"
mkdir -p "$MCP_PATH"
cd "$MCP_PATH"

# Clone the repository
git clone https://github.com/franturino/mcp_server_toolkit.git
cd mcp_server_toolkit

步骤2:安装依赖项

npm install

步骤3:构建项目

npm run build

步骤4:复制工作流(可选)

# Copy workflow files to your dx-project
cp workflows/* /home/codebuilder/dx-project/.a4drules/workflows/

步骤5:配置MCP设置

编辑或创建 a4d_mcp_settings.json 在:

/home/codebuilder/.local/share/code-server/User/globalStorage/salesforce.salesforcedx-einstein-gpt/settings/a4d_mcp_settings.json

添加或更新:

{
    "mcpServers": {
        "mcp_server_toolkit": {
            "disabled": false,
            "timeout": 600,
            "type": "stdio",
            "command": "node",
            "args": [
                "/home/codebuilder/.local/share/code-server/User/globalStorage/salesforce.salesforcedx-einstein-gpt/MCP/mcp_server_toolkit/build/index.js"
            ]
        }
    }
}

步骤6:设置只读权限(推荐)

chmod -R a-w build src
find build src -type d -exec chmod a+rx {} +
find build src -type f -exec chmod a+r {} +

文件权限管理

这些脚本通过文件权限实现安全性,自动管理对关键文件的访问。

为什么文件权限很重要

项目建成后 src/ 和 build/ 目录很重要:

  • 它们包含编译代码和源代码 不应该被意外修改
  • 只读保护可防止意外更改 在正常发育过程中
  • 更新需要临时写入权限 提取并重建新代码

权限工作流

✅ 初始安装

  1. 构建成功完成
  2. 目录 设置为只读 自动地
  3. 防止意外修改

🔄 更新期间

  1. update.ps1/update.sh 恢复 写入权限
  2. 提取最新更改并重建
  3. 自动重置为 只读的 完成后
  4. 对用户透明-自动发生!

手动权限更改

如果需要,您可以手动更改权限:

Windows(PowerShell)

# Make writeable (to edit files)
Get-ChildItem -Path "C:\path\to\build" -Recurse | Set-ItemProperty -Name IsReadOnly -Value $false

# Make read-only (for protection)
Get-ChildItem -Path "C:\path\to\build" -Recurse | Set-ItemProperty -Name IsReadOnly -Value $true

Unix/Linux(Bash)

# Make writeable (to edit files)
chmod -R a+w /path/to/build

# Make read-only (for protection)
chmod -R a-w /path/to/build
find /path/to/build -type d -exec chmod a+rx {} +
find /path/to/build -type f -exec chmod a+r {} +

JSON配置详细信息

安装后,通过以下方式在VS代码设置中配置MCP服务器 a4d_mcp_settings.json 文件。

配置位置

  • 视窗: C:\Users\<username>\.vscode-server\data\User\globalStorage\salesforce.salesforcedx-einstein-gpt\settings\a4d_mcp_settings.json
  • 操作系统: /home/<username>/.local/share/code-server/User/globalStorage/salesforce.salesforcedx-einstein-gpt/settings/a4d_mcp_settings.json

配置结构

{
    "mcpServers": {
        "mcp_server_toolkit": {
            "disabled": false,
            "timeout": 600,
            "type": "stdio",
            "command": "node",
            "args": [
                "/path/to/mcp_server_toolkit/build/index.js"
            ]
        }
    }
}

配置参数说明

参数 值 用途
disabled false 启用MCP服务器(设置为 true 禁用)
timeout 600 MCP操作超时(秒)(10分钟)
type "stdio" 通信方式(标准输入/输出)
command "node" 运行时可执行文件(Node.js)
args [...] 服务器入口点的路径(build/index.js)

修改配置

如果需要修改配置:

  1. 找到文件 使用上述路径
  2. 编辑JSON 使用文本编辑器
  3. 保存文件
  4. 重新启动VS代码或代码生成器 使更改生效

⚠️ 重要:保持JSON语法有效!无效的JSON将阻止服务器加载。


故障排除

🔍 安装前检查

在运行安装脚本之前,请验证:

  • []Git已安装: git --version
  • []已安装Node.js: node --version
  • []已安装npm: npm --version
  • []您在用户目录中具有写入权限
  • [](Windows)PowerShell正在以管理员身份运行

❌ 常见问题及解决方法

✘ “安装已完成”错误

这意味着什么:脚本检测到现有安装。

解决方案:

  • 更新:改为运行更新脚本(update.ps1 或 update.sh)
  • 重新安装:手动删除旧安装并重新运行安装程序
    # Windows
    Remove-Item -Path "C:\Users\codebuilder\.vscode-server\data\User\globalStorage\salesforce.salesforcedx-einstein-gpt\MCP\mcp_server_toolkit" -Recurse -Force
    
    # Unix/Linux
    rm -rf ~/.local/share/code-server/User/globalStorage/salesforce.salesforcedx-einstein-gpt/MCP/mcp_server_toolkit
    

✘ PowerShell执行策略错误

错误信息:

cannot be loaded because running scripts is disabled on this system

解决方案:启用脚本执行:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

然后再次运行安装脚本。


✘ “权限被拒绝”错误(Unix/Linux)

错误信息:

Permission denied: ./setup.sh
./setup.sh: command not found

解决方案:使脚本可执行:

chmod +x setup.sh update.sh

✘ 找不到Git

错误信息:

git is not recognized | git: command not found

解决方案:

  1. 从以下位置安装Githttps://git-scm.com/
  2. 重新启动终端
  3. 验证安装: git --version

开 视窗,确保Git在您的系统PATH中:

  • 右键单击“这台电脑”→ 属性
  • 点击“高级系统设置”
  • 点击“环境变量”
  • 检查Git bin 文件夹位于PATH中

✘ npm安装失败

错误信息:

npm ERR! code E... | npm ERR! 404 | npm ERR! network ...

解决方案:

  1. 检查互联网连接
  2. 清除npm缓存: npm cache clean --force
  3. 删除 node_modules 和 package-lock.json:
    rm -rf node_modules package-lock.json
    npm install
    
  4. 检查npm版本: npm --version (应该是最近的)

✘ 构建过程失败

错误信息 (期间 npm run build):

error TS... | Error: Cannot find module 'typescript'

解决方案:

  1. 确保安装了依赖项: npm install
  2. 检查TypeScript安装: npm list typescript
  3. 尝试重建: npm run build

✘ 找不到设置文件或JSON无效

错误信息:

File not found: a4d_mcp_settings.json | Invalid JSON | parse error

解决方案:

  1. 验证文件是否存在 在正确的路径上(检查设置输出)
  2. 如果丢失,使用有效的JSON手动创建:
    {
        "mcpServers": {
            "mcp_server_toolkit": {
                "disabled": false,
                "timeout": 600,
                "type": "stdio",
                "command": "node",
                "args": ["...full path to build/index.js..."]
            }
        }
    }
    
  3. 如果JSON无效,检查:
    • 属性之间缺少逗号
    • 不匹配的牙套或托槽
    • 报价类型不正确
  4. 使用JSON验证器:https://jsonlint.com/

✘ MCP服务器在VS代码中未处于活动状态

检查什么:

  1. 验证配置是否存在:

    • 打开你的 a4d_mcp_settings.json
    • 确保 "disabled": false
  2. 检查路径是否正确:

    • 验证中的路径 args 实际存在
    • 确保 build/index.js 存在
  3. 检查输出通道:

    • 打开VS代码输出面板
    • 从下拉列表中选择“MCP服务器工具包”
    • 查找错误消息
  4. 重新启动VS代码:

    Close VS Code completely and reopen it
    (not just reload window)
    
  5. 检查日志文件:

    • 在安装/更新日志文件中查找错误
    • 这些是在安装脚本目录中创建的

📋 验证检查表

安装后,验证一切正常:

  • []日志文件显示“安装脚本已完成”
  • [ ] a4d_mcp_settings.json 包含 mcp_server_toolkit 配置
  • [ ] build/build/index.js 文件存在并且可读
  • []目录 build/ 和 src/ 存在
  • [](Windows)检查任务计划程序是否存在任何问题(如果已创建计划任务)
  • []VS Code/Code Builder在输出面板中没有显示错误
  • []重新启动编辑器,MCP服务器成功加载

� 手动检查安装

Windows(PowerShell)

# Verify repository exists
Test-Path "C:\Users\codebuilder\.vscode-server\data\User\globalStorage\salesforce.salesforcedx-einstein-gpt\MCP\mcp_server_toolkit"

# Verify build files exist
Test-Path "C:\Users\codebuilder\.vscode-server\data\User\globalStorage\salesforce.salesforcedx-einstein-gpt\MCP\mcp_server_toolkit\build\index.js"

# Check configuration
Get-Content "C:\Users\codebuilder\.vscode-server\data\User\globalStorage\salesforce.salesforcedx-einstein-gpt\settings\a4d_mcp_settings.json" | ConvertFrom-Json

Unix/Linux(Bash)

# Verify repository exists
test -d ~/.local/share/code-server/User/globalStorage/salesforce.salesforcedx-einstein-gpt/MCP/mcp_server_toolkit && echo "Directory exists" || echo "Directory missing"

# Verify build files exist
test -f ~/.local/share/code-server/User/globalStorage/salesforce.salesforcedx-einstein-gpt/MCP/mcp_server_toolkit/build/index.js && echo "File exists" || echo "File missing"

# Check configuration
cat ~/.local/share/code-server/User/globalStorage/salesforce.salesforcedx-einstein-gpt/settings/a4d_mcp_settings.json | jq


## 🛠️ Workflow: Update Defect Status with Validation

This workflow allows you to update the status of a defect, verifying that the provided status is among the allowed values.

### 📥 Input

The workflow accepts two inputs:

- `defect_code`: the defect code to update (e.g., D-123)
- `defect_status`: the status to assign to the defect

Valid statuses include:

New, Re-opened, Sospeso, Need More Information, Non Deployabile, Fix in Process,
Ready to Test, In Deployment, Deploy PREPROD, Ready to test - NEW INTEGRA,
Deploy SUPPORT, Ready to test - PREPROD, Ready to test - SUPPORT,
Closed - End of life, Closed - Duplicate, Closed - Rejected, Closed - Resolved,
Not a Defect, Deploy PROD

### ⚙️ Behavior

- If the inputs are **provided directly in the prompt**, the workflow uses them without asking.
  - Example:
    ```
    /aggiorna-stato-defect.md "D-123" "Ready to Test"
    ```
- If one or both inputs are **missing**, the workflow will prompt the user interactively.
- The workflow **validates the status**:
  - If the status is invalid, it displays an error message with the list of allowed statuses.
  - If the status is valid, it invokes the MCP server `mcp_server_toolkit` using the method `updateDefectStatus`.

### 📤 Output

The workflow creates a task that updates the status of the specified defect, useful for operational management and change tracking.

## 📋 Workflow: Retrieve Multiple Defect Details

This workflow allows you to retrieve details for one or more defects specified by the user.

### 📥 Input

The workflow accepts one input:

- `defect_codes`: a list of defect codes separated by commas (e.g., `D-123,D-456,D-789`)

### ⚙️ Behavior

- If the `defect_codes` input is **provided directly in the prompt**, the workflow uses it without asking.
  - Example:
    ```
    /richiedi-defect-details.md "D-123,D-456"
    ```
- If the input is **missing**, the workflow will prompt the user interactively.
- The workflow loops through each provided code and creates a task to retrieve defect details using the MCP server `mcp_server_toolkit`.

### 📤 Output

For each code provided, the workflow creates a task that invokes the `getDefectDetails` method on the MCP server, useful for analysis, debugging, or tracking.

## 🧾 Workflow: Insert Manual Configuration

This workflow allows you to insert a manual configuration in Salesforce, associated with a specific defect, using the MCP server.

### 📥 Input

The workflow accepts two inputs:

- `defect_code`: the defect code (e.g., D-123)
- `config_note`: the note to associate with the manual configuration

### ⚙️ Behavior

- If the inputs are **provided directly in the prompt**, the workflow uses them without asking.
  - Example:
    ```
    /inserisci-configurazione-manuale.md "D-123" "Configuration required for test environment"
    ```
- If one or both inputs are **missing**, the workflow will prompt the user interactively.
- Once the data is collected, the workflow invokes the MCP server `mcp_server_toolkit` using the method `insertManualConfiguration`.

### 📤 Output

The workflow creates a task that records the manual configuration associated with the specified defect, useful for change tracking and technical management.

## 🧾 Workflow: Create Metadata for Import to Salesforce

This workflow allows you to create a metadata record for importing data into a specific Salesforce table using external codes. It interacts with the MCP server tool `create_metadata_for_import_salesforce`.

### 📥 Input

The workflow accepts the following inputs:

- `defectId` *(optional)*: The ID of the Defect__c record (e.g., `a1B0500000abcdeAAA`)
- `defectName` *(optional)*: The name/code of the defect (e.g., `D-123`)
- `tableName`: The name of the table where records will be imported
- `externalCodesInput`: A comma-separated list of external codes to associate with the metadata

### ⚙️ Behavior

- If the inputs are **provided directly in the prompt**, the workflow uses them without asking.
  - Example:
    ```
    /crea-metadata-import-salesforce.md "D-123" "ImportTable__c" "codeA,codeB,codeC"
    ```
- If one or more inputs are **missing**, the workflow will prompt the user interactively.
- The workflow converts the external codes into an array and invokes the MCP server tool `create_metadata_for_import_salesforce`.

### 📤 Output

The workflow creates a task that inserts a `NDC_XMLObject__c` record in Salesforce, associating it with the specified defect and external codes. The result includes a success or error message returned by the MCP server.

This workflow is useful for automating metadata creation for bulk imports and ensuring traceability through defect linkage.

## 📊 Workflow: Query Metadata by Defect in Salesforce

This workflow allows you to retrieve metadata records associated with a specific defect in Salesforce, using either the defect ID or its code. It interacts with the MCP server tool `query_metadata_by_defect_salesforce`.

### 📥 Input

The workflow accepts the following inputs:

- `defectId` *(optional)*: The ID of the Defect__c record (e.g., `a1B0500000abcdeAAA`)
- `defectCode` *(optional)*: The code of the defect (e.g., `D-123`)

### ⚙️ Behavior

- If the inputs are **provided directly in the prompt**, the workflow uses them without asking.
  - Example:
    ```
    /query-metadata-by-defect.md "D-123"
    ```
- If neither input is provided, the workflow will prompt the user to enter either the defect ID or code.
- The workflow invokes the MCP server tool `query_metadata_by_defect_salesforce`, which:
  - Resolves the defect ID if only the code is provided
  - Queries all metadata records (`NDC_XMLObject__c`) linked to the defect
  - Returns the result in JSON format

### 📤 Output

### 📤 Output

The workflow creates a task that returns the metadata records associated with the specified defect. This is useful for tracking, auditing, or validating import configurations.

---

## Available Workflows

The toolkit includes pre-configured workflows for managing defects and metadata in Salesforce. Each workflow is defined as a Markdown file in the `workflows/` directory.

### 📋 Workflow List

| Workflow File | Purpose | Inputs |
|---------------|---------|--------|
| `retrieve-metadata-of-defect.md` | Query metadata associated with a defect | Defect ID or Code |
| `update-status-defect.md` | Update defect status with validation | Defect Code, New Status |
| `get-detect_details.md` | Retrieve details for one or more defects | Comma-separated defect codes |
| `get-defect_details_by_status_and_developer.md` | Get defects by developer and status filter | Developer Name, Status(es) |
| `insert-confmanuale.md` | Insert manual configuration for a defect | Defect Code, Configuration Note |
| `create_metadata_defect.md` | Create metadata record for Salesforce import | Defect ID/Code, Table Name, External Codes |
| `insert-ExternalCode.md` | Link external codes to defect metadata | Defect Code, External Code List |

### 🔄 Workflow Features

All workflows include:
- ✅ **Interactive prompts** - Request user input if not provided
- ✅ **Input validation** - Check for allowed values
- ✅ **Error handling** - Display clear error messages
- ✅ **MCP integration** - Use the `mcp_server_toolkit` for backend operations

### 📥 Using Workflows

#### In Salesforce Code Builder

```
/workflow-name.md [arg1] [arg2]
```

**Example** (provide all arguments):
```
/update-status-defect.md "D-123" "Ready to Test"
```

**Example** (let workflow prompt for missing arguments):
```
/update-status-defect.md
# Workflow will ask: "Enter Defect Code: ", then "Enter Status: "
```

#### Common Workflow Parameters

**Valid Defect Statuses**:
```
New, Re-opened, Sospeso, Need More Information, Non Deployabile, 
Fix in Process, Ready to Test, In Deployment, Deploy PREPROD, 
Ready to test - NEW INTEGRA, Deploy SUPPORT, Ready to test - PREPROD, 
Ready to test - SUPPORT, Closed - End of life, Closed - Duplicate, 
Closed - Rejected, Closed - Resolved, Not a Defect, Deploy PROD
```

---

## 📞 Support & Documentation

### Getting Help

1. **Check the log files** - Located in the setup script directory
   - `install_YYYYMMDD_HHMMSS.log` - Installation log
   - `update_YYYYMMDD_HHMMSS.log` - Update log

2. **Review the Troubleshooting section above** - Solutions for common issues

3. **Verify your installation** - Use the checklist in Troubleshooting → Verification Checklist

4. **Check file permissions** - Especially important on Unix/Linux systems

### Repository Links

- 📦 **MCP Server Toolkit**: https://github.com/franturino/mcp_server_toolkit
- 🛠️ **Setup Scripts**: https://github.com/franturino/mcp-server-setup
- 🐛 **Report Issues**: Create an issue on GitHub

### Key Features Summary

✅ **Automated Installation** - Single command setup  
✅ **Simple Updates** - Pull latest changes anytime  
✅ **File Protection** - Automatic read-only management  
✅ **Workflow Tools** - Pre-built automation workflows  
✅ **Detailed Logging** - Complete audit trail  
✅ **Salesforce Integration** - Full MCP server support  
✅ **Cross-Platform** - Works on Windows, Linux, and macOS  

---

## 📝 After Installation

### First Steps

1. ✅ Verify MCP server is active in VS Code
2. ✅ Restart VS Code or Code Builder
3. ✅ Check workflows are available (try `/` to see list)
4. ✅ Run a simple workflow to test

### Regular Maintenance

- **Monthly**: Run `update.ps1` or `update.sh` to get latest features
- **As needed**: Check log files for warnings or errors
- **Periodically**: Verify file permissions are correct

### Staying Updated

The update scripts keep you current with:
- Latest bug fixes
- New features and workflows
- Security updates
- Dependency updates

Simply run the update script whenever you want the latest version!

---

**Last Updated**: November 12, 2025  
**Version**: 2.1 (Complete Installation & Usage Guide)