mcpcap 0.2.2__tar.gz → 0.3.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.2.2 → mcpcap-0.3.0}/.gitignore +2 -1
  2. {mcpcap-0.2.2/src/mcpcap.egg-info → mcpcap-0.3.0}/PKG-INFO +99 -8
  3. {mcpcap-0.2.2 → mcpcap-0.3.0}/README.md +97 -7
  4. mcpcap-0.3.0/docs/source/_static/.gitkeep +2 -0
  5. {mcpcap-0.2.2 → mcpcap-0.3.0}/docs/source/conf.py +0 -1
  6. {mcpcap-0.2.2 → mcpcap-0.3.0}/docs/source/user-guide/installation.md +1 -0
  7. {mcpcap-0.2.2 → mcpcap-0.3.0}/docs/source/user-guide/mcp-integration.md +16 -6
  8. {mcpcap-0.2.2 → mcpcap-0.3.0}/docs/source/user-guide/quickstart.md +31 -7
  9. mcpcap-0.3.0/examples/README.md +64 -0
  10. {mcpcap-0.2.2 → mcpcap-0.3.0}/pyproject.toml +2 -0
  11. {mcpcap-0.2.2 → mcpcap-0.3.0}/src/mcpcap/_version.py +3 -3
  12. mcpcap-0.3.0/src/mcpcap/cli.py +85 -0
  13. mcpcap-0.3.0/src/mcpcap/core/config.py +230 -0
  14. {mcpcap-0.2.2 → mcpcap-0.3.0}/src/mcpcap/core/server.py +10 -2
  15. {mcpcap-0.2.2 → mcpcap-0.3.0}/src/mcpcap/modules/dns.py +108 -20
  16. {mcpcap-0.2.2 → mcpcap-0.3.0/src/mcpcap.egg-info}/PKG-INFO +99 -8
  17. {mcpcap-0.2.2 → mcpcap-0.3.0}/src/mcpcap.egg-info/SOURCES.txt +1 -0
  18. {mcpcap-0.2.2 → mcpcap-0.3.0}/src/mcpcap.egg-info/requires.txt +1 -0
  19. {mcpcap-0.2.2 → mcpcap-0.3.0}/tests/test_cli.py +13 -7
  20. {mcpcap-0.2.2 → mcpcap-0.3.0}/tests/test_dns.py +10 -6
  21. mcpcap-0.2.2/examples/README.md +0 -49
  22. mcpcap-0.2.2/src/mcpcap/cli.py +0 -54
  23. mcpcap-0.2.2/src/mcpcap/core/config.py +0 -52
  24. {mcpcap-0.2.2 → mcpcap-0.3.0}/.DS_Store +0 -0
  25. {mcpcap-0.2.2 → mcpcap-0.3.0}/.github/FUNDING.yml +0 -0
  26. {mcpcap-0.2.2 → mcpcap-0.3.0}/.github/workflows/release.yml +0 -0
  27. {mcpcap-0.2.2 → mcpcap-0.3.0}/.github/workflows/test.yml +0 -0
  28. {mcpcap-0.2.2 → mcpcap-0.3.0}/.readthedocs.yaml +0 -0
  29. {mcpcap-0.2.2 → mcpcap-0.3.0}/LICENSE +0 -0
  30. {mcpcap-0.2.2 → mcpcap-0.3.0}/docs/Makefile +0 -0
  31. {mcpcap-0.2.2 → mcpcap-0.3.0}/docs/source/api/cli.rst +0 -0
  32. {mcpcap-0.2.2 → mcpcap-0.3.0}/docs/source/api/core.rst +0 -0
  33. {mcpcap-0.2.2 → mcpcap-0.3.0}/docs/source/api/modules.rst +0 -0
  34. {mcpcap-0.2.2 → mcpcap-0.3.0}/docs/source/index.rst +0 -0
  35. {mcpcap-0.2.2 → mcpcap-0.3.0}/docs/source/user-guide/analysis-guides.md +0 -0
  36. {mcpcap-0.2.2 → mcpcap-0.3.0}/examples/dns.pcap +0 -0
  37. {mcpcap-0.2.2 → mcpcap-0.3.0}/readme-assets/mcpcap-logo.png +0 -0
  38. {mcpcap-0.2.2 → mcpcap-0.3.0}/requirements.txt +0 -0
  39. {mcpcap-0.2.2 → mcpcap-0.3.0}/setup.cfg +0 -0
  40. {mcpcap-0.2.2 → mcpcap-0.3.0}/src/mcpcap/__init__.py +0 -0
  41. {mcpcap-0.2.2 → mcpcap-0.3.0}/src/mcpcap/core/__init__.py +0 -0
  42. {mcpcap-0.2.2 → mcpcap-0.3.0}/src/mcpcap/modules/__init__.py +0 -0
  43. {mcpcap-0.2.2 → mcpcap-0.3.0}/src/mcpcap/modules/base.py +0 -0
  44. {mcpcap-0.2.2 → mcpcap-0.3.0}/src/mcpcap/resources/__init__.py +0 -0
  45. {mcpcap-0.2.2 → mcpcap-0.3.0}/src/mcpcap/resources/references.py +0 -0
  46. {mcpcap-0.2.2 → mcpcap-0.3.0}/src/mcpcap.egg-info/dependency_links.txt +0 -0
  47. {mcpcap-0.2.2 → mcpcap-0.3.0}/src/mcpcap.egg-info/entry_points.txt +0 -0
  48. {mcpcap-0.2.2 → mcpcap-0.3.0}/src/mcpcap.egg-info/top_level.txt +0 -0
  49. {mcpcap-0.2.2 → mcpcap-0.3.0}/tests/__init__.py +0 -0
@@ -215,4 +215,5 @@ src/mcpcap/_version.py
215
215
  !examples/*.pcap
216
216
  !examples/*.pcapng
217
217
 
218
- .DS_Store
218
+ .DS_Store
219
+ plan.md
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcpcap
3
- Version: 0.2.2
3
+ Version: 0.3.0
4
4
  Summary: A modular Python MCP Server for analyzing PCAP files
5
5
  Author: mcpcap contributors
6
6
  License: MIT
@@ -23,6 +23,7 @@ Description-Content-Type: text/markdown
23
23
  License-File: LICENSE
24
24
  Requires-Dist: fastmcp
25
25
  Requires-Dist: scapy
26
+ Requires-Dist: requests
26
27
  Provides-Extra: test
27
28
  Requires-Dist: pytest; extra == "test"
28
29
  Requires-Dist: pytest-cov; extra == "test"
@@ -85,10 +86,26 @@ uvx mcpcap
85
86
 
86
87
  1. **Start the MCP Server**:
87
88
 
89
+ **Local PCAP file:**
90
+ ```bash
91
+ mcpcap --pcap-path /path/to/specific/file.pcap
92
+ ```
93
+
94
+ **Local PCAP directory:**
88
95
  ```bash
89
96
  mcpcap --pcap-path /path/to/pcap/files
90
97
  ```
91
98
 
99
+ **Remote PCAP file:**
100
+ ```bash
101
+ mcpcap --pcap-url https://example.com/sample.pcap
102
+ ```
103
+
104
+ **With advanced options:**
105
+ ```bash
106
+ mcpcap --pcap-path /path/to/pcaps --max-packets 100 --protocols dns
107
+ ```
108
+
92
109
  2. **Connect your LLM client** to the MCP server
93
110
 
94
111
  3. **Ask questions** about your network traffic:
@@ -121,27 +138,80 @@ The DNS module analyzes Domain Name System packets in PCAP files.
121
138
 
122
139
  ### PCAP Sources
123
140
 
124
- **Local Directory**:
141
+ mcpcap supports multiple ways to specify PCAP data sources:
125
142
 
143
+ **Local PCAP File**:
144
+ ```bash
145
+ mcpcap --pcap-path /local/path/to/specific.pcap
146
+ ```
147
+
148
+ **Local Directory**:
126
149
  ```bash
127
150
  mcpcap --pcap-path /local/path/to/pcaps
128
151
  ```
129
152
 
130
- **Remote HTTP Server**:
153
+ **Remote PCAP File (Direct Link)**:
154
+ ```bash
155
+ mcpcap --pcap-url https://wiki.wireshark.org/uploads/dns.cap
156
+ ```
131
157
 
158
+ **Remote Directory Listing**:
132
159
  ```bash
133
160
  mcpcap --pcap-url http://example.com/pcaps/
134
161
  ```
135
162
 
136
- ### Module Selection
163
+ ### Analysis Options
137
164
 
165
+ **Module Selection**:
138
166
  ```bash
139
167
  mcpcap --modules dns --pcap-path /path/to/files
140
168
  ```
141
169
 
170
+ **Protocol Filtering**:
171
+ ```bash
172
+ mcpcap --protocols dns --pcap-path /path/to/files
173
+ ```
174
+
175
+ **Packet Limiting** (for large files):
176
+ ```bash
177
+ mcpcap --max-packets 1000 --pcap-path /path/to/files
178
+ ```
179
+
180
+ **Combined Options**:
181
+ ```bash
182
+ mcpcap --pcap-path /data/capture.pcap --max-packets 500 --protocols dns
183
+ ```
184
+
185
+ ## CLI Reference
186
+
187
+ ```bash
188
+ mcpcap [--pcap-path PATH | --pcap-url URL] [OPTIONS]
189
+ ```
190
+
191
+ **Source Options** (choose one):
192
+ - `--pcap-path PATH`: Local PCAP file or directory
193
+ - `--pcap-url URL`: Remote PCAP file URL or directory listing
194
+
195
+ **Analysis Options**:
196
+ - `--modules MODULES`: Comma-separated modules to load (default: dns)
197
+ - `--protocols PROTOCOLS`: Comma-separated protocols to analyze (default: dns)
198
+ - `--max-packets N`: Maximum packets to analyze per file (default: unlimited)
199
+
200
+ **Examples**:
201
+ ```bash
202
+ # Analyze specific file
203
+ mcpcap --pcap-path ./capture.pcap
204
+
205
+ # Remote file with packet limit
206
+ mcpcap --pcap-url https://example.com/dns.cap --max-packets 100
207
+
208
+ # Directory with protocol filter
209
+ mcpcap --pcap-path /captures --protocols dns --modules dns
210
+ ```
211
+
142
212
  ## Example
143
213
 
144
- An example PCAP file (`example.pcap`) containing DNS traffic is included with the project to help you get started.
214
+ An example PCAP file (`dns.pcap`) containing DNS traffic is included in the `examples/` directory to help you get started.
145
215
 
146
216
  ## Architecture
147
217
 
@@ -170,7 +240,26 @@ Future modules might include:
170
240
 
171
241
  ## Remote Access
172
242
 
173
- mcpcap supports reading PCAP files from remote HTTP servers without authentication. Future versions may include support for Basic Authentication and other security mechanisms.
243
+ mcpcap supports reading PCAP files from remote HTTP servers in two modes:
244
+
245
+ **Direct File Access**: Point directly to a PCAP file URL
246
+ ```bash
247
+ mcpcap --pcap-url https://wiki.wireshark.org/uploads/__moin_import__/attachments/SampleCaptures/dns.cap
248
+ ```
249
+
250
+ **Directory Listing**: Parse HTML directory listings to find PCAP files
251
+ ```bash
252
+ mcpcap --pcap-url http://server.com/pcap-files/
253
+ ```
254
+
255
+ **Supported File Types**: `.pcap`, `.pcapng`, `.cap`
256
+
257
+ **Current Limitations**:
258
+ - HTTP/HTTPS only (no authentication)
259
+ - Directory listings require standard HTML format
260
+ - Files are downloaded temporarily for analysis
261
+
262
+ Future versions may include support for Basic Authentication and other security mechanisms.
174
263
 
175
264
  ## Contributing
176
265
 
@@ -190,8 +279,10 @@ MIT
190
279
  ## Requirements
191
280
 
192
281
  - Python 3.10+
193
- - scapy
194
- - MCP server dependencies (automatically installed)
282
+ - scapy (packet parsing and analysis)
283
+ - requests (HTTP remote file access)
284
+ - fastmcp (MCP server framework)
285
+ - All dependencies are automatically installed via pip
195
286
 
196
287
  ## Support
197
288
 
@@ -42,10 +42,26 @@ uvx mcpcap
42
42
 
43
43
  1. **Start the MCP Server**:
44
44
 
45
+ **Local PCAP file:**
46
+ ```bash
47
+ mcpcap --pcap-path /path/to/specific/file.pcap
48
+ ```
49
+
50
+ **Local PCAP directory:**
45
51
  ```bash
46
52
  mcpcap --pcap-path /path/to/pcap/files
47
53
  ```
48
54
 
55
+ **Remote PCAP file:**
56
+ ```bash
57
+ mcpcap --pcap-url https://example.com/sample.pcap
58
+ ```
59
+
60
+ **With advanced options:**
61
+ ```bash
62
+ mcpcap --pcap-path /path/to/pcaps --max-packets 100 --protocols dns
63
+ ```
64
+
49
65
  2. **Connect your LLM client** to the MCP server
50
66
 
51
67
  3. **Ask questions** about your network traffic:
@@ -78,27 +94,80 @@ The DNS module analyzes Domain Name System packets in PCAP files.
78
94
 
79
95
  ### PCAP Sources
80
96
 
81
- **Local Directory**:
97
+ mcpcap supports multiple ways to specify PCAP data sources:
82
98
 
99
+ **Local PCAP File**:
100
+ ```bash
101
+ mcpcap --pcap-path /local/path/to/specific.pcap
102
+ ```
103
+
104
+ **Local Directory**:
83
105
  ```bash
84
106
  mcpcap --pcap-path /local/path/to/pcaps
85
107
  ```
86
108
 
87
- **Remote HTTP Server**:
109
+ **Remote PCAP File (Direct Link)**:
110
+ ```bash
111
+ mcpcap --pcap-url https://wiki.wireshark.org/uploads/dns.cap
112
+ ```
88
113
 
114
+ **Remote Directory Listing**:
89
115
  ```bash
90
116
  mcpcap --pcap-url http://example.com/pcaps/
91
117
  ```
92
118
 
93
- ### Module Selection
119
+ ### Analysis Options
94
120
 
121
+ **Module Selection**:
95
122
  ```bash
96
123
  mcpcap --modules dns --pcap-path /path/to/files
97
124
  ```
98
125
 
126
+ **Protocol Filtering**:
127
+ ```bash
128
+ mcpcap --protocols dns --pcap-path /path/to/files
129
+ ```
130
+
131
+ **Packet Limiting** (for large files):
132
+ ```bash
133
+ mcpcap --max-packets 1000 --pcap-path /path/to/files
134
+ ```
135
+
136
+ **Combined Options**:
137
+ ```bash
138
+ mcpcap --pcap-path /data/capture.pcap --max-packets 500 --protocols dns
139
+ ```
140
+
141
+ ## CLI Reference
142
+
143
+ ```bash
144
+ mcpcap [--pcap-path PATH | --pcap-url URL] [OPTIONS]
145
+ ```
146
+
147
+ **Source Options** (choose one):
148
+ - `--pcap-path PATH`: Local PCAP file or directory
149
+ - `--pcap-url URL`: Remote PCAP file URL or directory listing
150
+
151
+ **Analysis Options**:
152
+ - `--modules MODULES`: Comma-separated modules to load (default: dns)
153
+ - `--protocols PROTOCOLS`: Comma-separated protocols to analyze (default: dns)
154
+ - `--max-packets N`: Maximum packets to analyze per file (default: unlimited)
155
+
156
+ **Examples**:
157
+ ```bash
158
+ # Analyze specific file
159
+ mcpcap --pcap-path ./capture.pcap
160
+
161
+ # Remote file with packet limit
162
+ mcpcap --pcap-url https://example.com/dns.cap --max-packets 100
163
+
164
+ # Directory with protocol filter
165
+ mcpcap --pcap-path /captures --protocols dns --modules dns
166
+ ```
167
+
99
168
  ## Example
100
169
 
101
- An example PCAP file (`example.pcap`) containing DNS traffic is included with the project to help you get started.
170
+ An example PCAP file (`dns.pcap`) containing DNS traffic is included in the `examples/` directory to help you get started.
102
171
 
103
172
  ## Architecture
104
173
 
@@ -127,7 +196,26 @@ Future modules might include:
127
196
 
128
197
  ## Remote Access
129
198
 
130
- mcpcap supports reading PCAP files from remote HTTP servers without authentication. Future versions may include support for Basic Authentication and other security mechanisms.
199
+ mcpcap supports reading PCAP files from remote HTTP servers in two modes:
200
+
201
+ **Direct File Access**: Point directly to a PCAP file URL
202
+ ```bash
203
+ mcpcap --pcap-url https://wiki.wireshark.org/uploads/__moin_import__/attachments/SampleCaptures/dns.cap
204
+ ```
205
+
206
+ **Directory Listing**: Parse HTML directory listings to find PCAP files
207
+ ```bash
208
+ mcpcap --pcap-url http://server.com/pcap-files/
209
+ ```
210
+
211
+ **Supported File Types**: `.pcap`, `.pcapng`, `.cap`
212
+
213
+ **Current Limitations**:
214
+ - HTTP/HTTPS only (no authentication)
215
+ - Directory listings require standard HTML format
216
+ - Files are downloaded temporarily for analysis
217
+
218
+ Future versions may include support for Basic Authentication and other security mechanisms.
131
219
 
132
220
  ## Contributing
133
221
 
@@ -147,8 +235,10 @@ MIT
147
235
  ## Requirements
148
236
 
149
237
  - Python 3.10+
150
- - scapy
151
- - MCP server dependencies (automatically installed)
238
+ - scapy (packet parsing and analysis)
239
+ - requests (HTTP remote file access)
240
+ - fastmcp (MCP server framework)
241
+ - All dependencies are automatically installed via pip
152
242
 
153
243
  ## Support
154
244
 
@@ -0,0 +1,2 @@
1
+ # This file ensures the _static directory is tracked by git
2
+ # Static files for Sphinx documentation go here
@@ -52,7 +52,6 @@ html_theme_options = {
52
52
  "canonical_url": "",
53
53
  "analytics_id": "",
54
54
  "logo_only": False,
55
- "display_version": True,
56
55
  "prev_next_buttons_location": "bottom",
57
56
  "style_external_links": False,
58
57
  "vcs_pageview_mode": "",
@@ -57,6 +57,7 @@ mcpcap depends on:
57
57
 
58
58
  - **fastmcp**: MCP server framework
59
59
  - **scapy**: Packet parsing and analysis
60
+ - **requests**: HTTP client for remote PCAP access
60
61
  - **Python 3.10+**: Modern Python features and type hints
61
62
 
62
63
  All dependencies are automatically installed when you install mcpcap.
@@ -144,11 +144,17 @@ Analyzes DNS packets in a PCAP file.
144
144
  ### Server Configuration
145
145
 
146
146
  ```bash
147
- # Basic usage
147
+ # Local directory
148
148
  mcpcap --pcap-path /path/to/pcaps
149
149
 
150
- # Advanced options (coming soon)
151
- mcpcap --pcap-path /path/to/pcaps --max-packets 1000 --protocols dns,http
150
+ # Local file
151
+ mcpcap --pcap-path /path/to/specific.pcap
152
+
153
+ # Remote file
154
+ mcpcap --pcap-url https://example.com/capture.pcap
155
+
156
+ # With analysis options
157
+ mcpcap --pcap-path /path/to/pcaps --max-packets 1000 --protocols dns --modules dns
152
158
  ```
153
159
 
154
160
  ### Client Configuration Examples
@@ -158,16 +164,20 @@ mcpcap --pcap-path /path/to/pcaps --max-packets 1000 --protocols dns,http
158
164
  ```json
159
165
  {
160
166
  "mcpServers": {
167
+ "mcpcap-local-file": {
168
+ "command": "mcpcap",
169
+ "args": ["--pcap-path", "/path/to/specific.pcap", "--max-packets", "500"]
170
+ },
161
171
  "mcpcap-production": {
162
172
  "command": "mcpcap",
163
- "args": ["--pcap-path", "/production/captures"],
173
+ "args": ["--pcap-path", "/production/captures", "--protocols", "dns"],
164
174
  "env": {
165
175
  "LOG_LEVEL": "INFO"
166
176
  }
167
177
  },
168
- "mcpcap-analysis": {
178
+ "mcpcap-remote": {
169
179
  "command": "mcpcap",
170
- "args": ["--pcap-path", "/analysis/workspace"]
180
+ "args": ["--pcap-url", "https://example.com/samples/dns.cap"]
171
181
  }
172
182
  }
173
183
  }
@@ -8,24 +8,40 @@ Get up and running with mcpcap in minutes!
8
8
  pip install mcpcap
9
9
  ```
10
10
 
11
- ## 2. Prepare Your PCAP Files
11
+ ## 2. Choose Your PCAP Source
12
12
 
13
- Create a directory with your PCAP files:
13
+ mcpcap supports multiple PCAP sources:
14
14
 
15
+ **Single PCAP file**:
16
+ ```bash
17
+ # Use a specific PCAP file
18
+ mcpcap --pcap-path ~/Downloads/capture.pcap
19
+ ```
20
+
21
+ **Directory of PCAP files**:
15
22
  ```bash
16
23
  mkdir ~/pcap-analysis
17
24
  # Copy your PCAP files to this directory
18
25
  cp your-capture.pcap ~/pcap-analysis/
26
+ mcpcap --pcap-path ~/pcap-analysis
19
27
  ```
20
28
 
21
- ## 3. Start the MCP Server
22
-
29
+ **Remote PCAP file**:
23
30
  ```bash
24
- mcpcap --pcap-path ~/pcap-analysis
31
+ # Direct link to a PCAP file
32
+ mcpcap --pcap-url https://wiki.wireshark.org/uploads/__moin_import__/attachments/SampleCaptures/dns.cap
25
33
  ```
26
34
 
35
+ ## 3. Start the MCP Server
36
+
27
37
  The server will start and display connection information. Keep this terminal open.
28
38
 
39
+ **With analysis options**:
40
+ ```bash
41
+ # Limit to first 100 packets for faster analysis
42
+ mcpcap --pcap-path ~/pcap-analysis --max-packets 100
43
+ ```
44
+
29
45
  ## 4. Connect with an MCP Client
30
46
 
31
47
  ### Option A: MCP Inspector (Quick Testing)
@@ -34,7 +50,15 @@ Install and run MCP Inspector:
34
50
 
35
51
  ```bash
36
52
  npm install -g @modelcontextprotocol/inspector
53
+
54
+ # Test with local directory
37
55
  npx @modelcontextprotocol/inspector mcpcap --pcap-path ~/pcap-analysis
56
+
57
+ # Test with specific file
58
+ npx @modelcontextprotocol/inspector mcpcap --pcap-path ~/capture.pcap
59
+
60
+ # Test with remote file
61
+ npx @modelcontextprotocol/inspector mcpcap --pcap-url https://example.com/dns.cap
38
62
  ```
39
63
 
40
64
  This opens a web interface where you can test the tools interactively.
@@ -87,7 +111,7 @@ Use the `list_dns_packets` tool with a filename:
87
111
  "stackoverflow.com"
88
112
  ]
89
113
  },
90
- "packets": [...]
114
+ "packets": ["..."]
91
115
  }
92
116
  ```
93
117
 
@@ -133,7 +157,7 @@ Here's a typical analysis workflow:
133
157
 
134
158
  - Explore the [MCP Integration Guide](mcp-integration.md) for detailed client setup
135
159
  - Read the [Analysis Guides](analysis-guides.md) for advanced techniques
136
- - Check out the [Examples](../examples/security-analysis.md) for real-world scenarios
160
+ - Check out the examples directory for real-world scenarios
137
161
 
138
162
  ## Common Issues
139
163
 
@@ -0,0 +1,64 @@
1
+ # mcpcap Examples
2
+
3
+ This directory contains example PCAP files and usage demonstrations.
4
+
5
+ ## Example Files
6
+
7
+ - `dns.pcap` - Sample DNS traffic capture for testing mcpcap functionality
8
+
9
+ ## Usage Examples
10
+
11
+ ### Basic Analysis
12
+
13
+ **Analyze the entire examples directory:**
14
+ ```bash
15
+ mcpcap --pcap-path ./examples
16
+ ```
17
+
18
+ **Analyze specific file:**
19
+ ```bash
20
+ mcpcap --pcap-path ./examples/dns.pcap
21
+ ```
22
+
23
+ **With packet limits for faster testing:**
24
+ ```bash
25
+ mcpcap --pcap-path ./examples/dns.pcap --max-packets 50
26
+ ```
27
+
28
+ ### MCP Client Testing
29
+
30
+ **With MCP Inspector:**
31
+ ```bash
32
+ npm install -g @modelcontextprotocol/inspector
33
+ npx @modelcontextprotocol/inspector mcpcap --pcap-path ./examples/dns.pcap
34
+ ```
35
+
36
+ Then use the web interface to:
37
+ - 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
40
+
41
+ ### Analysis Prompts
42
+
43
+ Use these specialized prompts in your MCP client:
44
+
45
+ - **`security_analysis`** - Focus on threat detection in DNS traffic
46
+ - **`network_troubleshooting`** - Identify DNS performance issues
47
+ - **`forensic_investigation`** - Detailed timeline and attribution analysis
48
+
49
+ ## Creating Your Own Examples
50
+
51
+ To add new example files:
52
+
53
+ 1. Place PCAP files (`.pcap` or `.pcapng`) in this directory
54
+ 2. Update this README with descriptions
55
+ 3. Test with the mcpcap server
56
+
57
+ ## Sample Output
58
+
59
+ When analyzing DNS packets, you'll get structured JSON output including:
60
+
61
+ - Packet timestamps and network details
62
+ - DNS query/response information
63
+ - Statistics (queries, responses, unique domains)
64
+ - Security-relevant metadata
@@ -28,6 +28,7 @@ classifiers = [
28
28
  dependencies = [
29
29
  "fastmcp",
30
30
  "scapy",
31
+ "requests",
31
32
  ]
32
33
 
33
34
  [project.optional-dependencies]
@@ -73,6 +74,7 @@ include = ["mcpcap*"]
73
74
  target-version = "py310"
74
75
  line-length = 88
75
76
  src = ["src", "tests"]
77
+ exclude = ["src/mcpcap/_version.py"]
76
78
 
77
79
  [tool.ruff.lint]
78
80
  select = [
@@ -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.2.2'
32
- __version_tuple__ = version_tuple = (0, 2, 2)
31
+ __version__ = version = '0.3.0'
32
+ __version_tuple__ = version_tuple = (0, 3, 0)
33
33
 
34
- __commit_id__ = commit_id = 'gfe9c89f9a'
34
+ __commit_id__ = commit_id = 'gc1a9a0372'
@@ -0,0 +1,85 @@
1
+ """CLI entry point for mcpcap.
2
+
3
+ This module provides the command-line interface for mcpcap, handling argument parsing
4
+ and server initialization.
5
+ """
6
+
7
+ import argparse
8
+ import sys
9
+
10
+ from .core import Config, MCPServer
11
+
12
+
13
+ def main():
14
+ """Main function to parse arguments and start the MCP server.
15
+
16
+ Parses command-line arguments, initializes the configuration and MCP server,
17
+ and handles graceful shutdown and error conditions.
18
+
19
+ Returns:
20
+ int: Exit code (0 for success, 1 for error)
21
+
22
+ Raises:
23
+ ValueError: If the provided PCAP path is invalid
24
+ KeyboardInterrupt: If the user interrupts the server
25
+ Exception: For any unexpected errors during server operation
26
+ """
27
+ parser = argparse.ArgumentParser(description="mcpcap MCP Server")
28
+
29
+ # PCAP source options (mutually exclusive)
30
+ source_group = parser.add_mutually_exclusive_group(required=True)
31
+ source_group.add_argument(
32
+ "--pcap-path", help="Path to PCAP file or directory containing PCAP files"
33
+ )
34
+ source_group.add_argument(
35
+ "--pcap-url",
36
+ help="HTTP URL to PCAP file (direct link) or directory containing PCAP files",
37
+ )
38
+
39
+ # Analysis options
40
+ parser.add_argument(
41
+ "--modules",
42
+ help="Comma-separated list of modules to load (default: dns)",
43
+ default="dns",
44
+ )
45
+ parser.add_argument(
46
+ "--protocols",
47
+ help="Comma-separated list of protocols to analyze (default: dns)",
48
+ default="dns",
49
+ )
50
+ parser.add_argument(
51
+ "--max-packets",
52
+ type=int,
53
+ help="Maximum number of packets to analyze per file (default: unlimited)",
54
+ )
55
+
56
+ args = parser.parse_args()
57
+
58
+ try:
59
+ # Initialize configuration
60
+ config = Config(
61
+ pcap_path=args.pcap_path,
62
+ 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"],
65
+ max_packets=args.max_packets,
66
+ )
67
+
68
+ # Create and start MCP server
69
+ server = MCPServer(config)
70
+ server.run()
71
+ return 0
72
+
73
+ except ValueError as e:
74
+ print(f"Error: {e}", file=sys.stderr)
75
+ return 1
76
+ except KeyboardInterrupt:
77
+ print("\\nServer stopped by user", file=sys.stderr)
78
+ return 0
79
+ except Exception as e:
80
+ print(f"Unexpected error: {e}", file=sys.stderr)
81
+ return 1
82
+
83
+
84
+ if __name__ == "__main__":
85
+ exit(main())