AG

a-g-u-p-t-a/wireshark-mcp

开发工具

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

24 stars 4 forks 质量 72 趋势 14

TShark/Wireshark MCP 服务器,通过 Claude 进行网络数据包分析

概览

通过模型上下文协议(MCP)为AI代理进行数据包捕获和分析。 支持:光标、Claude Desktop、Claude Code、VS Code / Copilot、Windsurf、custom agents及类似工具。无厂商锁定——主机只需启动: GitHub Pages(可选):设置 ,然后 Pages 工作流程发布文档/作为 HTML。 - 通过MCP进行实时捕获和pcap/pcapng分析 - 通过MCP引导工作流程 - 启动:如果缺少TShark,进程会退出,这样你的主机会显示服务器离线/错误,而不是显示损坏的工具列表 - 设置/修改CLI,让新用户可以配置路径而不猜测 - Python - TShark(PATH 或 TSHARK_PATH)- Npcap(Windows)或 libpcap(Unix)用于捕获- 授权在目标网络上捕获 设置检测TShark(或请求路径),然后写入或打印一个标准的mcpservers JSON块。先指向你的主机配置,再指向主机。 - Python:C:\Users\YOU\...\wireshark-mcp\.venv\Scripts\python。

概述(AI 翻译)

通过模型上下文协议(MCP)为AI代理进行数据包捕获和分析。

支持任何标准MCP主机:光标、Claude Desktop、Claude Code、VS Code / Copilot、Windsurf、custom agents及类似工具。无厂商锁定——主机只需启动:

版本0.2.2

文档(维基)
新手设置 安装TShark + 此包
MCP 客户端 Cursor,Claude,VS Code,通用代码
故障排除 离线服务器,PATH问题
安全 安全捕获规则

GitHub Pages(可选):设置 Settings → Pages → Source = GitHub Actions,然后 Pages 工作流程将 docs/ 发布为 HTML。

你得到了什么

  • 通过MCP 工具进行实时捕捉和pcap/pcapng分析
  • 通过MCP 提示词引导工作流程
  • 启动 预冲段:如果缺少 TShark,进程会退出,这样你的主机会显示服务器离线/错误,而不是坏掉的工具列表
  • setup / doctor 光源链,使新用户无需猜测即可配置路径

要求

  • Python 3.10+
  • TShark(PATH 或 TSHARK_PATH)
  • Npcap(Windows)或libpcap(Unix)用于live捕获
  • 目标网络捕获授权

快速开始(5分钟)

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

README

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

Wireshark MCP Server

Packet capture and analysis for AI agents via the Model Context Protocol (MCP).

Works with any stdio MCP host: Cursor, Claude Desktop, Claude Code, VS Code / Copilot, Windsurf, custom agents, and similar tools. No vendor lock-in — the host only needs to launch:

python -m wireshark_mcp

Version 0.2.2

Docs (wiki)
Setup for novices Install TShark + this package
MCP clients Cursor, Claude, VS Code, generic
Troubleshooting Offline server, PATH issues
Security Safe capture rules

GitHub Pages (optional): set Settings → Pages → Source = GitHub Actions, then the Pages workflow publishes docs/ as HTML.

What you get

  • Live capture and pcap/pcapng analysis through MCP tools
  • Guided workflows via MCP prompts
  • Startup preflight: if TShark is missing, the process exits so your host shows the server offline/error instead of a broken tool list
  • setup / doctor CLIs so a new user can configure paths without guessing

Requirements

  • Python 3.10+
  • TShark (PATH or TSHARK_PATH)
  • Npcap (Windows) or libpcap (Unix) for live capture
  • Authorization to capture on the target network

Quick start (5 minutes)

git clone https://github.com/A-G-U-P-T-A/wireshark-mcp
cd wireshark-mcp
python -m venv .venv

# Windows:  .venv\Scripts\activate
# Unix:     source .venv/bin/activate

python -m pip install -e .
python -m wireshark_mcp doctor
python -m wireshark_mcp setup

setup detects TShark (or asks for its path) and writes or prints a standard mcpServers JSON block. Point your host at that config, then reload / restart the host.

Windows Wireshark install:

winget install --id WiresharkFoundation.Wireshark -e

MCP config (any host)

{
  "mcpServers": {
    "wireshark": {
      "command": "/absolute/path/to/.venv/bin/python",
      "args": ["-m", "wireshark_mcp"],
      "env": {
        "TSHARK_PATH": "/absolute/path/to/tshark"
      }
    }
  }
}

Windows example paths:

  • Python: C:\\Users\\YOU\\...\\wireshark-mcp\\.venv\\Scripts\\python.exe
  • TShark: C:\\Program Files\\Wireshark\\tshark.exe

Ready-made template: examples/mcpServers.wireshark.json
Client-specific file locations: docs/Clients.md

CLI

Command Purpose
python -m wireshark_mcp Run the MCP server (stdio)
python -m wireshark_mcp doctor JSON dependency report (exit 0/1)
python -m wireshark_mcp setup Interactive TShark + host config
python -m wireshark_mcp setup --client print Print JSON only

Project layout

src/wireshark_mcp/     # MCP server package (tools, prompts, preflight)
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "wireshark": { "command": "/absolute/path/to/.venv/bin/python", "args": ["-m", "wireshark_mcp"], "env": { "TSHARK_PATH": "/absolute/path/to/tshark" } } } }