
mcpcap
Enables LLMs to analyze network packet captures (PCAP files) from local or remote sources through a modular architecture. Supports DNS traffic analysis with structured JSON responses for network security and troubleshooting tasks.
README
mcpcap
A modular Python MCP (Model Context Protocol) Server for analyzing PCAP files. mcpcap enables LLMs to read and analyze network packet captures from local or remote sources, providing structured JSON responses about network traffic.
Overview
mcpcap uses a modular architecture to analyze different network protocols found in PCAP files. Each module focuses on a specific protocol, allowing for targeted analysis and easy extensibility. The server leverages the powerful scapy library for packet parsing and analysis.
Key Features
- Modular Architecture: Easily extensible to support new protocols
- Local & Remote PCAP Support: Read files from local directories or HTTP servers
- Scapy Integration: Leverages scapy's comprehensive packet parsing capabilities
- MCP Server: Integrates seamlessly with LLM clients via Model Context Protocol
- JSON Responses: Structured data format for easy LLM consumption
Installation
mcpcap requires Python 3.10 or greater.
Using pip
pip install mcpcap
Using uv
uv add mcpcap
Using uvx (for one-time usage)
uvx mcpcap
Quick Start
-
Start the MCP Server:
Local PCAP file:
mcpcap --pcap-path /path/to/specific/file.pcap
Local PCAP directory:
mcpcap --pcap-path /path/to/pcap/files
Remote PCAP file:
mcpcap --pcap-url https://example.com/sample.pcap
With advanced options:
mcpcap --pcap-path /path/to/pcaps --max-packets 100 --protocols dns
-
Connect your LLM client to the MCP server
-
Ask questions about your network traffic:
- "What domain was queried the most in the DNS traffic?"
- "Show me all DNS queries for example.com"
- "What are the top 5 queried domains?"
Modules
mcpcap supports multiple protocol analysis modules:
DNS Module
The DNS module analyzes Domain Name System packets in PCAP files.
Capabilities:
- Extract DNS queries and responses
- Identify queried domains and subdomains
- Analyze query types (A, AAAA, MX, etc.)
- Track query frequency and patterns
- Identify DNS servers used
DHCP Module
The DHCP module analyzes Dynamic Host Configuration Protocol packets in PCAP files.
Capabilities:
- 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
Example Usage:
# Analyze DHCP traffic only
mcpcap --pcap-path /path/to/dhcp.pcap --modules dhcp
# Analyze both DNS and DHCP
mcpcap --pcap-path /path/to/mixed.pcap --modules dns,dhcp
Configuration
PCAP Sources
mcpcap supports multiple ways to specify PCAP data sources:
Local PCAP File:
mcpcap --pcap-path /local/path/to/specific.pcap
Local Directory:
mcpcap --pcap-path /local/path/to/pcaps
Remote PCAP File (Direct Link):
mcpcap --pcap-url https://wiki.wireshark.org/uploads/dns.cap
Remote Directory Listing:
mcpcap --pcap-url http://example.com/pcaps/
Analysis Options
Module Selection:
# Single module
mcpcap --modules dns --pcap-path /path/to/files
# Multiple modules
mcpcap --modules dns,dhcp --pcap-path /path/to/files
Protocol Selection (automatically matches loaded modules):
# DNS analysis only
mcpcap --modules dns --pcap-path /path/to/files
# DHCP analysis only
mcpcap --modules dhcp --pcap-path /path/to/files
# Both DNS and DHCP analysis
mcpcap --modules dns,dhcp --pcap-path /path/to/files
Packet Limiting (for large files):
mcpcap --max-packets 1000 --pcap-path /path/to/files
Combined Options:
mcpcap --pcap-path /data/capture.pcap --max-packets 500 --modules dns,dhcp
CLI Reference
mcpcap [--pcap-path PATH | --pcap-url URL] [OPTIONS]
Source Options (choose one):
--pcap-path PATH
: Local PCAP file or directory--pcap-url URL
: Remote PCAP file URL or directory listing
Analysis Options:
--modules MODULES
: Comma-separated modules to load (default: dns)- Available modules:
dns
,dhcp
- Protocols are automatically set to match loaded modules
- Available modules:
--max-packets N
: Maximum packets to analyze per file (default: unlimited)
Examples:
# Analyze specific file
mcpcap --pcap-path ./capture.pcap
# Remote file with packet limit
mcpcap --pcap-url https://example.com/dns.cap --max-packets 100
# Directory with DHCP analysis
mcpcap --pcap-path /captures --modules dhcp
Example
An example PCAP file (dns.pcap
) containing DNS traffic is included in the examples/
directory to help you get started.
Architecture
mcpcap's modular design makes it easy to extend support for new protocols:
- Core Engine: Handles PCAP file loading and basic packet processing
- Protocol Modules: Individual modules for specific protocols (DNS, etc.)
- MCP Interface: Translates between LLM queries and packet analysis results
- Output Formatter: Converts analysis results to structured JSON
Adding New Modules
New protocol modules can be added by:
- Implementing the module interface
- Defining scapy display filters for the protocol
- Creating analysis functions specific to the protocol
- Registering the module with the core engine
Future modules might include:
- BGP (Border Gateway Protocol)
- HTTP/HTTPS traffic analysis
- TCP connection tracking
- And more!
Remote Access
mcpcap supports reading PCAP files from remote HTTP servers in two modes:
Direct File Access: Point directly to a PCAP file URL
mcpcap --pcap-url https://wiki.wireshark.org/uploads/__moin_import__/attachments/SampleCaptures/dns.cap
Directory Listing: Parse HTML directory listings to find PCAP files
mcpcap --pcap-url http://server.com/pcap-files/
Supported File Types: .pcap
, .pcapng
, .cap
Current Limitations:
- HTTP/HTTPS only (no authentication)
- Directory listings require standard HTML format
- Files are downloaded temporarily for analysis
Future versions may include support for Basic Authentication and other security mechanisms.
Contributing
Contributions are welcome! Whether you want to:
- Add support for new protocols
- Improve existing modules
- Enhance the MCP interface
- Add new features
Please feel free to open issues and submit pull requests.
License
MIT
Requirements
- Python 3.10+
- scapy (packet parsing and analysis)
- requests (HTTP remote file access)
- fastmcp (MCP server framework)
- All dependencies are automatically installed via pip
Documentation
Full documentation is available at docs.mcpcap.ai
Support
For questions, issues, or feature requests, please open an issue on GitHub.
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。