Skip to main content

PyShark integration for Model Context Protocol

Project description

Wireshark MCP Server

This project exposes PyShark functionality through the Model Context Protocol (MCP), allowing AI assistants like Claude to interact with network packet capture and analysis capabilities.

Installation

  1. Install the required dependencies:
# Install with uv (recommended)
uv add mcp[cli] pyshark

# Or with pip
pip install mcp[cli] pyshark
  1. Clone this repository:
git clone https://github.com/A-G-U-P-T-A/wireshark-mcp
cd wireshark-mcp

Requirements

  • Python 3.8+
  • TShark (Wireshark's command-line component) must be installed
  • Administrative/root privileges for live packet capture

Usage

Running the server

You can run the server in development mode with the MCP Inspector:

mcp dev pyshark_mcp.py

Or install it directly in Claude Desktop:

mcp install pyshark_mcp.py

Available functionality

This MCP server exposes the following:

Resources

  • pyshark://version - Gets the PyShark version information
  • pyshark://config - Gets the PyShark configuration
  • pyshark://capture-history - Gets history of previous packet captures

Tools

  • list_interfaces - Lists all available network interfaces
  • capture_live_packets - Captures live packets from a network interface
  • read_pcap_file - Reads and analyzes a packet capture file
  • analyze_traffic - Analyzes network traffic patterns from a capture

Advanced tools provided in advanced_captures.py:

  • capture_targeted_traffic - Captures traffic targeted to specific host, port, or protocol
  • capture_to_file - Captures network traffic and saves to a pcap file
  • analyze_http_traffic - Analyzes HTTP traffic from a capture file
  • detect_network_protocols - Detects and reports network protocols in use

Prompts

  • packet_capture_help - Provides help information about packet capturing with PyShark

Example usage in Claude

Once the server is installed in Claude Desktop, you can interact with it like this:

You: What interfaces are available for network capture?

Claude: Let me check the available network interfaces on your system.
[Calls list_interfaces tool]

You: Can you capture HTTP traffic for 10 seconds?

Claude: I'll capture HTTP traffic for 10 seconds.
[Calls capture_live_packets with appropriate parameters]

You: Can you analyze the traffic I just captured?

Claude: Here's an analysis of the captured traffic:
[Calls analyze_traffic to provide insights]

Remember to always ensure you have permission to capture network traffic.

Security Considerations

Network packet capture is a sensitive operation. Please ensure:

  1. You have proper authorization to capture network traffic
  2. You comply with all applicable laws and regulations
  3. You don't capture sensitive or private data inadvertently
  4. You handle capture files securely to prevent unauthorized access

Requirements

  • PyShark: Python wrapper for TShark
  • TShark: Command-line version of Wireshark (must be installed separately)
  • Administrative privileges: Often required for live packet capture

Customization

You can customize this MCP server by:

  1. Adding more advanced capture and analysis tools
  2. Implementing filters for specific traffic types
  3. Creating specialized analysis functions for protocols of interest
  4. Extending the capture history management capabilities

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iflow_mcp_a_g_u_p_t_a_pyshark_mcp-0.1.0.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file iflow_mcp_a_g_u_p_t_a_pyshark_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_a_g_u_p_t_a_pyshark_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_a_g_u_p_t_a_pyshark_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0909c6894a4c0ff26dc653f76cd219f3cb2b3c04ecd8ee0596779ffe4234d3e8
MD5 25213634a598889dea0d06174e909b36
BLAKE2b-256 ff7aea057003ef878a4d88f7f4d04b159640ab5b03e48cbee7fc22db286f78c0

See more details on using hashes here.

File details

Details for the file iflow_mcp_a_g_u_p_t_a_pyshark_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_a_g_u_p_t_a_pyshark_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_a_g_u_p_t_a_pyshark_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d5ac3d54b8b634d76431971cd83e4ac6e1a164dcd3151ece0df47ca802f8176
MD5 690faee408175ba469954d14e46ef257
BLAKE2b-256 14d099256d6e50c60f21e5230c1f008ff38bde7a603004ed09b25de39b8b68d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page