
Research
/Security News
Popular npm Packages in the keyv and Cacheable Namespaces Compromised in Active Supply Chain Attack
Popular npm packages keyv and cacheable compromised.
mcpcap
Advanced tools
A modular Python MCP (Model Context Protocol) server for analyzing PCAP files. mcpcap exposes protocol-specific analysis tools that accept a local file path or remote HTTP URL at call time, so the server stays stateless and works cleanly with MCP clients.
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.
mcpcap requires Python 3.10 or greater.
pip install mcpcap
uv add mcpcap
uvx mcpcap
Build the image from the repository root:
docker build -t mcpcap .
Run it over HTTP for MCP clients that connect to a network endpoint:
docker run --rm \
-p 8080:8080 \
-v "$(pwd)/examples:/pcaps:ro" \
mcpcap --transport http --host 0.0.0.0 --port 8080
Run it over stdio for clients that can spawn docker run directly:
docker run --rm -i \
-v "$(pwd)/examples:/pcaps:ro" \
mcpcap
When you mount local captures into the container, use the container path in tool calls:
analyze_dns_packets("/pcaps/dns.pcap")
Remote http:// and https:// PCAP URLs work without a volume mount because mcpcap downloads them inside the container at call time.
For the default HTTP workflow, start the bundled Compose service:
docker compose up
This pulls ghcr.io/mcpcap/mcpcap:latest, publishes http://127.0.0.1:8080/mcp, and mounts ./examples into the container as /pcaps.
analyze_dns_packets("/pcaps/dns.pcap")
To analyze your own captures, change the volume in docker-compose.yml from ./examples:/pcaps:ro to your local capture directory.
For local development against the checked-out source instead of GHCR:
docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build
Start mcpcap as a stateless MCP server:
# Default stdio transport for Claude Desktop and similar clients
mcpcap
# Start with specific modules only
mcpcap --modules dns,tcp
# With packet analysis limits
mcpcap --max-packets 1000
# Start an HTTP transport server for remote MCP clients
mcpcap --transport http --host 127.0.0.1 --port 8080
Use stdio transport for local MCP clients like Claude Desktop:
{
"mcpServers": {
"mcpcap": {
"command": "mcpcap",
"args": []
}
}
}
Use HTTP transport when your MCP client expects a network endpoint:
mcpcap --transport http --host 127.0.0.1 --port 8080
Point your HTTP-capable MCP client at:
http://127.0.0.1:8080/mcp
Docker users can publish the same endpoint with:
docker run --rm \
-p 8080:8080 \
-v "/path/to/captures:/pcaps:ro" \
mcpcap --transport http --host 0.0.0.0 --port 8080
Or with Compose:
docker compose up
Use the analysis tools with any PCAP file by providing the file path or URL when you call the tool:
DNS Analysis:
analyze_dns_packets("/path/to/dns.pcap")
analyze_dns_packets("https://example.com/remote.pcap")
DHCP Analysis:
analyze_dhcp_packets("/path/to/dhcp.pcap")
analyze_dhcp_packets("https://example.com/dhcp-capture.pcap")
ICMP Analysis:
analyze_icmp_packets("/path/to/icmp.pcap")
analyze_icmp_packets("https://example.com/ping-capture.pcap")
TCP Connection Analysis:
analyze_tcp_connections("/path/to/capture.pcap")
analyze_tcp_connections("/path/to/capture.pcap", server_ip="192.168.1.1", server_port=80)
TCP Pattern Analysis:
analyze_tcp_anomalies("/path/to/capture.pcap", server_ip="10.0.0.1")
TCP Retransmission Analysis:
analyze_tcp_retransmissions("/path/to/capture.pcap")
Traffic Flow Analysis:
analyze_traffic_flow("/path/to/capture.pcap", server_ip="192.168.1.100")
SIP Analysis:
analyze_sip_packets("/path/to/voip-signaling.pcap")
analyze_sip_packets("https://example.com/sip-call-flow.pcap")
CapInfos Analysis:
analyze_capinfos("/path/to/any.pcap")
analyze_capinfos("https://example.com/capture.pcap")
If you are using Docker with a bind mount, pass the in-container path instead of the host path:
analyze_capinfos("/pcaps/dns.pcap")
analyze_dns_packets(pcap_file): Complete DNS traffic analysis
analyze_dhcp_packets(pcap_file): Complete DHCP traffic analysis
analyze_icmp_packets(pcap_file): Complete ICMP traffic analysis
analyze_tcp_connections(pcap_file, server_ip=None, server_port=None, detailed=False): TCP connection state analysis
analyze_tcp_anomalies(pcap_file, server_ip=None, server_port=None): Observational TCP traffic analysis
analyze_tcp_retransmissions(pcap_file, server_ip=None, threshold=0.02): TCP retransmission analysis
analyze_traffic_flow(pcap_file, server_ip, server_port=None): Bidirectional traffic flow analysis
analyze_sip_packets(pcap_file): SIP signaling analysis
analyze_capinfos(pcap_file): PCAP file metadata and statistics
mcpcap provides specialized analysis prompts to guide LLM analysis:
security_analysis - Focus on threat detection, DGA domains, DNS tunnelingnetwork_troubleshooting - Identify DNS performance and configuration issuesforensic_investigation - Timeline reconstruction and evidence collectiondhcp_network_analysis - Network administration and IP managementdhcp_security_analysis - Security threats and rogue DHCP detectiondhcp_forensic_investigation - Forensic analysis of DHCP transactionsicmp_network_diagnostics - Network connectivity and path analysisicmp_security_analysis - ICMP-based attacks and reconnaissance detectionicmp_forensic_investigation - Timeline reconstruction and network mappingtcp_connection_troubleshooting - Connection issues, handshake analysis, termination patternstcp_security_analysis - Attack detection, firewall analysis, anomaly identificationsip_security_analysis - Registration abuse, toll fraud, and signaling exposure reviewsip_troubleshooting_analysis - Call setup progression, routing mismatches, and response-code failuressip_forensic_investigation - Timeline reconstruction by Call-ID, CSeq, endpoint, and transport# Load specific modules
mcpcap --modules dns # DNS analysis only
mcpcap --modules tcp # TCP analysis only
mcpcap --modules dhcp # DHCP analysis only
mcpcap --modules icmp # ICMP analysis only
mcpcap --modules sip # SIP analysis only
mcpcap --modules dns,tcp # DNS and TCP analysis
mcpcap --modules dns,dhcp,icmp,tcp,sip,capinfos # All modules (default)
# Limit packet analysis for large files
mcpcap --max-packets 1000
# Default stdio transport
mcpcap
# HTTP transport for network-accessible MCP clients
mcpcap --transport http
# HTTP transport on a custom interface and port
mcpcap --transport http --host 0.0.0.0 --port 9000
mcpcap --modules dns,dhcp,icmp,tcp,sip,capinfos --max-packets 500
mcpcap [--modules MODULES] [--max-packets N] [--transport {stdio,http}] [--host HOST] [--port PORT]
Options:
--modules MODULES: Comma-separated modules to load (default: dns,dhcp,icmp,tcp,sip,capinfos)
dns, dhcp, icmp, tcp, sip, capinfos--max-packets N: Maximum packets to analyze per file (default: unlimited)--transport {stdio,http}: MCP transport to expose (default: stdio)--host HOST: Host to bind for HTTP transport (default: 127.0.0.1)--port PORT: Port to bind for HTTP transport (default: 8080)Examples:
# Start with all modules
mcpcap
# DNS and TCP analysis only
mcpcap --modules dns,tcp
# TCP analysis for troubleshooting connections
mcpcap --modules tcp
# With packet limits for large files
mcpcap --max-packets 1000
# Expose mcpcap over HTTP
mcpcap --transport http --host 127.0.0.1 --port 8080
Example PCAP files are included in the examples/ directory:
dns.pcap - DNS traffic for testing DNS analysisdhcp.pcap - DHCP 4-way handshake captureThere is currently no bundled ICMP sample capture in examples/.
npm install -g @modelcontextprotocol/inspector
npx @modelcontextprotocol/inspector mcpcap
Then test the tools:
// In the MCP Inspector web interface
analyze_dns_packets("./examples/dns.pcap")
analyze_dhcp_packets("./examples/dhcp.pcap")
analyze_capinfos("./examples/dns.pcap")
analyze_tcp_connections("/absolute/path/to/capture.pcap")
analyze_sip_packets("/absolute/path/to/voip-signaling.pcap")
mcpcap's modular design supports easy extension:
MCP Client Request → analyze_*_packets(pcap_file)
→ BaseModule.analyze_packets()
→ Module._analyze_protocol_file()
→ Structured JSON Response
Create new protocol modules by:
BaseModule_analyze_protocol_file(pcap_file)Future modules might include:
Both analysis tools accept remote PCAP files via HTTP/HTTPS URLs:
# Examples of remote analysis
analyze_dns_packets("https://raw.githubusercontent.com/mcpcap/mcpcap/main/examples/dns.pcap")
analyze_dhcp_packets("https://example.com/network-capture.pcap")
analyze_icmp_packets("https://example.com/ping-test.pcap")
analyze_capinfos("https://example.com/network-metadata.pcap")
analyze_tcp_connections("https://example.com/tcp-session.pcap")
analyze_sip_packets("https://example.com/sip-signaling.pcap")
Features:
.pcap, .pcapng, and .cap filesWhen analyzing PCAP files:
Contributions welcome! Areas for contribution:
MIT
For questions, issues, or feature requests, please open an issue on GitHub.
FAQs
A modular Python MCP Server for analyzing PCAP files
We found that mcpcap demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Popular npm packages keyv and cacheable compromised.

Security News
A misconfiguration gave three Anthropic models internet access, and one, believing it was in a simulation, shipped a credential-stealing package to PyPI.

Security News
/Company News
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.