Wireshark MCP Server
README.md
# Wireshark MCP Server
> An MCP server that enables AI assistants to interact with Wireshark's
> command-line tools for automated network traffic capture and analysis.
[](https://www.python.org/)
[](https://modelcontextprotocol.io/)
[](https://www.wireshark.org/)
[](LICENSE)
## ๐ Documentation
### Lab Report
A detailed report covering the installation, configuration,
troubleshooting, and verification of the Wireshark MCP Server.
๐ [Read the MCP Wireshark Lab Report](docs/MCP_Wireshark_Lab_Report.pdf)
## Overview
Wireshark MCP Server connects AI assistants with Wireshark's command-line
analysis tools including `tshark`, `dumpcap`, `capinfos`, and `mergecap`.
The goal is to allow an AI assistant to perform network traffic analysis
through structured MCP tools instead of requiring the user to manually
execute multiple Wireshark commands.
## ๐ How It Works
The Wireshark MCP Server acts as a bridge between an AI assistant and
Wireshark's command-line analysis tools.
```text
โโโโโโโโโโโโโโโโโโโโโโโโโ
โ AI Assistant โ
โ Claude Desktop โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โ MCP / JSON-RPC
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโ
โ Wireshark MCP Server โ
โ Python โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Wireshark CLI Tools โ
โ โ
โ tshark โ dumpcap โ capinfos โ mergecap โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Network / PCAP / PCAPNG โ
โ โ
โ Live Traffic Capture Files โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโ
โ Structured Results โ
โ Packet / Protocol โ
โ Endpoint / Stream โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโ
โ AI Analysis โ
โ Explanation / Summary โ
โ Troubleshooting โ
โโโโโโโโโโโโโโโโโโโโโโโโโ
---
## ๐ฏ Project Goals
The project aims to provide an AI-accessible interface for:
- Live packet capture
- PCAP analysis
- Display-filter validation
- Protocol hierarchy analysis
- Endpoint analysis
- Conversation analysis
- TCP/UDP stream following
- Packet inspection
- Capture metadata extraction
- Packet export
- Capture file merging
---
## ๐งฐ Technologies
| Technology | Purpose |
|---|---|
| Python | MCP server implementation |
| Model Context Protocol | AI โ tool communication |
| Wireshark | Packet analysis |
| tshark | CLI packet analyzer |
| dumpcap | Packet capture |
| capinfos | Capture metadata |
| mergecap | PCAP merging |
| Claude Desktop | MCP client |
---
## โจ Features
### Capture
- List network interfaces
- Start live captures
- Stop captures
- Monitor active captures
- Perform short quick captures
### PCAP Analysis
- Read PCAP/PCAPNG files
- Inspect individual packets
- Analyze protocol hierarchy
- Analyze conversations
- Analyze endpoints
- Follow network streams
### Filtering
- Validate Wireshark display filters
- Apply filters to packet analysis
- Export filtered packets
### File Operations
- List generated capture files
- Merge multiple capture files
- Retrieve capture metadata
---
## ๐ง MCP Tools
| Tool | Description |
|---|---|
| `list_interfaces` | List available network interfaces |
| `get_interface_statistics` | Retrieve interface traffic statistics |
| `start_live_capture` | Start a background packet capture |
| `get_capture_status` | Check capture status |
| `list_active_captures` | List running captures |
| `stop_live_capture` | Stop an active capture |
| `quick_capture` | Perform a short packet capture |
| `read_pcap_file` | Read and analyze PCAP files |
| `get_packet_details` | Retrieve detailed packet information |
| `get_protocol_hierarchy` | Analyze protocol distribution |
| `get_conversations` | Analyze network conversations |
| `get_endpoints` | Analyze network endpoints |
| `follow_stream` | Follow TCP/UDP/HTTP/TLS streams |
| `get_capture_summary` | Retrieve capture metadata |
| `export_filtered_packets` | Export filtered packets |
| `merge_capture_files` | Merge capture files |
| `list_capture_files` | List generated captures |
| `validate_display_filter` | Validate Wireshark display filters |
---
## ๐ป Installation
```
### 1. Clone the repository
```bash
git clone https://github.com/dhruvjaiswal-98/wireshark-mcp-server.git
cd wireshark-mcp-server
```
### 2. Install Wireshark
```
Wireshark must be installed on the host system.
Verify:
tshark --version
dumpcap --version
capinfos --version
```
### 3. Install Python dependencies
```
pip install -r requirements.txt
```
### 4. Run the MCP server
python server.py
```
๐ค Claude Desktop Configuration
Add the MCP server to your Claude Desktop configuration.
Example:
{
"mcpServers": {
"wireshark": {
"command": "python",
"args": [
"/absolute/path/to/server.py"
]
}
}
}
Restart Claude Desktop after changing the configuration.
```
### 5. Add a "How It Works" section
This is particularly important for **your cybersecurity portfolio**.
```markdown
## ๐ How It Works
1. The user sends a network-analysis request to the AI assistant.
2. The AI assistant determines which MCP tool is required.
3. The MCP client sends a structured request to the Wireshark MCP server.
4. The MCP server validates the requested operation.
5. The server executes the appropriate Wireshark CLI utility.
6. Wireshark processes the packet capture or live traffic.
7. The MCP server converts the result into structured output.
8. The AI assistant interprets the result and provides an explanation.
```
### ๐งช Example Prompts
```
Once connected, you can ask:
Interface discovery
List my available network interfaces.
Packet capture
Capture traffic for 15 seconds and summarize the protocols observed.
DNS analysis
Analyze this PCAP and list all DNS queries.
HTTP analysis
Find HTTP traffic and summarize the hosts contacted.
TCP analysis
Show the top TCP conversations sorted by bytes.
Troubleshooting
Analyze this PCAP and identify unusual retransmissions or connection failures.
Security analysis
Analyze this capture for suspicious network behavior and explain your findings.
```
### ๐ Security Considerations
```
This project executes Wireshark command-line utilities on the local system.
Because packet capture can expose sensitive information:
- Only capture traffic on systems/networks you are authorized to monitor.
- Avoid uploading sensitive PCAP files to third-party services.
- Be careful when following streams containing credentials or personal data.
- Restrict access to generated capture files.
- Do not use packet capture capabilities against systems without authorization.
This project is intended for:
- Security labs
- Network troubleshooting
- CTF environments
- Authorized security testing
- Educational purposes
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues