A modular Python MCP Server for analyzing PCAP files
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcpacket-0.1.2.tar.gz.
File metadata
- Download URL: mcpacket-0.1.2.tar.gz
- Upload date:
- Size: 1.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d5beef403f1aa9823dac2d7afc35bfc754610286d2a03f56bac5679718c988c
|
|
| MD5 |
66d3c16f46ff58bfc4809412db630041
|
|
| BLAKE2b-256 |
a8c1981f89d8e0bb4fbb5b7bff07a67e86c126a9e1ae6427ace06d38f55088a2
|
Provenance
The following attestation bundles were made for mcpacket-0.1.2.tar.gz:
Publisher:
release.yml on danohn/mcpacket
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcpacket-0.1.2.tar.gz -
Subject digest:
7d5beef403f1aa9823dac2d7afc35bfc754610286d2a03f56bac5679718c988c - Sigstore transparency entry: 487103724
- Sigstore integration time:
-
Permalink:
danohn/mcpacket@9fa715cda172878dde0635c92409646c458ef4f6 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/danohn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9fa715cda172878dde0635c92409646c458ef4f6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcpacket-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mcpacket-0.1.2-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
840793661b567e7938d6cfb98e22ed486d0892672c4402c94903e10c713b11a3
|
|
| MD5 |
8e58f50367dd5324039b770113ff7873
|
|
| BLAKE2b-256 |
dd28ca4f2cbce62c77dfac90f3fdcc6686e1b1177494e9e788c374806b36823d
|
Provenance
The following attestation bundles were made for mcpacket-0.1.2-py3-none-any.whl:
Publisher:
release.yml on danohn/mcpacket
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcpacket-0.1.2-py3-none-any.whl -
Subject digest:
840793661b567e7938d6cfb98e22ed486d0892672c4402c94903e10c713b11a3 - Sigstore transparency entry: 487103743
- Sigstore integration time:
-
Permalink:
danohn/mcpacket@9fa715cda172878dde0635c92409646c458ef4f6 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/danohn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9fa715cda172878dde0635c92409646c458ef4f6 -
Trigger Event:
push
-
Statement type: