SharkMCP
SharkMCP
sharkd(Wiresharkのプログラムインターフェース)をLLM用のツールセットとして公開するMCPサーバーです。PCAP/PCAPNGファイルを読み込み、自然言語で分析できます。
要件
Python 3.10以上
Wireshark (
sharkdを提供)
Related MCP server: Wireshark MCP
インストール
git clone https://github.com/weirdmachine64/sharkmcp.git
cd sharkmcp
pip install -e .または、インストールせずにリポジトリから直接実行します:
uvx --from git+https://github.com/weirdmachine64/sharkmcp sharkmcp設定
.mcp.jsonに追加します:
{
"mcpServers": {
"sharkmcp": {
"command": "uvx",
"args": ["--from", "git+https://github.com/weirdmachine64/sharkmcp", "sharkmcp"],
"env": {
"SHARKMCP_TIMEOUT": "300"
}
}
}
}環境変数 | デフォルト | 説明 |
|
| sharkdバイナリへのパス |
|
| リクエストごとのタイムアウト(秒) |
ツール
読み込まれた各PCAPには、専用のsharkdサブプロセスが割り当てられます。負荷の高いスキャン(会話、エキスパート情報、オブジェクトのエクスポートなど)の結果はメモリにキャッシュされるため、ページネーションされた後続の呼び出しは再スキャンなしで処理されます。
セッション
ツール | 説明 |
| PCAP/PCAPNGファイルを読み込む |
| 読み込まれたすべてのPCAPを一覧表示する |
| セッションを終了しメモリを解放する |
概要
ツール | 説明 |
| フレーム数、期間、ファイルサイズ、検出されたプロトコル |
| 利用可能なすべてのタップタイプ、フォロープロトコル、フィールドタイプ |
パケット検査
ツール | 説明 |
| 表示フィルタを使用したページネーション可能なフレームリスト |
| 1フレームの完全なプロトコルツリー |
| パケットごとの任意のフィールドをテーブルとして抽出する |
ユーティリティ
ツール | 説明 |
| 表示フィルタやフィールド名を検証する |
| プレフィックスによるフィールド名や設定名のオートコンプリート |
| ディセクタ設定を読み取る |
| このセッションのディセクタ設定を行う |
| フレームに注釈を付ける(セッションスコープ) |
トラフィック構造
ツール | 説明 |
| フレーム/バイト数を含むネストされたプロトコルツリー |
| インターバルごとのフレーム数およびバイト数 |
| マルチライントラフィックグラフ。 |
| ストリームを再構築する ( |
会話とトポロジー
ツール | 説明 |
| 会話テーブル — ピアペアごとのバイト数/フレーム数 |
| エンドポイントテーブル — ホストごとの送信/受信 |
両方でサポートされているレイヤータイプ:tcp, udp, ip, ipv6, eth, sctp, dccp, mptcp, wifi, bluetooth, zigbee, fc, fddi, usb など。
プロトコル統計
ツール | 説明 |
| フレームごとの異常検知 — エラー、警告、注意、チャット |
|
|
|
|
|
|
|
|
メディアとVoIP
ツール | 説明 |
| ステータスと参加者を含むSIP/H.323通話リスト |
| RTPストリームインベントリ。ストリームごとのジッター/損失には |
| UDPマルチキャストストリーム統計 |
エクスポートとオブジェクト
ツール | 説明 |
| 抽出可能なオブジェクトの一覧 ( |
| オブジェクト、TLSセッションキー ( |
エスケープハッチ
ツール | 説明 |
| sharkdタップを直接実行する — 1回のPCAPスキャンで最大16個の仕様。有効な識別子を見つけるには |
例
> load_pcap("/captures/traffic.pcap", alias="traffic")
> protocol_hierarchy("traffic")
> expert_info("traffic", limit=20)
> conversations("traffic", type="tcp", sort_by="bytes")
> extract_fields("traffic", ["dns.qry.name", "dns.a"], filter="dns")
> follow_stream("traffic", "http", "tcp.stream eq 0")
> export_objects("traffic", type="http")
> download_object("traffic", "eo:http_0")アーキテクチャ
LLM
│ MCP (stdio)
▼
SharkMCP server
│ JSON-RPC 2.0 (stdin/stdout)
├─ sharkd [pcap-1]
├─ sharkd [pcap-2]
└─ sharkd [pcap-N]読み込まれたPCAPごとに1つの sharkd サブプロセスが起動します。セッションは分離されており、異なるエイリアスに対する同時クエリが互いにブロックすることはありません。
Available Tools
30 toolscompleteA
Autocomplete field names or preference names by prefix.
field — field prefix, e.g. "tcp." → all tcp.* dissector fields.
pref — preference prefix, e.g. "tcp." → all tcp.* preferences.
At least one of field or pref must be provided.
Dense protocols (e.g. "opcua.") can return thousands of entries;
limit caps the list (0 = no cap).
Inputs: alias (required), field, pref, limit.
conversationsB
Conversation table for a given layer. Sums frames/bytes per peer pair.
Results are sorted by sort_by (descending) and paged with skip/limit.
The PCAP is scanned only on the first call for a given filter; all
subsequent pages are served from an in-memory cache. Set limit=0 for all.
Inputs: alias (required), type, display_filter, sort_by, +2 more.
download_objectA
Download the raw content of an exportable object, TLS secrets, or RTP audio.
Tokens come from:
export_objects → "eo:http_0", "eo:imf_0", etc.
TLS session keys → "ssl-secrets" (NSS Key Log format, if embedded)
RTP audio stream → "rtp:<src_ip>_<src_port>_<dst_ip>_<dst_port>_<ssrc>"
Content is returned base64-encoded under the data key along with
the MIME type and original filename where available.
Inputs: alias (required), token (required).
endpointsA
Endpoint table for a given layer. Sums tx/rx frames and bytes per host.
Results are sorted by sort_by (descending) and paged with skip/limit.
The PCAP is scanned only on the first call for a given filter; all
subsequent pages are served from an in-memory cache. Set limit=0 for all.
Inputs: alias (required), type, display_filter, sort_by, +2 more.
expert_infoC
Per-frame expert diagnostics — errors, warnings, notes, and chats.
Returns Wireshark's built-in anomaly detection results: TCP retransmissions,
malformed packets, unusual sequences, and protocol violations.
Each entry contains frame number (f), severity (s), protocol (p),
and message (m). Results are cached after the first scan.
Inputs: alias (required), display_filter, skip, limit.
export_objectsA
List exportable objects of the given type found in the capture.
Each returned object includes a _download token that can be passed to
download_object to retrieve the raw content. Supported types:
http, dicom, smb, tftp, imf, ftp-data.
The PCAP is scanned only on the first call for a given type; subsequent pages are served from cache.
Inputs: alias (required), type, skip, limit.
extract_fieldsC
Extract arbitrary fields per packet, e.g.
["ip.src", "tcp.dstport", "http.host"]. Returns rows of dicts keyed
by field name.
Inputs: alias (required), fields (required), display_filter, skip, +1 more.
follow_streamB
Reassemble a stream. display_filter selects it (e.g. tcp.stream eq 3).
Returns client/server addrs and base64 payload chunks with direction.
Long-lived streams can produce huge payload lists; max_payloads caps
how many chunks are returned. Set to 0 for no cap.
Inputs: alias (required), protocol (required), display_filter (required), max_payloads.
get_preferenceA
Read one or all sharkd dissector preferences.
Pass a dotted preference name (e.g. "tcp.check_checksum") to read a
single value, or omit to dump all preferences. Useful for checking
whether a dissector is enabled or what port a protocol is bound to.
Inputs: alias (required), preference.
iographA
Per-interval traffic graph for up to 8 simultaneous lines.
Each entry in graphs must be one of:
"packets" | "bytes" | "bits" — basic counters
"sum:" | "avg:" — aggregate a numeric field per interval
"min:" | "max:" — min/max of a numeric field per interval
"load:" | "frames:" — bit-rate or frame count for a field
filters — optional per-graph display filters (parallel list to graphs);
enables multi-line graphs of different protocol streams.
Results are paged with skip/limit (default 300 buckets ≈ 5 min at 1 s).
Inputs: alias (required), graphs (required), interval_ms, filters, +2 more.
io_statsA
Per-interval frame and byte counts. interval_ms is the bucket size.
Results are in chronological order and paged with skip/limit.
The PCAP is scanned only on the first call for a given (interval, filter)
combination; subsequent pages are served from cache.
Default limit is 300 intervals (~5 min at 1 s buckets). Set limit=0 for all.
Inputs: alias (required), interval_ms, display_filter, skip, +1 more.
list_packetsC
Page through packets via sharkd frames.
display_filter accepts Wireshark display-filter syntax.
columns overrides the default column set with arbitrary field names
(e.g. ["frame.number", "ip.src", "tcp.dstport"]).
refs is a list of reference frame numbers for delta-time calculations.
Inputs: alias (required), display_filter, skip, limit, +2 more.
list_pcapsA
List every loaded PCAP with its current sharkd status.
Inputs: no named parameters. Returns: result
load_pcapA
Load a PCAP/PCAPNG file into a fresh sharkd session.
alias defaults to the basename. Each loaded PCAP keeps a dedicated
sharkd subprocess warm so subsequent queries are interactive.
Returns the alias and basic status (frame count, duration, file size).
Inputs: path (required), alias.
multicast_streamsB
UDP multicast stream statistics.
Returns per-stream packet counts, byte rates, and burst statistics for all UDP multicast flows in the capture.
Inputs: alias (required), display_filter.
packet_detailA
Full protocol tree for one frame.
include_bytes — add raw bytes (base64) per layer.
include_hidden — include hidden protocol tree fields.
ref_frame — reference frame number for delta-time display.
prev_frame — previous frame number for delta-time display.
Inputs: alias (required), frame_number (required), include_bytes, include_hidden, +2 more.
pcap_summaryC
Combined status + analyse: filename, size, frame count, duration,
protocols seen, first/last timestamps.
Inputs: alias (required).
protocol_hierarchyC
Protocol hierarchy stats — nested tree of frame/byte counts per protocol.
Inputs: alias (required), display_filter.
protocol_statsC
Protocol-level aggregate statistics.
protocol options: dns — query/response counts by type and return code http — HTTP request/response packet counters http_requests — requests grouped by URI http_server — load distribution across servers http_seq — HTTP request sequences http2 — HTTP/2 stream statistics rtsp — RTSP packet counters sip — SIP response code counters dhcp — DHCP message type distribution h225 — H.225 message and response status
Inputs: alias (required), protocol (required), display_filter.
response_time_delayC
Response time delay statistics for signalling protocols.
Measures per-transaction round-trip delay: h225_ras — H.225 RAS registration/admission delays megaco — MEGACO/H.248 gateway control delays mgcp — MGCP gateway control delays radius — RADIUS authentication/accounting delays
Inputs: alias (required), protocol (required), display_filter.
rtp_streamsB
RTP stream inventory and per-stream quality analysis.
Without stream_spec — returns all RTP streams with SSRC, codec,
packet count, and timing.
With stream_spec — returns jitter, packet loss, and sequence error
statistics for one stream. Format:
<src_ip>_<src_port>_<dst_ip>_<dst_port>_<ssrc>
e.g. 200.57.7.195_9762_200.57.7.196_26946_0xd2bd4e3e
Inputs: alias (required), stream_spec, display_filter.
sequence_diagramB
Flow sequence diagram data for visualising packet exchanges.
Returns time-ordered node and flow entries suitable for rendering a sequence diagram (equivalent to Wireshark's Flow Graph window). any — all flows tcp — TCP flows (handshakes, data, teardowns) icmp — ICMP echo request/reply flows icmpv6 — ICMPv6 flows
Inputs: alias (required), type, display_filter.
server_infoA
List all types available in this sharkd session: tap identifiers, follow protocols, column fields, and stats tree entries.
Useful for discovering valid values before calling conversations, endpoints, follow_stream, or protocol_hierarchy.
Inputs: alias (required).
service_response_timeC
Service response time statistics — min/max/avg latency per request type.
Measures the elapsed time between a protocol request and its response. Useful for detecting slow servers, network congestion, or anomalous response-time patterns in application protocols.
Inputs: alias (required), protocol (required), display_filter.
set_frame_commentA
Set a comment on a frame for the duration of this session (non-persistent).
Pass an empty string to clear an existing comment. Useful for annotating frames during forensic analysis.
Inputs: alias (required), frame_number (required), comment.
set_preferenceA
Set a sharkd dissector preference for this session.
Changes are session-scoped and do not persist after the server restarts.
Common uses: forcing a non-standard port to decode as a specific protocol
(e.g. name="http.tcp.port", value="8080"), or enabling/disabling a
dissector option.
Inputs: alias (required), name (required), value (required).
tapA
Run one or more sharkd statistics taps in a single PCAP scan.
specs — tap identifiers from server_info, e.g.
["expert", "conv:TCP", "stat:dns", "srt:smb"]
filter — global display filter applied to all taps (sharkd supports
only one filter per tap call; per-tap filters are iograph-only)
skip / limit — pagination applied to each tap's flat list result
Up to 16 specs per call (sharkd limit). Results are cached after the
first scan; paginated follow-up calls are served from memory.
Use server_info to discover all valid tap identifiers.
Inputs: alias (required), specs (required), filter, skip, +1 more.
unload_pcapB
Terminate the sharkd session for alias and free its memory.
Inputs: alias (required).
validateA
Validate a display-filter expression and/or a field name.
filter — Wireshark display filter (e.g. tcp.port == 443).
field — fully qualified field name (e.g. http.request.method).
Returns {"status":"OK"} on success or an error object.
At least one of filter or field must be provided.
Inputs: alias (required), filter, field.
voip_callsC
VoIP call list with state, duration, and participant addresses.
Detects SIP, H.323, MGCP, and SKINNY calls in the capture and reconstructs the call flow from signalling messages.
Inputs: alias (required), display_filter.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 30 tools
Each tool targets a distinct operation on packet capture data, such as loading, listing, extracting fields, following streams, or computing statistics. Overlaps like io_stats and iograph are clarified by descriptions (one simple counts, the other multi-line graphs). No two tools appear to do the same thing.
Tool names mix verb_noun patterns (list_pcaps, load_pcap, set_preference) with noun-only names (protocol_hierarchy, voip_calls, rtp_streams). While the naming is readable and uses snake_case consistently, the lack of a uniform verb prefix creates inconsistency.
30 tools cover a broad range of PCAP analysis features (loading, filtering, statistics, protocol details, export). This is slightly above the typical 15-20 but justified given the extensive functionality of Wireshark/sharkd. No obvious bloat.
The tool surface is comprehensive for analyzing packet captures: it covers file management, packet listing, field extraction, stream reassembly, export objects, multiple statistics taps, protocol-specific analysis, preferences, and validation. Missing features like live capture or saving are outside the server's stated purpose.
Maintenance
Related MCP Connectors
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
File tools for your AI chat: PDF tables to Excel, merge PDFs, images to PDF, fill PDF forms.
File uploads for AI agents. Upload, list, and manage files. No signup required.
Open, inspect, filter, edit and convert xlsx and csv files from your AI chat. Processing is local.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables LLMs to perform automated network forensics, threat hunting, and traffic analysis using Wireshark/TShark.344MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to analyze network traffic using Wireshark/tshark, providing packet statistics, protocol analysis, and anomaly detection through natural language interaction.75MIT
- FlicenseCqualityDmaintenanceEnables LLMs to capture, analyze, and summarize network traffic using Wireshark CLI tools, supporting live capture, pcap analysis, and LLM-oriented summaries.76-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with tshark and related command-line tools for live packet capture, PCAP analysis, filtering, stream following, and capture file merging.1MIT