mcpcap 0.3.0__tar.gz → 0.4.0__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.
Files changed (49) hide show
  1. {mcpcap-0.3.0 → mcpcap-0.4.0}/.github/workflows/release.yml +28 -17
  2. {mcpcap-0.3.0/src/mcpcap.egg-info → mcpcap-0.4.0}/PKG-INFO +39 -10
  3. {mcpcap-0.3.0 → mcpcap-0.4.0}/README.md +38 -9
  4. {mcpcap-0.3.0 → mcpcap-0.4.0}/docs/source/user-guide/mcp-integration.md +25 -12
  5. {mcpcap-0.3.0 → mcpcap-0.4.0}/examples/README.md +25 -6
  6. mcpcap-0.4.0/examples/dhcp.pcap +0 -0
  7. {mcpcap-0.3.0 → mcpcap-0.4.0}/src/mcpcap/_version.py +3 -3
  8. {mcpcap-0.3.0 → mcpcap-0.4.0}/src/mcpcap/cli.py +6 -7
  9. {mcpcap-0.3.0 → mcpcap-0.4.0}/src/mcpcap/core/server.py +22 -9
  10. {mcpcap-0.3.0 → mcpcap-0.4.0}/src/mcpcap/modules/__init__.py +2 -1
  11. mcpcap-0.4.0/src/mcpcap/modules/dhcp.py +446 -0
  12. {mcpcap-0.3.0 → mcpcap-0.4.0/src/mcpcap.egg-info}/PKG-INFO +39 -10
  13. {mcpcap-0.3.0 → mcpcap-0.4.0}/src/mcpcap.egg-info/SOURCES.txt +3 -4
  14. {mcpcap-0.3.0 → mcpcap-0.4.0}/tests/test_cli.py +52 -0
  15. mcpcap-0.4.0/tests/test_dhcp.py +379 -0
  16. mcpcap-0.3.0/.DS_Store +0 -0
  17. mcpcap-0.3.0/requirements.txt +0 -62
  18. mcpcap-0.3.0/src/mcpcap/resources/__init__.py +0 -5
  19. mcpcap-0.3.0/src/mcpcap/resources/references.py +0 -90
  20. {mcpcap-0.3.0 → mcpcap-0.4.0}/.github/FUNDING.yml +0 -0
  21. {mcpcap-0.3.0 → mcpcap-0.4.0}/.github/workflows/test.yml +0 -0
  22. {mcpcap-0.3.0 → mcpcap-0.4.0}/.gitignore +0 -0
  23. {mcpcap-0.3.0 → mcpcap-0.4.0}/.readthedocs.yaml +0 -0
  24. {mcpcap-0.3.0 → mcpcap-0.4.0}/LICENSE +0 -0
  25. {mcpcap-0.3.0 → mcpcap-0.4.0}/docs/Makefile +0 -0
  26. {mcpcap-0.3.0 → mcpcap-0.4.0}/docs/source/_static/.gitkeep +0 -0
  27. {mcpcap-0.3.0 → mcpcap-0.4.0}/docs/source/api/cli.rst +0 -0
  28. {mcpcap-0.3.0 → mcpcap-0.4.0}/docs/source/api/core.rst +0 -0
  29. {mcpcap-0.3.0 → mcpcap-0.4.0}/docs/source/api/modules.rst +0 -0
  30. {mcpcap-0.3.0 → mcpcap-0.4.0}/docs/source/conf.py +0 -0
  31. {mcpcap-0.3.0 → mcpcap-0.4.0}/docs/source/index.rst +0 -0
  32. {mcpcap-0.3.0 → mcpcap-0.4.0}/docs/source/user-guide/analysis-guides.md +0 -0
  33. {mcpcap-0.3.0 → mcpcap-0.4.0}/docs/source/user-guide/installation.md +0 -0
  34. {mcpcap-0.3.0 → mcpcap-0.4.0}/docs/source/user-guide/quickstart.md +0 -0
  35. {mcpcap-0.3.0 → mcpcap-0.4.0}/examples/dns.pcap +0 -0
  36. {mcpcap-0.3.0 → mcpcap-0.4.0}/pyproject.toml +0 -0
  37. {mcpcap-0.3.0 → mcpcap-0.4.0}/readme-assets/mcpcap-logo.png +0 -0
  38. {mcpcap-0.3.0 → mcpcap-0.4.0}/setup.cfg +0 -0
  39. {mcpcap-0.3.0 → mcpcap-0.4.0}/src/mcpcap/__init__.py +0 -0
  40. {mcpcap-0.3.0 → mcpcap-0.4.0}/src/mcpcap/core/__init__.py +0 -0
  41. {mcpcap-0.3.0 → mcpcap-0.4.0}/src/mcpcap/core/config.py +0 -0
  42. {mcpcap-0.3.0 → mcpcap-0.4.0}/src/mcpcap/modules/base.py +0 -0
  43. {mcpcap-0.3.0 → mcpcap-0.4.0}/src/mcpcap/modules/dns.py +0 -0
  44. {mcpcap-0.3.0 → mcpcap-0.4.0}/src/mcpcap.egg-info/dependency_links.txt +0 -0
  45. {mcpcap-0.3.0 → mcpcap-0.4.0}/src/mcpcap.egg-info/entry_points.txt +0 -0
  46. {mcpcap-0.3.0 → mcpcap-0.4.0}/src/mcpcap.egg-info/requires.txt +0 -0
  47. {mcpcap-0.3.0 → mcpcap-0.4.0}/src/mcpcap.egg-info/top_level.txt +0 -0
  48. {mcpcap-0.3.0 → mcpcap-0.4.0}/tests/__init__.py +0 -0
  49. {mcpcap-0.3.0 → mcpcap-0.4.0}/tests/test_dns.py +0 -0
@@ -52,25 +52,36 @@ jobs:
52
52
  twine check dist/*
53
53
 
54
54
  - name: Create GitHub Release
55
- uses: actions/create-release@v1
55
+ run: |
56
+ # Extract version without 'v' prefix for pip install
57
+ VERSION=${GITHUB_REF_NAME#v}
58
+
59
+ # Get previous tag for release notes generation
60
+ PREV_TAG=$(git tag --sort=-version:refname | grep -v "$GITHUB_REF_NAME" | head -1)
61
+
62
+ # Create release with auto-generated notes
63
+ if [ -n "$PREV_TAG" ]; then
64
+ gh release create $GITHUB_REF_NAME \
65
+ --title "Release $GITHUB_REF_NAME" \
66
+ --generate-notes \
67
+ --notes-start-tag "$PREV_TAG"
68
+ else
69
+ # First release, no previous tag
70
+ gh release create $GITHUB_REF_NAME \
71
+ --title "Release $GITHUB_REF_NAME" \
72
+ --generate-notes
73
+ fi
74
+
75
+ # Add installation instructions to the beginning
76
+ gh release edit $GITHUB_REF_NAME \
77
+ --notes "$(echo "## Installation
78
+ \`\`\`bash
79
+ pip install mcpcap==$VERSION
80
+ \`\`\`
81
+
82
+ $(gh release view $GITHUB_REF_NAME --json body -q .body)")"
56
83
  env:
57
84
  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
85
 
75
86
  - name: Publish to PyPI
76
87
  uses: pypa/gh-action-pypi-publish@release/v1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcpcap
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: A modular Python MCP Server for analyzing PCAP files
5
5
  Author: mcpcap contributors
6
6
  License: MIT
@@ -115,6 +115,8 @@ uvx mcpcap
115
115
 
116
116
  ## Modules
117
117
 
118
+ mcpcap supports multiple protocol analysis modules:
119
+
118
120
  ### DNS Module
119
121
 
120
122
  The DNS module analyzes Domain Name System packets in PCAP files.
@@ -127,11 +129,26 @@ The DNS module analyzes Domain Name System packets in PCAP files.
127
129
  - Track query frequency and patterns
128
130
  - Identify DNS servers used
129
131
 
132
+ ### DHCP Module
133
+
134
+ The DHCP module analyzes Dynamic Host Configuration Protocol packets in PCAP files.
135
+
136
+ **Capabilities**:
137
+
138
+ - Track DHCP transactions (DISCOVER, OFFER, REQUEST, ACK)
139
+ - Identify DHCP clients and servers
140
+ - Monitor IP address assignments and lease information
141
+ - Analyze DHCP options and configurations
142
+ - Detect DHCP anomalies and security issues
143
+
130
144
  **Example Usage**:
131
145
 
132
- ```python
133
- # LLM can ask: "What domains were queried in this PCAP?"
134
- # mcpcap will return structured JSON with DNS query information
146
+ ```bash
147
+ # Analyze DHCP traffic only
148
+ mcpcap --pcap-path /path/to/dhcp.pcap --modules dhcp
149
+
150
+ # Analyze both DNS and DHCP
151
+ mcpcap --pcap-path /path/to/mixed.pcap --modules dns,dhcp
135
152
  ```
136
153
 
137
154
  ## Configuration
@@ -164,12 +181,23 @@ mcpcap --pcap-url http://example.com/pcaps/
164
181
 
165
182
  **Module Selection**:
166
183
  ```bash
184
+ # Single module
167
185
  mcpcap --modules dns --pcap-path /path/to/files
186
+
187
+ # Multiple modules
188
+ mcpcap --modules dns,dhcp --pcap-path /path/to/files
168
189
  ```
169
190
 
170
- **Protocol Filtering**:
191
+ **Protocol Selection** (automatically matches loaded modules):
171
192
  ```bash
172
- mcpcap --protocols dns --pcap-path /path/to/files
193
+ # DNS analysis only
194
+ mcpcap --modules dns --pcap-path /path/to/files
195
+
196
+ # DHCP analysis only
197
+ mcpcap --modules dhcp --pcap-path /path/to/files
198
+
199
+ # Both DNS and DHCP analysis
200
+ mcpcap --modules dns,dhcp --pcap-path /path/to/files
173
201
  ```
174
202
 
175
203
  **Packet Limiting** (for large files):
@@ -179,7 +207,7 @@ mcpcap --max-packets 1000 --pcap-path /path/to/files
179
207
 
180
208
  **Combined Options**:
181
209
  ```bash
182
- mcpcap --pcap-path /data/capture.pcap --max-packets 500 --protocols dns
210
+ mcpcap --pcap-path /data/capture.pcap --max-packets 500 --modules dns,dhcp
183
211
  ```
184
212
 
185
213
  ## CLI Reference
@@ -194,7 +222,8 @@ mcpcap [--pcap-path PATH | --pcap-url URL] [OPTIONS]
194
222
 
195
223
  **Analysis Options**:
196
224
  - `--modules MODULES`: Comma-separated modules to load (default: dns)
197
- - `--protocols PROTOCOLS`: Comma-separated protocols to analyze (default: dns)
225
+ - Available modules: `dns`, `dhcp`
226
+ - Protocols are automatically set to match loaded modules
198
227
  - `--max-packets N`: Maximum packets to analyze per file (default: unlimited)
199
228
 
200
229
  **Examples**:
@@ -205,8 +234,8 @@ mcpcap --pcap-path ./capture.pcap
205
234
  # Remote file with packet limit
206
235
  mcpcap --pcap-url https://example.com/dns.cap --max-packets 100
207
236
 
208
- # Directory with protocol filter
209
- mcpcap --pcap-path /captures --protocols dns --modules dns
237
+ # Directory with DHCP analysis
238
+ mcpcap --pcap-path /captures --modules dhcp
210
239
  ```
211
240
 
212
241
  ## Example
@@ -71,6 +71,8 @@ uvx mcpcap
71
71
 
72
72
  ## Modules
73
73
 
74
+ mcpcap supports multiple protocol analysis modules:
75
+
74
76
  ### DNS Module
75
77
 
76
78
  The DNS module analyzes Domain Name System packets in PCAP files.
@@ -83,11 +85,26 @@ The DNS module analyzes Domain Name System packets in PCAP files.
83
85
  - Track query frequency and patterns
84
86
  - Identify DNS servers used
85
87
 
88
+ ### DHCP Module
89
+
90
+ The DHCP module analyzes Dynamic Host Configuration Protocol packets in PCAP files.
91
+
92
+ **Capabilities**:
93
+
94
+ - Track DHCP transactions (DISCOVER, OFFER, REQUEST, ACK)
95
+ - Identify DHCP clients and servers
96
+ - Monitor IP address assignments and lease information
97
+ - Analyze DHCP options and configurations
98
+ - Detect DHCP anomalies and security issues
99
+
86
100
  **Example Usage**:
87
101
 
88
- ```python
89
- # LLM can ask: "What domains were queried in this PCAP?"
90
- # mcpcap will return structured JSON with DNS query information
102
+ ```bash
103
+ # Analyze DHCP traffic only
104
+ mcpcap --pcap-path /path/to/dhcp.pcap --modules dhcp
105
+
106
+ # Analyze both DNS and DHCP
107
+ mcpcap --pcap-path /path/to/mixed.pcap --modules dns,dhcp
91
108
  ```
92
109
 
93
110
  ## Configuration
@@ -120,12 +137,23 @@ mcpcap --pcap-url http://example.com/pcaps/
120
137
 
121
138
  **Module Selection**:
122
139
  ```bash
140
+ # Single module
123
141
  mcpcap --modules dns --pcap-path /path/to/files
142
+
143
+ # Multiple modules
144
+ mcpcap --modules dns,dhcp --pcap-path /path/to/files
124
145
  ```
125
146
 
126
- **Protocol Filtering**:
147
+ **Protocol Selection** (automatically matches loaded modules):
127
148
  ```bash
128
- mcpcap --protocols dns --pcap-path /path/to/files
149
+ # DNS analysis only
150
+ mcpcap --modules dns --pcap-path /path/to/files
151
+
152
+ # DHCP analysis only
153
+ mcpcap --modules dhcp --pcap-path /path/to/files
154
+
155
+ # Both DNS and DHCP analysis
156
+ mcpcap --modules dns,dhcp --pcap-path /path/to/files
129
157
  ```
130
158
 
131
159
  **Packet Limiting** (for large files):
@@ -135,7 +163,7 @@ mcpcap --max-packets 1000 --pcap-path /path/to/files
135
163
 
136
164
  **Combined Options**:
137
165
  ```bash
138
- mcpcap --pcap-path /data/capture.pcap --max-packets 500 --protocols dns
166
+ mcpcap --pcap-path /data/capture.pcap --max-packets 500 --modules dns,dhcp
139
167
  ```
140
168
 
141
169
  ## CLI Reference
@@ -150,7 +178,8 @@ mcpcap [--pcap-path PATH | --pcap-url URL] [OPTIONS]
150
178
 
151
179
  **Analysis Options**:
152
180
  - `--modules MODULES`: Comma-separated modules to load (default: dns)
153
- - `--protocols PROTOCOLS`: Comma-separated protocols to analyze (default: dns)
181
+ - Available modules: `dns`, `dhcp`
182
+ - Protocols are automatically set to match loaded modules
154
183
  - `--max-packets N`: Maximum packets to analyze per file (default: unlimited)
155
184
 
156
185
  **Examples**:
@@ -161,8 +190,8 @@ mcpcap --pcap-path ./capture.pcap
161
190
  # Remote file with packet limit
162
191
  mcpcap --pcap-url https://example.com/dns.cap --max-packets 100
163
192
 
164
- # Directory with protocol filter
165
- mcpcap --pcap-path /captures --protocols dns --modules dns
193
+ # Directory with DHCP analysis
194
+ mcpcap --pcap-path /captures --modules dhcp
166
195
  ```
167
196
 
168
197
  ## Example
@@ -4,7 +4,7 @@ Learn how to integrate mcpcap with different MCP (Model Context Protocol) client
4
4
 
5
5
  ## What is MCP?
6
6
 
7
- The Model Context Protocol (MCP) enables LLMs to securely access external resources and tools. mcpcap implements an MCP server that provides DNS analysis capabilities to any compatible MCP client.
7
+ The Model Context Protocol (MCP) enables LLMs to securely access external resources and tools. mcpcap implements an MCP server that provides network protocol analysis capabilities (DNS, DHCP, and more) to any compatible MCP client.
8
8
 
9
9
  ## Available MCP Clients
10
10
 
@@ -119,26 +119,38 @@ Lists all PCAP files in the configured directory.
119
119
  Analyzes DNS packets in a PCAP file.
120
120
 
121
121
  **Parameters**:
122
- - `pcap_file` (optional): Filename to analyze (defaults to "example.pcap")
122
+ - `pcap_file` (optional): Filename to analyze (defaults to first available file)
123
123
 
124
- **Returns**: Structured JSON with packet details and statistics
124
+ **Returns**: Structured JSON with DNS packet details and statistics
125
125
 
126
- ## Available Resources
126
+ ### `list_dhcp_packets`
127
127
 
128
- ### DNS Reference Materials
128
+ Analyzes DHCP packets in a PCAP file.
129
129
 
130
- - `dns-record-types://reference`: DNS record types guide
131
- - `dns-flags://reference`: DNS flags and response codes
132
- - `suspicious-domains://indicators`: Security indicators for domains
130
+ **Parameters**:
131
+ - `pcap_file` (optional): Filename to analyze (defaults to first available file)
132
+
133
+ **Returns**: Structured JSON with DHCP packet details including:
134
+ - Complete DHCP transactions (DISCOVER → OFFER → REQUEST → ACK)
135
+ - Client and server identification (MAC addresses, hostnames)
136
+ - IP address assignments and lease information
137
+ - DHCP options and configurations
138
+ - Transaction timing and statistics
133
139
 
134
140
  ## Available Prompts
135
141
 
136
- ### Analysis Prompts
142
+ ### DNS Analysis Prompts
137
143
 
138
144
  - `security_analysis`: Security-focused DNS analysis guidance
139
145
  - `network_troubleshooting`: Network performance troubleshooting
140
146
  - `forensic_investigation`: Digital forensics approach
141
147
 
148
+ ### DHCP Analysis Prompts
149
+
150
+ - `dhcp_network_analysis`: Network administration and IP management analysis
151
+ - `dhcp_security_analysis`: Security threats and rogue DHCP server detection
152
+ - `dhcp_forensic_investigation`: Forensic analysis of DHCP transactions and timeline
153
+
142
154
  ## Configuration Options
143
155
 
144
156
  ### Server Configuration
@@ -154,7 +166,7 @@ mcpcap --pcap-path /path/to/specific.pcap
154
166
  mcpcap --pcap-url https://example.com/capture.pcap
155
167
 
156
168
  # With analysis options
157
- mcpcap --pcap-path /path/to/pcaps --max-packets 1000 --protocols dns --modules dns
169
+ mcpcap --pcap-path /path/to/pcaps --max-packets 1000 --modules dns,dhcp
158
170
  ```
159
171
 
160
172
  ### Client Configuration Examples
@@ -170,7 +182,7 @@ mcpcap --pcap-path /path/to/pcaps --max-packets 1000 --protocols dns --modules d
170
182
  },
171
183
  "mcpcap-production": {
172
184
  "command": "mcpcap",
173
- "args": ["--pcap-path", "/production/captures", "--protocols", "dns"],
185
+ "args": ["--pcap-path", "/production/captures", "--modules", "dns,dhcp"],
174
186
  "env": {
175
187
  "LOG_LEVEL": "INFO"
176
188
  }
@@ -228,9 +240,10 @@ export mcpcap_PCAP_PATH=/default/path
228
240
  - Verify no other processes are using the same resources
229
241
 
230
242
  **Empty results**
231
- - Confirm PCAP files contain DNS traffic (`port 53`)
243
+ - Confirm PCAP files contain expected traffic (DNS on `port 53`, DHCP on `port 67/68`)
232
244
  - Check file extensions are `.pcap` or `.pcapng`
233
245
  - Verify files aren't corrupted with `file` command
246
+ - Ensure protocol modules are properly configured (`--modules dns,dhcp`)
234
247
 
235
248
  **Performance issues**
236
249
  - Use smaller PCAP files for initial testing
@@ -1,10 +1,11 @@
1
1
  # mcpcap Examples
2
2
 
3
- This directory contains example PCAP files and usage demonstrations.
3
+ This directory contains example PCAP files and usage demonstrations for different protocol modules.
4
4
 
5
5
  ## Example Files
6
6
 
7
- - `dns.pcap` - Sample DNS traffic capture for testing mcpcap functionality
7
+ - `dns.pcap` - Sample DNS traffic capture for testing DNS module functionality
8
+ - `dhcp.pcap` - Sample DHCP traffic capture showing complete 4-way handshake (DISCOVER → OFFER → REQUEST → ACK)
8
9
 
9
10
  ## Usage Examples
10
11
 
@@ -17,7 +18,11 @@ mcpcap --pcap-path ./examples
17
18
 
18
19
  **Analyze specific file:**
19
20
  ```bash
21
+ # DNS analysis
20
22
  mcpcap --pcap-path ./examples/dns.pcap
23
+
24
+ # DHCP analysis
25
+ mcpcap --pcap-path ./examples/dhcp.pcap --modules dhcp
21
26
  ```
22
27
 
23
28
  **With packet limits for faster testing:**
@@ -35,17 +40,23 @@ npx @modelcontextprotocol/inspector mcpcap --pcap-path ./examples/dns.pcap
35
40
 
36
41
  Then use the web interface to:
37
42
  - Call `list_pcap_files()` to see available files
38
- - Call `list_dns_packets()` (leave filename empty for direct file mode)
39
- - View structured DNS analysis results
43
+ - Call `list_dns_packets()` or `list_dhcp_packets()`
44
+ - View structured analysis results
40
45
 
41
46
  ### Analysis Prompts
42
47
 
43
48
  Use these specialized prompts in your MCP client:
44
49
 
50
+ **DNS Module Prompts:**
45
51
  - **`security_analysis`** - Focus on threat detection in DNS traffic
46
52
  - **`network_troubleshooting`** - Identify DNS performance issues
47
53
  - **`forensic_investigation`** - Detailed timeline and attribution analysis
48
54
 
55
+ **DHCP Module Prompts:**
56
+ - **`dhcp_network_analysis`** - Network administration and IP management
57
+ - **`dhcp_security_analysis`** - Security threats and rogue DHCP detection
58
+ - **`dhcp_forensic_investigation`** - Forensic analysis of DHCP transactions
59
+
49
60
  ## Creating Your Own Examples
50
61
 
51
62
  To add new example files:
@@ -56,9 +67,17 @@ To add new example files:
56
67
 
57
68
  ## Sample Output
58
69
 
70
+ ### DNS Analysis
59
71
  When analyzing DNS packets, you'll get structured JSON output including:
60
-
61
72
  - Packet timestamps and network details
62
73
  - DNS query/response information
63
74
  - Statistics (queries, responses, unique domains)
64
- - Security-relevant metadata
75
+ - Security-relevant metadata
76
+
77
+ ### DHCP Analysis
78
+ When analyzing DHCP packets, you'll get structured JSON output including:
79
+ - Complete DHCP transaction tracking (DISCOVER/OFFER/REQUEST/ACK)
80
+ - Client and server identification (MAC addresses, IP addresses)
81
+ - Lease information and timing
82
+ - DHCP options and configurations
83
+ - Network statistics and anomaly detection
Binary file
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.3.0'
32
- __version_tuple__ = version_tuple = (0, 3, 0)
31
+ __version__ = version = '0.4.0'
32
+ __version_tuple__ = version_tuple = (0, 4, 0)
33
33
 
34
- __commit_id__ = commit_id = 'gc1a9a0372'
34
+ __commit_id__ = commit_id = 'g17496513d'
@@ -42,11 +42,6 @@ def main():
42
42
  help="Comma-separated list of modules to load (default: dns)",
43
43
  default="dns",
44
44
  )
45
- parser.add_argument(
46
- "--protocols",
47
- help="Comma-separated list of protocols to analyze (default: dns)",
48
- default="dns",
49
- )
50
45
  parser.add_argument(
51
46
  "--max-packets",
52
47
  type=int,
@@ -56,12 +51,16 @@ def main():
56
51
  args = parser.parse_args()
57
52
 
58
53
  try:
54
+ # Parse modules and automatically set protocols to match
55
+ modules = args.modules.split(",") if args.modules else ["dns"]
56
+ protocols = modules # Protocols automatically match loaded modules
57
+
59
58
  # Initialize configuration
60
59
  config = Config(
61
60
  pcap_path=args.pcap_path,
62
61
  pcap_url=args.pcap_url,
63
- modules=args.modules.split(",") if args.modules else ["dns"],
64
- protocols=args.protocols.split(",") if args.protocols else ["dns"],
62
+ modules=modules,
63
+ protocols=protocols,
65
64
  max_packets=args.max_packets,
66
65
  )
67
66
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  from fastmcp import FastMCP
4
4
 
5
+ from ..modules.dhcp import DHCPModule
5
6
  from ..modules.dns import DNSModule
6
- from ..resources.references import setup_resources
7
7
  from .config import Config
8
8
 
9
9
 
@@ -19,21 +19,34 @@ class MCPServer:
19
19
  self.config = config
20
20
  self.mcp = FastMCP("mcpcap")
21
21
 
22
- # Initialize modules
23
- self.dns_module = DNSModule(config)
22
+ # Initialize modules based on configuration
23
+ self.modules = {}
24
+ if "dns" in self.config.modules:
25
+ self.modules["dns"] = DNSModule(config)
26
+ if "dhcp" in self.config.modules:
27
+ self.modules["dhcp"] = DHCPModule(config)
24
28
 
25
29
  # Register tools
26
30
  self._register_tools()
27
31
 
28
- # Setup resources and prompts
29
- setup_resources(self.mcp)
30
- self.dns_module.setup_prompts(self.mcp)
32
+ # Setup prompts
33
+ for module in self.modules.values():
34
+ module.setup_prompts(self.mcp)
31
35
 
32
36
  def _register_tools(self) -> None:
33
37
  """Register all available tools with the MCP server."""
34
- # Register DNS module tools
35
- self.mcp.tool(self.dns_module.list_dns_packets)
36
- self.mcp.tool(self.dns_module.list_pcap_files)
38
+ # Register tools for each loaded module
39
+ for module_name, module in self.modules.items():
40
+ if module_name == "dns":
41
+ self.mcp.tool(module.list_dns_packets)
42
+ elif module_name == "dhcp":
43
+ self.mcp.tool(module.list_dhcp_packets)
44
+
45
+ # Register shared list_pcap_files tool (same for all modules)
46
+ if self.modules:
47
+ # Use the first available module for listing PCAP files
48
+ first_module = next(iter(self.modules.values()))
49
+ self.mcp.tool(first_module.list_pcap_files)
37
50
 
38
51
  def run(self) -> None:
39
52
  """Start the MCP server."""
@@ -1,6 +1,7 @@
1
1
  """Protocol analysis modules for mcpcap."""
2
2
 
3
3
  from .base import BaseModule
4
+ from .dhcp import DHCPModule
4
5
  from .dns import DNSModule
5
6
 
6
- __all__ = ["BaseModule", "DNSModule"]
7
+ __all__ = ["BaseModule", "DHCPModule", "DNSModule"]