@aipermission/mcp 0.1.8 → 0.1.11

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/README.md CHANGED
@@ -54,6 +54,7 @@ The generated MCP config contains a bearer token. Keep it private. For project-l
54
54
  - `get_request`
55
55
  - `list_requests`
56
56
  - `read_console`
57
+ - `restart_console_session`
57
58
  - `send_message`
58
59
  - `list_file_transfers`
59
60
  - `get_file_transfer`
@@ -97,11 +98,11 @@ Supported clients:
97
98
  - `gemini`: `GEMINI.md`
98
99
  - `custom`: prints portable Markdown to stdout
99
100
 
100
- These instructions teach the agent how to poll `approval_pending` and `running` requests, read live console output, write short reasons, use explicit file transfer paths, and avoid printing secrets. The default installer uses the operator instruction bundled in the npm package; `--source` accepts local file paths only and rejects HTTP(S) sources.
101
+ These instructions teach the agent how to poll `approval_pending` and `running` requests, handle `stale` approvals by sending a fresh request, read live console output, recover stuck persistent console sessions with `restart_console_session`, write short reasons, use explicit file transfer paths, and avoid printing secrets. The default installer uses the operator instruction bundled in the npm package; `--source` accepts local file paths only and rejects HTTP(S) sources.
101
102
 
102
103
  ## Security Boundary
103
104
 
104
- This package talks to a local AIPermission gateway. `AIPERMISSION_API_URL` must point to `localhost`, `127.0.0.1`, or `[::1]`; remote URLs are rejected before the bearer token is sent. Do not expose the gateway on LAN or the public internet, and do not use it as a shared DevOps service. Tokens grant access only to the servers and execution rules configured in the gateway UI. Token/server permissions may be temporary; expired grants are omitted from `list_servers` and no longer authorize command, console, or file-transfer tools.
105
+ This package talks to a local AIPermission gateway. `AIPERMISSION_API_URL` must point to `localhost`, `127.0.0.1`, or `[::1]`; remote URLs are rejected before the bearer token is sent. Do not expose the gateway on LAN or the public internet, and do not use it as a shared DevOps service. Tokens grant access only to the servers and execution rules configured in the gateway UI. Token/server permissions may be temporary; expired grants are omitted from `list_servers` and no longer authorize command, console, or file-transfer tools. `list_servers` is permission-scoped, not a live SSH health check; treat `exec` connection errors as the current reachability signal.
105
106
 
106
107
  ## License
107
108
 
@@ -27,6 +27,11 @@ If no server is visible, say that the current token has no accessible servers.
27
27
  If `expires_at` is present, treat access as temporary. Finish within that
28
28
  maintenance window or ask the operator to extend access.
29
29
 
30
+ `list_servers()` is permission-scoped, not a live health check. A visible server
31
+ may still be powered off, unreachable, reject SSH authentication, or require host
32
+ key review. Treat `exec` dial, timeout, authentication, and host-key errors as
33
+ the current reachability signal.
34
+
30
35
  ## Command Reasons
31
36
 
32
37
  Every `exec` call should include a short `reason`.
@@ -67,9 +72,14 @@ failed
67
72
  declined
68
73
  blocked
69
74
  error
75
+ stale
70
76
  ```
71
77
 
72
78
  If the request is `declined`, read `user_note` and follow the user's correction.
79
+ If the request is `stale`, the approval context changed before execution; send a fresh `exec` request with the current command and reason instead of trying to reuse the old approval.
80
+ If the request is `error`, read the error text. SSH reachability, refused ports,
81
+ authentication failures, and host-key failures are current connection signals;
82
+ do not assume a listed server is live just because `list_servers` returned it.
73
83
 
74
84
  ## Running Flow
75
85
 
@@ -80,6 +90,14 @@ When `exec` or `get_request` returns `running`:
80
90
  3. Use `read_console(server_id)` between polls only when the token has `always_run` permission.
81
91
  4. Do not start another long-running command on the same server until the active request reaches a terminal status, unless the user explicitly asks.
82
92
 
93
+ If the request appears stuck for an unusually long time and `read_console`
94
+ shows no useful progress, ask the operator before recovery unless they already
95
+ asked you to recover the session. When recovery is approved, call
96
+ `restart_console_session(server_id)`. This does not intentionally run a remote
97
+ shell command; it closes the gateway-owned persistent console session and the
98
+ next `exec` opens a fresh SSH session. Treat any canceled request as
99
+ inconclusive and re-run only the minimal safe inspection needed.
100
+
83
101
  ## Message Flow
84
102
 
85
103
  Use `send_message(message, server_id?, session_id?)` for short operator-visible notes.
package/dist/server.js CHANGED
@@ -72,6 +72,19 @@ server.tool(
72
72
  }
73
73
  );
74
74
 
75
+ server.tool(
76
+ "restart_console_session",
77
+ "Restart the persistent console session for a server when it appears stuck. This closes the current gateway-owned console session and the next exec will open a fresh SSH session.",
78
+ {
79
+ server_id: z.number().int().positive().describe("Server id from list_servers."),
80
+ },
81
+ async ({ server_id }) => {
82
+ return jsonToolResult(() => apiPost("/api/mcp/console/restart", {
83
+ server_id,
84
+ }));
85
+ }
86
+ );
87
+
75
88
  server.tool(
76
89
  "get_request",
77
90
  "Read an aipermission command request by id. Use this after exec returns approval_pending or running.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aipermission/mcp",
3
- "version": "0.1.8",
3
+ "version": "0.1.11",
4
4
  "mcpName": "io.github.aipermission/aipermission-mcp",
5
5
  "description": "Local-first MCP bridge for the aipermission gateway.",
6
6
  "license": "MIT",
package/server.json CHANGED
@@ -3,12 +3,12 @@
3
3
  "name": "io.github.aipermission/aipermission-mcp",
4
4
  "title": "AIPermission",
5
5
  "description": "Local-first MCP bridge for the AIPermission gateway.",
6
- "version": "0.1.8",
6
+ "version": "0.1.11",
7
7
  "packages": [
8
8
  {
9
9
  "registryType": "npm",
10
10
  "identifier": "@aipermission/mcp",
11
- "version": "0.1.8",
11
+ "version": "0.1.11",
12
12
  "transport": {
13
13
  "type": "stdio"
14
14
  }