mcpacket
A modular Python MCP (Model Context Protocol) Server for analyzing PCAP files. mcpacket enables LLMs to read and analyze network packet captures from local or remote sources, providing structured JSON responses about network traffic.
Overview
mcpacket 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
mcpacket requires Python 3.10 or greater.
Using pip
pip install mcpacket
Using uv
uv add mcpacket
Using uvx (for one-time usage)
uvx mcpacket
Quick Start
-
Start the MCP Server:
mcpacket --pcap-path /path/to/pcap/files
-
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
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
Example Usage:
# LLM can ask: "What domains were queried in this PCAP?"
# mcpacket will return structured JSON with DNS query information
Configuration
PCAP Sources
Local Directory:
mcpacket --pcap-path /local/path/to/pcaps
Remote HTTP Server:
mcpacket --pcap-url http://example.com/pcaps/
Module Selection
mcpacket --modules dns --pcap-path /path/to/files
Example
An example PCAP file (example.pcap) containing DNS traffic is included with the project to help you get started.
Architecture
mcpacket'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
mcpacket supports reading PCAP files from remote HTTP servers without authentication. 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
- MCP server dependencies (automatically installed)
Support
For questions, issues, or feature requests, please open an issue on GitHub.
Metadata
Release files for mcpacket 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mcpacket-0.1.3.tar.gz | 1.6 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcpacket-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.6 MB
Release files / mcpacket-0.1.3.tar.gz
| Download URL | mcpacket-0.1.3.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
544ce028817e83e3d5c620fb235b9479373a2dfc8e6ccedde8c4adcebf062f30
|
|
BLAKE2b-256 checksum How to use checksums |
df6f8a5374eb2923808289c6085a8d8a68e2bc0075549199b2d6c3dbd60fa2d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2025.
Transparency logRelease files / mcpacket-0.1.3-py3-none-any.whl
| Download URL | mcpacket-0.1.3-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11e9c9a62bb8a2bc522899bc41f0641d2f0fa3a1e2a17ecdeec8288b800bd979
|
|
BLAKE2b-256 checksum How to use checksums |
28278f73769e7ac9fa19738e6920d39fec750a89842b0164f86bfb478754b7b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2025.
Transparency log