
一个用于分析PCAP文件的瑞士刀式MCP服务器
概览
一个MCP服务器,将sharkd——Wireshark的程序接口——作为一套大型语言模型的工具。加载PCAP/PCAPNG文件并用自然语言分析它们。 - Python 3.10+ - Wireshark(提供sharkd) 或者直接从仓库运行,不安装: 每个加载的PCAP都有一个专用的sharkd子进程。昂贵扫描的结果(对话、专家信息、导出对象)会缓存到内存中,因此分页的后续调用无需重新扫描即可提供。 支持的层类型包括:TCP、UDP、IP、IPV6、eth、sctp、dccp、mptcp、wifi、蓝牙、zigbee、fc、fddi、USB等。 每个加载的PCAP有一个鲨鱼子进程。会话是隔离的——不同别名上的并发查询不会互相阻塞。
概述(AI 翻译)
一个MCP服务器,将sharkd——Wireshark的程序接口——作为一套大型语言模型的工具。加载PCAP/PCAPNG文件并用自然语言分析它们。
要求
- Python 3.10+
- Wireshark(提供
sharkd)
安装
或者直接从仓库运行,不安装:
配置
补充你的.mcp.json:
| 环境变量 | 默认 | 描述 |
|---|---|---|
SHARKMCP_SHARKD_BIN |
sharkd |
通往鲨鱼二元的路径 |
SHARKMCP_TIMEOUT |
300 |
每次请求超时时间(秒数) |
工具
每个加载的PCAP都有一个专用的sharkd子进程。昂贵扫描的结果(对话、专家信息、导出对象)会缓存到内存中,因此分页的后续调用无需重新扫描即可提供。
会议
| 工具 | 描述 |
|---|---|
load_pcap(path, alias?) |
加载PCAP/PCAPNG文件 |
list_pcaps() |
列出所有已加载的PCAP |
unload_pcap(alias) |
终止会话并释放内存 |
概述
| 工具 | 描述 |
|---|---|
pcap_summary(alias) |
帧数、时长、文件大小、所见协议 |
server_info(alias) |
所有可用的分接类型,遵循协议,场类型 |
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
SharkMCP
An MCP server that exposes sharkd — Wireshark’s programmatic interface — as a set of tools for LLMs. Load PCAP/PCAPNG files and analyse them with natural language.
Requirements
- Python 3.10+
- Wireshark (provides
sharkd)
Installation
git clone https://github.com/weirdmachine64/sharkmcp.git
cd sharkmcp
pip install -e .
Or run directly from the repo without installing:
uvx --from git+https://github.com/weirdmachine64/sharkmcp sharkmcp
Configuration
Add to your .mcp.json:
{
"mcpServers": {
"sharkmcp": {
"command": "uvx",
"args": ["--from", "git+https://github.com/weirdmachine64/sharkmcp", "sharkmcp"],
"env": {
"SHARKMCP_TIMEOUT": "300"
}
}
}
}
| Env var | Default | Description |
|---|---|---|
SHARKMCP_SHARKD_BIN |
sharkd |
Path to sharkd binary |
SHARKMCP_TIMEOUT |
300 |
Per-request timeout in seconds |
Tools
Each loaded PCAP gets a dedicated sharkd subprocess. Results from expensive scans (conversations, expert info, export objects) are cached in memory so paginated follow-up calls are served without re-scanning.
Session
| Tool | Description |
|---|---|
load_pcap(path, alias?) |
Load a PCAP/PCAPNG file |
list_pcaps() |
List all loaded PCAPs |
unload_pcap(alias) |
Terminate session and free memory |
Overview
| Tool | Description |
|---|---|
pcap_summary(alias) |
Frame count, duration, file size, protocols seen |
server_info(alias) |
All available tap types, follow protocols, field types |
Packet Inspection
| Tool | Description |
|---|---|
list_packets(alias, filter?, columns?, refs?) |
Paginated frame list with display filter |
packet_detail(alias, frame, include_bytes?, include_hidden?) |
Full protocol tree for one frame |
extract_fields(alias, fields, filter?) |
Extract arbitrary fields per packet as a table |
Utilities
| Tool | Description |
|---|---|
validate(alias, filter?, field?) |
Validate a display filter and/or field name |
complete(alias, field?, pref?) |
Autocomplete field or preference names by prefix |
get_preference(alias, preference?) |
Read dissector preferences |
set_preference(alias, name, value) |
Set a dissector preference for this session |
set_frame_comment(alias, frame, comment) |
Annotate a frame (session-scoped) |
Traffic Structure
| Tool | Description |
|---|---|
protocol_hierarchy(alias, filter?) |
Nested protocol tree with frame/byte counts |
io_stats(alias, interval_ms?, filter?) |
Per-interval frame and byte counts |
iograph(alias, graphs, interval_ms?, filters?) |
Multi-line traffic graph; supports packets, bytes, bits, sum:, avg:, min:, max:, load:, frames: |
安装
uvx --from git+https://github.com/weirdmachine64/sharkmcp sharkmcp配置
{
"mcpServers": {
"sharkmcp": {
"command": "uvx",
"args": ["--from", "git+https://github.com/weirdmachine64/sharkmcp", "sharkmcp"],
"env": {
"SHARKMCP_TIMEOUT": "300"
}
}
}
}