
Mcpcap
ai.mcpcapv0.9.6更新於 Sep 29, 2026
An MCP server for analyzing PCAP files.
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mcpcap,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
mcpcap
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.
Overview
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.
Key Features
- Stateless MCP Tools: Each analysis call supplies its own PCAP path or URL
- Modular Architecture: DNS, DHCP, ICMP, TCP, SIP, and CapInfos modules with easy extensibility for new protocols
- Advanced TCP Analysis: Connection lifecycle, traffic patterns, retransmissions, and flow inspection
- 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
Installation
mcpcap requires Python 3.10 or greater.
Using pip
Using uv
Using uvx (for one-time usage)
Using Docker
Build the image from the repository root:
Run it over HTTP for MCP clients that connect to a network endpoint:
Run it over stdio for clients that can spawn docker run directly:
When you mount local captures into the container, use the container path in tool calls:
Remote http:// and https:// PCAP URLs work without a volume mount because mcpcap downloads them inside the container at call time.
Using Docker Compose
For the default HTTP workflow, start the bundled Compose service:
This pulls ghcr.io/mcpcap/mcpcap:latest, publishes http://127.0.0.1:8080/mcp, and mounts ./examples into the container as /pcaps.
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:
Quick Start
1. Start the MCP Server
Start mcpcap as a stateless MCP server:
2. Connect Your MCP Client
Use stdio transport for local MCP clients like Claude Desktop:
Use HTTP transport when your MCP client expects a network endpoint:
Point your HTTP-capable MCP client at:
Docker users can publish the same endpoint with:
Or with Compose:
3. Analyze PCAP Files
Use the analysis tools with any PCAP file by providing the file path or URL when you call the tool:
DNS Analysis:
DHCP Analysis:
ICMP Analysis:
TCP Connection Analysis:
TCP Pattern Analysis:
TCP Retransmission Analysis:
Traffic Flow Analysis:
SIP Analysis:
CapInfos Analysis:
If you are using Docker with a bind mount, pass the in-container path instead of the host path:
Available Tools
DNS Analysis Tools
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
DHCP Analysis Tools
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
ICMP Analysis Tools
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
TCP Analysis Tools
-
analyze_tcp_connections(pcap_file, server_ip=None, server_port=None, detailed=False): TCP connection state analysis- Track TCP three-way handshake (SYN, SYN-ACK, ACK)
- Analyze connection lifecycle and termination (FIN, RST)
- Identify successful vs failed connections
- Filter by server IP and/or port
- Detect connection issues and abnormal closures
-
analyze_tcp_anomalies(pcap_file, server_ip=None, server_port=None): Observational TCP traffic analysis- Summarize handshakes, flags, resets, and retransmissions
- Surface directional RST and retransmission patterns
- Report connection lifecycle metrics
- Return factual traffic patterns for further investigation
-
analyze_tcp_retransmissions(pcap_file, server_ip=None, threshold=0.02): TCP retransmission analysis- Measure overall and per-connection retransmission rates
- Identify connections with quality issues
- Compare against configurable thresholds
- Detect network congestion and packet loss
-
analyze_traffic_flow(pcap_file, server_ip, server_port=None): Bidirectional traffic flow analysis- Analyze client-to-server vs server-to-client traffic
- Identify traffic asymmetry
- Determine RST packet sources
- Interpret connection patterns and behaviors
SIP Analysis Tools
analyze_sip_packets(pcap_file): SIP signaling analysis- Parse SIP requests and responses across UDP and TCP transports
- Extract call identifiers, CSeq values, endpoints, and key signaling headers
- Summarize request methods and response code classes
- Surface user agents, signaling servers, and transport usage
- Support VoIP troubleshooting, security review, and forensic reconstruction
CapInfos Analysis Tools
analyze_capinfos(pcap_file): PCAP file metadata and statistics- File information (size, name, link layer encapsulation)
- Packet statistics (count, data size, average packet size)
- Temporal analysis (duration, timestamps, packet rates)
- Data throughput metrics (bytes/second, bits/second)
- Similar to Wireshark's capinfos(1) utility
Analysis Prompts
mcpcap provides specialized analysis prompts to guide LLM analysis:
DNS Prompts
security_analysis- Focus on threat detection, DGA domains, DNS tunnelingnetwork_troubleshooting- Identify DNS performance and configuration issuesforensic_investigation- Timeline reconstruction and evidence collection
DHCP Prompts
dhcp_network_analysis- Network administration and IP managementdhcp_security_analysis- Security threats and rogue DHCP detectiondhcp_forensic_investigation- Forensic analysis of DHCP transactions
ICMP Prompts
icmp_network_diagnostics- Network connectivity and path analysisicmp_security_analysis- ICMP-based attacks and reconnaissance detectionicmp_forensic_investigation- Timeline reconstruction and network mapping
TCP Prompts
tcp_connection_troubleshooting- Connection issues, handshake analysis, termination patternstcp_security_analysis- Attack detection, firewall analysis, anomaly identification
SIP Prompts
sip_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
Configuration Options
Module Selection
Analysis Limits
Transport Options
Complete Configuration Example
CLI Reference
Options:
--modules MODULES: Comma-separated modules to load (default:dns,dhcp,icmp,tcp,sip,capinfos)- Available modules:
dns,dhcp,icmp,tcp,sip,capinfos
- Available modules:
--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:
Examples
Example PCAP files are included in the examples/ directory:
dns.pcap- DNS traffic for testing DNS analysisdhcp.pcap- DHCP 4-way handshake capture
There is currently no bundled ICMP sample capture in examples/.
Using with MCP Inspector
Then test the tools:
Architecture
mcpcap's modular design supports easy extension:
Core Components
- BaseModule: Shared file handling, validation, and remote download
- Protocol Modules: DNS, DHCP, ICMP, TCP, SIP, and CapInfos implementations
- MCP Interface: Tool registration and prompt management
- FastMCP Framework: MCP server implementation
Tool Flow
Adding New Modules
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
- UDP connection analysis
- BGP routing analysis
- SSL/TLS certificate analysis
- Network forensics tools
- Port scan detection
Remote File Support
Both analysis tools accept remote PCAP files via HTTP/HTTPS URLs:
Features:
- Automatic temporary download and cleanup
- Support for
.pcap,.pcapng, and.capfiles - HTTP/HTTPS protocols supported
Security Considerations
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
Contributing
Contributions welcome! Areas for contribution:
- New Protocol Modules: Add support for HTTP, BGP, TLS, RTP, etc.
- Enhanced Analysis: Improve existing DNS/DHCP analysis
- Security Features: Add more threat detection capabilities
- Performance: Optimize analysis for large PCAP files
License
MIT
Requirements
- Python 3.10+
- scapy (packet parsing and analysis)
- requests (remote file access)
- fastmcp (MCP server framework)
Documentation
- GitHub: github.com/mcpcap/mcpcap
- Documentation: docs.mcpcap.ai
- Website: mcpcap.ai
Support
For questions, issues, or feature requests, please open an issue on GitHub.
來源:README.md,提交 5d9ba2b
工具
0版本歷史
1- v0.9.6最新Sep 16, 2026


