@holin-work/holin-cli 1.1.2 → 1.1.3
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.
- package/bin/holin-cli.js +17 -16
- package/package.json +1 -1
package/bin/holin-cli.js
CHANGED
|
@@ -123,17 +123,30 @@ async function pingVerify(apiKey) {
|
|
|
123
123
|
|
|
124
124
|
function createProxyServer() {
|
|
125
125
|
const server = http.createServer((req, res) => {
|
|
126
|
-
// Block OAuth discovery probes — return
|
|
126
|
+
// Block OAuth discovery probes — return 401 so platform knows auth is required
|
|
127
127
|
if (req.url.startsWith("/.well-known/")) {
|
|
128
|
-
const body = JSON.stringify({ error: "
|
|
129
|
-
res.writeHead(
|
|
128
|
+
const body = JSON.stringify({ error: "unauthorized" });
|
|
129
|
+
res.writeHead(401, { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(body) });
|
|
130
|
+
res.end(body);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Read credentials on every request (hot-reload support)
|
|
135
|
+
const creds = readCredentials();
|
|
136
|
+
if (!creds?.api_key) {
|
|
137
|
+
// No credentials: return 401 so platform knows auth is required (not "no auth needed")
|
|
138
|
+
const body = JSON.stringify({ error: "unauthorized", message: "Run 'holin-cli auth login' first." });
|
|
139
|
+
res.writeHead(401, {
|
|
140
|
+
"Content-Type": "application/json",
|
|
141
|
+
"Content-Length": Buffer.byteLength(body),
|
|
142
|
+
"WWW-Authenticate": "Bearer realm=\"Holin API\"",
|
|
143
|
+
});
|
|
130
144
|
res.end(body);
|
|
131
145
|
return;
|
|
132
146
|
}
|
|
133
147
|
|
|
134
148
|
// Health check endpoint
|
|
135
149
|
if (req.method === "GET" && req.url === "/health") {
|
|
136
|
-
const creds = readCredentials();
|
|
137
150
|
const body = JSON.stringify({
|
|
138
151
|
status: "ok",
|
|
139
152
|
authenticated: !!(creds && creds.api_key),
|
|
@@ -150,18 +163,6 @@ function createProxyServer() {
|
|
|
150
163
|
return;
|
|
151
164
|
}
|
|
152
165
|
|
|
153
|
-
// Read credentials on every request (hot-reload support)
|
|
154
|
-
const creds = readCredentials();
|
|
155
|
-
if (!creds?.api_key) {
|
|
156
|
-
const body = JSON.stringify({ error: "not_authenticated", message: "Run 'holin-cli auth login' first." });
|
|
157
|
-
res.writeHead(401, {
|
|
158
|
-
"Content-Type": "application/json",
|
|
159
|
-
"Content-Length": Buffer.byteLength(body),
|
|
160
|
-
});
|
|
161
|
-
res.end(body);
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
166
|
// Build upstream request
|
|
166
167
|
// MCP streamable-http has a single endpoint; forward directly to upstream path.
|
|
167
168
|
// Accio requests http://127.0.0.1:18787/mcp → upstream https://api.holin.work/icbu/mcp
|