mcpcap 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcpcap-0.2.1/.DS_Store +0 -0
- mcpcap-0.2.1/.github/FUNDING.yml +4 -0
- mcpcap-0.2.1/.github/workflows/release.yml +86 -0
- mcpcap-0.2.1/.github/workflows/test.yml +65 -0
- mcpcap-0.2.1/.gitignore +218 -0
- mcpcap-0.2.1/.readthedocs.yaml +34 -0
- mcpcap-0.2.1/LICENSE +21 -0
- mcpcap-0.2.1/PKG-INFO +198 -0
- mcpcap-0.2.1/README.md +155 -0
- mcpcap-0.2.1/docs/Makefile +20 -0
- mcpcap-0.2.1/docs/source/api/cli.rst +12 -0
- mcpcap-0.2.1/docs/source/api/core.rst +20 -0
- mcpcap-0.2.1/docs/source/api/modules.rst +20 -0
- mcpcap-0.2.1/docs/source/conf.py +120 -0
- mcpcap-0.2.1/docs/source/index.rst +82 -0
- mcpcap-0.2.1/docs/source/user-guide/analysis-guides.md +284 -0
- mcpcap-0.2.1/docs/source/user-guide/installation.md +91 -0
- mcpcap-0.2.1/docs/source/user-guide/mcp-integration.md +269 -0
- mcpcap-0.2.1/docs/source/user-guide/quickstart.md +164 -0
- mcpcap-0.2.1/examples/README.md +49 -0
- mcpcap-0.2.1/examples/dns.pcap +0 -0
- mcpcap-0.2.1/pyproject.toml +95 -0
- mcpcap-0.2.1/readme-assets/logo.png +0 -0
- mcpcap-0.2.1/requirements.txt +62 -0
- mcpcap-0.2.1/setup.cfg +4 -0
- mcpcap-0.2.1/src/mcpcap/__init__.py +38 -0
- mcpcap-0.2.1/src/mcpcap/_version.py +34 -0
- mcpcap-0.2.1/src/mcpcap/cli.py +54 -0
- mcpcap-0.2.1/src/mcpcap/core/__init__.py +6 -0
- mcpcap-0.2.1/src/mcpcap/core/config.py +52 -0
- mcpcap-0.2.1/src/mcpcap/core/server.py +41 -0
- mcpcap-0.2.1/src/mcpcap/modules/__init__.py +6 -0
- mcpcap-0.2.1/src/mcpcap/modules/base.py +36 -0
- mcpcap-0.2.1/src/mcpcap/modules/dns.py +349 -0
- mcpcap-0.2.1/src/mcpcap/resources/__init__.py +5 -0
- mcpcap-0.2.1/src/mcpcap/resources/references.py +90 -0
- mcpcap-0.2.1/src/mcpcap.egg-info/PKG-INFO +198 -0
- mcpcap-0.2.1/src/mcpcap.egg-info/SOURCES.txt +43 -0
- mcpcap-0.2.1/src/mcpcap.egg-info/dependency_links.txt +1 -0
- mcpcap-0.2.1/src/mcpcap.egg-info/entry_points.txt +2 -0
- mcpcap-0.2.1/src/mcpcap.egg-info/requires.txt +21 -0
- mcpcap-0.2.1/src/mcpcap.egg-info/top_level.txt +1 -0
- mcpcap-0.2.1/tests/__init__.py +1 -0
- mcpcap-0.2.1/tests/test_cli.py +87 -0
- mcpcap-0.2.1/tests/test_dns.py +107 -0
mcpcap-0.2.1/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1,86 @@
|
|
1
|
+
name: Release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- 'v*.*.*' # Triggers on version tags like v1.0.0, v2.1.3, etc.
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build-and-publish:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
permissions:
|
12
|
+
contents: write # Required for creating releases
|
13
|
+
id-token: write # Required for PyPI trusted publishing
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v4
|
17
|
+
with:
|
18
|
+
# Fetch full history for setuptools-scm to work properly
|
19
|
+
fetch-depth: 0
|
20
|
+
|
21
|
+
- name: Set up Python
|
22
|
+
uses: actions/setup-python@v5
|
23
|
+
with:
|
24
|
+
python-version: "3.11"
|
25
|
+
|
26
|
+
- name: Install build dependencies
|
27
|
+
run: |
|
28
|
+
python -m pip install --upgrade pip
|
29
|
+
pip install build setuptools-scm[toml]
|
30
|
+
|
31
|
+
- name: Verify version matches tag
|
32
|
+
run: |
|
33
|
+
# Extract version from tag (remove 'v' prefix)
|
34
|
+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
|
35
|
+
# Get version from setuptools-scm
|
36
|
+
DETECTED_VERSION=$(python -c "from setuptools_scm import get_version; print(get_version())")
|
37
|
+
echo "Tag version: $TAG_VERSION"
|
38
|
+
echo "Detected version: $DETECTED_VERSION"
|
39
|
+
# Verify they match
|
40
|
+
if [ "$TAG_VERSION" != "$DETECTED_VERSION" ]; then
|
41
|
+
echo "Version mismatch! Tag: $TAG_VERSION, Detected: $DETECTED_VERSION"
|
42
|
+
exit 1
|
43
|
+
fi
|
44
|
+
|
45
|
+
- name: Build package
|
46
|
+
run: |
|
47
|
+
python -m build
|
48
|
+
|
49
|
+
- name: Verify package contents
|
50
|
+
run: |
|
51
|
+
pip install twine
|
52
|
+
twine check dist/*
|
53
|
+
|
54
|
+
- name: Create GitHub Release
|
55
|
+
uses: actions/create-release@v1
|
56
|
+
env:
|
57
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
58
|
+
with:
|
59
|
+
tag_name: ${{ github.ref }}
|
60
|
+
release_name: Release ${{ github.ref }}
|
61
|
+
draft: false
|
62
|
+
prerelease: false
|
63
|
+
body: |
|
64
|
+
## What's Changed
|
65
|
+
|
66
|
+
Release ${{ github.ref }} of mcpcap.
|
67
|
+
|
68
|
+
### Installation
|
69
|
+
```bash
|
70
|
+
pip install mcpcap==${{ github.ref_name }}
|
71
|
+
```
|
72
|
+
|
73
|
+
See [CHANGELOG.md](CHANGELOG.md) for detailed changes.
|
74
|
+
|
75
|
+
- name: Publish to PyPI
|
76
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
77
|
+
# Note: This uses PyPI's trusted publisher feature
|
78
|
+
# You'll need to configure this in your PyPI project settings
|
79
|
+
# Alternative: use password-based auth with secrets.PYPI_API_TOKEN
|
80
|
+
|
81
|
+
- name: Upload build artifacts
|
82
|
+
uses: actions/upload-artifact@v4
|
83
|
+
with:
|
84
|
+
name: dist-files
|
85
|
+
path: dist/
|
86
|
+
retention-days: 30
|
@@ -0,0 +1,65 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main, dev ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ main ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
python-version: ["3.10", "3.11", "3.12"]
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v4
|
18
|
+
with:
|
19
|
+
# Fetch full history for setuptools-scm to work properly
|
20
|
+
fetch-depth: 0
|
21
|
+
|
22
|
+
- name: Set up Python ${{ matrix.python-version }}
|
23
|
+
uses: actions/setup-python@v5
|
24
|
+
with:
|
25
|
+
python-version: ${{ matrix.python-version }}
|
26
|
+
|
27
|
+
- name: Install dependencies
|
28
|
+
run: |
|
29
|
+
python -m pip install --upgrade pip
|
30
|
+
pip install -e .[test]
|
31
|
+
|
32
|
+
- name: Check version detection
|
33
|
+
run: |
|
34
|
+
python -c "import mcpcap; print('Version:', mcpcap.__version__)"
|
35
|
+
|
36
|
+
- name: Run linting with ruff
|
37
|
+
run: |
|
38
|
+
pip install ruff
|
39
|
+
ruff check .
|
40
|
+
ruff format --check .
|
41
|
+
|
42
|
+
- name: Run tests with pytest
|
43
|
+
run: |
|
44
|
+
python -m pytest tests/ -v
|
45
|
+
|
46
|
+
check-version:
|
47
|
+
runs-on: ubuntu-latest
|
48
|
+
steps:
|
49
|
+
- uses: actions/checkout@v4
|
50
|
+
with:
|
51
|
+
fetch-depth: 0
|
52
|
+
|
53
|
+
- name: Set up Python
|
54
|
+
uses: actions/setup-python@v5
|
55
|
+
with:
|
56
|
+
python-version: "3.11"
|
57
|
+
|
58
|
+
- name: Install setuptools-scm
|
59
|
+
run: |
|
60
|
+
python -m pip install --upgrade pip
|
61
|
+
pip install setuptools-scm[toml]
|
62
|
+
|
63
|
+
- name: Verify version can be determined
|
64
|
+
run: |
|
65
|
+
python -c "from setuptools_scm import get_version; print('Detected version:', get_version())"
|
mcpcap-0.2.1/.gitignore
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
2
|
+
__pycache__/
|
3
|
+
*.py[codz]
|
4
|
+
*$py.class
|
5
|
+
|
6
|
+
# C extensions
|
7
|
+
*.so
|
8
|
+
|
9
|
+
# Distribution / packaging
|
10
|
+
.Python
|
11
|
+
build/
|
12
|
+
develop-eggs/
|
13
|
+
dist/
|
14
|
+
downloads/
|
15
|
+
eggs/
|
16
|
+
.eggs/
|
17
|
+
lib/
|
18
|
+
lib64/
|
19
|
+
parts/
|
20
|
+
sdist/
|
21
|
+
var/
|
22
|
+
wheels/
|
23
|
+
share/python-wheels/
|
24
|
+
*.egg-info/
|
25
|
+
.installed.cfg
|
26
|
+
*.egg
|
27
|
+
MANIFEST
|
28
|
+
|
29
|
+
# PyInstaller
|
30
|
+
# Usually these files are written by a python script from a template
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
32
|
+
*.manifest
|
33
|
+
*.spec
|
34
|
+
|
35
|
+
# Installer logs
|
36
|
+
pip-log.txt
|
37
|
+
pip-delete-this-directory.txt
|
38
|
+
|
39
|
+
# Unit test / coverage reports
|
40
|
+
htmlcov/
|
41
|
+
.tox/
|
42
|
+
.nox/
|
43
|
+
.coverage
|
44
|
+
.coverage.*
|
45
|
+
.cache
|
46
|
+
nosetests.xml
|
47
|
+
coverage.xml
|
48
|
+
*.cover
|
49
|
+
*.py.cover
|
50
|
+
.hypothesis/
|
51
|
+
.pytest_cache/
|
52
|
+
cover/
|
53
|
+
|
54
|
+
# Translations
|
55
|
+
*.mo
|
56
|
+
*.pot
|
57
|
+
|
58
|
+
# Django stuff:
|
59
|
+
*.log
|
60
|
+
local_settings.py
|
61
|
+
db.sqlite3
|
62
|
+
db.sqlite3-journal
|
63
|
+
|
64
|
+
# Flask stuff:
|
65
|
+
instance/
|
66
|
+
.webassets-cache
|
67
|
+
|
68
|
+
# Scrapy stuff:
|
69
|
+
.scrapy
|
70
|
+
|
71
|
+
# Sphinx documentation
|
72
|
+
docs/_build/
|
73
|
+
|
74
|
+
# PyBuilder
|
75
|
+
.pybuilder/
|
76
|
+
target/
|
77
|
+
|
78
|
+
# Jupyter Notebook
|
79
|
+
.ipynb_checkpoints
|
80
|
+
|
81
|
+
# IPython
|
82
|
+
profile_default/
|
83
|
+
ipython_config.py
|
84
|
+
|
85
|
+
# pyenv
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
88
|
+
# .python-version
|
89
|
+
|
90
|
+
# pipenv
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
94
|
+
# install all needed dependencies.
|
95
|
+
#Pipfile.lock
|
96
|
+
|
97
|
+
# UV
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
100
|
+
# commonly ignored for libraries.
|
101
|
+
#uv.lock
|
102
|
+
|
103
|
+
# poetry
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
106
|
+
# commonly ignored for libraries.
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
108
|
+
#poetry.lock
|
109
|
+
#poetry.toml
|
110
|
+
|
111
|
+
# pdm
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
115
|
+
#pdm.lock
|
116
|
+
#pdm.toml
|
117
|
+
.pdm-python
|
118
|
+
.pdm-build/
|
119
|
+
|
120
|
+
# pixi
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
122
|
+
#pixi.lock
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
125
|
+
.pixi
|
126
|
+
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
128
|
+
__pypackages__/
|
129
|
+
|
130
|
+
# Celery stuff
|
131
|
+
celerybeat-schedule
|
132
|
+
celerybeat.pid
|
133
|
+
|
134
|
+
# SageMath parsed files
|
135
|
+
*.sage.py
|
136
|
+
|
137
|
+
# Environments
|
138
|
+
.env
|
139
|
+
.envrc
|
140
|
+
.venv
|
141
|
+
env/
|
142
|
+
venv/
|
143
|
+
ENV/
|
144
|
+
env.bak/
|
145
|
+
venv.bak/
|
146
|
+
|
147
|
+
# Spyder project settings
|
148
|
+
.spyderproject
|
149
|
+
.spyproject
|
150
|
+
|
151
|
+
# Rope project settings
|
152
|
+
.ropeproject
|
153
|
+
|
154
|
+
# mkdocs documentation
|
155
|
+
/site
|
156
|
+
|
157
|
+
# mypy
|
158
|
+
.mypy_cache/
|
159
|
+
.dmypy.json
|
160
|
+
dmypy.json
|
161
|
+
|
162
|
+
# Pyre type checker
|
163
|
+
.pyre/
|
164
|
+
|
165
|
+
# pytype static type analyzer
|
166
|
+
.pytype/
|
167
|
+
|
168
|
+
# Cython debug symbols
|
169
|
+
cython_debug/
|
170
|
+
|
171
|
+
# PyCharm
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
176
|
+
#.idea/
|
177
|
+
|
178
|
+
# Abstra
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
181
|
+
# Learn more at https://abstra.io/docs
|
182
|
+
.abstra/
|
183
|
+
|
184
|
+
# Visual Studio Code
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
189
|
+
# .vscode/
|
190
|
+
|
191
|
+
# Ruff stuff:
|
192
|
+
.ruff_cache/
|
193
|
+
|
194
|
+
# PyPI configuration file
|
195
|
+
.pypirc
|
196
|
+
|
197
|
+
# Cursor
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
201
|
+
.cursorignore
|
202
|
+
.cursorindexingignore
|
203
|
+
|
204
|
+
# Marimo
|
205
|
+
marimo/_static/
|
206
|
+
marimo/_lsp/
|
207
|
+
__marimo__/
|
208
|
+
|
209
|
+
# setuptools-scm generated version file
|
210
|
+
src/mcpcap/_version.py
|
211
|
+
|
212
|
+
# Project specific - ignore PCAP files except in examples
|
213
|
+
*.pcap
|
214
|
+
*.pcapng
|
215
|
+
!examples/*.pcap
|
216
|
+
!examples/*.pcapng
|
217
|
+
|
218
|
+
.DS_Store
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Read the Docs configuration file
|
2
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
3
|
+
|
4
|
+
version: 2
|
5
|
+
|
6
|
+
build:
|
7
|
+
os: ubuntu-22.04
|
8
|
+
tools:
|
9
|
+
python: "3.11"
|
10
|
+
jobs:
|
11
|
+
post_create_environment:
|
12
|
+
# Install poetry
|
13
|
+
- pip install setuptools-scm[toml]
|
14
|
+
post_install:
|
15
|
+
# Install docs dependencies
|
16
|
+
- pip install -e .[docs]
|
17
|
+
|
18
|
+
# Build documentation with Sphinx
|
19
|
+
sphinx:
|
20
|
+
configuration: docs/source/conf.py
|
21
|
+
fail_on_warning: true
|
22
|
+
|
23
|
+
# Optionally build your docs in additional formats such as PDF and ePub
|
24
|
+
formats:
|
25
|
+
- pdf
|
26
|
+
- epub
|
27
|
+
|
28
|
+
# Optional but recommended, declare the Python requirements required to build your docs
|
29
|
+
python:
|
30
|
+
install:
|
31
|
+
- method: pip
|
32
|
+
path: .
|
33
|
+
extra_requirements:
|
34
|
+
- docs
|
mcpcap-0.2.1/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 danohn
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
mcpcap-0.2.1/PKG-INFO
ADDED
@@ -0,0 +1,198 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: mcpcap
|
3
|
+
Version: 0.2.1
|
4
|
+
Summary: A modular Python MCP Server for analyzing PCAP files
|
5
|
+
Author: mcpcap contributors
|
6
|
+
License: MIT
|
7
|
+
Project-URL: Homepage, https://github.com/danohn/mcpcap
|
8
|
+
Project-URL: Repository, https://github.com/danohn/mcpcap
|
9
|
+
Project-URL: Issues, https://github.com/danohn/mcpcap/issues
|
10
|
+
Keywords: pcap,network,analysis,mcp,dns
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
12
|
+
Classifier: Intended Audience :: Developers
|
13
|
+
Classifier: Intended Audience :: System Administrators
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
19
|
+
Classifier: Topic :: System :: Networking :: Monitoring
|
20
|
+
Classifier: Topic :: Security
|
21
|
+
Requires-Python: >=3.10
|
22
|
+
Description-Content-Type: text/markdown
|
23
|
+
License-File: LICENSE
|
24
|
+
Requires-Dist: fastmcp
|
25
|
+
Requires-Dist: scapy
|
26
|
+
Provides-Extra: test
|
27
|
+
Requires-Dist: pytest; extra == "test"
|
28
|
+
Requires-Dist: pytest-cov; extra == "test"
|
29
|
+
Requires-Dist: setuptools-scm[toml]; extra == "test"
|
30
|
+
Provides-Extra: dev
|
31
|
+
Requires-Dist: setuptools-scm[toml]; extra == "dev"
|
32
|
+
Requires-Dist: build; extra == "dev"
|
33
|
+
Requires-Dist: twine; extra == "dev"
|
34
|
+
Requires-Dist: ruff; extra == "dev"
|
35
|
+
Provides-Extra: docs
|
36
|
+
Requires-Dist: sphinx>=7.0; extra == "docs"
|
37
|
+
Requires-Dist: sphinx-rtd-theme; extra == "docs"
|
38
|
+
Requires-Dist: myst-parser; extra == "docs"
|
39
|
+
Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
|
40
|
+
Requires-Dist: sphinx-copybutton; extra == "docs"
|
41
|
+
Requires-Dist: linkify-it-py; extra == "docs"
|
42
|
+
Dynamic: license-file
|
43
|
+
|
44
|
+
# mcpcap
|
45
|
+
|
46
|
+

|
47
|
+
|
48
|
+
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.
|
49
|
+
|
50
|
+
## Overview
|
51
|
+
|
52
|
+
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.
|
53
|
+
|
54
|
+
### Key Features
|
55
|
+
|
56
|
+
- **Modular Architecture**: Easily extensible to support new protocols
|
57
|
+
- **Local & Remote PCAP Support**: Read files from local directories or HTTP servers
|
58
|
+
- **Scapy Integration**: Leverages scapy's comprehensive packet parsing capabilities
|
59
|
+
- **MCP Server**: Integrates seamlessly with LLM clients via Model Context Protocol
|
60
|
+
- **JSON Responses**: Structured data format for easy LLM consumption
|
61
|
+
|
62
|
+
## Installation
|
63
|
+
|
64
|
+
mcpcap requires Python 3.10 or greater.
|
65
|
+
|
66
|
+
### Using pip
|
67
|
+
|
68
|
+
```bash
|
69
|
+
pip install mcpcap
|
70
|
+
```
|
71
|
+
|
72
|
+
### Using uv
|
73
|
+
|
74
|
+
```bash
|
75
|
+
uv add mcpcap
|
76
|
+
```
|
77
|
+
|
78
|
+
### Using uvx (for one-time usage)
|
79
|
+
|
80
|
+
```bash
|
81
|
+
uvx mcpcap
|
82
|
+
```
|
83
|
+
|
84
|
+
## Quick Start
|
85
|
+
|
86
|
+
1. **Start the MCP Server**:
|
87
|
+
|
88
|
+
```bash
|
89
|
+
mcpcap --pcap-path /path/to/pcap/files
|
90
|
+
```
|
91
|
+
|
92
|
+
2. **Connect your LLM client** to the MCP server
|
93
|
+
|
94
|
+
3. **Ask questions** about your network traffic:
|
95
|
+
- "What domain was queried the most in the DNS traffic?"
|
96
|
+
- "Show me all DNS queries for example.com"
|
97
|
+
- "What are the top 5 queried domains?"
|
98
|
+
|
99
|
+
## Modules
|
100
|
+
|
101
|
+
### DNS Module
|
102
|
+
|
103
|
+
The DNS module analyzes Domain Name System packets in PCAP files.
|
104
|
+
|
105
|
+
**Capabilities**:
|
106
|
+
|
107
|
+
- Extract DNS queries and responses
|
108
|
+
- Identify queried domains and subdomains
|
109
|
+
- Analyze query types (A, AAAA, MX, etc.)
|
110
|
+
- Track query frequency and patterns
|
111
|
+
- Identify DNS servers used
|
112
|
+
|
113
|
+
**Example Usage**:
|
114
|
+
|
115
|
+
```python
|
116
|
+
# LLM can ask: "What domains were queried in this PCAP?"
|
117
|
+
# mcpcap will return structured JSON with DNS query information
|
118
|
+
```
|
119
|
+
|
120
|
+
## Configuration
|
121
|
+
|
122
|
+
### PCAP Sources
|
123
|
+
|
124
|
+
**Local Directory**:
|
125
|
+
|
126
|
+
```bash
|
127
|
+
mcpcap --pcap-path /local/path/to/pcaps
|
128
|
+
```
|
129
|
+
|
130
|
+
**Remote HTTP Server**:
|
131
|
+
|
132
|
+
```bash
|
133
|
+
mcpcap --pcap-url http://example.com/pcaps/
|
134
|
+
```
|
135
|
+
|
136
|
+
### Module Selection
|
137
|
+
|
138
|
+
```bash
|
139
|
+
mcpcap --modules dns --pcap-path /path/to/files
|
140
|
+
```
|
141
|
+
|
142
|
+
## Example
|
143
|
+
|
144
|
+
An example PCAP file (`example.pcap`) containing DNS traffic is included with the project to help you get started.
|
145
|
+
|
146
|
+
## Architecture
|
147
|
+
|
148
|
+
mcpcap's modular design makes it easy to extend support for new protocols:
|
149
|
+
|
150
|
+
1. **Core Engine**: Handles PCAP file loading and basic packet processing
|
151
|
+
2. **Protocol Modules**: Individual modules for specific protocols (DNS, etc.)
|
152
|
+
3. **MCP Interface**: Translates between LLM queries and packet analysis results
|
153
|
+
4. **Output Formatter**: Converts analysis results to structured JSON
|
154
|
+
|
155
|
+
### Adding New Modules
|
156
|
+
|
157
|
+
New protocol modules can be added by:
|
158
|
+
|
159
|
+
1. Implementing the module interface
|
160
|
+
2. Defining scapy display filters for the protocol
|
161
|
+
3. Creating analysis functions specific to the protocol
|
162
|
+
4. Registering the module with the core engine
|
163
|
+
|
164
|
+
Future modules might include:
|
165
|
+
|
166
|
+
- BGP (Border Gateway Protocol)
|
167
|
+
- HTTP/HTTPS traffic analysis
|
168
|
+
- TCP connection tracking
|
169
|
+
- And more!
|
170
|
+
|
171
|
+
## Remote Access
|
172
|
+
|
173
|
+
mcpcap supports reading PCAP files from remote HTTP servers without authentication. Future versions may include support for Basic Authentication and other security mechanisms.
|
174
|
+
|
175
|
+
## Contributing
|
176
|
+
|
177
|
+
Contributions are welcome! Whether you want to:
|
178
|
+
|
179
|
+
- Add support for new protocols
|
180
|
+
- Improve existing modules
|
181
|
+
- Enhance the MCP interface
|
182
|
+
- Add new features
|
183
|
+
|
184
|
+
Please feel free to open issues and submit pull requests.
|
185
|
+
|
186
|
+
## License
|
187
|
+
|
188
|
+
MIT
|
189
|
+
|
190
|
+
## Requirements
|
191
|
+
|
192
|
+
- Python 3.10+
|
193
|
+
- scapy
|
194
|
+
- MCP server dependencies (automatically installed)
|
195
|
+
|
196
|
+
## Support
|
197
|
+
|
198
|
+
For questions, issues, or feature requests, please open an issue on GitHub.
|