devport-doctor 0.1.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.
Files changed (50) hide show
  1. devport_doctor-0.1.1/.github/ISSUE_TEMPLATE/bug_report.md +19 -0
  2. devport_doctor-0.1.1/.github/PULL_REQUEST_TEMPLATE.md +11 -0
  3. devport_doctor-0.1.1/.github/workflows/ci.yml +43 -0
  4. devport_doctor-0.1.1/.github/workflows/release.yml +47 -0
  5. devport_doctor-0.1.1/.gitignore +26 -0
  6. devport_doctor-0.1.1/AGENTS.md +29 -0
  7. devport_doctor-0.1.1/CHANGELOG.md +28 -0
  8. devport_doctor-0.1.1/CONTRIBUTING.md +28 -0
  9. devport_doctor-0.1.1/LICENSE +21 -0
  10. devport_doctor-0.1.1/PKG-INFO +183 -0
  11. devport_doctor-0.1.1/README.md +152 -0
  12. devport_doctor-0.1.1/SECURITY.md +14 -0
  13. devport_doctor-0.1.1/assets/banner.svg +143 -0
  14. devport_doctor-0.1.1/docs/architecture.md +29 -0
  15. devport_doctor-0.1.1/docs/decisions/0001-evidence-based-diagnostics.md +16 -0
  16. devport_doctor-0.1.1/docs/demo.svg +35 -0
  17. devport_doctor-0.1.1/docs/requirements.md +23 -0
  18. devport_doctor-0.1.1/pyproject.toml +74 -0
  19. devport_doctor-0.1.1/src/devport/__init__.py +3 -0
  20. devport_doctor-0.1.1/src/devport/cli.py +288 -0
  21. devport_doctor-0.1.1/src/devport/config.py +9 -0
  22. devport_doctor-0.1.1/src/devport/core/__init__.py +1 -0
  23. devport_doctor-0.1.1/src/devport/core/engine.py +370 -0
  24. devport_doctor-0.1.1/src/devport/core/rules.py +117 -0
  25. devport_doctor-0.1.1/src/devport/inspectors/__init__.py +1 -0
  26. devport_doctor-0.1.1/src/devport/inspectors/connectivity.py +65 -0
  27. devport_doctor-0.1.1/src/devport/inspectors/docker.py +137 -0
  28. devport_doctor-0.1.1/src/devport/inspectors/ports.py +56 -0
  29. devport_doctor-0.1.1/src/devport/inspectors/wsl.py +152 -0
  30. devport_doctor-0.1.1/src/devport/mcp_server.py +98 -0
  31. devport_doctor-0.1.1/src/devport/models.py +154 -0
  32. devport_doctor-0.1.1/src/devport/platforms/__init__.py +23 -0
  33. devport_doctor-0.1.1/src/devport/platforms/linux.py +11 -0
  34. devport_doctor-0.1.1/src/devport/platforms/windows.py +11 -0
  35. devport_doctor-0.1.1/src/devport/reporters/__init__.py +1 -0
  36. devport_doctor-0.1.1/src/devport/reporters/json_report.py +8 -0
  37. devport_doctor-0.1.1/src/devport/reporters/markdown.py +65 -0
  38. devport_doctor-0.1.1/src/devport/reporters/terminal.py +33 -0
  39. devport_doctor-0.1.1/tests/integration/test_doctor.py +36 -0
  40. devport_doctor-0.1.1/tests/integration/test_port_inspection.py +37 -0
  41. devport_doctor-0.1.1/tests/unit/test_cli.py +149 -0
  42. devport_doctor-0.1.1/tests/unit/test_connectivity.py +69 -0
  43. devport_doctor-0.1.1/tests/unit/test_docker.py +104 -0
  44. devport_doctor-0.1.1/tests/unit/test_engine.py +307 -0
  45. devport_doctor-0.1.1/tests/unit/test_mcp_server.py +134 -0
  46. devport_doctor-0.1.1/tests/unit/test_platforms.py +19 -0
  47. devport_doctor-0.1.1/tests/unit/test_ports.py +74 -0
  48. devport_doctor-0.1.1/tests/unit/test_reporters.py +88 -0
  49. devport_doctor-0.1.1/tests/unit/test_wsl.py +98 -0
  50. devport_doctor-0.1.1/uv.lock +1784 -0
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report a bug in DevPort Doctor
4
+ title: "fix: "
5
+ labels: bug
6
+ ---
7
+
8
+ ## Description
9
+ <!-- A clear description of the bug -->
10
+
11
+ ## Steps to Reproduce
12
+ 1.
13
+ 2.
14
+
15
+ ## Expected Behavior
16
+
17
+ ## Environment
18
+ - OS:
19
+ - Python version:
@@ -0,0 +1,11 @@
1
+ ## Summary
2
+ <!-- Briefly describe what this PR does -->
3
+
4
+ ## Related Issue
5
+ <!-- Link the issue, e.g. Closes #1 -->
6
+
7
+ ## Checklist
8
+ - [ ] `uv run ruff check .` passes
9
+ - [ ] `uv run ruff format --check .` passes
10
+ - [ ] `uv run pyright` passes
11
+ - [ ] `uv run pytest` passes
@@ -0,0 +1,43 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ quality-and-tests:
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os: [ubuntu-latest, windows-latest]
15
+
16
+ runs-on: ${{ matrix.os }}
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@v4
23
+
24
+ - name: Set up Python
25
+ run: uv python install 3.11
26
+
27
+ - name: Install dependencies
28
+ run: uv sync --locked || uv sync
29
+
30
+ - name: Lint (Ruff)
31
+ run: uv run ruff check .
32
+
33
+ - name: Format check (Ruff)
34
+ run: uv run ruff format --check .
35
+
36
+ - name: Type check (Pyright)
37
+ run: uv run pyright
38
+
39
+ - name: Run tests (Pytest)
40
+ run: uv run pytest
41
+
42
+ - name: Build package
43
+ run: uv build
@@ -0,0 +1,47 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: write
10
+
11
+ jobs:
12
+ build-and-release:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Install uv
18
+ uses: astral-sh/setup-uv@v4
19
+
20
+ - name: Set up Python
21
+ run: uv python install 3.11
22
+
23
+ - name: Install dependencies
24
+ run: uv sync --locked || uv sync
25
+
26
+ - name: Verify quality & tests
27
+ run: |
28
+ uv run ruff check .
29
+ uv run ruff format --check .
30
+ uv run pyright
31
+ uv run pytest
32
+
33
+ - name: Build distributions
34
+ run: uv build
35
+
36
+ - name: Create GitHub Release
37
+ uses: softprops/action-gh-release@v2
38
+ with:
39
+ generate_release_notes: true
40
+ files: |
41
+ dist/*.whl
42
+ dist/*.tar.gz
43
+
44
+ - name: Publish to PyPI
45
+ env:
46
+ UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
47
+ run: uv publish
@@ -0,0 +1,26 @@
1
+ # OS
2
+ .DS_Store
3
+ Thumbs.db
4
+
5
+ # Editors
6
+ .vscode/
7
+ .idea/
8
+ *.swp
9
+ *.swo
10
+
11
+ # Environment
12
+ .env
13
+ .env.local
14
+ .env.*.local
15
+
16
+ # Dependencies & Build
17
+ .venv/
18
+ .pytest_cache/
19
+ .ruff_cache/
20
+ .coverage
21
+ htmlcov/
22
+ node_modules/
23
+ __pycache__/
24
+ *.pyc
25
+ dist/
26
+ build/
@@ -0,0 +1,29 @@
1
+ # AGENTS.md
2
+
3
+ Guidelines for coding agents contributing to **DevPort Doctor**.
4
+
5
+ ## Architecture & Code Standards
6
+
7
+ - **Package layout:** Source lives in `src/devport/`, tests in `tests/unit/` and `tests/integration/`.
8
+ - **Separation of concerns:** Keep CLI (`cli.py`) and MCP (`mcp_server.py`) thin wrappers over the shared diagnostic engine and inspectors.
9
+ - **Type safety:** All public functions and models must be strictly typed (`pyright` standard mode). Use Pydantic v2 models for structured diagnostic results.
10
+ - **Evidence-based diagnostics:** Distinguish `PASS`, `FAIL`, `WARN`, `SKIP`, and `UNKNOWN`. Never assert a definitive root cause without collected evidence.
11
+ - **Cross-platform support:** Primary target is Windows, with Linux compatibility. Isolate OS-specific logic in platform adapters.
12
+
13
+ ## Security & Privacy Rules
14
+
15
+ - All diagnostics must remain **read-only** by default (never auto-kill processes or mutate firewall/network settings).
16
+ - Never use `shell=True` with `subprocess`; always pass argument lists and explicit timeouts.
17
+ - Validate all CLI and MCP inputs; restrict initial connectivity checks to local development targets.
18
+ - Never expose environment secrets, API keys, or sensitive process arguments in reports.
19
+
20
+ ## Required Verification
21
+
22
+ Before finishing any change, verify all checks pass:
23
+
24
+ ```bash
25
+ uv run ruff check .
26
+ uv run ruff format --check .
27
+ uv run pyright
28
+ uv run pytest
29
+ ```
@@ -0,0 +1,28 @@
1
+ # Changelog
2
+
3
+ All notable changes to **DevPort Doctor** will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.1] - 2026-12-03
9
+
10
+ ### Added
11
+ - Security and coverage dev tooling (`bandit`, `pip-audit`, `pytest-cov`) and expanded CLI/rule tests (91% coverage).
12
+ - PyPI package metadata (`keywords`, `classifiers`, `[project.urls]`) and automated `uv publish` step in `release.yml`.
13
+
14
+ ### Fixed
15
+ - Resolved full executable paths via `shutil.which` in Docker and WSL inspectors before invoking `subprocess.run`.
16
+ - Removed tracked `.coverage` artifact and ignored coverage files in `.gitignore`.
17
+
18
+ ## [0.1.0] - 2026-12-02
19
+
20
+ ### Added
21
+ - CLI entrypoint (`devport`) with `--help` and `--version` (`-V`).
22
+ - TCP listening port & process discovery (`devport list`, `devport inspect <port>`) via `psutil` and `socket`.
23
+ - Evidence-based diagnostic engine (`devport doctor <port>`) detecting unused ports, IPv4/IPv6 binding mismatches, timeouts, and permission-restricted sockets.
24
+ - Docker daemon and published/unpublished container port inspection (`devport docker`).
25
+ - Windows Subsystem for Linux (WSL) distribution and listening port inspection (`devport wsl`).
26
+ - Structured output formats: Rich terminal, JSON (`--format json`), and sanitized Markdown (`--format markdown`).
27
+ - Read-only MCP server (`devport mcp`) exposing `list_ports`, `inspect_port`, `diagnose_port`, `inspect_docker_ports`, and `inspect_wsl_ports`.
28
+ - Cross-platform GitHub Actions CI (`ubuntu-latest` and `windows-latest`) running Ruff, Pyright, Pytest, and `uv build`.
@@ -0,0 +1,28 @@
1
+ # Contributing to DevPort Doctor
2
+
3
+ Contributions are welcome! Please follow the engineering workflow below.
4
+
5
+ ## Development Setup
6
+
7
+ ```bash
8
+ git clone https://github.com/jeromeprince777/DevPort-Doctor.git
9
+ cd DevPort-Doctor
10
+ uv sync
11
+ ```
12
+
13
+ ## Workflow
14
+
15
+ 1. Pick an open issue (or open one describing the bug/feature).
16
+ 2. Create a branch from `main` using a descriptive prefix (`feat/`, `fix/`, `docs/`, `test/`, `chore/`).
17
+ 3. Keep changes modular, strictly typed (`pyright`), and read-only by default.
18
+ 4. Add unit or integration tests for new behavior.
19
+ 5. Run all quality checks before opening a Pull Request:
20
+
21
+ ```bash
22
+ uv run ruff check .
23
+ uv run ruff format --check .
24
+ uv run pyright
25
+ uv run pytest
26
+ ```
27
+
28
+ 6. Use [Conventional Commits](https://www.conventionalcommits.org/) (e.g., `feat: ...`, `fix: ...`, `docs: ...`) and reference the issue (`Closes #<id>`) in your PR description.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jerome Prince
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.
@@ -0,0 +1,183 @@
1
+ Metadata-Version: 2.5
2
+ Name: devport-doctor
3
+ Version: 0.1.1
4
+ Summary: Diagnose local development ports, processes, and connectivity issues with CLI and MCP support.
5
+ Project-URL: Homepage, https://github.com/jeromeprince777/DevPort-Doctor
6
+ Project-URL: Repository, https://github.com/jeromeprince777/DevPort-Doctor
7
+ Project-URL: Issues, https://github.com/jeromeprince777/DevPort-Doctor/issues
8
+ Project-URL: Changelog, https://github.com/jeromeprince777/DevPort-Doctor/blob/main/CHANGELOG.md
9
+ Author-email: Jerome Prince <jeromeprince777@gmail.com>
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: cli,diagnostics,docker,localhost,mcp,networking,ports,wsl
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Software Development :: Debuggers
23
+ Classifier: Topic :: System :: Networking
24
+ Requires-Python: >=3.11
25
+ Requires-Dist: mcp>=1.0.0
26
+ Requires-Dist: psutil>=6.0.0
27
+ Requires-Dist: pydantic>=2.8.0
28
+ Requires-Dist: rich>=13.7.0
29
+ Requires-Dist: typer>=0.12.0
30
+ Description-Content-Type: text/markdown
31
+
32
+ <div align="center">
33
+ <img src="./assets/banner.svg" alt="DevPort Doctor Animated Banner" width="100%" />
34
+ </div>
35
+
36
+ # DevPort Doctor
37
+
38
+ Local-first CLI and MCP toolkit for diagnosing port conflicts, localhost connectivity failures, Docker port mappings, and WSL networking issues.
39
+
40
+ ![DevPort Doctor Terminal Demo](https://raw.githubusercontent.com/jeromeprince777/DevPort-Doctor/main/docs/demo.svg)
41
+
42
+ ## Why DevPort Doctor?
43
+
44
+ Most port utilities only kill processes (`killport`, `kill-port`) or print raw socket tables (`netstat`, `lsof`). **DevPort Doctor** performs **read-only, evidence-based diagnostics** across your local stack:
45
+
46
+ - **Process & Port Inspection** — List listening TCP ports, owning processes, and PIDs (`psutil`) while gracefully handling permission-restricted system sockets.
47
+ - **IPv4 vs. IPv6 Diagnostics** — Detect occupied ports, connection refusals, timeouts, and `127.0.0.1` vs. `::1` binding mismatches (`socket`).
48
+ - **Docker & WSL Awareness** — Inspect published vs. unpublished container ports and Windows-to-WSL listening sockets (`subprocess`, `shell=False`).
49
+ - **Multiple Output Formats** — Rich terminal reports, structured JSON (`--format json`), and sanitized Markdown exports (`--format markdown`) with automatic home-path and credential redaction.
50
+ - **MCP Integration** — Expose read-only diagnostic tools to AI coding agents over stdio (`devport mcp`) with zero external APIs.
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ # Install globally as a CLI tool (once published to PyPI)
56
+ uv tool install devport-doctor
57
+
58
+ # Or run from source
59
+ git clone https://github.com/jeromeprince777/DevPort-Doctor.git
60
+ cd DevPort-Doctor
61
+ uv sync
62
+ uv run devport --help
63
+ ```
64
+
65
+ ## Usage
66
+
67
+ ```bash
68
+ # Show version and help
69
+ devport --version
70
+ devport --help
71
+
72
+ # List all listening TCP ports (or filter by port)
73
+ devport list
74
+ devport list --port 3000
75
+
76
+ # Inspect a port's listeners and IPv4/IPv6 reachability
77
+ devport inspect 3000
78
+
79
+ # Run full evidence-based diagnostics
80
+ devport doctor 3000
81
+ devport doctor 3000 --host localhost
82
+ devport doctor 3000 --format json
83
+ devport doctor 3000 --format markdown
84
+
85
+ # Inspect Docker containers or WSL distributions
86
+ devport docker
87
+ devport wsl
88
+
89
+ # Start the read-only MCP server (stdio)
90
+ devport mcp
91
+ ```
92
+
93
+ ### Example Output
94
+
95
+ ```text
96
+ DevPort Doctor v0.1.0
97
+
98
+ Target: localhost:18789
99
+
100
+ [PASS] Host resolution
101
+ ::1
102
+ 127.0.0.1
103
+ [WARN] TCP connection
104
+ 127.0.0.1:18789 (IPv4) -> OPEN
105
+ ::1:18789 (IPv6) -> REFUSED
106
+ [PASS] Listening process
107
+ 127.0.0.1:18789 (IPv4) PID=23916 process=node.exe
108
+ [SKIP] Docker diagnostics
109
+ Docker CLI was not found on PATH.
110
+ [SKIP] WSL diagnostics
111
+ WSL is installed, but no Linux distributions are configured.
112
+
113
+ Likely cause:
114
+ Service is reachable on 127.0.0.1 (IPv4) only; ::1 (IPv6) failed (IPv4/IPv6 binding mismatch).
115
+
116
+ Recommendation:
117
+ Configure the server to bind to all interfaces (0.0.0.0 or ::), or connect explicitly via 127.0.0.1:18789.
118
+ ```
119
+
120
+ ## MCP Server Configuration
121
+
122
+ Add **DevPort Doctor** to your MCP client configuration (e.g., Antigravity, Claude Desktop, or Cursor):
123
+
124
+ ```json
125
+ {
126
+ "mcpServers": {
127
+ "devport-doctor": {
128
+ "command": "devport",
129
+ "args": ["mcp"]
130
+ }
131
+ }
132
+ }
133
+ ```
134
+
135
+ Exposed read-only tools: `list_ports`, `inspect_port`, `diagnose_port`, `inspect_docker_ports`, and `inspect_wsl_ports`.
136
+
137
+ ## Architecture
138
+
139
+ ```mermaid
140
+ flowchart TD
141
+ A[CLI Interface] --> C[Diagnostic Engine]
142
+ B[MCP Server] --> C
143
+ C --> D[Port Inspector]
144
+ C --> E[Connectivity Tester]
145
+ C --> F[Docker Inspector]
146
+ C --> G[WSL Inspector]
147
+ D --> H[Diagnostic Rules]
148
+ E --> H
149
+ F --> H
150
+ G --> H
151
+ H --> I[Structured Results]
152
+ I --> J[Rich Terminal Output]
153
+ I --> K[JSON / Markdown Reports]
154
+ ```
155
+
156
+ See [docs/architecture.md](docs/architecture.md), [docs/requirements.md](docs/requirements.md), and [ADR 0001](docs/decisions/0001-evidence-based-diagnostics.md) for design details.
157
+
158
+ ## Supported Platforms & Known Limitations
159
+
160
+ - **Primary platform:** Windows 11 (verified locally + `windows-latest` CI).
161
+ - **Secondary platform:** Linux (verified via `ubuntu-latest` CI).
162
+ - **macOS:** Not yet tested or officially supported.
163
+ - **Docker & WSL:** Verified via unit tests with mocked command output and graceful fallback checks on Windows; live container/distro integration depends on local Docker Desktop / WSL2 setup.
164
+ - **Permissions:** Inspecting system-owned sockets (e.g., Windows `System` PID 4) may require elevated privileges; DevPort Doctor reports `Access denied` / `UNKNOWN` rather than failing.
165
+
166
+ ## Development
167
+
168
+ ```bash
169
+ uv run ruff check .
170
+ uv run ruff format --check .
171
+ uv run pyright
172
+ uv run pytest
173
+ uv build
174
+ ```
175
+
176
+ ## Contributing & Security
177
+
178
+ - See [CONTRIBUTING.md](CONTRIBUTING.md) for development workflow and PR guidelines.
179
+ - See [SECURITY.md](SECURITY.md) for vulnerability reporting and security guarantees.
180
+
181
+ ## License
182
+
183
+ [MIT](LICENSE)
@@ -0,0 +1,152 @@
1
+ <div align="center">
2
+ <img src="./assets/banner.svg" alt="DevPort Doctor Animated Banner" width="100%" />
3
+ </div>
4
+
5
+ # DevPort Doctor
6
+
7
+ Local-first CLI and MCP toolkit for diagnosing port conflicts, localhost connectivity failures, Docker port mappings, and WSL networking issues.
8
+
9
+ ![DevPort Doctor Terminal Demo](https://raw.githubusercontent.com/jeromeprince777/DevPort-Doctor/main/docs/demo.svg)
10
+
11
+ ## Why DevPort Doctor?
12
+
13
+ Most port utilities only kill processes (`killport`, `kill-port`) or print raw socket tables (`netstat`, `lsof`). **DevPort Doctor** performs **read-only, evidence-based diagnostics** across your local stack:
14
+
15
+ - **Process & Port Inspection** — List listening TCP ports, owning processes, and PIDs (`psutil`) while gracefully handling permission-restricted system sockets.
16
+ - **IPv4 vs. IPv6 Diagnostics** — Detect occupied ports, connection refusals, timeouts, and `127.0.0.1` vs. `::1` binding mismatches (`socket`).
17
+ - **Docker & WSL Awareness** — Inspect published vs. unpublished container ports and Windows-to-WSL listening sockets (`subprocess`, `shell=False`).
18
+ - **Multiple Output Formats** — Rich terminal reports, structured JSON (`--format json`), and sanitized Markdown exports (`--format markdown`) with automatic home-path and credential redaction.
19
+ - **MCP Integration** — Expose read-only diagnostic tools to AI coding agents over stdio (`devport mcp`) with zero external APIs.
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ # Install globally as a CLI tool (once published to PyPI)
25
+ uv tool install devport-doctor
26
+
27
+ # Or run from source
28
+ git clone https://github.com/jeromeprince777/DevPort-Doctor.git
29
+ cd DevPort-Doctor
30
+ uv sync
31
+ uv run devport --help
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ```bash
37
+ # Show version and help
38
+ devport --version
39
+ devport --help
40
+
41
+ # List all listening TCP ports (or filter by port)
42
+ devport list
43
+ devport list --port 3000
44
+
45
+ # Inspect a port's listeners and IPv4/IPv6 reachability
46
+ devport inspect 3000
47
+
48
+ # Run full evidence-based diagnostics
49
+ devport doctor 3000
50
+ devport doctor 3000 --host localhost
51
+ devport doctor 3000 --format json
52
+ devport doctor 3000 --format markdown
53
+
54
+ # Inspect Docker containers or WSL distributions
55
+ devport docker
56
+ devport wsl
57
+
58
+ # Start the read-only MCP server (stdio)
59
+ devport mcp
60
+ ```
61
+
62
+ ### Example Output
63
+
64
+ ```text
65
+ DevPort Doctor v0.1.0
66
+
67
+ Target: localhost:18789
68
+
69
+ [PASS] Host resolution
70
+ ::1
71
+ 127.0.0.1
72
+ [WARN] TCP connection
73
+ 127.0.0.1:18789 (IPv4) -> OPEN
74
+ ::1:18789 (IPv6) -> REFUSED
75
+ [PASS] Listening process
76
+ 127.0.0.1:18789 (IPv4) PID=23916 process=node.exe
77
+ [SKIP] Docker diagnostics
78
+ Docker CLI was not found on PATH.
79
+ [SKIP] WSL diagnostics
80
+ WSL is installed, but no Linux distributions are configured.
81
+
82
+ Likely cause:
83
+ Service is reachable on 127.0.0.1 (IPv4) only; ::1 (IPv6) failed (IPv4/IPv6 binding mismatch).
84
+
85
+ Recommendation:
86
+ Configure the server to bind to all interfaces (0.0.0.0 or ::), or connect explicitly via 127.0.0.1:18789.
87
+ ```
88
+
89
+ ## MCP Server Configuration
90
+
91
+ Add **DevPort Doctor** to your MCP client configuration (e.g., Antigravity, Claude Desktop, or Cursor):
92
+
93
+ ```json
94
+ {
95
+ "mcpServers": {
96
+ "devport-doctor": {
97
+ "command": "devport",
98
+ "args": ["mcp"]
99
+ }
100
+ }
101
+ }
102
+ ```
103
+
104
+ Exposed read-only tools: `list_ports`, `inspect_port`, `diagnose_port`, `inspect_docker_ports`, and `inspect_wsl_ports`.
105
+
106
+ ## Architecture
107
+
108
+ ```mermaid
109
+ flowchart TD
110
+ A[CLI Interface] --> C[Diagnostic Engine]
111
+ B[MCP Server] --> C
112
+ C --> D[Port Inspector]
113
+ C --> E[Connectivity Tester]
114
+ C --> F[Docker Inspector]
115
+ C --> G[WSL Inspector]
116
+ D --> H[Diagnostic Rules]
117
+ E --> H
118
+ F --> H
119
+ G --> H
120
+ H --> I[Structured Results]
121
+ I --> J[Rich Terminal Output]
122
+ I --> K[JSON / Markdown Reports]
123
+ ```
124
+
125
+ See [docs/architecture.md](docs/architecture.md), [docs/requirements.md](docs/requirements.md), and [ADR 0001](docs/decisions/0001-evidence-based-diagnostics.md) for design details.
126
+
127
+ ## Supported Platforms & Known Limitations
128
+
129
+ - **Primary platform:** Windows 11 (verified locally + `windows-latest` CI).
130
+ - **Secondary platform:** Linux (verified via `ubuntu-latest` CI).
131
+ - **macOS:** Not yet tested or officially supported.
132
+ - **Docker & WSL:** Verified via unit tests with mocked command output and graceful fallback checks on Windows; live container/distro integration depends on local Docker Desktop / WSL2 setup.
133
+ - **Permissions:** Inspecting system-owned sockets (e.g., Windows `System` PID 4) may require elevated privileges; DevPort Doctor reports `Access denied` / `UNKNOWN` rather than failing.
134
+
135
+ ## Development
136
+
137
+ ```bash
138
+ uv run ruff check .
139
+ uv run ruff format --check .
140
+ uv run pyright
141
+ uv run pytest
142
+ uv build
143
+ ```
144
+
145
+ ## Contributing & Security
146
+
147
+ - See [CONTRIBUTING.md](CONTRIBUTING.md) for development workflow and PR guidelines.
148
+ - See [SECURITY.md](SECURITY.md) for vulnerability reporting and security guarantees.
149
+
150
+ ## License
151
+
152
+ [MIT](LICENSE)
@@ -0,0 +1,14 @@
1
+ # Security Policy
2
+
3
+ ## Security Guarantees
4
+
5
+ DevPort Doctor is designed as a **read-only local diagnostic tool**:
6
+
7
+ - **No destructive actions:** Never terminates processes or modifies firewall/network configuration.
8
+ - **Local-only targets:** Connectivity diagnostics are restricted to local development addresses (`localhost`, `127.0.0.1`, `::1`, `0.0.0.0`).
9
+ - **Safe subprocess execution:** External commands (`docker`, `wsl.exe`) are invoked with argument lists (`shell=False`) and explicit timeouts.
10
+ - **Privacy-first reporting:** Markdown exports redact local user home paths and credential-like patterns.
11
+
12
+ ## Reporting a Vulnerability
13
+
14
+ If you discover a security vulnerability, please do not open a public issue with exploit details. Contact the maintainer directly at `jeromeprince777@gmail.com` with steps to reproduce.