mcpField
F
fiddler-mcp-setup

fiddler-mcp-setup

github.com/telerikAgent 工作流1287 次安装12 周前更新
代码仓库

关于 fiddler-mcp-setup

fiddler-mcp-setup 是配置 Fiddler Everywhere MCP 服务的操作技能,面向使用受支持 Agent 工具的场景。它检查安装和连接状态、识别提供方,并通过 Fiddler 本地 API 引导登录与配置。

主要功能

  1. 01检查 Fiddler 安装和可达性
  2. 02识别 Agent 提供方
  3. 03发现 MCP 服务端口
  4. 04检查现有提供方配置
  5. 05需要时启动登录
  6. 06自动配置提供方

适用场景

  1. 01为 Agent 配置 Fiddler MCP
  2. 02查找非默认本地服务端口
  3. 03刷新现有提供方配置

MCP 相关

它通过本地管理端点为选定的 Agent 提供方配置 Fiddler Everywhere 的 MCP 服务,也可通过服务的 MCP 接口启动登录流程。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/telerik/fiddler-agent-tools --skill fiddler-mcp-setup

安装后在 Claude Code 中输入/fiddler-mcp-setup确认已加载。

详细介绍

Fiddler MCP 设置

配置 Fiddler Everywhere MCP 服务,以便 Agent 工具调用 Fiddler 的流量检查、状态和会话 API。


操作规则

  • 优先使用 Shell。 MCP 尚未配置,因此无法使用 MCP 工具。
  • 仅按顺序执行。 严格按顺序完成各步骤,不要并行运行步骤或脚本。每一步都可能依赖上一步生成的值。
  • 在 Windows 上——检测已打开的终端。只有当终端不是 PowerShell 时,才使用 powershell.exe -Command 'script' 包装脚本。使用单引号包裹脚本。

步骤 1 — 验证是否已安装 Fiddler

macOS:

if [ -d "/Applications/Fiddler Everywhere.app" ]; then echo "INSTALLED"; else echo "NOT_INSTALLED"; fi

Linux:

if command -v fiddler-everywhere &>/dev/null; then echo "INSTALLED"; else echo "NOT_INSTALLED"; fi

Windows(PowerShell):

$installed = Get-ItemProperty `
  "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*",
  "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*",
  "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" `
  -ErrorAction SilentlyContinue |
  Where-Object { $_.DisplayName -like "*Fiddler Everywhere*" }
if ($installed) { "INSTALLED" } else { "NOT_INSTALLED" }

如果为 NOT_INSTALLED:停止并告知用户:

“尚未安装 Fiddler Everywhere。请先安装。”


步骤 2 — 检测提供程序

识别正在配置的 Agent,并设置 PROVIDER。

父进程名称

检查父进程:

macOS / Linux:

ps -p $PPID -o comm= 2>/dev/null

Windows(PowerShell):

(Get-Process -Id (Get-CimInstance Win32_Process -Filter "ProcessId=$PID").ParentProcessId).Name

将输出与已知进程名称进行匹配:

进程名称包含提供程序值
code、code-helpervscode
cursorcursor
claudeclaude_code
copilotcopilot_cli
codexcodex_cli

如果匹配结果明确无误,将表中的提供程序值设为 PROVIDER,然后继续步骤 3。

如果仍无法识别,询问用户:

“您要为哪个 Agent 设置 Fiddler MCP?(VS Code / GitHub Copilot、Cursor、Claude Code CLI、GitHub Copilot CLI 或 OpenAI Codex CLI)”

根据用户的回答,从上表中设置 PROVIDER。


步骤 3 — 查找端口

Fiddler Everywhere 默认监听端口 8868。确认端口可访问,并为后续所有步骤设置 PORT。

macOS / Linux:

curl -s -o /dev/null -w "%{http_code}" "http://localhost:8868/api/McpManagement/Detect?provider=PROVIDER"

Windows(PowerShell):

curl.exe -s -o NUL -w "%{http_code}" "http://localhost:8868/api/McpManagement/Detect?provider=PROVIDER"
结果操作
任意 HTTP 响应码端口 8868 可访问。设置 PORT=8868,然后继续步骤 4。
000(连接被拒绝)端口 8868 未在监听。运行下面的端口发现脚本。

端口发现脚本:

macOS / Linux:

python3 -c "
import json, glob, os
ports = set()
for f in glob.glob(os.path.expanduser('~/.fiddler/*/Settings/appsettings.json')):
    try:
        p = json.load(open(f)).get('MCPServerSettings', {}).get('Port')
        if p and p != 8868:
            ports.add(p)
    except: pass
print(' '.join(str(p) for p in ports) if ports else 'none')
"

Windows(PowerShell):

$ports = Get-ChildItem "$env:USERPROFILE\.fiddler\*\Settings\appsettings.json" -ErrorAction SilentlyContinue |
  ForEach-Object { (Get-Content $_ | ConvertFrom-Json).MCPServerSettings.Port } |
  Where-Object { $_ -and $_ -ne 8868 } | Select-Object -Unique
Write-Output $(if ($ports) { $ports -join ' ' } else { 'none' })

对返回的每个端口进行探测:

macOS / Linux:

curl -s -o /dev/null -w "%{http_code}" "http://localhost:PORT/api/McpManagement/Detect?provider=PROVIDER"

Windows(PowerShell):

curl.exe -s -o NUL -w "%{http_code}" "http://localhost:PORT/api/McpManagement/Detect?provider=PROVIDER"

将第一个返回任意 HTTP 响应的端口设为 PORT。如果没有端口响应,则说明 Fiddler 未运行——启动 Fiddler,然后从步骤 3 开始重试。

启动 Fiddler:

macOS:

open -a "Fiddler Everywhere" && sleep 15

Linux:

(nohup fiddler-everywhere &>/dev/null &); sleep 15

Windows: 重要:在 Windows 上,如果当前使用的终端是 bash,请使用专用的 GitBash 脚本。

PowerShell

$candidates = @(
  "$env:LOCALAPPDATA\Programs\Fiddler Everywhere\Fiddler Everywhere.exe",
  "C:\Program Files\Fiddler Everywhere\Fiddler Everywhere.exe",
  "C:\Program Files (x86)\Fiddler Everywhere\Fiddler Everywhere.exe"
)
$fiddlerExe = $candidates | Where-Object { Test-Path $_ } | Select-Object -First 1
if ($fiddlerExe) {
  $cmdLine = '"' + $fiddlerExe + '"'
  Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{ CommandLine = $cmdLine } | Out-Null
  Start-Sleep 15
}

Git Bash

FIDDLER_EXE=""
for dir in "$LOCALAPPDATA/Programs/Fiddler Everywhere" \
           "/c/Program Files/Fiddler Everywhere" \
           "/c/Program Files (x86)/Fiddler Everywhere"; do
  if [ -f "$dir/Fiddler Everywhere.exe" ]; then
    FIDDLER_EXE="$dir/Fiddler Everywhere.exe"
    break
  fi
done
if [ -n "$FIDDLER_EXE" ]; then
  "$FIDDLER_EXE" &
  sleep 15
fi

**重要:**继续后续步骤之前,请等待 15 秒,让 Fiddler 启动!

如果重新启动后仍无法访问:

“无法访问 Fiddler Everywhere。请确认它正在运行,然后重试。”

后续所有步骤都会使用 PORT。


步骤 4 — 检查是否已有配置

调用 Detect 端点,查看此提供程序是否已配置 Fiddler MCP:

macOS / Linux:

curl -s "http://localhost:$PORT/api/McpManagement/Detect?provider=PROVIDER"

Windows(PowerShell):

curl.exe -s "http://localhost:$PORT/api/McpManagement/Detect?provider=PROVIDER"

将 PROVIDER 替换为步骤 2 中的值。

响应操作
表示配置已存在 / 已配置告知用户:“PROVIDER 已配置 Fiddler MCP。”询问用户是否要重新运行设置以刷新配置。只有在用户确认后才继续。
表示尚未配置继续步骤 5。
403停止:“您的 Fiddler 套餐不包含 MCP 访问权限。请升级订阅。”
用户未登录按照下面的登录流程操作,然后重试步骤 4。

登录(如果 Fiddler 提示用户未登录)

使用 MCP 协议触发登录流程。按顺序完成以下子步骤。

1. 打开 MCP 会话并获取会话 ID:

macOS / Linux:

SESSION_ID=$(curl -si -X POST "http://localhost:$PORT/mcp" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"mcp-setup","version":"1.0"}}}' \
  | grep -i "^mcp-session-id:" | awk '{print $2}' | tr -d '\r')
echo "Session ID: $SESSION_ID"

Windows (PowerShell):

$initResp = curl.exe -si -X POST "http://localhost:$PORT/mcp" `
  -H "Content-Type: application/json" `
  -H "Accept: application/json, text/event-stream" `
  -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2024-11-05\",\"capabilities\":{},\"clientInfo\":{\"name\":\"mcp-setup\",\"version\":\"1.0\"}}}'
$SESSION_ID = ($initResp | Select-String "(?i)mcp-session-id:\s*(\S+)").Matches.Groups[1].Value.Trim()
Write-Host "Session ID: $SESSION_ID"

如果 SESSION_ID 为空,可能是 Fiddler 尚未完全启动——等待几秒后重试。

2. 获取工具列表,确认 initiate_login 可用:

macOS / Linux:

curl -s -X POST "http://localhost:$PORT/mcp" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "Mcp-Session-Id: $SESSION_ID" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'

Windows (PowerShell):

curl.exe -s -X POST "http://localhost:$PORT/mcp" `
  -H "Content-Type: application/json" `
  -H "Accept: application/json, text/event-stream" `
  -H "Mcp-Session-Id: $SESSION_ID" `
  -d '{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/list\",\"params\":{}}'

继续之前,请确认响应中包含 initiate_login。

3. 调用 initiate_login:

macOS / Linux:

curl -s -X POST "http://localhost:$PORT/mcp" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "Mcp-Session-Id: $SESSION_ID" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"initiate_login","arguments":{}}}'

Windows (PowerShell):

curl.exe -s -X POST "http://localhost:$PORT/mcp" `
  -H "Content-Type: application/json" `
  -H "Accept: application/json, text/event-stream" `
  -H "Mcp-Session-Id: $SESSION_ID" `
  -d '{\"jsonrpc\":\"2.0\",\"id\":3,\"method\":\"tools/call\",\"params\":{\"name\":\"initiate_login\",\"arguments\":{}}}'

告诉用户:

“浏览器中已打开登录窗口。请完成登录,然后告知我。”

等待用户确认登录完成,然后重试触发此登录流程的步骤。


步骤 5 — 自动配置

调用 Configure 端点。Fiddler 将自动生成或重用 API 密钥,并为该提供商写入正确的配置文件:

macOS / Linux:

curl -s -X POST "http://localhost:$PORT/api/McpManagement/Configure" \
  -H "Content-Type: application/json" \
  -d '{"provider":"PROVIDER"}'

Windows (PowerShell):

curl.exe -s -X POST "http://localhost:$PORT/api/McpManagement/Configure" `
  -H "Content-Type: application/json" `
  -d '{\"provider\":\"PROVIDER\"}'

将 PROVIDER 替换为步骤 2 中的值。

响应操作
成功 / 2xx配置已写入。继续执行步骤 6。
403停止:“您的 Fiddler 套餐不包含 MCP 访问权限。请升级您的订阅。”
用户未登录按照步骤 4 中的 登录 流程操作,然后重试步骤 5。
其他任何失败记录响应,并请用户检查 Fiddler 是否正常运行。

步骤 6 — 确认成功

告诉用户:

“Fiddler MCP 已为 PROVIDER 完成配置。请重启您的 Agent(重新加载 VS Code 窗口、重启 Cursor 等)以应用新配置,然后尝试使用 Fiddler 工具。”

评论

支持 Markdown