A modular Python MCP (Model Context Protocol) Server for analyzing PCAP files. mcpcap enables LLMs to read and analyze network packet captures with protocol-specific analysis tools that accept local files or remote URLs as parameters.
mcpcap uses a modular architecture to analyze different network protocols found in PCAP files. Each module provides specialized analysis tools that can be called independently with any PCAP file, making it perfect for integration with Claude Desktop and other MCP clients.
- Stateless MCP Tools: Each analysis accepts PCAP file paths or URLs as parameters
- Modular Architecture: DNS, DHCP, and ICMP modules with easy extensibility for new protocols
- Local & Remote PCAP Support: Analyze files from local storage or HTTP URLs
- Scapy Integration: Leverages scapy's comprehensive packet parsing capabilities
- Specialized Analysis Prompts: Security, networking, and forensic analysis guidance
- JSON Responses: Structured data format optimized for LLM consumption
mcpcap requires Python 3.10 or greater.
Start mcpcap as a stateless MCP server:
Configure your MCP client (like Claude Desktop) to connect to the mcpcap server:
Use the analysis tools with any PCAP file:
DNS Analysis:
DHCP Analysis:
ICMP Analysis:
- analyze_dns_packets(pcap_file): Complete DNS traffic analysis
- Extract DNS queries and responses
- Identify queried domains and subdomains
- Analyze query types (A, AAAA, MX, CNAME, etc.)
- Track query frequency and patterns
- Detect potential security issues
- analyze_dhcp_packets(pcap_file): Complete DHCP traffic analysis
- Track DHCP transactions (DISCOVER, OFFER, REQUEST, ACK)
- Identify DHCP clients and servers
- Monitor IP address assignments and lease information
- Analyze DHCP options and configurations
- Detect DHCP anomalies and security issues
- analyze_icmp_packets(pcap_file): Complete ICMP traffic analysis
- Analyze ping requests and replies with response times
- Identify network connectivity and reachability issues
- Track TTL values and routing paths (traceroute data)
- Detect ICMP error messages (unreachable, time exceeded)
- Monitor for potential ICMP-based attacks or reconnaissance
mcpcap provides specialized analysis prompts to guide LLM analysis:
- security_analysis - Focus on threat detection, DGA domains, DNS tunneling
- network_troubleshooting - Identify DNS performance and configuration issues
- forensic_investigation - Timeline reconstruction and evidence collection
- dhcp_network_analysis - Network administration and IP management
- dhcp_security_analysis - Security threats and rogue DHCP detection
- dhcp_forensic_investigation - Forensic analysis of DHCP transactions
- icmp_network_diagnostics - Network connectivity and path analysis
- icmp_security_analysis - ICMP-based attacks and reconnaissance detection
- icmp_forensic_investigation - Timeline reconstruction and network mapping
Options:
- --modules MODULES: Comma-separated modules to load (default: dns,dhcp,icmp)
- Available modules: dns, dhcp, icmp
- --max-packets N: Maximum packets to analyze per file (default: unlimited)
Examples:
Example PCAP files are included in the examples/ directory:
- dns.pcap - DNS traffic for testing DNS analysis
- dhcp.pcap - DHCP 4-way handshake capture
- icmp.pcap - ICMP ping and traceroute traffic
Then test the tools:
mcpcap's modular design supports easy extension:
- BaseModule: Shared file handling, validation, and remote download
- Protocol Modules: DNS, DHCP, and ICMP analysis implementations
- MCP Interface: Tool registration and prompt management
- FastMCP Framework: MCP server implementation
Create new protocol modules by:
- Inheriting from BaseModule
- Implementing _analyze_protocol_file(pcap_file)
- Registering analysis tools with the MCP server
- Adding specialized analysis prompts
Future modules might include:
- HTTP/HTTPS traffic analysis
- TCP connection tracking
- BGP routing analysis
- SSL/TLS certificate analysis
- Network forensics tools
Both analysis tools accept remote PCAP files via HTTP/HTTPS URLs:
Features:
- Automatic temporary download and cleanup
- Support for .pcap, .pcapng, and .cap files
- HTTP/HTTPS protocols supported
When analyzing PCAP files:
- Files may contain sensitive network information
- Remote downloads are performed over HTTPS when possible
- Temporary files are cleaned up automatically
- Consider the source and trustworthiness of remote files
Contributions welcome! Areas for contribution:
- New Protocol Modules: Add support for HTTP, BGP, TCP, etc.
- Enhanced Analysis: Improve existing DNS/DHCP analysis
- Security Features: Add more threat detection capabilities
- Performance: Optimize analysis for large PCAP files
MIT
- Python 3.10+
- scapy (packet parsing and analysis)
- requests (remote file access)
- fastmcp (MCP server framework)
- GitHub: github.com/mcpcap/mcpcap
- Documentation: docs.mcpcap.ai
- Website: mcpcap.ai
For questions, issues, or feature requests, please open an issue on GitHub.