Skip to main content
Glama
niusulong

TShark2MCP

by niusulong

TShark2MCP

AI-assisted pcap/pcapng analysis over the Model Context Protocol. Wraps Wireshark's tshark / capinfos as 5 typed MCP tools so AI clients (Claude Desktop, Cursor, VS Code) can analyze network captures through a standardized interface.

All processing is local — captures never leave the machine.

Tools

Each tool exposes a full JSON Schema (auto-generated from typed parameters), so the AI client knows exactly what to pass and what comes back.

Tool

Purpose

get_pcap_overview

File metadata + protocol hierarchy (capinfos + io,phs — loads no individual packet)

list_conversations

TCP streams / UDP sessions with per-direction packet/byte counts

extract_packets

Filter by protocol and/or capture-relative time window

extract_stream

Deep-dive one TCP stream / UDP session by 5-tuple (matches both directions)

get_statistics

Retransmission rate, throughput, duplicate ACKs, out-of-order, HTTP latency

Related MCP server: TShark MCP

Requirements

  • Python ≥ 3.10

  • Wireshark ≥ 4.0optional. A stripped portable build (~118 MB, Windows) is bundled under vendor/wireshark/ and used by default. Install Wireshark only to override the bundled copy or to run outside this source tree.

Install

cd TShark2MCP
python -m venv .venv
.venv\Scripts\activate                 # Windows; `source .venv/bin/activate` on Unix
pip install -e ".[dev]"

tshark is found by cascading lookup:

  1. TSHARK_PATH env var (executable file or Wireshark install directory)

  2. Bundled vendor/wireshark/ shipped with the repo (default — no install needed)

  3. Common Windows install dirs (C:\Program Files\Wireshark, ...)

  4. System PATH

With vendor/wireshark/ present you need neither Wireshark installed nor TSHARK_PATH set.

Run

python -m tshark_mcp                    # stdio transport (default)
# or the console script the editable install registered:
tshark-mcp

Configure an MCP client

Claude Desktop / Cursor (claude_desktop_config.json or equivalent). Point command at your project venv's python:

{
  "mcpServers": {
    "tshark": {
      "command": "D:\\<path>\\TShark2MCP\\.venv\\Scripts\\python.exe",
      "args": ["-m", "tshark_mcp"]
    }
  }
}

The bundled vendor/wireshark/ is used automatically — no env is needed. Set env.TSHARK_PATH only to force a specific tshark:

      "env": { "TSHARK_PATH": "C:\\Program Files\\Wireshark\\tshark.exe" }

Test

pytest                                  # all tests (integration ones need tshark)
pytest -m "not integration"             # pure unit tests only (no tshark)

Integration tests use the sample .pcap / .pcapng files in the repository root.

Architecture

src/tshark_mcp/
  server.py     MCPServer + register_all
  config.py     tshark/capinfos path resolution
  executor.py   async tshark/capinfos subprocess wrapper (non-blocking)
  filters.py    display-filter construction (typed, injection-safe)
  parsers.py    capinfos / io,phs / conv text parsing
  security.py   protocol allowlist
  models.py     pydantic request/response models  (= each tool's inputSchema)
  tools/        overview, conversations, extract, statistics

Design: tool logic is pure async (executor, params) -> result; register_all wires each onto @mcp.tool() with a shared TSharkExecutor closure, so tools stay unit-testable with a mock executor and no MCP server.

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    B
    quality
    A
    maintenance
    An MCP server that enables LLMs to analyze pcap files by providing tools for packet dissection, stream following, and data extraction via tshark. It supports protocol hierarchy analysis, credential scanning, and threat intelligence checks on captured network traffic.
    51
    201
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    An MCP server for analyzing network traffic and pcap files using tshark. It enables users to list TCP streams, extract application-layer payloads, and perform packet analysis with BPF filters.
    2
  • A
    license
    A
    quality
    C
    maintenance
    An MCP server that exposes TShark as tools for AI-assisted network packet analysis, supporting PCAP analysis, live capture, TLS decryption, and telecom/SS7 signaling protocols.
    25
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.

  • MCP server for AI access to Swagger by SmartBear.

  • MCP server for AI access to SmartBear tools, including BugSnag, Reflect, Swagger, PactFlow, QTM4J.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/niusulong/TShark2MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server