harbormaster-mcp 1.0.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.
- harbormaster_mcp-1.0.0/.github/workflows/ci.yml +427 -0
- harbormaster_mcp-1.0.0/.github/workflows/publish.yml +104 -0
- harbormaster_mcp-1.0.0/.gitignore +9 -0
- harbormaster_mcp-1.0.0/LICENSE +21 -0
- harbormaster_mcp-1.0.0/PKG-INFO +274 -0
- harbormaster_mcp-1.0.0/README.md +221 -0
- harbormaster_mcp-1.0.0/docs/agent-request-payload-spike.md +144 -0
- harbormaster_mcp-1.0.0/docs/architecture-harbormaster.md +899 -0
- harbormaster_mcp-1.0.0/docs/design-fan-out-streaming.md +143 -0
- harbormaster_mcp-1.0.0/docs/design-harbormaster.md +189 -0
- harbormaster_mcp-1.0.0/docs/fleetq-bridge-contract.md +148 -0
- harbormaster_mcp-1.0.0/docs/fleetq-relay-protocol.md +160 -0
- harbormaster_mcp-1.0.0/docs/legacy/architecture.md +140 -0
- harbormaster_mcp-1.0.0/docs/legacy/design.md +64 -0
- harbormaster_mcp-1.0.0/docs/legacy/sprint-retro.md +74 -0
- harbormaster_mcp-1.0.0/docs/legacy/test-plan.md +69 -0
- harbormaster_mcp-1.0.0/docs/operator-guide.md +341 -0
- harbormaster_mcp-1.0.0/docs/publishing.md +88 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-TEMPLATE.md +128 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0.md +178 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a1.md +139 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a10.md +207 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a11.md +203 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a12.md +170 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a13.md +182 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a14.md +170 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a15.md +156 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a16.md +149 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a17.md +182 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a18.md +135 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a19.md +191 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a2.md +86 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a20.md +154 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a3.md +106 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a4.md +99 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a5.md +104 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a6.md +100 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a7.md +92 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a8.md +89 -0
- harbormaster_mcp-1.0.0/docs/sprint-retro-harbormaster-v1.0.0a9.md +127 -0
- harbormaster_mcp-1.0.0/docs/test-plan-harbormaster.md +216 -0
- harbormaster_mcp-1.0.0/pyproject.toml +129 -0
- harbormaster_mcp-1.0.0/src/harbormaster/__init__.py +7 -0
- harbormaster_mcp-1.0.0/src/harbormaster/__main__.py +278 -0
- harbormaster_mcp-1.0.0/src/harbormaster/backends/__init__.py +26 -0
- harbormaster_mcp-1.0.0/src/harbormaster/backends/base.py +74 -0
- harbormaster_mcp-1.0.0/src/harbormaster/backends/claude.py +356 -0
- harbormaster_mcp-1.0.0/src/harbormaster/config.py +142 -0
- harbormaster_mcp-1.0.0/src/harbormaster/fleetq/__init__.py +24 -0
- harbormaster_mcp-1.0.0/src/harbormaster/fleetq/bridge.py +153 -0
- harbormaster_mcp-1.0.0/src/harbormaster/fleetq/endpoints.py +47 -0
- harbormaster_mcp-1.0.0/src/harbormaster/fleetq/heartbeat.py +168 -0
- harbormaster_mcp-1.0.0/src/harbormaster/fleetq/kg.py +155 -0
- harbormaster_mcp-1.0.0/src/harbormaster/fleetq/memory.py +102 -0
- harbormaster_mcp-1.0.0/src/harbormaster/fleetq/relay.py +222 -0
- harbormaster_mcp-1.0.0/src/harbormaster/fleetq/triples.py +154 -0
- harbormaster_mcp-1.0.0/src/harbormaster/graph/__init__.py +37 -0
- harbormaster_mcp-1.0.0/src/harbormaster/graph/builder.py +147 -0
- harbormaster_mcp-1.0.0/src/harbormaster/graph/cache.py +97 -0
- harbormaster_mcp-1.0.0/src/harbormaster/graph/parser.py +291 -0
- harbormaster_mcp-1.0.0/src/harbormaster/history/__init__.py +41 -0
- harbormaster_mcp-1.0.0/src/harbormaster/history/embed.py +106 -0
- harbormaster_mcp-1.0.0/src/harbormaster/history/schema.py +175 -0
- harbormaster_mcp-1.0.0/src/harbormaster/history/store.py +407 -0
- harbormaster_mcp-1.0.0/src/harbormaster/projects.py +261 -0
- harbormaster_mcp-1.0.0/src/harbormaster/server.py +14 -0
- harbormaster_mcp-1.0.0/src/harbormaster/ssh.py +136 -0
- harbormaster_mcp-1.0.0/src/harbormaster/tools/__init__.py +27 -0
- harbormaster_mcp-1.0.0/src/harbormaster/tools/_grounding.py +143 -0
- harbormaster_mcp-1.0.0/src/harbormaster/tools/_helpers.py +447 -0
- harbormaster_mcp-1.0.0/src/harbormaster/tools/ask.py +49 -0
- harbormaster_mcp-1.0.0/src/harbormaster/tools/delegate.py +59 -0
- harbormaster_mcp-1.0.0/src/harbormaster/tools/fan_out.py +218 -0
- harbormaster_mcp-1.0.0/src/harbormaster/tools/graph.py +63 -0
- harbormaster_mcp-1.0.0/src/harbormaster/tools/hosts.py +27 -0
- harbormaster_mcp-1.0.0/src/harbormaster/tools/projects.py +173 -0
- harbormaster_mcp-1.0.0/src/harbormaster/tools/recall.py +115 -0
- harbormaster_mcp-1.0.0/src/harbormaster/transport.py +103 -0
- harbormaster_mcp-1.0.0/src/harbormaster/ui/__init__.py +9 -0
- harbormaster_mcp-1.0.0/src/harbormaster/ui/app.py +39 -0
- harbormaster_mcp-1.0.0/src/harbormaster/ui/cli.py +146 -0
- harbormaster_mcp-1.0.0/src/harbormaster/ui/routes.py +653 -0
- harbormaster_mcp-1.0.0/src/harbormaster/ui/templates/base.html +36 -0
- harbormaster_mcp-1.0.0/src/harbormaster/ui/templates/dashboard.html +62 -0
- harbormaster_mcp-1.0.0/tests/conftest.py +8 -0
- harbormaster_mcp-1.0.0/tests/fixtures/fake_claude.py +63 -0
- harbormaster_mcp-1.0.0/tests/integration/__init__.py +0 -0
- harbormaster_mcp-1.0.0/tests/integration/test_e2e_fake_claude.py +189 -0
- harbormaster_mcp-1.0.0/tests/integration/test_real_projects.py +58 -0
- harbormaster_mcp-1.0.0/tests/smoke_fleetq.py +116 -0
- harbormaster_mcp-1.0.0/tests/unit/__init__.py +0 -0
- harbormaster_mcp-1.0.0/tests/unit/test_backends.py +402 -0
- harbormaster_mcp-1.0.0/tests/unit/test_bridge.py +230 -0
- harbormaster_mcp-1.0.0/tests/unit/test_cli.py +55 -0
- harbormaster_mcp-1.0.0/tests/unit/test_config.py +79 -0
- harbormaster_mcp-1.0.0/tests/unit/test_config_validation.py +61 -0
- harbormaster_mcp-1.0.0/tests/unit/test_fan_out.py +165 -0
- harbormaster_mcp-1.0.0/tests/unit/test_graph_builder.py +160 -0
- harbormaster_mcp-1.0.0/tests/unit/test_graph_cache.py +94 -0
- harbormaster_mcp-1.0.0/tests/unit/test_graph_parser.py +229 -0
- harbormaster_mcp-1.0.0/tests/unit/test_graph_tool.py +126 -0
- harbormaster_mcp-1.0.0/tests/unit/test_grounding.py +216 -0
- harbormaster_mcp-1.0.0/tests/unit/test_heartbeat.py +356 -0
- harbormaster_mcp-1.0.0/tests/unit/test_history_embed.py +72 -0
- harbormaster_mcp-1.0.0/tests/unit/test_history_schema.py +115 -0
- harbormaster_mcp-1.0.0/tests/unit/test_history_store.py +321 -0
- harbormaster_mcp-1.0.0/tests/unit/test_history_writeback.py +137 -0
- harbormaster_mcp-1.0.0/tests/unit/test_kg_writeback.py +176 -0
- harbormaster_mcp-1.0.0/tests/unit/test_kg_writer.py +177 -0
- harbormaster_mcp-1.0.0/tests/unit/test_logging.py +126 -0
- harbormaster_mcp-1.0.0/tests/unit/test_memory_writeback.py +248 -0
- harbormaster_mcp-1.0.0/tests/unit/test_projects.py +229 -0
- harbormaster_mcp-1.0.0/tests/unit/test_recall_tool.py +144 -0
- harbormaster_mcp-1.0.0/tests/unit/test_relay.py +423 -0
- harbormaster_mcp-1.0.0/tests/unit/test_ssh.py +87 -0
- harbormaster_mcp-1.0.0/tests/unit/test_tools.py +54 -0
- harbormaster_mcp-1.0.0/tests/unit/test_transport.py +125 -0
- harbormaster_mcp-1.0.0/tests/unit/test_triples.py +193 -0
- harbormaster_mcp-1.0.0/tests/unit/test_ui.py +924 -0
- harbormaster_mcp-1.0.0/tests/unit/test_ui_cli.py +90 -0
- harbormaster_mcp-1.0.0/uv.lock +2374 -0
|
@@ -0,0 +1,427 @@
|
|
|
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
|
+
smoke-fleetq:
|
|
293
|
+
# Gated live smoke against a real FleetQ instance. Skipped by default —
|
|
294
|
+
# set the `FLEETQ_SMOKE_ENABLED` repo variable to `true` and configure
|
|
295
|
+
# the `FLEETQ_TEST_BASE_URL` + `FLEETQ_TEST_API_TOKEN` secrets to enable.
|
|
296
|
+
# Build is intentionally NOT in this job's `needs:` so a skipped run on
|
|
297
|
+
# public PRs doesn't block release artifacts. Inputs are repo-admin
|
|
298
|
+
# configured (`vars.*` / `secrets.*`) — no untrusted github.event.* is
|
|
299
|
+
# consumed, consistent with the workflow-wide security note above.
|
|
300
|
+
name: Live FleetQ Bridge smoke (gated)
|
|
301
|
+
runs-on: ubuntu-24.04
|
|
302
|
+
needs: test
|
|
303
|
+
if: ${{ vars.FLEETQ_SMOKE_ENABLED == 'true' }}
|
|
304
|
+
steps:
|
|
305
|
+
- uses: actions/checkout@v4
|
|
306
|
+
|
|
307
|
+
- name: Install uv
|
|
308
|
+
uses: astral-sh/setup-uv@v3
|
|
309
|
+
with:
|
|
310
|
+
enable-cache: true
|
|
311
|
+
|
|
312
|
+
- name: Install dependencies
|
|
313
|
+
run: uv sync --extra dev --extra fleetq
|
|
314
|
+
|
|
315
|
+
- name: Run live FleetQ Bridge smoke
|
|
316
|
+
env:
|
|
317
|
+
FLEETQ_TEST_BASE_URL: ${{ secrets.FLEETQ_TEST_BASE_URL }}
|
|
318
|
+
FLEETQ_TEST_API_TOKEN: ${{ secrets.FLEETQ_TEST_API_TOKEN }}
|
|
319
|
+
run: uv run python tests/smoke_fleetq.py
|
|
320
|
+
|
|
321
|
+
smoke-mcp-streaming:
|
|
322
|
+
# Live SSE wire-shape check. Drives /mcp/harbormaster with
|
|
323
|
+
# `Accept: text/event-stream` and asserts the response is text/event-stream
|
|
324
|
+
# with a final `event: result` line. Doesn't need a real claude binary —
|
|
325
|
+
# tools/list returns the static tool registry, so the test is fast and
|
|
326
|
+
# deterministic. This catches wire-shape regressions on the daemon side
|
|
327
|
+
# that unit-mocked tests can't see.
|
|
328
|
+
name: MCP HTTP-direct SSE wire-shape smoke
|
|
329
|
+
runs-on: ubuntu-24.04
|
|
330
|
+
needs: test
|
|
331
|
+
steps:
|
|
332
|
+
- uses: actions/checkout@v4
|
|
333
|
+
|
|
334
|
+
- name: Install uv
|
|
335
|
+
uses: astral-sh/setup-uv@v3
|
|
336
|
+
with:
|
|
337
|
+
enable-cache: true
|
|
338
|
+
|
|
339
|
+
- name: Install dependencies
|
|
340
|
+
run: uv sync --extra dev
|
|
341
|
+
|
|
342
|
+
- name: Generate auth token
|
|
343
|
+
id: token
|
|
344
|
+
run: |
|
|
345
|
+
{
|
|
346
|
+
echo "token=$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
|
|
347
|
+
} >> "$GITHUB_OUTPUT"
|
|
348
|
+
|
|
349
|
+
- name: Start harbormaster-ui with mcp bound
|
|
350
|
+
env:
|
|
351
|
+
HARBORMASTER_UI_TOKEN: ${{ steps.token.outputs.token }}
|
|
352
|
+
run: |
|
|
353
|
+
# The UI app exposes /mcp/{server} when launched with mcp bound;
|
|
354
|
+
# harbormaster-ui's CLI does that by default since v1.0.0a4.
|
|
355
|
+
uv run harbormaster-ui --host 127.0.0.1 --port 17534 &
|
|
356
|
+
echo "UI_PID=$!" >> "$GITHUB_ENV"
|
|
357
|
+
for _ in $(seq 1 30); do
|
|
358
|
+
status=$(curl -s -o /dev/null -w '%{http_code}' --max-time 1 http://127.0.0.1:17534/api/health || echo 0)
|
|
359
|
+
if [ "$status" = "401" ]; then
|
|
360
|
+
echo "UI up — auth middleware live"
|
|
361
|
+
exit 0
|
|
362
|
+
fi
|
|
363
|
+
sleep 0.5
|
|
364
|
+
done
|
|
365
|
+
echo "UI did not become healthy within 15s"
|
|
366
|
+
exit 1
|
|
367
|
+
|
|
368
|
+
- name: Drive /mcp/harbormaster with SSE accept and assert wire shape
|
|
369
|
+
env:
|
|
370
|
+
TOKEN: ${{ steps.token.outputs.token }}
|
|
371
|
+
run: |
|
|
372
|
+
# Capture full body, then verify content-type + SSE event shape.
|
|
373
|
+
body=$(curl -s -i --max-time 10 \
|
|
374
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
375
|
+
-H 'Accept: text/event-stream' \
|
|
376
|
+
-H 'Content-Type: application/json' \
|
|
377
|
+
-d '{"method":"tools/list","params":{}}' \
|
|
378
|
+
http://127.0.0.1:17534/mcp/harbormaster)
|
|
379
|
+
|
|
380
|
+
echo "$body" | head -20
|
|
381
|
+
|
|
382
|
+
# Strip CR from SSE wire — sse-starlette emits \r\n line endings
|
|
383
|
+
# per the SSE spec, but GNU grep's $ anchor matches before \n only,
|
|
384
|
+
# so the trailing \r breaks ^event: result$ on Ubuntu (it passed
|
|
385
|
+
# by coincidence on BSD grep / macOS). Normalize once, then assert.
|
|
386
|
+
body_norm=$(echo "$body" | tr -d '\r')
|
|
387
|
+
|
|
388
|
+
echo "$body_norm" | grep -qi '^content-type: text/event-stream' || {
|
|
389
|
+
echo "FAIL: Content-Type was not text/event-stream"
|
|
390
|
+
exit 1
|
|
391
|
+
}
|
|
392
|
+
echo "$body_norm" | grep -q '^event: result$' || {
|
|
393
|
+
echo "FAIL: response did not contain 'event: result'"
|
|
394
|
+
exit 1
|
|
395
|
+
}
|
|
396
|
+
echo "$body_norm" | grep -qE '"name":[[:space:]]*"ask_project"' || {
|
|
397
|
+
echo "FAIL: response did not list ask_project tool"
|
|
398
|
+
exit 1
|
|
399
|
+
}
|
|
400
|
+
echo "OK: SSE wire shape verified"
|
|
401
|
+
|
|
402
|
+
- name: Stop background server
|
|
403
|
+
if: always()
|
|
404
|
+
run: |
|
|
405
|
+
if [ -n "${UI_PID:-}" ]; then
|
|
406
|
+
kill "$UI_PID" 2>/dev/null || true
|
|
407
|
+
fi
|
|
408
|
+
|
|
409
|
+
build:
|
|
410
|
+
name: Build sdist + wheel
|
|
411
|
+
runs-on: ubuntu-24.04
|
|
412
|
+
needs: [test, smoke-http, smoke-ui, smoke-ui-auth, smoke-ui-with-token, smoke-mcp-streaming]
|
|
413
|
+
steps:
|
|
414
|
+
- uses: actions/checkout@v4
|
|
415
|
+
|
|
416
|
+
- name: Install uv
|
|
417
|
+
uses: astral-sh/setup-uv@v3
|
|
418
|
+
|
|
419
|
+
- name: Build distribution
|
|
420
|
+
run: uv build
|
|
421
|
+
|
|
422
|
+
- name: Upload artifacts
|
|
423
|
+
uses: actions/upload-artifact@v4
|
|
424
|
+
with:
|
|
425
|
+
name: dist
|
|
426
|
+
path: dist/
|
|
427
|
+
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,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.
|