harbormaster-mcp 1.0.0a9__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 (77) hide show
  1. harbormaster_mcp-1.0.0a9/.github/workflows/ci.yml +310 -0
  2. harbormaster_mcp-1.0.0a9/.github/workflows/publish.yml +104 -0
  3. harbormaster_mcp-1.0.0a9/.gitignore +7 -0
  4. harbormaster_mcp-1.0.0a9/LICENSE +21 -0
  5. harbormaster_mcp-1.0.0a9/PKG-INFO +239 -0
  6. harbormaster_mcp-1.0.0a9/README.md +193 -0
  7. harbormaster_mcp-1.0.0a9/docs/agent-request-payload-spike.md +144 -0
  8. harbormaster_mcp-1.0.0a9/docs/architecture-harbormaster.md +482 -0
  9. harbormaster_mcp-1.0.0a9/docs/design-harbormaster.md +189 -0
  10. harbormaster_mcp-1.0.0a9/docs/fleetq-bridge-contract.md +148 -0
  11. harbormaster_mcp-1.0.0a9/docs/fleetq-relay-protocol.md +160 -0
  12. harbormaster_mcp-1.0.0a9/docs/legacy/architecture.md +140 -0
  13. harbormaster_mcp-1.0.0a9/docs/legacy/design.md +64 -0
  14. harbormaster_mcp-1.0.0a9/docs/legacy/sprint-retro.md +74 -0
  15. harbormaster_mcp-1.0.0a9/docs/legacy/test-plan.md +69 -0
  16. harbormaster_mcp-1.0.0a9/docs/publishing.md +88 -0
  17. harbormaster_mcp-1.0.0a9/docs/sprint-retro-harbormaster-v1.0.0a1.md +139 -0
  18. harbormaster_mcp-1.0.0a9/docs/sprint-retro-harbormaster-v1.0.0a2.md +86 -0
  19. harbormaster_mcp-1.0.0a9/docs/sprint-retro-harbormaster-v1.0.0a3.md +106 -0
  20. harbormaster_mcp-1.0.0a9/docs/sprint-retro-harbormaster-v1.0.0a4.md +99 -0
  21. harbormaster_mcp-1.0.0a9/docs/sprint-retro-harbormaster-v1.0.0a5.md +104 -0
  22. harbormaster_mcp-1.0.0a9/docs/sprint-retro-harbormaster-v1.0.0a6.md +100 -0
  23. harbormaster_mcp-1.0.0a9/docs/sprint-retro-harbormaster-v1.0.0a7.md +92 -0
  24. harbormaster_mcp-1.0.0a9/docs/sprint-retro-harbormaster-v1.0.0a8.md +89 -0
  25. harbormaster_mcp-1.0.0a9/docs/sprint-retro-harbormaster-v1.0.0a9.md +127 -0
  26. harbormaster_mcp-1.0.0a9/docs/test-plan-harbormaster.md +216 -0
  27. harbormaster_mcp-1.0.0a9/pyproject.toml +102 -0
  28. harbormaster_mcp-1.0.0a9/src/harbormaster/__init__.py +7 -0
  29. harbormaster_mcp-1.0.0a9/src/harbormaster/__main__.py +269 -0
  30. harbormaster_mcp-1.0.0a9/src/harbormaster/backends/__init__.py +26 -0
  31. harbormaster_mcp-1.0.0a9/src/harbormaster/backends/base.py +74 -0
  32. harbormaster_mcp-1.0.0a9/src/harbormaster/backends/claude.py +141 -0
  33. harbormaster_mcp-1.0.0a9/src/harbormaster/config.py +117 -0
  34. harbormaster_mcp-1.0.0a9/src/harbormaster/fleetq/__init__.py +22 -0
  35. harbormaster_mcp-1.0.0a9/src/harbormaster/fleetq/bridge.py +153 -0
  36. harbormaster_mcp-1.0.0a9/src/harbormaster/fleetq/endpoints.py +47 -0
  37. harbormaster_mcp-1.0.0a9/src/harbormaster/fleetq/heartbeat.py +113 -0
  38. harbormaster_mcp-1.0.0a9/src/harbormaster/fleetq/relay.py +222 -0
  39. harbormaster_mcp-1.0.0a9/src/harbormaster/projects.py +261 -0
  40. harbormaster_mcp-1.0.0a9/src/harbormaster/server.py +14 -0
  41. harbormaster_mcp-1.0.0a9/src/harbormaster/ssh.py +136 -0
  42. harbormaster_mcp-1.0.0a9/src/harbormaster/tools/__init__.py +23 -0
  43. harbormaster_mcp-1.0.0a9/src/harbormaster/tools/_helpers.py +100 -0
  44. harbormaster_mcp-1.0.0a9/src/harbormaster/tools/ask.py +38 -0
  45. harbormaster_mcp-1.0.0a9/src/harbormaster/tools/delegate.py +46 -0
  46. harbormaster_mcp-1.0.0a9/src/harbormaster/tools/fan_out.py +218 -0
  47. harbormaster_mcp-1.0.0a9/src/harbormaster/tools/hosts.py +27 -0
  48. harbormaster_mcp-1.0.0a9/src/harbormaster/tools/projects.py +173 -0
  49. harbormaster_mcp-1.0.0a9/src/harbormaster/transport.py +103 -0
  50. harbormaster_mcp-1.0.0a9/src/harbormaster/ui/__init__.py +9 -0
  51. harbormaster_mcp-1.0.0a9/src/harbormaster/ui/app.py +39 -0
  52. harbormaster_mcp-1.0.0a9/src/harbormaster/ui/cli.py +146 -0
  53. harbormaster_mcp-1.0.0a9/src/harbormaster/ui/routes.py +162 -0
  54. harbormaster_mcp-1.0.0a9/src/harbormaster/ui/templates/base.html +36 -0
  55. harbormaster_mcp-1.0.0a9/src/harbormaster/ui/templates/dashboard.html +62 -0
  56. harbormaster_mcp-1.0.0a9/tests/conftest.py +8 -0
  57. harbormaster_mcp-1.0.0a9/tests/fixtures/fake_claude.py +63 -0
  58. harbormaster_mcp-1.0.0a9/tests/integration/__init__.py +0 -0
  59. harbormaster_mcp-1.0.0a9/tests/integration/test_e2e_fake_claude.py +189 -0
  60. harbormaster_mcp-1.0.0a9/tests/integration/test_real_projects.py +58 -0
  61. harbormaster_mcp-1.0.0a9/tests/unit/__init__.py +0 -0
  62. harbormaster_mcp-1.0.0a9/tests/unit/test_backends.py +178 -0
  63. harbormaster_mcp-1.0.0a9/tests/unit/test_bridge.py +230 -0
  64. harbormaster_mcp-1.0.0a9/tests/unit/test_cli.py +55 -0
  65. harbormaster_mcp-1.0.0a9/tests/unit/test_config.py +79 -0
  66. harbormaster_mcp-1.0.0a9/tests/unit/test_config_validation.py +61 -0
  67. harbormaster_mcp-1.0.0a9/tests/unit/test_fan_out.py +165 -0
  68. harbormaster_mcp-1.0.0a9/tests/unit/test_heartbeat.py +208 -0
  69. harbormaster_mcp-1.0.0a9/tests/unit/test_logging.py +126 -0
  70. harbormaster_mcp-1.0.0a9/tests/unit/test_projects.py +229 -0
  71. harbormaster_mcp-1.0.0a9/tests/unit/test_relay.py +423 -0
  72. harbormaster_mcp-1.0.0a9/tests/unit/test_ssh.py +87 -0
  73. harbormaster_mcp-1.0.0a9/tests/unit/test_tools.py +53 -0
  74. harbormaster_mcp-1.0.0a9/tests/unit/test_transport.py +125 -0
  75. harbormaster_mcp-1.0.0a9/tests/unit/test_ui.py +373 -0
  76. harbormaster_mcp-1.0.0a9/tests/unit/test_ui_cli.py +90 -0
  77. harbormaster_mcp-1.0.0a9/uv.lock +1773 -0
@@ -0,0 +1,310 @@
1
+ # Security note: this workflow does NOT consume any untrusted github.event.*
2
+ # fields (titles, bodies, branch labels, commit messages). The only ${{ }}
3
+ # expansions are workflow-defined matrix values and trusted action versions —
4
+ # no user-controlled string flows into a `run:` step. See:
5
+ # https://github.blog/security/vulnerability-research/how-to-catch-github-actions-workflow-injections-before-attackers-do/
6
+
7
+ name: CI
8
+
9
+ on:
10
+ push:
11
+ branches: [main]
12
+ tags: ["v*"]
13
+ pull_request:
14
+ branches: [main]
15
+ workflow_dispatch:
16
+
17
+ concurrency:
18
+ group: ci-${{ github.ref }}
19
+ cancel-in-progress: true
20
+
21
+ permissions:
22
+ contents: read
23
+
24
+ jobs:
25
+ test:
26
+ name: ${{ matrix.os }} · py${{ matrix.python-version }}
27
+ runs-on: ${{ matrix.os }}
28
+ strategy:
29
+ fail-fast: false
30
+ matrix:
31
+ os: [ubuntu-24.04, macos-14]
32
+ python-version: ["3.11", "3.12", "3.13"]
33
+
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+
37
+ - name: Install uv
38
+ uses: astral-sh/setup-uv@v3
39
+ with:
40
+ enable-cache: true
41
+
42
+ - name: Set up Python ${{ matrix.python-version }}
43
+ run: uv python install ${{ matrix.python-version }}
44
+
45
+ - name: Install dependencies
46
+ run: uv sync --extra dev --python ${{ matrix.python-version }}
47
+
48
+ - name: Lint (ruff)
49
+ run: uv run --python ${{ matrix.python-version }} ruff check src/ tests/
50
+
51
+ - name: Type check (mypy --strict)
52
+ run: uv run --python ${{ matrix.python-version }} mypy --strict src/harbormaster/
53
+
54
+ - name: Tests (pytest)
55
+ run: uv run --python ${{ matrix.python-version }} pytest tests/ -v
56
+
57
+ smoke-http:
58
+ name: HTTP transport smoke test (SSE + bearer auth)
59
+ runs-on: ubuntu-24.04
60
+ needs: test
61
+ steps:
62
+ - uses: actions/checkout@v4
63
+
64
+ - name: Install uv
65
+ uses: astral-sh/setup-uv@v3
66
+ with:
67
+ enable-cache: true
68
+
69
+ - name: Install dependencies
70
+ run: uv sync --extra dev
71
+
72
+ - name: Generate auth token
73
+ id: token
74
+ # Workflow-internal random — not user input. Stored in step output for
75
+ # downstream env: bindings (no ${{ }} interpolation inside run: scripts).
76
+ run: |
77
+ {
78
+ echo "token=$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
79
+ } >> "$GITHUB_OUTPUT"
80
+
81
+ - name: Start harbormaster-mcp in background
82
+ env:
83
+ HARBORMASTER_MCP_TOKEN: ${{ steps.token.outputs.token }}
84
+ run: |
85
+ uv run harbormaster-mcp --transport sse --port 17532 &
86
+ echo "HMS_PID=$!" >> "$GITHUB_ENV"
87
+ # Poll until the bearer middleware is live (max 15s)
88
+ for _ in $(seq 1 30); do
89
+ status=$(curl -s -o /dev/null -w '%{http_code}' --max-time 1 http://127.0.0.1:17532/sse || echo 0)
90
+ if [ "$status" = "401" ]; then
91
+ echo "Server up — auth middleware is rejecting unauth requests"
92
+ exit 0
93
+ fi
94
+ sleep 0.5
95
+ done
96
+ echo "Server did not start within 15s"
97
+ exit 1
98
+
99
+ - name: Reject request without Authorization header
100
+ run: |
101
+ status=$(curl -s -o /dev/null -w '%{http_code}' --max-time 5 http://127.0.0.1:17532/sse)
102
+ test "$status" = "401" || { echo "Expected 401, got $status"; exit 1; }
103
+
104
+ - name: Reject request with wrong bearer token
105
+ run: |
106
+ status=$(curl -s -o /dev/null -w '%{http_code}' --max-time 5 \
107
+ -H 'Authorization: Bearer obviously-wrong' \
108
+ http://127.0.0.1:17532/sse)
109
+ test "$status" = "401" || { echo "Expected 401, got $status"; exit 1; }
110
+
111
+ - name: Accept request with correct bearer token
112
+ env:
113
+ TOKEN: ${{ steps.token.outputs.token }}
114
+ run: |
115
+ # SSE keeps the connection open, so cap the curl with --max-time.
116
+ # The middleware's job is "anything except 401" — the actual
117
+ # MCP handshake response is FastMCP's concern, not ours here.
118
+ status=$(curl -s -o /dev/null -w '%{http_code}' --max-time 3 \
119
+ -H "Authorization: Bearer $TOKEN" \
120
+ http://127.0.0.1:17532/sse || echo 0)
121
+ if [ "$status" = "401" ]; then
122
+ echo "FAIL: bearer middleware rejected the correct token (status=$status)"
123
+ exit 1
124
+ fi
125
+ echo "OK: middleware passed through to FastMCP (status=$status)"
126
+
127
+ - name: Stop background server
128
+ if: always()
129
+ run: |
130
+ if [ -n "${HMS_PID:-}" ]; then
131
+ kill "$HMS_PID" 2>/dev/null || true
132
+ fi
133
+
134
+ smoke-ui:
135
+ name: Live UI smoke test (loopback, no auth)
136
+ runs-on: ubuntu-24.04
137
+ needs: test
138
+ steps:
139
+ - uses: actions/checkout@v4
140
+
141
+ - name: Install uv
142
+ uses: astral-sh/setup-uv@v3
143
+ with:
144
+ enable-cache: true
145
+
146
+ - name: Install dependencies
147
+ run: uv sync --extra dev
148
+
149
+ - name: Start harbormaster-ui in background
150
+ run: |
151
+ uv run harbormaster-ui --host 127.0.0.1 --port 17531 &
152
+ echo "UI_PID=$!" >> "$GITHUB_ENV"
153
+ # Poll /api/health up to 15s
154
+ for _ in $(seq 1 30); do
155
+ status=$(curl -s -o /dev/null -w '%{http_code}' --max-time 1 http://127.0.0.1:17531/api/health || echo 0)
156
+ if [ "$status" = "200" ]; then
157
+ echo "UI up after $_ tries"
158
+ exit 0
159
+ fi
160
+ sleep 0.5
161
+ done
162
+ echo "UI did not become healthy within 15s"
163
+ exit 1
164
+
165
+ - name: /api/health returns ok + version
166
+ run: |
167
+ body=$(curl -s --max-time 5 http://127.0.0.1:17531/api/health)
168
+ echo "body: $body"
169
+ echo "$body" | grep -q '"status":"ok"' || { echo "missing status:ok"; exit 1; }
170
+ echo "$body" | grep -q '"version":' || { echo "missing version field"; exit 1; }
171
+
172
+ - name: /api/projects returns a JSON list
173
+ run: |
174
+ status=$(curl -s -o /tmp/projects.json -w '%{http_code}' --max-time 5 http://127.0.0.1:17531/api/projects)
175
+ test "$status" = "200" || { echo "Expected 200, got $status"; exit 1; }
176
+ # Body must be a JSON array (starts with [, ends with ])
177
+ first=$(head -c 1 /tmp/projects.json)
178
+ last=$(tail -c 1 /tmp/projects.json)
179
+ test "$first" = "[" || { echo "body does not start with ["; head -c 200 /tmp/projects.json; exit 1; }
180
+ test "$last" = "]" || { echo "body does not end with ]"; tail -c 200 /tmp/projects.json; exit 1; }
181
+
182
+ - name: / returns dashboard HTML
183
+ run: |
184
+ body=$(curl -s --max-time 5 http://127.0.0.1:17531/)
185
+ echo "$body" | grep -q '<title>' || { echo "missing <title>"; exit 1; }
186
+ echo "$body" | grep -q 'Harbormaster' || { echo "missing 'Harbormaster' in body"; exit 1; }
187
+ echo "$body" | grep -q 'tailwindcss' || { echo "missing tailwindcss CDN"; exit 1; }
188
+
189
+ - name: Stop background server
190
+ if: always()
191
+ run: |
192
+ if [ -n "${UI_PID:-}" ]; then
193
+ kill "$UI_PID" 2>/dev/null || true
194
+ fi
195
+
196
+ smoke-ui-auth:
197
+ name: UI auth required for non-loopback bind
198
+ runs-on: ubuntu-24.04
199
+ needs: test
200
+ steps:
201
+ - uses: actions/checkout@v4
202
+
203
+ - name: Install uv
204
+ uses: astral-sh/setup-uv@v3
205
+ with:
206
+ enable-cache: true
207
+
208
+ - name: Install dependencies
209
+ run: uv sync --extra dev
210
+
211
+ - name: Public bind without token must exit 2
212
+ run: |
213
+ # Run with --host 0.0.0.0 (public) and no HARBORMASTER_UI_TOKEN.
214
+ # The CLI must abort BEFORE binding any port. Capture exit code.
215
+ set +e
216
+ uv run harbormaster-ui --host 0.0.0.0 --port 17532 2>&1
217
+ rc=$?
218
+ set -e
219
+ test "$rc" = "2" || { echo "Expected exit 2, got $rc"; exit 1; }
220
+ echo "OK: aborted with exit 2 as expected"
221
+
222
+ smoke-ui-with-token:
223
+ name: UI opt-in bearer auth on loopback (token roundtrip)
224
+ runs-on: ubuntu-24.04
225
+ needs: test
226
+ steps:
227
+ - uses: actions/checkout@v4
228
+
229
+ - name: Install uv
230
+ uses: astral-sh/setup-uv@v3
231
+ with:
232
+ enable-cache: true
233
+
234
+ - name: Install dependencies
235
+ run: uv sync --extra dev
236
+
237
+ - name: Generate auth token
238
+ id: token
239
+ run: |
240
+ {
241
+ echo "token=$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
242
+ } >> "$GITHUB_OUTPUT"
243
+
244
+ - name: Start harbormaster-ui with token in background
245
+ env:
246
+ HARBORMASTER_UI_TOKEN: ${{ steps.token.outputs.token }}
247
+ run: |
248
+ # Loopback bind + token set -> opt-in auth even on 127.0.0.1.
249
+ uv run harbormaster-ui --host 127.0.0.1 --port 17533 &
250
+ echo "UI_PID=$!" >> "$GITHUB_ENV"
251
+ # Poll until the bearer middleware is rejecting unauth (proves it's live).
252
+ for _ in $(seq 1 30); do
253
+ status=$(curl -s -o /dev/null -w '%{http_code}' --max-time 1 http://127.0.0.1:17533/api/health || echo 0)
254
+ if [ "$status" = "401" ]; then
255
+ echo "UI up — opt-in token middleware live"
256
+ exit 0
257
+ fi
258
+ sleep 0.5
259
+ done
260
+ echo "UI did not become healthy within 15s"
261
+ exit 1
262
+
263
+ - name: Reject request without Authorization header
264
+ run: |
265
+ status=$(curl -s -o /dev/null -w '%{http_code}' --max-time 5 http://127.0.0.1:17533/api/health)
266
+ test "$status" = "401" || { echo "Expected 401, got $status"; exit 1; }
267
+
268
+ - name: Reject request with wrong bearer token
269
+ run: |
270
+ status=$(curl -s -o /dev/null -w '%{http_code}' --max-time 5 \
271
+ -H 'Authorization: Bearer obviously-wrong' \
272
+ http://127.0.0.1:17533/api/health)
273
+ test "$status" = "401" || { echo "Expected 401, got $status"; exit 1; }
274
+
275
+ - name: Accept request with correct bearer token
276
+ env:
277
+ TOKEN: ${{ steps.token.outputs.token }}
278
+ run: |
279
+ status=$(curl -s -o /dev/null -w '%{http_code}' --max-time 5 \
280
+ -H "Authorization: Bearer $TOKEN" \
281
+ http://127.0.0.1:17533/api/health)
282
+ test "$status" = "200" || { echo "Expected 200, got $status"; exit 1; }
283
+ echo "OK: bearer auth on UI works end-to-end"
284
+
285
+ - name: Stop background server
286
+ if: always()
287
+ run: |
288
+ if [ -n "${UI_PID:-}" ]; then
289
+ kill "$UI_PID" 2>/dev/null || true
290
+ fi
291
+
292
+ build:
293
+ name: Build sdist + wheel
294
+ runs-on: ubuntu-24.04
295
+ needs: [test, smoke-http, smoke-ui, smoke-ui-auth, smoke-ui-with-token]
296
+ steps:
297
+ - uses: actions/checkout@v4
298
+
299
+ - name: Install uv
300
+ uses: astral-sh/setup-uv@v3
301
+
302
+ - name: Build distribution
303
+ run: uv build
304
+
305
+ - name: Upload artifacts
306
+ uses: actions/upload-artifact@v4
307
+ with:
308
+ name: dist
309
+ path: dist/
310
+ retention-days: 14
@@ -0,0 +1,104 @@
1
+ # Security note: this workflow does NOT consume any untrusted github.event.*
2
+ # fields. Only tag-name and step-output expressions flow into run: blocks, all
3
+ # bound via env: for explicit handling. Uses PyPI Trusted Publishing (OIDC) —
4
+ # no long-lived API tokens stored in the repo.
5
+
6
+ name: Publish to PyPI
7
+
8
+ on:
9
+ push:
10
+ tags: ["v*"]
11
+ workflow_dispatch:
12
+ inputs:
13
+ target:
14
+ description: "Where to publish"
15
+ type: choice
16
+ options: [pypi, testpypi]
17
+ default: pypi
18
+
19
+ permissions:
20
+ contents: read
21
+
22
+ jobs:
23
+ build:
24
+ name: Build sdist + wheel
25
+ runs-on: ubuntu-24.04
26
+ outputs:
27
+ version: ${{ steps.version.outputs.version }}
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+
31
+ - name: Install uv
32
+ uses: astral-sh/setup-uv@v3
33
+
34
+ - name: Read package version
35
+ id: version
36
+ run: |
37
+ v=$(uv run python -c "from harbormaster import __version__; print(__version__)")
38
+ echo "version=$v" >> "$GITHUB_OUTPUT"
39
+ echo "Building harbormaster-mcp $v"
40
+
41
+ - name: Build distribution
42
+ run: uv build
43
+
44
+ - name: Verify built version matches tag
45
+ if: github.event_name == 'push'
46
+ env:
47
+ REF: ${{ github.ref_name }}
48
+ PKG_VERSION: ${{ steps.version.outputs.version }}
49
+ run: |
50
+ tag_version="${REF#v}"
51
+ if [ "$tag_version" != "$PKG_VERSION" ]; then
52
+ echo "Tag $REF (-> $tag_version) does not match package $PKG_VERSION"
53
+ exit 1
54
+ fi
55
+ echo "OK: tag $REF matches package version $PKG_VERSION"
56
+
57
+ - name: Upload distribution
58
+ uses: actions/upload-artifact@v4
59
+ with:
60
+ name: dist
61
+ path: dist/
62
+ retention-days: 14
63
+
64
+ publish-pypi:
65
+ name: Publish to PyPI
66
+ if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.target == 'pypi')
67
+ needs: build
68
+ runs-on: ubuntu-24.04
69
+ environment:
70
+ name: pypi
71
+ url: https://pypi.org/p/harbormaster-mcp
72
+ permissions:
73
+ id-token: write
74
+ steps:
75
+ - name: Download distribution
76
+ uses: actions/download-artifact@v4
77
+ with:
78
+ name: dist
79
+ path: dist/
80
+
81
+ - name: Publish to PyPI
82
+ uses: pypa/gh-action-pypi-publish@release/v1
83
+
84
+ publish-testpypi:
85
+ name: Publish to TestPyPI
86
+ if: github.event_name == 'workflow_dispatch' && inputs.target == 'testpypi'
87
+ needs: build
88
+ runs-on: ubuntu-24.04
89
+ environment:
90
+ name: testpypi
91
+ url: https://test.pypi.org/p/harbormaster-mcp
92
+ permissions:
93
+ id-token: write
94
+ steps:
95
+ - name: Download distribution
96
+ uses: actions/download-artifact@v4
97
+ with:
98
+ name: dist
99
+ path: dist/
100
+
101
+ - name: Publish to TestPyPI
102
+ uses: pypa/gh-action-pypi-publish@release/v1
103
+ with:
104
+ repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ .uv-cache/
5
+ .pytest_cache/
6
+ *.egg-info/
7
+ .DS_Store
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FleetQ contributors
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,239 @@
1
+ Metadata-Version: 2.4
2
+ Name: harbormaster-mcp
3
+ Version: 1.0.0a9
4
+ Summary: MCP server that routes Q&A across all your projects — locally or over SSH. Part of the FleetQ ecosystem.
5
+ Project-URL: Homepage, https://github.com/FleetQ/harbormaster
6
+ Project-URL: Repository, https://github.com/FleetQ/harbormaster
7
+ Project-URL: Issues, https://github.com/FleetQ/harbormaster/issues
8
+ Project-URL: Documentation, https://github.com/FleetQ/harbormaster/tree/main/docs
9
+ Author-email: FleetQ <harbormaster@fleetq.net>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: agent,ai,claude,claude-code,fleetq,mcp,router,subagent
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: mcp>=1.2.0
23
+ Requires-Dist: pydantic>=2.5
24
+ Provides-Extra: dev
25
+ Requires-Dist: fastapi>=0.110; extra == 'dev'
26
+ Requires-Dist: httpx>=0.27; extra == 'dev'
27
+ Requires-Dist: hypothesis>=6.100; extra == 'dev'
28
+ Requires-Dist: jinja2>=3.1; extra == 'dev'
29
+ Requires-Dist: mypy>=1.8; extra == 'dev'
30
+ Requires-Dist: pysher>=1.0; extra == 'dev'
31
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
32
+ Requires-Dist: pytest-cov>=4.1; extra == 'dev'
33
+ Requires-Dist: pytest-httpserver>=1.1; extra == 'dev'
34
+ Requires-Dist: pytest>=8.0; extra == 'dev'
35
+ Requires-Dist: ruff>=0.4; extra == 'dev'
36
+ Provides-Extra: fleetq
37
+ Requires-Dist: httpx>=0.27; extra == 'fleetq'
38
+ Requires-Dist: pysher>=1.0; extra == 'fleetq'
39
+ Provides-Extra: ui
40
+ Requires-Dist: bleach>=6.1; extra == 'ui'
41
+ Requires-Dist: fastapi>=0.110; extra == 'ui'
42
+ Requires-Dist: jinja2>=3.1; extra == 'ui'
43
+ Requires-Dist: sse-starlette>=2.0; extra == 'ui'
44
+ Requires-Dist: uvicorn[standard]>=0.27; extra == 'ui'
45
+ Description-Content-Type: text/markdown
46
+
47
+ # Harbormaster
48
+
49
+ > MCP server that routes Q&A across all your projects — locally or over SSH. **Part of the [FleetQ](https://fleetq.net) ecosystem.**
50
+
51
+ [![PyPI](https://img.shields.io/pypi/v/harbormaster-mcp.svg?label=harbormaster-mcp)](https://pypi.org/project/harbormaster-mcp/)
52
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
53
+ [![Status](https://img.shields.io/badge/status-alpha-orange.svg)](#status)
54
+
55
+ ## What it does
56
+
57
+ You work across many projects, each with its own `CLAUDE.md` and Serena memories. Switching cwd loses context. Harbormaster lets one Claude Code session ask any project a question without changing directory — the project's subagent loads its own memory, answers, and returns a summary.
58
+
59
+ Optional SSH fan-out lets the same tools target remote VPS hosts. Optional FleetQ adapter makes Harbormaster a first-class citizen of the FleetQ Bridge ecosystem (Platform Tool, A2A Agent Cards, federated knowledge graph).
60
+
61
+ ## Tools
62
+
63
+ | Tool | Purpose | Cost |
64
+ |---|---|---|
65
+ | `list_projects(host=None)` | Enumerate configured projects (local) or remote dir listing (SSH). | ~50 ms / ~1 s |
66
+ | `list_hosts()` | Configured `[hosts]` + `~/.ssh/config` Host aliases. | ~5 ms |
67
+ | `project_status(name, host=None)` | Git log, Serena memories, log tails. | ~200 ms / ~2 s |
68
+ | `ask_project(name, question, max_turns=5, host=None)` | Spawn `claude -p` in project cwd, return ≤ 800-word summary. | ~30 s / ~90 s |
69
+ | `delegate_task(name, task, deliverable, allow_writes=False, host=None)` | Read-only delegation; v1 fails closed for writes. | ~60 s / ~90 s |
70
+ | `fan_out_ask(question, project_filter=None, host_filter=None, max_concurrency=5, max_turns=3)` | Parallel multi-project Q&A. Returns one section per target. | ~`max_turns × claude_p_time` × ⌈targets/max_concurrency⌉ |
71
+
72
+ More tools (`recall_qa`, …) land in v1.1–1.2. See [`docs/architecture-harbormaster.md`](docs/architecture-harbormaster.md).
73
+
74
+ ## Install
75
+
76
+ ```bash
77
+ pipx install harbormaster-mcp
78
+ # or run without install:
79
+ uvx harbormaster-mcp
80
+ ```
81
+
82
+ Register in Claude Code:
83
+
84
+ ```bash
85
+ claude mcp add --scope user harbormaster harbormaster-mcp
86
+ ```
87
+
88
+ Or in Claude Desktop (`~/Library/Application Support/Claude/claude_desktop_config.json`):
89
+
90
+ ```json
91
+ {
92
+ "mcpServers": {
93
+ "harbormaster": {
94
+ "command": "/opt/homebrew/bin/harbormaster-mcp",
95
+ "env": {}
96
+ }
97
+ }
98
+ }
99
+ ```
100
+
101
+ ### Live UI (optional)
102
+
103
+ Install with the `[ui]` extra and run the dashboard alongside (or instead of) the MCP server:
104
+
105
+ ```bash
106
+ pipx install 'harbormaster-mcp[ui]'
107
+ harbormaster-ui --port 7531
108
+ # open http://127.0.0.1:7531/
109
+ ```
110
+
111
+ v1.0.0a4 ships:
112
+
113
+ - **Dashboard** at `/` — project grid with framework / git / Serena / CLAUDE.md badges (HTMX + Alpine + Tailwind via CDN, ~no build step).
114
+ - **`GET /api/projects`** — JSON list of every project Harbormaster discovers (use this to script your own dashboards).
115
+ - **`GET /api/health`** — `{"status":"ok","version":"..."}` for liveness probes.
116
+
117
+ The UI is a separate process from the MCP server. Run both — they read the same TOML config so projects discovered by one are visible to the other. SSE feed of live MCP queries lands in v1.0.0a5.
118
+
119
+ ### HTTP / SSE transport
120
+
121
+ For remote MCP clients or running outside the desktop client, Harbormaster can speak SSE / streamable-http instead of stdio. **A bearer token is required** — there is no auth-disabled HTTP mode.
122
+
123
+ ```bash
124
+ export HARBORMASTER_MCP_TOKEN=$(python -c 'import secrets; print(secrets.token_urlsafe(32))')
125
+ harbormaster-mcp --transport sse --host 127.0.0.1 --port 7532
126
+ # or the new MCP spec transport:
127
+ harbormaster-mcp --transport streamable-http --port 7532
128
+ ```
129
+
130
+ Clients send the token as `Authorization: Bearer <token>`. Missing or wrong tokens return 401.
131
+
132
+ Override the env-var name with `--auth-token-env MY_VAR` if you keep secrets under a different name. Use `--host 0.0.0.0` only if you understand the implications — the bearer token is the only thing between the open port and your projects.
133
+
134
+ Run `harbormaster-mcp --help` for the full flag set.
135
+
136
+ ## Configure
137
+
138
+ Zero-config by default — Harbormaster discovers projects under `~/htdocs/*` if it exists. For any other layout, drop a TOML file at `~/.config/harbormaster/config.toml`:
139
+
140
+ ```toml
141
+ [projects]
142
+ glob = ["~/code/*", "~/work/*"]
143
+ exclude = ["**/node_modules/**", "**/vendor/**"]
144
+
145
+ [hosts.friday]
146
+ ssh_host = "katsarov-server.local"
147
+ remote_htdocs = "~/htdocs"
148
+
149
+ [hosts.hetzner-1]
150
+ ssh_host = "hetzner-1.example.com"
151
+ remote_htdocs = "/var/www"
152
+ ```
153
+
154
+ A per-project override at `./.harbormaster.toml` in your cwd takes precedence over the user-level config.
155
+
156
+ Full schema and all options: [`docs/architecture-harbormaster.md` §3](docs/architecture-harbormaster.md).
157
+
158
+ ## Remote hosts
159
+
160
+ Every project-targeting tool accepts an optional `host` parameter. With `host` set, Harbormaster runs the equivalent command on that SSH host:
161
+
162
+ ```
163
+ > ask_project(name="pricex", question="quick health check?", host="friday")
164
+ [ssh friday bash -lc 'cd ~/htdocs/pricex && claude -p ...']
165
+ ```
166
+
167
+ **Pre-flight on each remote host**:
168
+
169
+ 1. Install Claude Code: `npm i -g @anthropic-ai/claude-code`.
170
+ 2. Authenticate once: `claude` (this is a separate Anthropic seat per host).
171
+ 3. Ensure project paths exist with their `CLAUDE.md` / `.serena/` in place.
172
+ 4. Confirm passwordless SSH from your machine (`BatchMode=yes` is enforced).
173
+
174
+ ## v1 limits
175
+
176
+ - Read-only delegation (`allow_writes=True` returns an error).
177
+ - 60 s local / 90 s remote subprocess timeout.
178
+ - 800-word output cap (full output dumped to `/tmp/harbormaster-*.md` on truncation).
179
+ - Remote `list_projects` returns a flat list of directory names (rich metadata is local-only — gathering it remotely would mean N round-trips).
180
+
181
+ ## Status
182
+
183
+ **v1.0.0a9** — `POST /mcp/{server}` HTTP-direct routing endpoint shipped 2026-05-08. **End-to-end FleetQ → harbormaster MCP routing now functional** (with the matching agent-fleet PR https://github.com/escapeboy/agent-fleet-o/pull/72 applied). The 6-week roadmap to general availability:
184
+
185
+ | Phase | Weeks | Focus |
186
+ |-------|-------|-------|
187
+ | v1.0 | 1–2 | Local + SSH + Live UI scaffold + PyPI alpha |
188
+ | v1.1 | 3–4 | FleetQ Bridge / Platform Tool / A2A integration |
189
+ | v1.2 | 5–6 | Q&A history, federated KG, auto project graph |
190
+
191
+ See [`docs/design-harbormaster.md`](docs/design-harbormaster.md) for the full design.
192
+
193
+ ## Lineage
194
+
195
+ Harbormaster v1.0 grew out of `project-router-mcp` v0.1 (2026-05-08). v0.1 git history is preserved on this repository — the v0.1 single-file server lived at `src/server.py` and remains in commits prior to the v1.0 scaffolding refactor.
196
+
197
+ ## Architecture
198
+
199
+ Single Python process hosting an MCP server (stdio + HTTP/SSE), an embedded Live UI, and an optional FleetQ adapter. Pluggable backend per host (default: `claude -p`). All shell-bound strings pass through `shlex.quote`.
200
+
201
+ Detailed component diagrams, transport choices, and integration contract: [`docs/architecture-harbormaster.md`](docs/architecture-harbormaster.md).
202
+
203
+ ## FleetQ Bridge integration (optional)
204
+
205
+ Install with the `[fleetq]` extra and Harbormaster can register itself as a Bridge daemon in your FleetQ deployment, advertising its 6 MCP tools to the platform:
206
+
207
+ ```bash
208
+ pipx install 'harbormaster-mcp[fleetq]'
209
+ ```
210
+
211
+ In your config TOML:
212
+
213
+ ```toml
214
+ [fleetq]
215
+ enabled = true
216
+ register_as_bridge = true
217
+ base_url = "https://app.fleetq.net" # or your self-hosted FleetQ URL
218
+ api_token_env = "FLEETQ_API_TOKEN" # env var holding the Sanctum token
219
+ heartbeat_interval = 30 # seconds between heartbeats
220
+ ```
221
+
222
+ Then export your Sanctum token (must have a `team:<uuid>` ability) and run the MCP server:
223
+
224
+ ```bash
225
+ export FLEETQ_API_TOKEN=...
226
+ harbormaster-mcp
227
+ ```
228
+
229
+ Harbormaster shows up in your FleetQ Connections UI as `harbormaster on <hostname>`. v1.0.0a6 ships **register + heartbeat + disconnect**; the reverse-WebSocket relay channel for incoming MCP tool calls lands in v1.0.0a7+.
230
+
231
+ Discovered contract reference: [`docs/fleetq-bridge-contract.md`](docs/fleetq-bridge-contract.md).
232
+
233
+ ## Releasing
234
+
235
+ PyPI publishing is automated via Trusted Publishing (OIDC) — no API tokens in the repo. Tag-pushes to `v*` trigger `.github/workflows/publish.yml`. Setup steps and the release checklist live in [`docs/publishing.md`](docs/publishing.md).
236
+
237
+ ## License
238
+
239
+ MIT — see [LICENSE](LICENSE).