@hibira-io/mcp-approval-gate 0.4.0 → 0.4.1
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/cli.js +1 -1
- package/src/connect.js +15 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
- The gate talks to Hibira Approvals at https://api.hibira.io/approvals by
|
|
6
|
+
default. `HIBIRA_APPROVALS_URL=https://approvals.hibira.io` and tokens saved
|
|
7
|
+
by older versions keep working (the old address still answers).
|
|
8
|
+
|
|
3
9
|
## 0.4.0
|
|
4
10
|
|
|
5
11
|
- `mcp-approval-gate hook claude|codex|cursor|hermes`: a hook for coding agents
|
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ front of them.
|
|
|
55
55
|
|
|
56
56
|
## Setup
|
|
57
57
|
|
|
58
|
-
1. Create a **Hibira Approvals workspace** at [
|
|
58
|
+
1. Create a **Hibira Approvals workspace** at [hibira.io/portal/approvals](https://hibira.io/portal/approvals)
|
|
59
59
|
and invite the people who approve (store managers, DBAs, ...). They get
|
|
60
60
|
requests on their phones and decide in the approvals inbox.
|
|
61
61
|
2. Put the gate in front of your database MCP server in your client's config
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hibira-io/mcp-approval-gate",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"mcpName": "io.hibira/mcp-approval-gate",
|
|
5
5
|
"description": "Supervisor approval for AI agents: wrap a database MCP server so writes wait for another person, and hook Claude Code, Codex and Cursor so risky shell commands (rm -rf, force push, deploys, terraform apply, DB writes) wait for approval in Hibira Approvals",
|
|
6
6
|
"keywords": [
|
package/src/cli.js
CHANGED
|
@@ -31,7 +31,7 @@ Connecting to Hibira Approvals (no keys to copy):
|
|
|
31
31
|
mcp-approval-gate status | logout [--profile <name>]
|
|
32
32
|
HIBIRA_APPROVALS_TOKEN a workspace token from the environment instead (servers, containers)
|
|
33
33
|
HIBIRA_APP_ID, HIBIRA_KEY, HIBIRA_SECRET or a Hibira app's keys (as in 0.2)
|
|
34
|
-
HIBIRA_APPROVALS_URL default https://
|
|
34
|
+
HIBIRA_APPROVALS_URL default https://api.hibira.io/approvals
|
|
35
35
|
|
|
36
36
|
Options (each also as an env var, shown in brackets):
|
|
37
37
|
--label <name> name of the database on the approval page [GATE_LABEL]
|
package/src/connect.js
CHANGED
|
@@ -6,7 +6,17 @@ import { mkdirSync, readFileSync, writeFileSync, chmodSync } from 'node:fs';
|
|
|
6
6
|
import { homedir, hostname } from 'node:os';
|
|
7
7
|
import { dirname, join } from 'node:path';
|
|
8
8
|
|
|
9
|
-
export const DEFAULT_URL = 'https://
|
|
9
|
+
export const DEFAULT_URL = 'https://api.hibira.io/approvals';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The gate's API under a base URL: https://api.hibira.io/approvals/gate, or
|
|
13
|
+
* /api/v1/gate on a bare host such as https://approvals.hibira.io (older
|
|
14
|
+
* settings and saved tokens, which keep working).
|
|
15
|
+
*/
|
|
16
|
+
export function gateUrl(baseUrl) {
|
|
17
|
+
const base = String(baseUrl).replace(/\/+$/, '');
|
|
18
|
+
return new URL(base).pathname.replace(/\/+$/, '') ? `${base}/gate` : `${base}/api/v1/gate`;
|
|
19
|
+
}
|
|
10
20
|
|
|
11
21
|
/** Where tokens are kept: $HIBIRA_CONFIG_DIR, $XDG_CONFIG_HOME/hibira or ~/.config/hibira. */
|
|
12
22
|
export function configPath(env = process.env) {
|
|
@@ -71,12 +81,12 @@ export class WorkspaceClient {
|
|
|
71
81
|
}
|
|
72
82
|
|
|
73
83
|
create(body) {
|
|
74
|
-
return call(this.fetch, `${this.baseUrl}/
|
|
84
|
+
return call(this.fetch, `${gateUrl(this.baseUrl)}/requests`, { method: 'POST', token: this.token, body });
|
|
75
85
|
}
|
|
76
86
|
|
|
77
87
|
get(id, waitSeconds = 0, signal) {
|
|
78
88
|
const qs = waitSeconds > 0 ? `?wait=${Math.min(25, Math.floor(waitSeconds))}` : '';
|
|
79
|
-
return call(this.fetch, `${this.baseUrl}/
|
|
89
|
+
return call(this.fetch, `${gateUrl(this.baseUrl)}/requests/${encodeURIComponent(id)}${qs}`, { token: this.token, signal });
|
|
80
90
|
}
|
|
81
91
|
}
|
|
82
92
|
|
|
@@ -90,7 +100,7 @@ export class DeviceLogin {
|
|
|
90
100
|
}
|
|
91
101
|
|
|
92
102
|
start() {
|
|
93
|
-
return call(this.fetch, `${this.baseUrl}/
|
|
103
|
+
return call(this.fetch, `${gateUrl(this.baseUrl)}/device`, {
|
|
94
104
|
method: 'POST',
|
|
95
105
|
body: { client: 'mcp-approval-gate', label: this.label || 'database', host: hostname().slice(0, 100) },
|
|
96
106
|
});
|
|
@@ -104,7 +114,7 @@ export class DeviceLogin {
|
|
|
104
114
|
if (signal?.aborted) throw new Error('cancelled');
|
|
105
115
|
await this.sleep(interval);
|
|
106
116
|
try {
|
|
107
|
-
return await call(this.fetch, `${this.baseUrl}/
|
|
117
|
+
return await call(this.fetch, `${gateUrl(this.baseUrl)}/token`, {
|
|
108
118
|
method: 'POST', body: { device_code: start.device_code }, signal,
|
|
109
119
|
});
|
|
110
120
|
} catch (err) {
|