PCAP-Analyzer MCP Server
Enables natural language analysis of network packet captures, including protocol detection, flow analysis, and security threat identification, integrated with AI assistants.
README
š PCAP Analyzer with MCP Integration
A powerful network packet analysis tool with Model Context Protocol (MCP) integration for seamless LLM interaction. Analyze network traffic using natural language commands through AI assistants like GitHub Copilot, Claude, or ChatGPT.
š Features
š Core Analysis Capabilities
- Protocol Detection: TCP, UDP, HTTP, HTTPS, QUIC
- Flow Analysis: Bidirectional traffic patterns with timing and throughput
- Port Analysis: Detailed analysis of specific ports with security insights
- IP Analysis: Inbound/outbound traffic analysis for specific hosts
- Security Detection: Automatic identification of scanning, reconnaissance, and anomalous patterns
š¤ MCP Integration
- Natural Language Interface: Ask AI assistants to analyze network traffic
- VS Code Integration: Works with GitHub Copilot and other LLM extensions
- Real-time Analysis: Interactive PCAP analysis through conversational AI
- Automated Reporting: AI-generated security assessments and recommendations
š”ļø Security Features
- Threat Detection: Identifies network scanning and reconnaissance attempts
- Anomaly Detection: Flags unusual traffic patterns and failed connections
- Attack Pattern Recognition: Detects coordinated scanning campaigns
- Security Reporting: Detailed threat analysis with actionable recommendations
š Prerequisites
- Python 3.8+
- Scapy library for packet analysis
- FastMCP framework for LLM integration
- VS Code (optional, for MCP integration)
š Quick Start
1. Installation
# Clone the repository
git clone <your-repo-url>
cd PCAP_Analyser
# Install dependencies
pip install -r requirements.txt
2. Basic Usage
Direct Python Analysis
from simple_analyzer import SimpleProtocolAnalyzer
# Create analyzer instance
analyzer = SimpleProtocolAnalyzer()
# Analyze PCAP file
results = analyzer.analyze_pcap('path/to/your/capture.pcap')
# Filter by port
port_flows = analyzer.filter_by_port(443)
# Filter by IP
ip_flows = analyzer.filter_by_ip('192.168.1.1')
MCP Server Mode (for AI Integration)
# Start MCP server
python3 mcp_server.py --mcp
# The server will listen for LLM requests
3. VS Code + AI Integration
- Configure VS Code MCP (create
.vscode/mcp.json):
{
"mcpServers": {
"pcap-analyzer": {
"command": "python3",
"args": ["mcp_server.py", "--mcp"],
"cwd": "/path/to/PCAP_Analyser",
"env": {
"PYTHONPATH": "/path/to/PCAP_Analyser"
}
}
}
}
- Use with AI Assistant:
"Load the network capture tcp-logs.pcap"
"Analyze flows for port 443"
"Check if there are any security issues with port 51570"
"Show me all HTTPS traffic patterns"
"Is there any scanning activity in this capture?"
š File Structure
PCAP_Analyser/
āāā README.md # This file
āāā requirements.txt # Python dependencies
āāā simple_analyzer.py # Core PCAP analysis engine
āāā mcp_server.py # MCP server for LLM integration
āāā mcp_config.json # MCP configuration
āāā PCAPs/ # Directory for PCAP files
ā āāā tcp.pcap # Sample TCP logs
š§ MCP Tools Available
1. load_pcap_file
# Load PCAP file for analysis
load_pcap_file('capture.pcap')
2. analyze_port_flows
# Analyze specific port traffic
analyze_port_flows(443) # HTTPS traffic
analyze_port_flows(22) # SSH traffic
3. analyze_ip_flows
# Analyze specific IP address
analyze_ip_flows('192.168.1.100')
4. analyze_protocol_flows
# Analyze by protocol
analyze_protocol_flows('TCP')
analyze_protocol_flows('HTTPS')
analyze_protocol_flows('QUIC')
5. get_pcap_summary
# Get overall PCAP summary
get_pcap_summary()
š”ļø Security Analysis Examples
Network Scanning Detection
# The analyzer automatically detects:
# - Port scanning attempts
# - Failed connection patterns
# - Reconnaissance activities
# - Coordinated attack campaigns
# Example output:
"""
šØ SECURITY ISSUE DETECTED for Port 51570
ā Part of Massive Scanning Campaign
- Same attacker: 10.10.28.14
- Same target: 10.10.28.35:1470
- Pattern: Failed connection attempts
- Duration: 2+ hours of sustained activity
"""
QUIC Analysis
# Analyze QUIC version negotiation failures
analyze_protocol_flows('QUIC')
# Detects:
# - Version negotiation failures
# - Protocol compatibility issues
# - Connection establishment problems
š Sample Analysis Output
š Flow Analysis for Port 443
PCAP File: network_capture.pcap
============================================================
š Summary:
⢠Found 2 flows involving port 443
⢠Total packets: 28,794
⢠Total bytes: 26,966,480
š Detailed Flow Analysis:
Flow 1: š Outbound from port 443
Source: 192.168.1.10:41948 ā Destination: 192.168.1.20:443
Protocol: HTTPS
Timeline: 21:23:11.982 ā 21:23:48.572 (Duration: 36.590s)
Traffic Volume: 9,610 packets, 519,907 bytes
Throughput: 262.6 packets/sec, 14,209 bytes/sec
š” Flow Analysis Summary:
⢠Protocols involved: HTTPS
⢠Normal HTTPS traffic pattern detected
⢠No security issues identified
šÆ Use Cases
Network Security Analysis
- Detect port scanning and network reconnaissance
- Identify failed connection attempts and attack patterns
- Analyze protocol-specific vulnerabilities
- Generate automated security reports
Performance Monitoring
- Analyze network throughput and latency
- Identify bandwidth-heavy applications
- Monitor connection patterns and duration
- Track protocol distribution
Troubleshooting
- Diagnose connection failures
- Analyze protocol negotiation issues
- Identify network bottlenecks
- Debug application communication problems
AI-Powered Analysis
- Natural language network analysis queries
- Automated threat detection with AI insights
- Conversational network forensics
- Intelligent pattern recognition
š® Advanced Features
Custom Protocol Detection
The analyzer can be extended to detect custom protocols and application-specific patterns.
Real-time Analysis
Process live network traffic or streaming PCAP data.
Integration Ready
- REST API endpoints for web integration
- Command-line interface for automation
- Export capabilities (JSON, CSV, HTML reports)
š¤ Contributing
- Fork the repository
- Create a feature branch
- Add your enhancements
- Submit a pull request
š License
This project is licensed under the MIT License - see the LICENSE file for details.
š Support
- Issues: Report bugs and request features on GitHub
- Documentation: Check the code comments for detailed API documentation
- Examples: See the
examples/directory for usage samples
š Acknowledgments
- Scapy: Powerful packet manipulation library
- FastMCP: Model Context Protocol implementation
- VS Code: Excellent MCP integration support
Ready to analyze your network traffic with AI? Get started now! š
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.