Skip to main content
Glama

SharkMCP

Un servidor MCP que expone sharkd —la interfaz programática de Wireshark— como un conjunto de herramientas para LLMs. Carga archivos PCAP/PCAPNG y analízalos con lenguaje natural.

Requisitos

  • Python 3.10+

  • Wireshark (proporciona sharkd)

Related MCP server: Wireshark MCP

Instalación

git clone https://github.com/weirdmachine64/sharkmcp.git
cd sharkmcp
pip install -e .

O ejecútalo directamente desde el repositorio sin instalar:

uvx --from git+https://github.com/weirdmachine64/sharkmcp sharkmcp

Configuración

Añádelo a tu .mcp.json:

{
  "mcpServers": {
    "sharkmcp": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/weirdmachine64/sharkmcp", "sharkmcp"],
      "env": {
        "SHARKMCP_TIMEOUT": "300"
      }
    }
  }
}

Var. de entorno

Predeterminado

Descripción

SHARKMCP_SHARKD_BIN

sharkd

Ruta al binario de sharkd

SHARKMCP_TIMEOUT

300

Tiempo de espera por solicitud en segundos

Herramientas

Cada PCAP cargado obtiene un subproceso dedicado de sharkd. Los resultados de escaneos costosos (conversaciones, información experta, exportación de objetos) se almacenan en caché en la memoria para que las llamadas de seguimiento paginadas se sirvan sin necesidad de volver a escanear.

Sesión

Herramienta

Descripción

load_pcap(path, alias?)

Carga un archivo PCAP/PCAPNG

list_pcaps()

Lista todos los PCAP cargados

unload_pcap(alias)

Termina la sesión y libera memoria

Resumen

Herramienta

Descripción

pcap_summary(alias)

Recuento de tramas, duración, tamaño del archivo, protocolos detectados

server_info(alias)

Todos los tipos de tap disponibles, protocolos de seguimiento, tipos de campo

Inspección de paquetes

Herramienta

Descripción

list_packets(alias, filter?, columns?, refs?)

Lista de tramas paginada con filtro de visualización

packet_detail(alias, frame, include_bytes?, include_hidden?)

Árbol de protocolo completo para una trama

extract_fields(alias, fields, filter?)

Extrae campos arbitrarios por paquete como una tabla

Utilidades

Herramienta

Descripción

validate(alias, filter?, field?)

Valida un filtro de visualización y/o nombre de campo

complete(alias, field?, pref?)

Autocompleta nombres de campos o preferencias por prefijo

get_preference(alias, preference?)

Lee las preferencias del disector

set_preference(alias, name, value)

Establece una preferencia de disector para esta sesión

set_frame_comment(alias, frame, comment)

Anota una trama (con alcance de sesión)

Estructura del tráfico

Herramienta

Descripción

protocol_hierarchy(alias, filter?)

Árbol de protocolos anidado con recuentos de tramas/bytes

io_stats(alias, interval_ms?, filter?)

Recuentos de tramas y bytes por intervalo

iograph(alias, graphs, interval_ms?, filters?)

Gráfico de tráfico de varias líneas; admite packets, bytes, bits, sum:<field>, avg:<field>, min:<field>, max:<field>, load:<field>, frames:<field>

follow_stream(alias, protocol, filter)

Reensambla un flujo (tcp, udp, tls, http, http2, quic, sip, dccp, websocket)

Conversaciones y topología

Herramienta

Descripción

conversations(alias, type?, sort_by?)

Tabla de conversaciones: bytes/tramas por par de pares

endpoints(alias, type?, sort_by?)

Tabla de puntos finales: tx/rx por host

Tipos de capa admitidos para ambos: tcp, udp, ip, ipv6, eth, sctp, dccp, mptcp, wifi, bluetooth, zigbee, fc, fddi, usb, y más.

Estadísticas de protocolo

Herramienta

Descripción

expert_info(alias, filter?)

Detección de anomalías por trama: errores, advertencias, notas, chats

protocol_stats(alias, protocol)

Estadísticas agregadas para dns, http, http_requests, http_server, sip, dhcp, h225, http2, rtsp

service_response_time(alias, protocol)

Latencia de solicitud/respuesta para smb, smb2, snmp, ldap, diameter, rpc, gtp, y más

response_time_delay(alias, protocol)

Retraso de ida y vuelta para radius, h225_ras, megaco, mgcp

sequence_diagram(alias, type?)

Datos del diagrama de flujo para tcp, icmp, icmpv6, any

Medios y VoIP

Herramienta

Descripción

voip_calls(alias, filter?)

Lista de llamadas SIP/H.323 con estado y participantes

rtp_streams(alias, stream_spec?)

Inventario de flujos RTP; pasa stream_spec para jitter/pérdida por flujo

multicast_streams(alias, filter?)

Estadísticas de flujo multicast UDP

Exportación y objetos

Herramienta

Descripción

export_objects(alias, type?)

Lista de objetos extraíbles (http, imf, smb, tftp, dicom, ftp-data)

download_object(alias, token)

Descarga un objeto, claves de sesión TLS (ssl-secrets) o audio RTP (rtp:<spec>) en base64

Salida de emergencia

Herramienta

Descripción

tap(alias, specs, filter?, skip?, limit?)

Ejecuta cualquier tap de sharkd directamente: hasta 16 especificaciones en un escaneo PCAP. Usa server_info para descubrir identificadores válidos.

Ejemplo

> 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")

Arquitectura

    LLM
     │  MCP (stdio)
     ▼
 SharkMCP server
     │  JSON-RPC 2.0 (stdin/stdout)
     ├─ sharkd [pcap-1]
     ├─ sharkd [pcap-2]
     └─ sharkd [pcap-N]

Un subproceso sharkd por cada PCAP cargado. Las sesiones están aisladas: las consultas simultáneas en diferentes alias nunca se bloquean entre sí.

Available Tools

30 tools
completeA

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

    B3.4/5.0

    Scored across 30 tools

    Disambiguation5/5

    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.

    Naming Consistency3/5

    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.

    Tool Count4/5

    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.

    Completeness5/5

    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

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers