Enables packet capture and analysis through Wireshark/tshark integration, allowing the agent to start recording network traffic, analyze packet contents, apply filters, decrypt SSL/TLS traffic, and troubleshoot network issues
SharkMCP - Network Packet Analysis MCP Server
A Model Context Protocol (MCP) server that provides network packet capture and analysis capabilities through Wireshark/tshark integration. Designed for AI assistants to perform network security analysis, troubleshooting, and packet inspection.
This server was thought for situations where you want your agent to debug a program that sends requests and verify the packet traffic, allowing the following workflow:
- Start recording packets
- Run tool or perform request
- Stop recording and analyze results
Architecture
SharkMCP provides a simple, local development-focused architecture:
Features
- Async Packet Capture: Start background capture sessions with configurable filters and timeouts.
- PCAP File Analysis: Analyze existing packet capture files
- Flexible Output Formats: JSON, custom fields, or traditional text output
- SSL/TLS Decryption: Support for SSL keylog files to decrypt HTTPS traffic
- Reusable Configurations: Save and reuse capture/analysis configurations
/!\ Packet information can be very extensive. Make sure to use a scoped display filter not to overload the context of your conversation.
Prerequisites
System Requirements
- Wireshark/tshark: Must be installed and accessible
- Node.js: Version 18+
- pnpm: Package manager (recommended)
Installing Wireshark/tshark
macOS (using Homebrew):
Ubuntu/Debian:
Windows: Download from wireshark.org
Installation
- Clone the repository:
- Install dependencies:
- Build the project:
- Run the server:
Testing
SharkMCP includes comprehensive integration tests that verify packet capture functionality.
Running Tests
Configuration
MCP Client Setup
SSL/TLS Decryption (Optional)
To decrypt HTTPS traffic, export the SSLKEYLOGFILE
environment variable:
Then configure your applications to log SSL keys to this file. Many applications support this automatically when the environment variable is set.
Then pass the log file pathname to the MCP server in the stop_capture_session
tool.
Usage
Available Tools
- start_capture_session: Start background packet capture
- stop_capture_session: Stop capture and analyze results
- analyze_pcap_file: Analyze existing PCAP files
- manage_config: Save/load reusable configurations
Basic Examples
Start a capture session:
Analyze captured traffic:
Save a configuration:
Development
Project Structure
Development Commands
Security Considerations
- Network Permissions: Packet capture requires elevated privileges
- File Access: Temporary files are created in
/tmp/
- Docker Security: Container runs as non-root user
- SSL Keylog: Sensitive SSL keys should be handled securely
Troubleshooting
Common Issues
"tshark not found":
- Ensure Wireshark is installed and tshark is in PATH
- Check installation with:
tshark -v
Permission denied for packet capture:
- On Linux: Add user to
wireshark
group or run withsudo
- On macOS: Grant Terminal network access in System Preferences
- On Windows: Run as Administrator
No packets captured:
- Verify network interface name (
ip link
on Linux,ifconfig
on macOS) - Check capture filter syntax
- Ensure traffic is present on the interface
Contributing (Very welcome!)
- Fork the repository
- Create a feature branch
- Make your changes following the existing code style
- Add tests for new functionality
- Submit a pull request
License
MIT License
Issues / Suggestions
Feel free to open an issue with any question or suggestion you may have.
You must be authenticated.
A Model Context Protocol server that provides network packet capture and analysis capabilities through Wireshark/tshark integration, enabling AI assistants to perform network security analysis and troubleshooting.
- Architecture
- Features
- Prerequisites
- Installation
- Testing
- Configuration
- Usage
- Development
- Security Considerations
- Troubleshooting
- Contributing (Very welcome!)
- License
- Issues / Suggestions
Related Resources
Related MCP Servers
- -securityFlicense-qualityA comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.Last updated -16TypeScript
- AsecurityAlicenseAqualityA Model Context Protocol server that provides LLMs with real-time network traffic analysis capabilities, enabling tasks like threat hunting, network diagnostics, and anomaly detection through Wireshark's tshark.Last updated -760JavaScriptMIT License
- -security-license-qualityA Model Context Protocol server that enables AI agents to interact with Netwrix Access Analyzer through standardized interfaces, allowing visibility into data access risks, data classification, and user access patterns to help organizations better secure their most sensitive data.Last updated -PythonMIT License
- -securityAlicense-qualityA Model Context Protocol server that provides network analysis tools for security professionals, enabling AI models like Claude to perform tasks such as ASN lookups, DNS analysis, WHOIS retrieval, and IP geolocation for security investigations.Last updated -1PythonApache 2.0