TH

tjamet/har-mcp

部署与 DevOps

本页由 AI 翻译,技术细节请以原文为准。 查看原文

27 stars 7 forks 质量 56 趋势 11MIT

一个用于解析和分析 HAR(HTTP 归档)文件的 MCP 服务器

概览

一个模型上下文协议(MCP)服务器,用于解析和分析HAR(HTTP归档)文件。该服务器允许AI助手检查以HAR格式捕获的网络流量,并内置支持对敏感认证头的编辑处理。 - 来自本地文件系统或HTTP URL - 访问于 HAR 文件中 - 用于特定 URL 和方法组合 - 自动遮蔽认证头部 - 处理现实世界 HAR 文件的格式:- 时间字段的浮点/十进制值(自动四舍五入为整数) - 纯文本或 base64 编码的响应内容 - 基本 HAR 规范中没有的额外字段 - 支持浏览器开发工具生成的标准 HAR 格式 你可以用标准的MCP配置安装这个MCP服务器。 在你的MCP配置中添加以下JSON模块。 或者你也可以直接用go run运行服务器。

概述(AI 翻译)

一个模型上下文协议(MCP)服务器,用于解析和分析HAR(HTTP归档)文件。该服务器允许AI助手检查以HAR格式捕获的网络流量,并内置支持对敏感认证头的编辑处理。

特色

  • **从本地文件系统或HTTP URL加载HAR文件
  • 列出所有访问在HAR文件中的URL和HTTP方法
  • 查询请求ID针对特定URL和方法组合
  • **通过自动遮蔽认证头部获取完整请求详情
  • 灵活的HAR解析技术,可处理真实世界的HAR文件,支持:
  • 时间域的浮点/十进制值(自动四舍五入为整数)
  • 纯文本或base64编码的响应内容
  • 基本HAR规范中不存在的额外字段
  • 支持浏览器开发工具产生的标准HAR格式

安装

你可以用标准的MCP配置安装这个MCP服务器。

在你的MCP配置中添加以下JSON模块。

使用 docker

用“去跑”

或者你也可以直接用go run运行服务器。

从源头构建

如果你没有 Docker,可以用 go build 在

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

HAR MCP Server

A Model Context Protocol (MCP) server for parsing and analyzing HAR (HTTP Archive) files. This server allows AI assistants to inspect network traffic captured in HAR format, with built-in support for redacting sensitive authentication headers.

Features

  • Load HAR files from local filesystem or HTTP URLs
  • List all URLs and HTTP methods accessed in the HAR file
  • Query request IDs for specific URL and method combinations
  • Retrieve full request details with automatic redaction of authentication headers
  • Flexible HAR parsing that handles real-world HAR files with:
    • Float/decimal values for time fields (automatically rounded to integers)
    • Plain text or base64-encoded response content
    • Additional fields not present in the basic HAR spec
  • Support for standard HAR format as produced by browser developer tools

Installation

You can install this MCP server using your standard MCP configuration.

Add the following JSON block to your mcp configuration.

Using docker

{
  "mcp": {
    "servers": {
      "har": {
        "command": "docker",
        "args": [
          "run",
          "-i",
          "--rm",
          "ghcr.io/tjamet/har-mcp"
        ]
      }
    }
  }
}

Using go run

Alternatively you can run thr server directly with go run.

{
  "mcpServers": {
    "github": {
      "command": "go",
      "args": [
        "run",
        "github.com/tjamet/har-mcp/cmd/har-mcp@main"
      ]
    }
  }
}

Build from source

If you don’t have Docker, you can use go build to build the binary in the cmd/har-mcp directory, and use the github-mcp-server command. To specify the output location of the build, use the -o flag. You should configure your server to use the built executable as its command. For example:

{
  "mcp": {
    "servers": {
      "github": {
        "command": "/path/to/har-mcp-server"
      }
    }
  }
}

Usage

The HAR MCP server runs as a stdio-based MCP server, communicating via JSON-RPC over standard input/output.

Running the Server

./har-mcp

Available Tools

1. load_har

Load a HAR file from a file path or HTTP URL.

Parameters:

  • source (string, required): File path or HTTP URL to the HAR file

Example:

{
  "source": "/path/to/capture.har"
}

2. list_urls_methods

List all accessed URLs and their HTTP methods from the loaded HAR file.

Parameters: None

Returns: Array of URL/method combinations with their associated request IDs.

3. get_request_ids

Get all request IDs for a specific URL and HTTP method.

Parameters:

  • url (string, required): The URL to filter by
  • method (string, required): The HTTP method to filter by (GET, POST, etc.)

Example:

{
  "url": "https://api.example.com/users",
  "method": "GET"
}
在 GitHub 查看完整 README

安装

docker run -i --rm ghcr.io/tjamet/har-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "github": { "command": "go", "args": [ "run", "github.com/tjamet/har-mcp/cmd/har-mcp@main" ] } } }